Forum Discussion
Robert_47833
Jun 26, 2012Altostratus
one difficult question in irule with repect to ratio hits or "virtual pools"?
hello,dear irule
there is a irule ,with many pools and uri match on it,
such as
if { [HTTP::uri] starts_with "/test1"} {
pool CJJ-SLX1
...
hooleylist
Jun 26, 2012Cirrostratus
Hi Robbie,
You can use a session cookie to track whether a request should go to a specific pool. You can set the cookie in HTTP_RESPONSE using 'HTTP::cookie insert $cookie_name value $cookie_value path / domain $domain'. You can check for the cookie in HTTP_REQUEST using [HTTP::cookie value $cookie_name].
If you want to "randomly" send x% of requests without a cookie to a specific pool, you can use rand(). The third example in this codeshare entry shows how to implement what you've described.
Example 3 - Send 90% of requests to poolA, 5% to poolB and 5% to poolC. Use a session cookie to persist clients to the same pool over their HTTP session
https://devcentral.f5.com/wiki/iRules.ratio_load_balancing_using_rand_function.ashx
If you want to prevent users from manually specifying the pool they go to, you could encrypt the cookie using a custom HTTP profile and the cookie to encryption option.
Aaron
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects