Forum Discussion

Hitesh's avatar
Hitesh
Icon for Nimbostratus rankNimbostratus
Mar 02, 2020

Load balancing using an API

Hello team,

We have a bunch of hosts running behind F5.

Every host is running few services.

One particular service is capable of providing free memory information through the API we developed:

GET http://hostname/myservice/usageAPI
 
Response:
{
   "freeMemory": 369959592
}

Is it possible to consume this API in F5, and load balance accordingly?

E.g. If freeMemory is less than threshold, than no request should be sent to that host for the time being.

After sometime, when freeMemory is above the threshold value, then F5 should redirect request to that host.

How to load balance in F5 through such API?

Note that we don't want to mark server/host status Up and Down. We just want to make sure that particular service has enough memory to take up the next memory intensive request.

We know Dynamic Ratio Load Balancing but that considers the overall health of the host.

We want to load balance based on status of one service out of few other services running on the host.

2 Replies

  • NAG's avatar
    NAG
    Icon for Cirrostratus rankCirrostratus

    Hi Hitesh,

     

    Yes, you can using monitors to mark pool members up or don based on value returned for "freeMemory" parameter. When pool member is down, no application traffic will be sent to it until is it backup again.

     

    BigIP has a feature called custom monitors. Using it, you can write a scrip to check for "freeMemory" and set pool member status accordingly.

     

    REF: https://devcentral.f5.com/s/question/0D51T00006kGmg2/custom-https-health-monitor

     

    Hope this helps,

    Nag

    • Hitesh's avatar
      Hitesh
      Icon for Nimbostratus rankNimbostratus

      ,

      We don't want to mark servers Up and Down.

      We want to load balance using the parameter.

       

      E.g. Out of all the servers in the pool, redirect the request to the server which has freeMemory more.

      Or in another terms, if freeMemory is less than some thresold, then don't redirect request to that server.

       

      After sometime, when the freeMemory is above the thresold, then that server should get new requests.