Search code examples
restgoogle-chromeadvanced-rest-client

Different response time in Google chrome network tab and Rest client addon


I have Rest server which returns a response. My target is to measure response, for this purpose i use two approaches:

  1. Addon in Google chrome Advanced Rest client
  2. Network tab in google chrome

My problem is that response time is different - Network tab in google chrome shows +3 seconds to time which was measured in Advanced Rest client.


Solution

  • I can't speak for the Chromium team but I can speak for the Advanced REST Client - as an author of the tool.

    ARC is operating directly on the socket. It uses low-level timing API to measure the time between different events (like time to first byte). These timings - for example - doesn't count the time to read the response on the client. Meaning, the library that is responsible for transport passes buffer instead of text to the app so it works faster. XHR has additional methods to check the response type and depending on it transforms the response to string, buffer or XML document. I can only guess that it counts to the overall time of the execution.

    Anyway, ARC went down to the lowest possible APIs to measure the timings very precisely. If you want to dig more about this you can check this line in the transport library: https://github.com/advanced-rest-client/socket-fetch/blob/stage/app.fetch.js#L487 This is an example of how the timings are calculated (here connect time). Overall time is just a sum of all these timings (+ redirections if any).