Forum Discussion

Richard_Jones's avatar
Richard_Jones
Icon for Nimbostratus rankNimbostratus
Jan 19, 2007

Limit user sessions to each node

Here is the problem I am trying to solve:

 

 

We have a pool of 6 servers. Each server can handle 400 concurrent users sessions. We have an array of pool member user counts, and we are tracking the number of sessions on each server by incrementing the user count when we see a new session cookie created (which is persisted on), and we decrement the user count when the session cookie is destroyed.

 

 

What I want to do is set the pool member status to "session disable" if the user count hits 400. That way, existing user sessions will continue due to persistence, but no new connections will hit this pool member. Is this possible?

 

 

If not, then is it possible to check the pool member user count after a load balancing decision has been made, and rebalance to a new node if the user count is over 400?

 

 

The problem I have run into is that I don't have access to the pool member ip address in HTTP_REQUEST events (I think that occurs before a load balancing decision. I just glanced at the LB_SELECTED event, and it looks like I can rebalance the user here. I will give this a try right now.

 

 

And I am also open to other ideas!

 

 

Thanks!
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    I believe the command you're looking for is LB::status. Click here

     

     

    As you can see from the Wiki entry there, you can set the status with this command, so you could add some simple logic to your rule that sets the status to session disabled as you outlined above.

     

     

     

    HTH,

     

    Colin
  • Thanks Colin

     

     

    I think I may have found a way around this. Rather than actually change the status of the node, I simply check the current tasks of each server (tasks is a value that I created and track), and send the user to the server with the fewest tasks. Then if all servers have a task count higher than the limit, then the user receives static HTML content back saying the service is currently unavailable.

     

     

    Thanks for the reply, though!
  • Hi,

     

     

    I'm strugling with same problem. But no luck. Can you provide me an example?

     

     

    tia,
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Did you check the link I posted above? Click here There's an example of reading the variable information there. Setting it would simply require you to add a parameter as per the listed syntax:

     

     

     

    LB::status pool member

     

     

     

    Colin
  • Hi Colin,

     

     

    I have encountered this problem again with another customer, and tested out the functionality you described.

     

     

    I have no success in setting a member as disabled using that syntax, but it does return TRUE.

     

     

    For instance,

     

     

    if { [LB::status pool pool1 member 192.168.100.1 80 down] } {

     

    log "member 100.1 is down"

     

    }

     

     

    will produce the intented log output if 100.1 is indeed down.

     

     

    So, is there any way to mark a pool member as disabled in iRules, instead of just down? Such as an LB::disabled or LB::session_disabled?

     

     

    Thanks!