Forum Discussion

Sulabh_Srivasta's avatar
Sulabh_Srivasta
Icon for Altostratus rankAltostratus
Mar 20, 2020

Connection limit on virtual server and message back to client

I am trying to set max connection limit and connection/sec on a virtual server, once the max connection limit is reached can LTM send message back to client that " it is over limit, please try after some time" or any schedule that try during this time window ?? Do we need to make any changes of back end servers in pool ?

Will appreciate your answers.

5 Replies

  • Hello,

     

    Connection limit that you want to put on F5 is specific to Virtual Server, Pool or Node. Now in your case, you want to put it on VS. In this case, no need of making any changes on backend servers. With connection limit settings on VS, F5 will just limit incoming connections as per configuration done.

     

    Hope it helps!

     

    Mayur

    • Sulabh_Srivasta's avatar
      Sulabh_Srivasta
      Icon for Altostratus rankAltostratus

      Mayur, thanks for reply. My question is "can LTM send a response to client - over limit, please try after some time " ??

  • For testing, I am using this iRule but it is not working :

     

    when RULE_INIT {

      set ::active_connections 0

      set ::max_connections 2

      set ::html_content "over_limit"

    }

    when CLIENT_ACCEPTED {

        set over_limit 0

        if {$::active_connections > $::max_connections } {

       set over_limit 1

      } else {

       incr ::active_connections 1

      }

    }

    when HTTP_REQUEST {

      if {$over_limit}{

        HTTP::respond 200 content $::html_content

        HTTP::close

      }

    }

    when CLIENT_CLOSED {

      incr ::active_connections -1

    }

  • try below iRule. Else you can also try by using FALLBACK HOST in http profile. You can enter a URL/VS-IP here so if the VS connection limits are reached it'll redirect clients to the URL/IP. And bind one iRULE which will just give response to clients e.g. - Service is unavailable

     

     

     

    when RULE_INIT {

      

      set ::max_connections 500

      set ::html_content "Try After sometime"

      

    }

    when CLIENT_ACCEPTED {

       

      set over_limit 0

      

      if {$::active_connections >= $::max_connections } {

       set over_limit 1

      } 

    }

    when HTTP_REQUEST {

       

      if {$over_limit}{

        

       HTTP::respond 200 content $::html_content

        

      }

    }

     

     

    2. If you are using Fallback host option

     

    when HTTP_REQUEST {

     

    HTTP::respond 503 content "Service Temporarily Unavailable"

     

    }

    • Sulabh_Srivasta's avatar
      Sulabh_Srivasta
      Icon for Altostratus rankAltostratus

      I used the first option with your given iRule but didn't work, then tried fallback option that didn't work either. I am stuck now.