Hello, I am using tomcat’s JSESSIONID for persistence and I created iRule using this example DevCentral - An F5 Technical Community However I have couple of doubts here, I am not sure that whether I need to configure default persistence profile with the pool or not, if so how can I do that? Second, when I reload the app with in sessiontimeout period BIG-IP sends request to another server, so I want to know why reloading is breaking the persistence setting even though JSESSIONID is with the request. Thanks for the help.
Sorry for long post but I think I am missing something here and got no clue somehow my persistence is not configured properly, here is the exact irule I am using
when HTTP_REQUEST {
set uri [ HTTP::uri ]
if { $uri contains "myapp" } {
find out if session id is defined
set sessionId [ HTTP::cookie "JSESSIONID" ]
log "request for $uri , when sessionId is -- $sessionId "
if { $sessionId == "" } {
look for auth cookie
set authCookie [ HTTP::cookie "auth" ]
set location [HTTP::cookie "server_location" ]
if { $authCookie != "" and $location != "" } {
if { $location equals "myapp" } {
pool appserver_pool
}
}
else {
HTTP::redirect "http://10.0.0.1/auth/"
}
} else {
persist session
persist uie $sessionId 3600
set location [ HTTP::cookie "server_location" ]
log "SessionId not null location is $location "
if { $location equals "myapp" } {
pool appserver_pool
}
}
}
elseif { $uri contains "auth" } {
log "request for $uri , when no session JSESSIONID is [HTTP::cookie "JSESSIONID"] "
pool authserver_pool
}
}
when HTTP_RESPONSE {
HTTP::header replace "Server IP" [ IP::server_addr ]
log "Server Address [IP::server_addr] "
set sessionId [ HTTP::cookie "JSESSIONID" ]
if { $sessionId ne "" } {
log "app server has set JSESSIONID $sessionId add persistence"
persist off session id for an hour (3600 seconds)..
persist add uie $sessionId 3600
}
}
My virtual server has authserver_pool as its default pool. appserver_pool has two nodes. Virtual server has http profile only. everything else is default. On an average I receive HTTP request in every 15 seconds from same client. And log shows this :
Wed May 5 01:11:23 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _persist_sessionId_on_resposne : Server Address 192.168.1.1
Wed May 5 01:11:23 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _validate_request : request for /myapp/poll , when sessionId is -- C195535A841C7D81985E33F2DFA51331
Wed May 5 01:11:10 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _persist_sessionId_on_resposne : Server Address 192.168.1.1
Wed May 5 01:11:09 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _validate_request : request for /myapp/poll , when sessionId is -- C195535A841C7D81985E33F2DFA51331
Wed May 5 01:10:56 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _persist_sessionId_on_resposne : Server Address 192.168.1.2
Wed May 5 01:10:56 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _validate_request : request for /myapp/poll , when sessionId is -- C195535A841C7D81985E33F2DFA51331
Wed May 5 01:10:43 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _persist_sessionId_on_resposne : Server Address 192.168.1.2
Wed May 5 01:10:43 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _validate_request : request for /myapp/poll , when sessionId is -- C195535A841C7D81985E33F2DFA51331
Wed May 5 01:10:30 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _persist_sessionId_on_resposne : Server Address 192.168.1.2
Wed May 5 01:10:30 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _validate_request : request for /myapp/poll , when sessionId is -- C195535A841C7D81985E33F2DFA51331
Wed May 5 01:10:17 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _persist_sessionId_on_resposne : Server Address 192.168.1.1
Wed May 5 01:10:17 PDT 2010 info local/tmm tmm[4117] 01220002 Rule _validate_request : request for /myapp/poll , when sessionId is -- C195535A841C7D81985E33F2DFA51331
I am not sure why request goes to 2nd node when I am persisting session for an hour. Someone plzzzzzzzzzz help me. I have no clue here. I would greatly appreciate your help.
Can someone please help me here, please let me know if I am missing any information here since I am new to this group. Hoping for getting some help.
Thanks.
Meena: Try enabling oneconnect, and use a mask of 255.255.255.255. See SOL7964, hopefully this helps. Either way, update when you give it a try.
-Matt
First of all thanks a lot for the reply.
I tried it but I am having strange behavior, because of nature of application client poll server every 30 seconds for any updates. persistence works for first 3-4 minutes (depending on number of connections) and after that LB switches connection to next server in line, again after some time connection is switched to first server. I could not find a pattern in switching time though.
I tried oneconnect, universal persistence both nothing seems to be working for me. Any clue??
thanks
Can you send over the virtual server configuration as well?
-Matt
Sorry for asking, how can I do that? can I take configuration from some file via command line?
You can look at bigip.conf for the relevant stuff, or just do a “b virtual show” from the CLI. It may be a while before I can look at this though - have you opened a support ticket? It’s likely they can help you solve this quickly.
-Matt
Thanks for the reply Matt, can anyone open a support ticket with F5, I was thinking one needs a support contract with them. can you please tell me how can I do so since I do not have access to web portal and I want to fix this problem asap.
Thanks agin.
I opened a case with F5 support, they think iRule is fine its NTP issue with BIG-IP LTM 10.1. I turned off NTP and set dates manually to GMT to all my servers and BIG-IP. I can still reproduce this issue. I am using universal persistence and LTM drops persistent record after some time (say 9-10 minutes). I converted my iRule to be the simplest all I have is
when HTTP_RESPONSE {
log "Server Address [IP::server_addr]"
if { [HTTP::cookie exists "JSESSIONID"] } {
persist add uie [HTTP::cookie "JSESSIONID"] 3600
}
}
when HTTP_REQUEST {
log "request for [ HTTP::uri ] , when sessionId is -- [HTTP::cookie "JSESSIONID"] "
if { [HTTP::cookie exists "JSESSIONID"] } {
persist uie [HTTP::cookie "JSESSIONID"] 3600
}
}
I would really appreciate if anyone has any clue about what’s going on here. Thanks.
I just had a moment to look at this. Unfortunately, I simply can’t replicate your problem…I’m persisting OK (for 10 or so minutes) with the same rule you’ve got above. If I delete my JSESSIONID cookie I flip to the other box, then persist there.
I think you’ve got a timeout somewhere. The date idea is valid one, so that’s good to rule out. Were you ever able to get the configuration for the virtual server?
-Matt
I also persist for some times and without me doing anything bigip deletes the entry in persistent table, and then next request is forwarded to different node (say 1.2). I am not deleting JSESSIONID, if I wait for sometime BIGIP again deletes persistence entry for 1.2 and recreates new entry for 1.1 after next request. I think 3600 should be the timeout for bigIP, which means an hour ??
Here is the configuration for my virtual server:
VIRTUAL ADDRESS 17.184.8.110 UNIT 1
| ARP enable
| (cur, max, limit, tot) = (0, 5, 0, 51)
| (pkts,bits) in = (4912, 5.243M), out = (17229, 77.93M)
+-> VIRTUAL vs_uie_appserver SERVICE http
| PVA acceleration none
| (cur, max, limit, tot) = (0, 5, 0, 51)
| (pkts,bits) in = (4912, 5.243M), out = (17229, 77.93M)
| requests (total) = 374
+-> POOL test_uie_pool LB METHOD round robin MIN/CUR ACTIVE MEMBERS 0/2
| (cur, max, limit, tot) = (0, 6, 0, 36)
| (pkts,bits) in = (4710, 5.233M), out = (7086, 74.11M)
+-> POOL MEMBER test_uie_pool/192.168.1.1:webcache active,up
| | session enabled priority 0 ratio 1
| | (cur, max, limit, tot) = (0, 3, 0, 18)
| | (pkts,bits) in = (2857, 3.278M), out = (4276, 44.76M)
| | requests (total) = 237
+-> POOL MEMBER test_uie_pool/192.168.1.2:webcache active,up
| session enabled priority 0 ratio 1
| (cur, max, limit, tot) = (0, 3, 0, 18)
| (pkts,bits) in = (1853, 1.954M), out = (2810, 29.35M)
| requests (total) = 137
Thanks for the help.