Concern 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 session, because I have millions of devices sending data and they should be sticky I want to contol the load balancing by my own and remove the need of F5 to save a map of millions so it can know to which server to route the traffic
the problem: I am creating every request a call to [active_members -list [LB::server pool]]. so it is creating a list or pointing to a list (I don't know how F5 implemented it). does this call (or anything else in the code) create any performance or memory usage impact?
Here is the iRule:
when HTTP_REQUEST {
get the ROUTEID last char and decide by it to which pool to go using modulo of the number of active servers. if no ROUTEID use regular round robin
doing this we will achieve sticky by session (device) AND the F5 wont need to hold millions of devices in the routing table
if { [HTTP::cookie exists "ROUTEID"] }{
set routeId [HTTP::cookie value "ROUTEID"]
set lastChar [string range $routeId 0 0]
make lastChar an integer
switch $lastChar {
"a" {
set lastChar 10
}
"b" {
set lastChar 11
}
"c" {
set lastChar 12
}
"d" {
set lastChar 13
}
"e" {
set lastChar 14
}
"f" {
set lastChar 15
}
}
set numOfMembers [active_members [LB::server pool]]
index that should be used by modulo of the ROUTEID with the number of active servers
set indx [expr $lastChar % $numOfMembers]
get the array of active members
set lst [active_members -list [LB::server pool]]
redirect to the relevant ip and port
pool [LB::server pool] member [lindex [lindex $lst $indx] 0] [lindex [lindex $lst $indx] 1]
}
}
Will there be a problem to performance or memory calling the [active_members -list [LB::server pool]]?
Thanks