Forum Discussion
oscarnet_69487
Nimbostratus
Mar 21, 2017how to check uri clock time select pool
Hi how can i use uri clock to select pool ? my irule
Code
when RULE_INIT {
set client_req_start_time [clock clicks -milliseconds]
}
when HTTP_REQUEST {
set http_request_time1 {[HTTP::uri] ends_with ".jpg" [clock clicks -milliseconds]}
set http_request_time2 {[HTTP::uri] ends_with ".png" [clock clicks -milliseconds]}
set http_request_time3 {[HTTP::uri] ends_with ".gif" [clock clicks -milliseconds]}
if { [expr $http_request_time1 - $client_req_start_time ] > 10 } {
pool pool_jpgA }
if { [expr $http_request_time2 - $client_req_start_time ] > 10 } {
pool pool_pngA }
if { [expr $http_request_time3 - $client_req_start_time ] > 10 } {
pool pool_gifA }
pool default_pool
}think's
1 Reply
- Stanislas_Piro2
Cumulonimbus
Hi,
I think you want to know the time between request and response:
when CLIENT_ACCEPTED { set default_pool [LB::server pool] } when HTTP_REQUEST { set client_req_start_time [clock clicks -milliseconds] switch -glob -- [HTTP::path] { "*.jpg" { set filetype "jpg" pool pool_jpgA } "*.png" { set filetype "png" pool pool_jpgA } "default" { set filetype "default" pool $default_pool } } } when HTTP_RESPONSE { switch -- $filetype { "jpg" { log local0. "jpg file - clock time : [expr {[clock clicks -milliseconds] - $client_req_start_time}]" } "png" { log local0. "png file - clock time : [expr {[clock clicks -milliseconds] - $client_req_start_time}]" } default { log local0. "gif file - clock time : [expr {[clock clicks -milliseconds] - $client_req_start_time}]" } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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