Forum Discussion

DB's avatar
DB
Icon for Nimbostratus rankNimbostratus
Aug 10, 2020

Add Network Latency measurement to output of iRule Apology page?

I have a simple Apology page being presented by an iRule using "content" such as:

HTTP::respond 200 content {

    <html>

....

 </html> 

}

Is there any mechanism I can use to include as output on that page any indication of latency from the client to this page? Realize it's an external client and the LTM doesn't have visibility back to the client, but is there any magic that could be done to measure round trip time from the client?

1 Reply

  • You could capture a timestamp from CLIENT_ACCEPTED, and then record the time for HTTP_REQUEST, and present that.

    You would effectively be measuring the RTT of an ACK back to the client, and then the Browser sending the first request.

    Something like:

    when CLIENT_ACCEPTED {
      set conntime [clock milliseconds]
    }
     
    when HTTP_REQUEST {
      set reqtime [clock milliseconds]
      set client_latency (reqtime - conntime)
      HTTP::respond 200 content { \
        <html> \
       ... \
       time to respond is $client_latency \
       .... \
       </html> }
    }
     
    when HTTP_RESPONSE {
      set resptime [clock milliseconds]
      set server_latency (resptime - reqtime)
    }
     
    when HTTP_RESPONSE_RELEASE {
      # reset conntime to track client latency
      set conntime [clock milliseconds]
    }