Forum Discussion

Peter_Baughn_84's avatar
Peter_Baughn_84
Icon for Nimbostratus rankNimbostratus
Sep 08, 2008

custom load balancing

We have a set of servers that each have a set number "jobs" they can handle. These jobs are scheduled with a web request. I would like to be able to load balance these based on the number of active jobs on a given server.

 

 

Basically least connections, but based on a custom value not TCP connections.

 

 

Anyone out there done something like this? Custom weights? iRules? iControl maybe to have each server set its own weight?

 

 

Thanks,

 

 

peter
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi Peter,

     

     

    The simplest option might be to build a status page on the application which displays UP if the count of sessions or jobs that the server is currently processing is lower than the threshold it can handle. You could then configure an HTTP monitor to check the page for the string "UP". If the server doesn't show UP, it would be marked down by the pool.

     

     

    Else, you could potentially use an iRule to count the number of jobs which have been sent to each server, but it would be much more complicated compared with the first option. If you do want to explore the iRule route, can you explain how you could determine when a job has been started and completed based on the request and/or responses sent to the VIP?

     

     

    Aaron
  • Thanks for the response!

     

     

    I thought about the status check page, one exists already, our dev folks would just need to add that parameter to the check list. My only concern was that marking it down would prevent existing persistent conns to be redirect to another host.

     

     

    On the other idea, yea I thought of an iRule as well. Our devs could add a header/URI value that could be parsed on server response, but I wasn't sure what you could actually do with that with respect to LB preference. I know you could persist on that value, but what I would need is to collect those values and set some sort of precedence to the pool member.

     

     

    I guess what I need is some sort of living member preference list, say a server has 10 out of a 100 available work loads, it would have a higher precedence than the server with 50 or 90.

     

     

    I am thinking your option one might be my only bet. Which would just prevent the LB from sending additional work to a already fully loaded server.

     

     

    peter
  • If your developers are really interested in best case scenario, batch processing really lends itself well to an icontrol application. Your application can customize priorities due to current server load and dynamically shift the load by utilizing iControl to interact with the LTM.
  • Paul_Szabo_9016's avatar
    Paul_Szabo_9016
    Historic F5 Account
    Couple of other ideas:

     

     

    (1) Dynamic ratio. If you can query the number of jobs on a server via e.g. snmp, you can set up the BIG-IP to change the ratio of each node dynamically. You'll want to query this fairly quickly (e.g. once a second) to keep up with changes in a dynamic load.

     

    (2) Use a 'passive' monitor via an iRule to monitor for the page that indicates no-more-jobs (as previously mentioned in the thread), then do a reselect when that comes back from the server. This is much more lively than a custom HTTP monitor. In fact any mechanism that doesn't provide immediate feedback to the LB logic is not that useful as it will oscillate badly.

     

    (3) Create your own "least jobs" LB in and iRule (as mentioned previously in the thread). as of 9.4.5 you have access to the list of active (up) servers and can write all sorts of LB stuff (see similar rules for e.g. CARP). We don't yet provide a good storage mechanism for storing your data on a per-server basis, so this won't exactly be easy, but it is possible.

     

     

    If this is HTTP then I advise use OneConnect as it frees up server jobs pool(e.g. Apache threads) the quickest.

     

     

    The other way I've seen this done (for Apache) is with connection limits in combination with OneConnect. This seems to manage the apache thread pool fairly nicely.

     

     

    Paul
  • Thanks everyone for your input. Its been helpful. I have some ideas now going forward.

     

     

    peter