Forum Discussion
AndyC_86542
Nimbostratus
Jan 26, 2009Strange persist behaviour
I have this little section of code in an iRule that decides which of various pools to send an HTTP request to. I wanted to make sure that requests from a single client go through the same proxy server within squid-proxy-pool.
set sourceIPAddress [IP::client_addr]
pool squid-proxy-pool
persist source_addr 7200
set pResult [persist lookup source_addr $sourceIPAddress]
log local0.debug "ip: $sourceIPAddress - persist result: $pResult"
I thought that this would do what I wanted and just added the last two lines to debug a separate problem. However, when I look at the logs, I get results like the following (dates removed from timestamps for readability):
16:30:12 ip: 192.168.20.221 - persist result: squid-proxy-pool 172.22.21.250 80
16:30:14 ip: 192.168.20.221 - persist result: squid-proxy-pool 172.22.21.249 80
16:30:16 ip: 192.168.20.221 - persist result: squid-proxy-pool 172.22.21.249 80
16:30:17 ip: 192.168.20.221 - persist result: squid-proxy-pool 172.22.21.249 80
16:30:17 ip: 192.168.20.221 - persist result: squid-proxy-pool 172.22.21.250 80
Am I completely missing the point with persist or is this really spattering requests all over the pool without regard to the source_addr setting?
14 Replies
- Deb_Allen_18Historic F5 Accountthat sure doesn't look right.
- AndyC_86542
Nimbostratus
Hi Deb,Persistence value Persistence Mode Virtual Server Pool Pool Member Age 172.22.20.220 Source Address Affinity catchall-virtual squid-proxy-pool 172.22.21.249:80 4817 seconds 172.22.20.220 Source Address Affinity catchall-virtual squid-proxy-pool 172.22.21.249:80 1217 seconds 172.22.20.228 Source Address Affinity catchall-virtual squid-proxy-pool 172.22.21.250:80 731 seconds 172.22.20.228 Source Address Affinity catchall-virtual squid-proxy-pool 172.22.21.249:80 731 seconds
- hoolio
Cirrostratus
Hi Andy, - AndyC_86542
Nimbostratus
Hi Aaron,virtual catchall-virtual { destination any:http mask none ip protocol tcp rules session-management profiles http tcp translate address enable } pool login-pool { monitor all gateway_icmp members 172.22.21.137:8080 172.22.21.147:8080 down session disable } pool squid-proxy-pool { monitor all gateway_icmp members 172.22.21.249:http 172.22.21.250:http } rule session-management { when RULE_INIT { set ::asm_bypass 0 set ::cookieName "wibble" } when HTTP_REQUEST { set hasCookie [HTTP::cookie exists $::cookieName] if {!($hasCookie)} { pool login-pool } else { Cookie found <...some URL parameter tweaking code removed...> Use persist by client ip address with a timeout of 2 hours set sourceIPAddress [IP::client_addr] pool squid-proxy-pool persist source_addr 7200 set pResult [persist lookup source_addr $sourceIPAddress] log local0.debug "ip: $sourceIPAddress - persist result: $pResult" } } }
- hoolio
Cirrostratus
I don't see anything obvious in the config that would cause this. For testing, can remove the source address persistence profile from the VIP? Can you also clear the persistence records for the VIP (or wait for them to clear) and then sprinkle your iRule generously with this:when CLIENT_CONNECTED { log local0. "[IP::client_addr]:[TCP::client_port]:\ [persist lookup source_addr [IP::client_addr]], new connection" } when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]:\ [persist lookup source_addr [IP::client_addr]], request, URI: [HTTP::uri]" set hasCookie [HTTP::cookie exists $::cookieName] if {!($hasCookie)} { log local0. "[IP::client_addr]:[TCP::client_port]:\ [persist lookup source_addr [IP::client_addr]], no cookie, using login-pool, URI: [HTTP::uri]" pool login-pool } else { log local0. "[IP::client_addr]:[TCP::client_port]:\ [persist lookup source_addr [IP::client_addr]], cookie, using squid-pool, pre-persist, URI: [HTTP::uri]" Cookie found <...some URL parameter tweaking code removed...> Use persist by client ip address with a timeout of 2 hours pool squid-proxy-pool persist source_addr 7200 log local0. "[IP::client_addr]:[TCP::client_port]:\ [persist lookup source_addr [IP::client_addr]], cookie, using squid-pool, post-persist, URI: [HTTP::uri]" } }
- AndyC_86542
Nimbostratus
Hi,when LB_SELECTED { log local0. "[IP::client_addr]:[TCP::client_port] :[LB::server]" }
tmm tmm[ 1835 ] Rule test LB_SELECTED: 172.22.20.221:4918 squid-pool 172.22.21.249 80 tmm tmm[ 1835 ] Rule test LB_SELECTED: 172.22.20.221:4918 squid-pool 172.22.21.249 80 tmm1 tmm1[ 1861 ] Rule test LB_SELECTED: 172.22.20.221:4777 squid-pool 172.22.21.250 80
- dennypayne
Employee
You're probably on to something, I would try turning off CMP on that virtual and see what happens. I think the syntax is: bigpipe virtual catchall-virtual cmp disable. - AndyC_86542
Nimbostratus
I tried disabling CMP on the virtual IP that gives the problem and then on all virtuals. No change. Still getting tmm and tmm1 in the logs and showing the same behaviour. - Jos_52767Historic F5 AccountIf source address persistence does not work within the VIP, then perhaps you can try disabling it and using UIE persistence in the iRule instead - https://support.f5.com/kb/en-us/solutions/public/7000/300/sol7392.html. The example in SOL7392 talks about persisting on the value of JSESSIONID, but you should be able to persist on [IP::client_addr].
- AndyC_86542
Nimbostratus
Hi Jos,bigpipe db Provision.tmmCount 1
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects