basic persistence functional behavior question

I am new to load balancers. The code below is for jsessionid persistence. What is the code actually doing here ? I’m having difficulty understanding how persistence is actually used in this context. Does persistence of some value (jsessionid) imply that subsequent requests that contain the same value for jsessionid will be routed to the same server as the initial request? And oppositely, that if a request comes in with a jsessionid that has not yet been persisted, that value gets persisted and the request is routed to whatever server load balancing algorithm determines.

I’m just not seeing the explicit routing in the code below so I think I’m missing some basic functional concept.

Thanks, Patrick

when HTTP_REQUEST {

if { [string length [HTTP::cookie exists “JSESSIONID”]] } {

Persist off of the cookie value

persist uie [HTTP::cookie “JSESSIONID”] 3600

} else {

Parse the jsessionid from the path

set jsess [findstr [string tolower [HTTP::path]] “jsessionid=” 11]

Use the jsessionid from the path for persisting

if { $jsess != “” } {

persist uie $jsess 3600

}

}

}

when HTTP_RESPONSE {

Check if there is a jsessionid cookie in the response

if { [string length [HTTP::cookie exists “JSESSIONID”]] } {

Persist off of the cookie value

persist uie [HTTP::cookie “JSESSIONID”] 3600

}

}

Hi Patrick,

The persist command is what determines which pool member is used when the client presents a JSESSIONID cookie or request with the JSESSIONID in the URI. If the request has a JSESSIONID which matches a persistence record, the pool member in the persistence record will be used. If the request doesn’t have a JSESSIONID or does but it doesn’t point to a valid persistence record, a pool member will be selected according to the load balancing algorithm of the pool.

Aaron