Forum Discussion
hoolio
Cirrostratus
Feb 16, 2007HTTP_RESPONSE_SEND event? Measuring request/response deltas
Hi,
I'm trying to extend the examples in this post (Click here)
The goal is to log different deltas for request and response times. Ideally, I'd like to be able to measure four data points and compare the deltas:
1) HTTP request initiated by client to TMM (HTTP_REQUEST)
2) HTTP request sent from TMM to node (HTTP_REQUEST_SEND)
3) HTTP response received by TMM from node (HTTP_RESPONSE_DATA)
4) HTTP response sent from TMM to client (event doesn't exist?)
Using the below rule, I've been able to get a delta from 1) to 3). I could also use the HTTP_REQUEST_DATA event to find out how long it takes for TMM to receive the full request data.However, I'd like to know if there is a method for getting the current time when TMM sends the HTTP response back to the client. If there isn't a current method, could you consider adding a new event for HTTP_RESPONSE_SEND?
If the client uses a single TCP connection for a single HTTP request, I could look at the CLIENT_CLOSED event. However most clients re-use TCP connections for multiple HTTP requests, so this doesn't suffice.
Here's the current version of the rule I'm using to log the delta between the request being received (1) and the response data being received:
when RULE_INIT {
set tcp counter
set tcp_count 0
}
when CLIENT_ACCEPTED {
incr ::tcp_count
set http_count 0
}
when HTTP_REQUEST {
incr http_count
set http_request_start_time [clock clicks -milliseconds]
set uri [HTTP::uri]
start collecting HTTP request data
HTTP::collect 15
}
when HTTP_RESPONSE {
get response content length
if { [HTTP::header exists "Content-Length"] }{
set content_length [HTTP::header value "Content-Length"]
}
else {
set content_length 0
}
start collecting HTTP response data
HTTP::collect 15
}
when HTTP_RESPONSE_DATA {
set http_response_data_start_time [clock clicks -milliseconds]
set delta_bigip [expr ( [expr abs ($http_request_start_time)] - [expr abs ($http_response_data_start_time)] )]
log local0. ",$delta_bigip,$uri,$content_length, - fields ,delta,uri,content length,"
}
Thanks,
Aaron
- JRahm
Admin
Can the time be logged in a clientside context of the HTTP_RESPONSE event? - Joe_D_Rozario_4
Nimbostratus
May be I am missing something but code does not verify the HTTP_RESPONSE actually corresponds to HTTP_REQUEST. Although it seems like the shortest response will always be correct. - hoolio
Cirrostratus
citizen_elah, you can get the time the response headers are received from the node in HTTP_RESPONSE. And if you're collecting the data, you can get the time that the response content is received in HTTP_RESPONSE_DATA. But to get a complete snapshot of the times, I'd like to get the time when the HTTP response is sent to the client. - hoolio
Cirrostratus
Actually, citizen_elah, after re-reading your post, I think I missed what you were saying. Are you suggesting there might be a way to force the evaluation of the HTTP_RESPONSE event in the clientside context? I don't know of any method for doing this. Do you have more info on this? - JRahm
Admin
Nope, I was posing the question... - JRahm
Admin
Let me try that again... Yes, I was suggesting this might be possible, but no, I don't have any information. I was just posing the question in hopes that the developers would jump in.
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