I have a single VIP that will have two types of users. I don’t want to define URLs for both so I’d like to use the PERSIST functionality, but only to keep a session going to the same pool, and not specifically to a single node of the pool.
Documentation on PERSIST seems to show it’s to a node only without any option to have pool persistence instead of node persistence.
Ideas?
One thought I had was to use standard PERSIST, but then try to split the persist lookup result and take only the pool name part and then set the pool after the persist statement in order to force it to the pool and not just one node. Would this work?
Are there any examples online or can someone share? Maybe this isn’t even possible…let me know!
What you are asking is doable, but do you have an idea of how you can differentiate your users? For example are the different users based on a parameter or cookie or source IP address they are requesting?
Once you figure out how to differentiate between the two sets of users, you can insert a session cookie in responses to track when a user has been assigned to one pool or another. On requests you can look for that cookie value to get them back to the same pool. You wouldn’t need to use the persist command for this.
I created an iRule for selecting the proper pool based on who’s making the request, but now I have a question…we use a VIP for multiple products, each running in their own IIS app pool. One of them uses a long-running HTTP request for doing a publish/subscription type transaction where we push an update out the connection…which is using the PERSIST function to stay on a single server in the pool (the PERSIST iRule is watching for “/streamer” requests only).
How can I have both of these running at the same time?
What is the order of events with the PERSIST setting/profile and the rest of the iRules?
I don’t think I understand all the pieces to answer your question - but you might want to look at the discussion at the bottom of DevCentral - An F5 Technical Community for some guidance.
If your iRule is specifically looking for requests only bound to a particular URI, and the requests using the standard persistence aren’t bound for that URI, then there shouldn’t be any crossover, should there?
Or would one client possibly be making requests to both?
I will actually need to hybrid the two together, but keep them separate. I’m sure that makes a lot of sense.
I have 2 complete environments behind one VIP. One client is paying for separate hardware (one set of servers) and then there’s everyone else (other set of servers).
I need to accomplish 2 things.
1) I need to determine if I have client A or not client A and choose a web pool based on A or not. I’m setting a session cookie to track this and direct appropriatly.
2) I need to take all /streamer calls and persist to a node, but only after I pick client A or not A. So I need to only get to the correct side/pool (based on the solution for 1) then let the PERSIST kick in to the node.
If I check the URI for <> "/streamer’ for the regular iRule for 1 above… and then for 2 only process when URI = “/streamer” I should be ok?
That should be very doable. All you need is to identify how to single out the requests for client A vs. your normal requests, and how you want to do persistence, then mush those two together.
So the logic sounds like:
If the inbound request is for client A, then pool A.
Else, if the request is inbound for /streamer, then persist to a particular node
if not /streamer client A then pool A else pool B (then set a session cookie to route faster for subsiquent requests)
if /streamer and client A, then pool A2 + PERSIST else pool B2 + PERSIST
I’m shooting for 4 pools, A1/A2 and B1/B2…the 1’s would be Observed method (best that I found for regular web requests) and the 2’s would be least connections since all of the /streamer connections are long running and I just want to balance based on connection count and not performance like Observed offers.
In the iRule I have CLIENT_ACCEPTED, HTTP_REQUEST, HTTP_REQUEST_DATA, HTTP_RESPONSE, and LB_SELECTED. Would I have to check the URI in each event in order to skip the activities in each event within the same iRule?
And, the PERSIST profile has the other iRule that is assigned to a Universal PERSIST profile which is set on the VIP…and then the other non-PERSIST iRule is just in the list of iRules…is this the best way to do this?
There is no default command to bail out of an entire iRule. The way I usually do this is set a variable early in the iRule and then check that to see if I need to process certain portions.
Initially based on client IP and then a secondary check of a logon token that we look up server side to see who it is. We don’t generate the logon token so we have to already make a call out to the auth system to verify the token for each request…we just add the logic to make sure we’re on the right side.
The client ip is an application proxy that lives at each client location to route traffic over a private WAN. We know who has what IPs, but may not have the most recent list when a new/additional one is added. So we use a security module on the web tier to identify and validate the user (auth token)/client to the web pool/stack processing the request (a guarrantee we are on the correct stack). If it fell through to the wrong pool, we reject, then attempt to catch the response in the iRule and re-send the request to the other side, adjusting the session cookie as needed so the next request followes to the correct pool, and the user doesn’t know it even happened…unless something went haywire and then the reject would make it back to the desktop with a HTTP 307 to the same URL/POST and it gets corrected on the redirect/retry.