Forum Discussion

mdvucak_136600's avatar
mdvucak_136600
Icon for Nimbostratus rankNimbostratus
Apr 24, 2014
Solved

Duplicate persistence entries in persistence table

Hi,

I wrote a short iRule to keep persistent connections between clients and certain pool members. The iRule uses "s_id" values as persistence keys from URIs (requests) and HTTP headers (responses). The iRule works as expected, but during load tests I noticed a bunch of duplicate entries in the persistence table.

Here are some snips from "bigpipe persist show all" output:

|     Mode universal   Value 01e77eb1-2758-4b2e-9224-59e375a64723
|        virtual 10.100.190.70:http   node 10.100.110.1:http   age 836sec
|     Mode universal   Value 01e77eb1-2758-4b2e-9224-59e375a64723
|        virtual 10.100.190.70:http   node 10.100.110.1:http   age 848sec
|     Mode universal   Value 028f6aff-e262-43cf-98fe-b46b3ae95c86
|        virtual 10.100.190.70:http   node 10.100.110.1:http   age 736sec
|     Mode universal   Value 028f6aff-e262-43cf-98fe-b46b3ae95c86
|        virtual 10.100.190.70:http   node 10.100.110.1:http   age 748sec
|     Mode universal   Value ffdd135d-4e9f-48e3-8dc0-c69f6c88f20c
|        virtual 10.100.190.70:http   node 10.100.110.2:http   age 414sec
|     Mode universal   Value ffdd135d-4e9f-48e3-8dc0-c69f6c88f20c
|        virtual 10.100.190.70:http   node 10.100.110.2:http   age 426sec

I can see that duplicate persistence entries (with the same value) both point to the same node. That is ok, I guess. Traffic is routed as intended.

My question is why do I see duplicate entries with different timeouts? I made modifications to the iRule just to prevent this, but no luck. This also only happens under heavy load. When testing with few requests / clients, this does not happen.

Here is the iRule. Can anyone explain this behaviour?

when HTTP_REQUEST {
        set DEBUG_REQ 1
        set MY_SID null
        set namevals [split [HTTP::uri] "?&"]
        set MATCH 0
        split the URI
        for {set i 0} {$i < [llength $namevals]} {incr i} {
               if a splitted part starts with "s_id", get the data
                if { [lindex $namevals $i] starts_with "s_id=" } {
                        set MY_SID [lindex [split [lindex $namevals $i] "="] 1]
                        if { "[persist lookup uie $MY_SID]" eq "" } {
                                if { $DEBUG_REQ eq 1 } { log local0. "(request-sid) Found a s_id in a request that isn't in the persistency table. Ignoring. MY_SID is $MY_SID - [IP::client_addr]:[TCP::client_port] -> [HTTP::host][HTTP::uri] " }
                        } else {
                                set MATCH 1
                        }
                }
        }
        if { $MATCH eq 1 } {
                persist uie $MY_SID
                if { $DEBUG_REQ eq 1 } { log local0. "(request) MY_SID is $MY_SID - [IP::client_addr]:[TCP::client_port] -> [HTTP::host][HTTP::uri] " }
                } else {
                pool [LB::server pool]
                if { $DEBUG_REQ eq 1 } { log local0. "(request-nosid) MY_SID is $MY_SID - [IP::client_addr]:[TCP::client_port] -> [HTTP::host][HTTP::uri] " }
        }
}

when HTTP_RESPONSE {
        set DEBUG_RESP 1
        if { [HTTP::header exists X-Session-Id] } {
                set MY_SID [HTTP::header X-Session-Id]
                if { "[persist lookup uie $MY_SID]" eq "" } {
                        persist add uie $MY_SID 2100
                        if { $DEBUG_RESP eq 1 } { log local0. "(response) Adding persist: $MY_SID - [IP::server_addr] -> [IP::client_addr] - status: [HTTP::status] - pool info: [LB::server] / [LB::server addr] " }
                } else {
                        if { $DEBUG_RESP eq 1 } { log local0. "(response) s_id $MY_SID already mapped to: [persist lookup uie $MY_SID] - [IP::server_addr] -> [IP::client_addr] - status: [HTTP::status] - pool info: [LB::server] / [LB::server addr] " }
                }
        } else {
        if { $DEBUG_RESP eq 1 } { log local0. "(response-nosid) No Session header in response - [IP::server_addr] -> [IP::client_addr] - status: [HTTP::status] - pool info: [LB::server] / [LB::server addr] " }
        }
}

