Forum Discussion
Andy_park_66466
Nimbostratus
Mar 21, 2006Want http request limit !!
I had seen this subject → http://devcentral.f5.com/Default.aspx?tabid=28&view=topic&forumid=5&postid=2169
Where is " variable 'reqs_sec " ?
I think 'variable 'reqs_sec' is missing.
How can I get " request per sec " ?
8 Replies
- Andy_park_66466
Nimbostratus
when HTTP_REQUEST {
set cur_time [clock seconds]
if { [HTTP::request_num] > 1 } {
if { $cur_time == $start_time } {
if { $reqs_sec > 3 } {
HTTP::respond 503 Retry-After 2
}
incr reqs_sec
return
}
}
set start_time $cur_time
set reqs_sec 0
} - Colin_Walker_12Historic F5 AccountIn the example you've posted, taken from Unruley's posting in the thread mentioned, the reqs_sec variable is a variable that he's setting with the incr command. That command will increase the value of recs_sec by 1, and if the varible doesn't exist, it will initialize it and set it equal to 1.
You can read more about the incr command in the TCL docs, here: Click here
-Colin - Hyun-Sub_Kim_37
Nimbostratus
When I use this iRule, I can see error message.
when HTTP_REQUEST {
set cur_time [clock seconds]
if { [HTTP::request_num] > 1 } {
if { $cur_time == $start_time } {
if { $reqs_sec > 3 } {
HTTP::respond 503
Retry-After 120
}
incr reqs_sec
return
}
}
set start_time $cur_time
set reqs_sec 0
}
======================================
I don`t know what the error message is.
Apr 24 21:22:07 tmm tmm[726]: 01220001:3: TCL error: Rule test - while executing "HTTP::respond 503 "
Apr 24 21:22:08 tmm tmm[726]: 01220001:3: TCL error: Rule test - while executing "HTTP::respond 503 "
Apr 24 21:22:09 tmm tmm[726]: 01220001:3: TCL error: Rule test - while executing "HTTP::respond 503 - Colin_Walker_12Historic F5 AccountThe error is stating that the HTTP::respond 503 command is not executing properly. Have you tried the HTTP::respond syntax from the above rule, or perhaps responding with different HTTP codes to see if that may solve the problem?
Colin - Hyun-Sub_Kim_37
Nimbostratus
I already tried the HTTP::respond syntax from the above rule.
But it is same problems.
Apr 24 21:22:09 tmm tmm[726]: 01220001:3: TCL error: Rule test - while executing "HTTP::respond 503 Retry-After 2
I need HTTP::respond 503 error message.
Please help us. - Deb_Allen_18Historic F5 AccountI've also run into an issue with 503 - seems it's not supported, or perhaps it needs a RetryAfter param. Didn't get a chance to check it out further, as 501 works just as well for our application and doesn't generate an error.
I'll also be posting a nice request rate limiting iRule to the codeshare later today or tomorrow... stay tuned.
/deb - Hyun-Sub_Kim_37
Nimbostratus
Thank you deb!
Please, can I see your posting ? - Colin_Walker_12Historic F5 Account
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
