Forum Discussion

Hamish_Marson_3's avatar
Hamish_Marson_3
Icon for Nimbostratus rankNimbostratus
Jul 24, 2006

Limiting Sessions?

Has anyone implemented an iRule that limits the number of sessions to a particular virtual server?

 

 

Failing that... Does anyone know if it's possible to access the session persistence table from an iRule? (e.g. to count the number of entries in it & redirect to a busy page if there's too many already).

 

 

[I looked at extending the iRule that does the limits on connectsion per client, but the session limits need some sort of timeout on the session array... And I'm not sure how (Or even if it were possible) to code a background task that would track & expire inactive sessions...

 

 

TIA

 

Hamish

 

3 Replies

  • Hi Hamish,

     

     

    Deb had an example rule that limited the number of sessions per VIP but she was waiting on a method to count the current number of records from the session table:

     

     

    Click here

     

     

    You might try replying to that post to keep everything together.

     

     

    Aaron
  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

     

    And the rule is done...

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/HTTP_Session_Limit.html

     

     

     

    Which uses the new table command in LTM 10.1.0 to count the number of actual sessions (Not connections) and redirect to a suitable holding page.

     

     

    The expansion of the iRule to eliminate the obvious 'features' desirable or otherwise is left as an exercise for later.

     

  • Hi Hamish,

     

     

    That looks like a great start. A few minor notes:

     

     

    - RULE_INIT runs once per TMM instance on CMP compatible platforms/rules

     

    - you can use the static name space instead of a global variable to maintain CMP compatibility (set ::max_active_clients 5 would be set static::max_active_clients 5)

     

     

    Aaron