Forum Discussion
amichai_246034
Nimbostratus
Feb 14, 2016Concern regarding calling active_members -list in an iRule for every call (performance and memory usage impact)
I have a concern regarding calling active_members -list in an iRule for every call (performance and memory usage impact) iRule below. Motivation: instead of using F5 round robin + sticky by sessi...
Kai_Wilke
MVP
Feb 14, 2016Hi Amichai,
even the smalest iRule may cause performance problems, if you've have already maxed out the capacity of your hardware. But if you have some spare capacity leftover, then this iRule shouldn't be a big deal.
Since performance seems to be a concern, you may try the syntax below. Its basically a carbon copy of your code, but performs ~45% faster...
when RULE_INIT {
array set static::hex2deci {
0 0 1 1 2 2 3 3
4 4 5 5 6 6 7 7
8 8 9 9 a 10 b 11
c 12 d 13 e 14 f 15
A 10 B 11 C 12 D 13
E 14 F 15
}
}
when HTTP_REQUEST {
if { [set hex [string range [HTTP::cookie value "ROUTEID"] 0 0]] ne "" } then {
set member [lindex [active_members -list [LB::server pool]] [expr { $static::hex2deci($hex) % [active_members [LB::server pool]] }]]
pool [LB::server pool] member [lindex $member 0] [lindex $member 1]
} else {
pool [LB::server pool]
}
}Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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