Forum Discussion
Kevin_106976
Jul 16, 2010Nimbostratus
Distribute load based on uri
Hi,
I want to distribute load across two uri's (/some/uri1 and /some/uri2) on a 70/30 percentage basis. Can I do this via an iRule ?
hooleylist
Jul 26, 2010Cirrostratus
I think Bhattman's example would work. But the downside to using a global counter is that it will prevent the VS from being "load balanced" across all of the TMM cores or CPUs (if you're on a CMP capable platform and LTM version). Another poster, Kev, came up with a simple solution for scenarios like this:
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/aff/5/afv/topic/aft/1172658/afc/1196453/Default.aspx
when HTTP_REQUEST {
if { rand() > 0.02 } {
pool default-pool
} else {
pool marketing-pool
}
}
You could adapt this to your scenario:
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/aff/5/afv/topic/aft/1172658/afc/1196453/Default.aspx
when HTTP_REQUEST {
Check if URI is one we want to redirect
if {[HTTP::uri] contains "search"}{
if { rand() > 0.70 } {
HTTP::redirect "http://uri1"
} else {
HTTP::redirect "http://uri2"
}
}
}
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