Forum Discussion
Universal Persistence for URI String
I am a newbie of iRules. My system is BIG-IP 10.2.1.
I would like to loadbalance across two virtual-servers based on URI string.
First, a server reply HTTP_RESPONSE with "ticket=123...." in Location header.
Next, a client sends HTTP_REQUEST with "ticket=123...." in Request URI to another virtual-server (but pool member is same) .
The "ticket=123...." is persistence key which is unique across the two virtual-servers sessions.
Those two sessions must be loadbalanced to the same servers.
Does anyone have similar environment with me?
Or can provide me any iRule sample to do this?
Thanks
3 Replies
- The_Bhattman
Nimbostratus
Hi Innoue,
If you have 2 virtual servers but share the same IP address then yes you can share the same persistance profile and match it across the 2 virtualls.
However, when it comes to 2 separate Virtual IP addresses then I think Election HASH iRule applied to both virtuals might do the trick
Here is the codeElection Hash iRule Compute Hash - MD5 MD5 calculation of Server + URI Rule selects Server that scores highest S = Current high score N = Node being evaluated W = Winning node when HTTP_REQUEST timing on { set S "" foreach N [active_members -list ] { if { [md5 $N [URI::query [HTTP::uri]] ticket] > $S } { set S [md5 $N[HTTP::uri]] set W $N } } pool member [lindex $W 0] [lindex $W 1] }
You can find more details about it on the following link
http://devcentral.f5.com/wiki/iRules.ElectionHashLoadBalancingAndPersistence.ashx
I hope this helps
Bhattman - iinoue_38219
Nimbostratus
Thanks, Bhattman.
In my case, virtuals don't have the same IP.
And, First Session is the "Reply" from one server , whose Location header includes "ticket=1,2,3...".
Next Session is the "Request" to another virtual server , whose Request URI includes "ticket1,2,3..."
So, this might need universal persistence.But Election HASH iRule may be useful in another case.
Thanks - iinoue_38219
Nimbostratus
Thanks, Bhattman.
In my case, virtuals don't have the same IP.
And, First Session is the "Reply" from one server , whose Location header includes "ticket=1,2,3...".
Next Session is the "Request" to another virtual server , whose Request URI includes "ticket1,2,3..."
So, this might need universal persistence.But Election HASH iRule may be useful in another case.
Thanks
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
