Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is causing over 200ms wait for an http response?

Tags:

http

Firebug shows not only the time it takes for individual requests, but splits them into phases. Most of the time spent on getting small files (~20KB) is spent waiting for the response (at least according to Firebug).

On stackoverflow, for instance, the wait for response on / takes 255 ms, transfer 42ms. On other sites I have seen figures like: 200ms response wait and 1 ms transfer. What is causing the wait?

Web sites are usually comprised from many files: the html document, css, js, some images. Take any of the demos here, dojox gfx demos, most of the time is spent in between transfering the tiny js files. This whole model strikes me as very inefficient.

like image 843
luntain Avatar asked Oct 25 '25 06:10

luntain


1 Answers

Before you receive the response, the following things have to happen:

  1. Your packet traverses the wild internets to the server.
  2. The server has to process the request and figure out what web site, virtual directory, whatever it belongs to.
  3. The web server has to pull the file off the disk. If it's a dynamic file it has to run it through the interpreter/execution engine/whatever (often the file must be completely processed before the server even begins to respond).
  4. The server has to begin the response and that packet has to traverse the intertrons back to the client.

If you figure 50ms as a ping time, a 200ms response time leaves 150ms for the server to do all its stuff...not blindingly fast, but respectable.

like image 92
David Avatar answered Oct 28 '25 04:10

David