Forum Discussion
darragh_19954
Nimbostratus
Dec 13, 2007Saving pools to persistence table when it's not the LB default
I'm trying to persist cookie-disabled users on a particular pool using their IP/UserAgent combination by saving the IP/UA as a universal key in the persistence tables.
In the BIG-IP GUI, I've set up poolA as the default pool with universal as the default persistence profile.
So when a new user arrives, there will be no entry in the persistence table. So we randomly sample between pool A and B. Then we save the outcome in the persistence table against their IP/UA as a key. When a subsequent request comes from that user, we check the persistence table and send to the pool previously sampled.
What I'm finding is that if I use pool A as the default for the load-balancer, and the request gets directed to B, then some of the subsequent requests (for page elements like stylesheets etc) will not find an entry in the persistence table so they get re-sampled. So the HTML comes from pool A and the stylesheet comes from pool B.
The code is below. I don't know what I'm doing wrong but it looks there is some delay between adding an entry to the non-default pool persistence and being able to query it. Any thoughts on this would much appreciated.
when HTTP_REQUEST {
set SessionID [string map {" " ""} "[IP::client_addr][HTTP::header User-Agent]"]
set persistence [session lookup uie $SessionID]
if { $persistence != "" } {
set PoolVal $persistence
set message "Persistence on $persistence"
} else {
if { rand() < 0.5 } {
set PoolVal "poolA"
} else {
set PoolVal "poolB"
}
set message "Pool sampled as $PoolVal"
}
log local0. "$PoolVal,$message,[HTTP::path]"
pool $PoolVal
}
when HTTP_RESPONSE {
if { $persistence == "" } {
session add uie $SessionID $PoolVal 60
}
}
- hoolio
Cirrostratus
I'd expect that the first request should be for a document. That document would reference other content like images and style sheets. So the client should make a single request where the persistence info is saved. The client shouldn't actually make any further requests until they get the response. - darragh_19954
Nimbostratus
Once the LB has selected pool A, the document is returned from that pool. The client does wait until this is returned and most of the subsequent requests for images, CSS and JS files are honoured correctly (an entry is found in persistence table and the request is directed to the pool that served the parent document). - hoolio
Cirrostratus
I'm not sure how there would ever be two persistence records for the same client as defined by the source IP and user-agent string with different values. I could see that the timeout of 60 seconds might be too short and a client would make a request more than a minute after the previous request. That would mean the previous persistence record would be removed and the subsequent request could be sent to the other pool. - darragh_19954
Nimbostratus
Thanks for all the help. - hoolio
Cirrostratus
Do you have match across virtuals and/or pools enabled? I would have thought you would only see a conflict if these options were enabled on the persistence profile.
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