F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

Parveez_70209's avatar
Parveez_70209
Icon for Nimbostratus rankNimbostratus
Oct 08, 2014

Irule to restrict number of concurrent sessions to 200

Hi Team,

 

We are trying to limit the number of concurrent/active during the initial patching activity.The problem is whenever we got an unscheduled activity, once the applications members booting up, its start seeing a lot of connections which is hanging the process.

 

So, we are trying to create a new Irule which we are planning to apply to the virtual-server limiting the sessions to only 200.

 

Kindly suggest.

 

Thanks and Regards PZ

 

5 Replies

  • Hi,sorry a bit new to this field..if not irule which option i need to select and put the value 200. But why irule is because we dont want manual intervention at the time of the unplanned activities. We will create and irule and place it offline into the lb. Whenever we need we will juat push the same from the batch script.

     

  • Here is the irule, you can modify as you need

     From http://devcentral.f5.com/wiki/iRules.table.ashx
     Limit each client IP address to 20 concurrent connections
    when CLIENT_ACCEPTED {
    
        Set a subtable name with a standard prefix and the client IP
       set tbl "connlimit:[IP::client_addr]"
    
        Use a key of the client IP:port
       set key "[IP::client_addr][TCP::client_port]"
    
        Check if the subtable has over 20 entries
       if { [table keys -subtable $tbl -count] > 20 } {
          reject
       } else {
    
           Add the client IP:port to the client IP-specific subtable 
             with a max lifetime of 180 seconds
          table set -subtable $tbl $key "ignored" 180
       }
    }
    
    when CLIENT_CLOSED {
        When the client connection is closed, remove the table entry
       table delete -subtable $tbl $key
    }
    

    For the virtual server settings http://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm-implementations-11-2-1/30.html

  • Sorry to say that PK Bhatia: the mentioned Irule is not working. This is restricting the connections limit: let's say for example 20 for each and every IP.

     

    Hi Team,

     

    Kindly guide whether the below Irule will work ? ================== https://devcentral.f5.com/wiki/iRules.virtual_server_connection_limit_with_HTTP_response.ashx?lc=1

     

    Thanks and Regards PZ

     

    • PK_Bhatia's avatar
      PK_Bhatia
      Icon for Nimbostratus rankNimbostratus
      That was quick, I think you missed the part that you need to modify...