Forum Discussion
dynamic loadbalancing using value from node
hi, can i dynamic loadbalaning with values from the node´s application? the application writes a score from 1 to 10 in a file. can the LTM this score in a table writing and the node with the best score becomes the next Client Connection? Thanks in Advance.
- Brad_146558Nimbostratus
LTM wouldn't be able to look at a file on the machine, at least I've never seen anyone do it. You could probably write an iRule to check against a web page and look for that value 1 through 10 then route traffic to that node based on the value.
There may be a simpler option though, could you tell us what kind of problems you are running into that prompted this?
- Brad_146558NimbostratusI stand corrected, it looks like you can read a file using LTM.
- juergen_lampar1Nimbostratus
hi, the application can write a score in a file on the Server (node). the LTM should read this value in this file via a Monitor and the Server (Node) with the best score should become the next Client Connection.
- Kevin_StewartEmployee
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
-
- juergen_lampar1Nimbostratus
Hi, the command "tmsh list ltm pool $pool |grep address " is for Version 11.X But in Version 10.2.4 the scrpit don´t running. The Output differ:
[root@F5:Active] config tmsh list ltm pool testerle_80 |grep address[root@F5:Active] config
[root@F5:Active] config tmsh list ltm pool testerle_80 |grep 192 192.168.212.67:http { 192.168.212.67:hosts2-ns {
- juergen_lampar1Nimbostratus
hi, with Version 10.2.4:
!/bin/bash define pool namepool="local-pool";
define pool member listener portport=80;
arr=($(tmsh list ltm pool $pool |grep "local ip range" | cut -d : -f1 ));
for x in "${arr[@]}" do score=
; tmsh modify ltm pool $pool members modify { $x:$port { ratio $score } }; donecurl -fNs http://$x/score.php
but can i Trigger the script via external montior?
- Kevin_StewartEmployee
but can i Trigger the script via external montior?
Absolutely, and there a few ways to do this. The easiest is simply to place that script in /config/monitors, then create an external monitor script in the GUI that points to this script and assigns a bogus pool. You need the pool assignment to make the monitor work, though it doesn't have to be tied to anything that you actually care about. Doing it this way also ensures that everything is backed up in an archive.
Recent Discussions
Related Content
* 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