Forum Discussion
Kevin_Stewart
Jun 24, 2014Employee
Two things worth considering:
-
If you needed this to be a real-time thing, then you'd necessarily have to query each server and compare scores on each new user session. To do this you'd use a series of sideband calls inside an iRule, and that would invariable add some latency.
-
Doing this in a monitor makes it, by definition, an asynchronous process, so you could just as well have a script poll all of the servers periodically and then update ratio values of a given pool. Something like this:
!/bin/bash define pool name pool="local-pool"; define pool member listener port port=80; arr=($(tmsh list ltm pool $pool |grep address |awk -F" " '{ print $2 }')); for x in "${arr[@]}" do score=`curl -fNs http://$x/score.php`; tmsh modify ltm pool $pool members modify { $x:$port { ratio $score } }; done