Forum Discussion

Ravi_Rajan_7549's avatar
Ravi_Rajan_7549
Icon for Nimbostratus rankNimbostratus
Feb 28, 2006

Limiting connections based on Application

I am new to irules and need some help.

 

 

I have a pool with 2 members and a virtual server for this pool.

 

2 members are web servers each containing the same 10 applications. I want to limit the number of connections to this virtual server for a particular app.

 

 

For ex.

 

 

1) 10 Users are accessing http://VIP/appA and i want the 11th user to be redirected to some other page (custom one) only if he accesss http://VIP/appA and if he accesses http://VIP/appB, he should be allowed for it.

 

 

TIA,

 

 

Ravi

 

 

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Interesting use case, it sounds like you'd need a rule similar to the one in the Docs & Tips section that deals with global variables and limiting the number of connections to a vip based on client IP address. You can find that doc here: Click here

     

     

    For your purposes, though, it sounds like you'd need to extend the $::active_clients array a little further, so that you had something like $::active_clients([$client_ip],[$appName]), which would represent the number of connections to the specified application, from a given client IP address. Note that this could produce a very large array depending on your usage.

     

     

    -Colin
  • Thanks for the link. I am going through it. Meanwhile, to give more insight into it, i don't want to limit connections based on client IP, rather i need to only monitor number of active clients for a particular app. Once the number of active clients reaches a limit (say 100), i want to redirect all further client requests for that particular app to a different page. Also, i need to decrement the count once the client closes a connection for that particular app so that other clients can come in.

     

     

    But if a client requests some other app, he should be able to access it.

     

     

    TIA,

     

     

    Ravi
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Then it sounds even more similar to the rule in the link I posted. You'll just want to change what's being kept track of to be the application URI, instead of the client IP address.

     

     

    -Colin
  • Looked at the example that uses global variable. but can someone tell how the updating of this global variable is done when multiple insataces are accessing and updating the value, is it single threaded or if mutli-thread then is it thread safe ?

     

     

    thanks