Forum Discussion

Joe_D_Rozario_4's avatar
Joe_D_Rozario_4
Icon for Nimbostratus rankNimbostratus
Jan 12, 2007

Preferential sorry page

I am VERY new at BigIp and iRules. I need some validations and suggestions in writing the iRules to manage high traffic situations on our site.

 

 

We want to show "sorry page" when the traffic is high but not at the breaking point yet. But we want to let the customers in who are in process

 

of buying (checking out or something in the shopping cart) or in secured sessions (logged on and checkout).

 

 

Couple of questions:

 

1. Which count serves the purpose better CLIENT_ACCEPTED or SERVER_CONNECTED ?

 

2. Is serving the "sorry page" from iRule using HTTP_RESPOND a better approach ?

 

 

Thanks

 

 

--------------------------------------------------

 

 

1 iRule reset_conn_counts_01

 

 

when RULE_INIT {

 

set ::tcc 0

 

set ::tcs 0

 

log local0. "Reseting: tac =$::tcs tcc=$::tcc"

 

}

 

 

--------------------------------------------------

 

 

2 iRule show_site_busy_01

 

 

when HTTP_REQUEST {

 

set ::shop_cart_value 0

 

 

if { ($::tcc > 50)} {

 

set ::shop_cart_value [HTTP::cookie "shop_cart"]

 

if { ($::shop_cart_value < 1 ) } {

 

 

HTTP::redirect "http://some.site.com/site_busy"

 

}

 

}

 

}

 

 

--------------------------------------------------

 

 

3 iRule count_conn _01

 

 

when CLIENT_ACCEPTED {

 

incr ::tcc 1

 

}

 

 

when CLIENT_CLOSED {

 

incr ::tcc -1

 

}

 

 

when SERVER_CONNECTED {

 

incr ::tcs 1

 

}

 

 

when SERVER_CLOSED {

 

incr ::tcs -1

 

}

 

 

--------------------------------------------------
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Check this iRule I just now added to the codeshare -- seems to have worked for a number of customers, and may work for your application, assuming the clients support cookies:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/HTTPSessionLimit.html (Click here)

     

     

    HTH

     

    /deb
  • Deb,

     

    I'm having a bit of trouble with your codeshare; is there some additional logging I can use to verify the steps that it goes through, like the cookie check, showing the total active count, etc...I have my max set to 3 for testing and I am hitting more than 3 current connections, and I do not seem to be redirecting based on my HTTP::redirect path.

     

    Thanks

     

    -L