Forum Discussion
Magnum_IP
Jul 26, 2011Nimbostratus
Trouble calculating web page load time
I have been posed a problem to log the load time for requested web pages.
I am quite far down the line but have hit a problem.
I thought the iRule would be fairly easy to write - a combnation of CLIENT_ACCEPTED, HTTP_REQUEST, HTTP_RESPONSE, CLIENT_CLOSED events and some timers. The thing I have learned through testing my iRule though is that browsers initiate several TCP connections triggering several CLIENT_ACCEPTED events to fulfil a request and I can't think of a way to tie these together to get the complete load time.
I'm sure it can be done I'm all out of ideas.
Looking for inspiration.
fergu5
- HamishCirrocumulusAsk the browser... There's extensions in some browsers (Chrome and Safari IIRC do this) that will allow the detection and (Accurate and consistent) reporting of page load times.
- Michael_YatesNimbostratusI agree with Hamish. I use HTTPWatch all the time, but if you want something to compare it to from the BIG-IP Perspective this iRule will track the TCP Connection (Start / Finish and provide Session Timing), as well as each HTTP Request and Response (with Request Timing).
when CLIENT_ACCEPTED { Get time for start of TCP Connection in milliseconds set tcp_start_time [clock clicks -milliseconds] Log the start of a new HTTP Request set local0. "(TCP Connection - Start) [IP::client_addr]:[TCP::client_port] to [IP::local_addr]:[TCP::local_port]" } when HTTP_REQUEST { Get time for start of HTTP Request in milliseconds set http_request_time [clock clicks -milliseconds] Log the start of new HTTP Request with URI set LogString "Client [IP::client_addr]:[TCP::client_port] -> [HTTP::uri]" Log the start of new HTTP Request without URI set LogString "Client [IP::client_addr]:[TCP::client_port]" log local0. "(HTTP - Request) $LogString" } when HTTP_RESPONSE { Recieved the response headers from the server. Log the pool name, IP and port, status and time delta Detailed Log Output - Client Communication - Pool Information - Status Messages - and Communication Delta log local0. "(Response) $LogString - pool info: [LB::server] - status: [HTTP::status] (Request / Response Delta: [expr {[clock clicks -milliseconds] - $http_request_time}]ms)" Response and Communication Delta log local0. "(HTTP - Response) $LogString - (Request / Response Delta: [expr {[clock clicks -milliseconds] - $http_request_time}]ms)" } when CLIENT_CLOSED { Log the end time of the TCP Connection Detailed Connection Closed - Transaction can be located by using the Client IP Address and Port to Load Balancer IP Address and Port for additional matching parameters. log local0. "(TCP Connection - Close) Client [IP::client_addr]:[TCP::client_port] to [IP::local_addr]:[TCP::local_port] (Connection Open for: [expr {[clock clicks -milliseconds] - $tcp_start_time}]ms)" }
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