Forum Discussion

oscarnet_69487's avatar
oscarnet_69487
Icon for Nimbostratus rankNimbostratus
Mar 27, 2017

how can i use http requests clock to select pool

hi

 

i have 3 file are "image1.jpg , image2.jpg , image3.jpg",

 

i have client_start_time and 3 file time clock.

 

when http request i can get http request time.

 

so i want use http request time latency to select pool.

 

i try the irule but it not work.

 

code

when CLIENT_ACCEPTED {
    set IP_req_start_time [clock clicks -milliseconds] 
}
when HTTP_REQUEST {
    if {[HTTP::uri] ends_with "image1.jpg"} {
    set image1_request_time [expr [clock clicks -milliseconds] - $IP_req_start_time] 
    }
    if {[HTTP::uri] ends_with "image2.jpg"} {
    set image2_request_time [expr [clock clicks -milliseconds] - $IP_req_start_time] 
    }
    if {[HTTP::uri] ends_with "image3.jpg"} {
    set image3_request_time [expr [clock clicks -milliseconds] - $IP_req_start_time] 
    } 
    if { image1_request_time > image2_request_time > image1_request_time} { pool pool_Server_A }
    if { image1_request_time > image2_request_time < image1_request_time} { pool pool_Server_B }
    if { image1_request_time < image2_request_time < image1_request_time} { pool pool_Server_C }
}

anyone can help me to do it. thank's

 

1 Reply

  • You seem to be sending everything to a single pool - pool_ServerA. What is the purpose of identifying the time if you are using the same pool ? Also, have you checked out "Fastest (application)" load balancing method ?