Br, Miro

  • Why is the "Client Addr" field empty on TMM1?

     

    no idea why but, you know, null client addr won't affect how persistence works because persistence key is not client address.

     

8 Replies

  • why do I see duplicate entries with different timeouts?

     

    are you using cmp platform? i guess it is duplicated because of cmp (one record per tmm).

     

    • mdvucak_136600's avatar
      mdvucak_136600
      Icon for Nimbostratus rankNimbostratus
      I'm using BIG-IP 3900 with 4 TMM instances. So I guess each TMM can have it's own persistence entry. I found out that this can be verified by running "*tmsh show ltm persistence persist-records all-properties*" Here's a additional question. Below is the output of the above command for one duplicated entry: ~~~ universal - 10.100.190.70:80 - 10.100.110.2:80 ---------------------------------------------------- TMM 3 Mode universal Key fffa505e-03ff-4192-8b2e-21b354992939 Age (sec.) 733 Virtual Name LOAD_TEST Virtual Addr 10.100.190.70:80 Node Addr 10.100.110.2:80 Pool Name LOAD_TEST Client Addr 10.100.110.2 universal - 10.100.190.70:80 - 10.100.110.2:80 ---------------------------------------------------- TMM 1 Mode universal Key fffa505e-03ff-4192-8b2e-21b354992939 Age (sec.) 707 Virtual Name LOAD_TEST Virtual Addr 10.100.190.70:80 Node Addr 10.100.110.2:80 Pool Name LOAD_TEST Client Addr :: ~~~ Why is the "Client Addr" field empty on TMM1? I read around that this can happen when there is only one TMM instance, but here there are clearly two separate ones.
  • why do I see duplicate entries with different timeouts?

     

    are you using cmp platform? i guess it is duplicated because of cmp (one record per tmm).

     

    • mdvucak_136600's avatar
      mdvucak_136600
      Icon for Nimbostratus rankNimbostratus
      I'm using BIG-IP 3900 with 4 TMM instances. So I guess each TMM can have it's own persistence entry. I found out that this can be verified by running "*tmsh show ltm persistence persist-records all-properties*" Here's a additional question. Below is the output of the above command for one duplicated entry: ~~~ universal - 10.100.190.70:80 - 10.100.110.2:80 ---------------------------------------------------- TMM 3 Mode universal Key fffa505e-03ff-4192-8b2e-21b354992939 Age (sec.) 733 Virtual Name LOAD_TEST Virtual Addr 10.100.190.70:80 Node Addr 10.100.110.2:80 Pool Name LOAD_TEST Client Addr 10.100.110.2 universal - 10.100.190.70:80 - 10.100.110.2:80 ---------------------------------------------------- TMM 1 Mode universal Key fffa505e-03ff-4192-8b2e-21b354992939 Age (sec.) 707 Virtual Name LOAD_TEST Virtual Addr 10.100.190.70:80 Node Addr 10.100.110.2:80 Pool Name LOAD_TEST Client Addr :: ~~~ Why is the "Client Addr" field empty on TMM1? I read around that this can happen when there is only one TMM instance, but here there are clearly two separate ones.
  • Why is the "Client Addr" field empty on TMM1?

     

    no idea why but, you know, null client addr won't affect how persistence works because persistence key is not client address.

     

  • Why is the "Client Addr" field empty on TMM1?

     

    no idea why but, you know, null client addr won't affect how persistence works because persistence key is not client address.