Reputation: 4680
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.
Upvotes: 4
Views: 3706
Reputation: 29706
200ms reminds me of Nagle's algorithm. Briefly stated, many operating systems will delay sending the first TCP packet for 200ms to see if any more data needs to be sent. I don't know for certain that it applies in the modern web context. An HTTP request is small enough that it might be delayed by nagling, but you'd hope the OS would be smart enough or at least the browser would disable naglging on requests.
If you run a packet sniffer and examine the trace's timestamps you can work out exactly where the 200ms is going.
Upvotes: 1
Reputation: 586
Waiting time is caused by processing your request on server-side (browsing through the questions database, creating of result page etc.) plus network delay (ping time)
Upvotes: 2
Reputation: 3227
Before you receive the response, the following things have to happen:
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.
Upvotes: 4
Reputation: 37803
Just the network "lag" (to abuse the term) — the time you'd see in a ping
— is probably around 50 - 100 ms, plus it will take the server a certain amount of time to parse the request, retrieve the file from disk, log the request, possibly read from a database, et cetera.
The short answer is: it takes time for servers to do stuff.
Upvotes: 1