We decided to modify the logic slightly... Instead of RR connections to the Pod VIP's we allow the first connection (no cookie set) to go to a "master pool" which includes all the nodes contained in each pod. We will use least connections (LB Algorithm) on this master pool to ensure the new request goes to not only the most available pod but also the server with the least connections. My thoughts are that once the logic sends this initial connection to the most available node, we can set a persist cookie on the reply. This cookie name/value is being set correctly based on server info in the podx_class but I need to include the proper persist value (Server:port) inside the cookie.
Question: Can anyone tell me how to set the value of the cookie so when the return comes back, and the iRule logic sends the return request to the proper VIP, the cookie can be used to persist to the proper node inside the pod pool?
Thanks,
when HTTP_REQUEST {
set reqcookie [findstr [HTTP::cookie names] "my_cookie"]
if { $reqcookie starts_with "my_cookie"} {
set podcookie [findstr $reqcookie "my_cookie" 9 " "]
set podvip [findclass "$podcookie" $::pod_ip " "]
virtual $podvip
} else {
pool master_pod_pool
}
}
when HTTP_RESPONSE {
if { [matchclass [IP::server_addr] equals $::pod1_class] } {
HTTP::cookie insert name "pod1" value [IP::server_addr]
} elseif { [matchclass [IP::server_addr] equals $::pod2_class] } {
HTTP::cookie insert name "pod2" value [IP::server_addr]
} elseif { [matchclass [IP::server_addr] equals $::pod3_class] } {
HTTP::cookie insert name "pod3" value [IP::server_addr]
}
}