Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is purely out of curiosity, but with every local server I've ever setup, there has always been a 0.5-2 second delay until pages are displayed.

Just as an example, I've setup a completely blank ubuntu server running apache, mysql and php. If I have a file with phpinfo(); in and request that from a machine sitting literally next to the server, the page will still take a second or two to load. Why isn't it [almost] instant?

Both machines are running quad core processors, 8gb ram etc using a gigabit switch. Why would a simple request like phpinfo take so long to 'happen'?

share|improve this question
up vote 3 down vote accepted

There could be a number of things influencing the time it takes to display it. If there's any code at all, it still has to be interpreted and run. DNS lookups still occur, so there's a delay in that (unless you have them all localhost lookups.) Rendering by the browser. The overhead of the protocol.

If you're interested you can run wireshark and see the network side of the overhead of lookups and protocol.

Everything else would come from the time it takes the server to process the request and your client to render the response.

share|improve this answer

Try benchmarking with ab:

ab -c 1 -n 1 http://your.server/page/

phpinfo() uses some resources and takes some time, and browser rendering takes some time too. Serving a static (short) html page took me 5ms on a gigabit LAN.

PS: modern browsers are really slow :/

share|improve this answer
Is there a windows equivalent to the ab command? All of my client machines are running windows at the moment. Judging by the answers here it looks like I've been incredibly ignorant in assuming the connection is the slowest part of the process. Ah well, you don't ask, you don't learn! – Anonymous May 29 '12 at 13:10
afaik it's bundle with apache (windows version too)... maybe you can somehow unpack the apache .msi and extract just the ab.exe binary, so you wouldn't have to install the whole apache just for the benchmark. – mulaz May 29 '12 at 13:14
7-Zip should do the trick for extracting. – JamesCW May 29 '12 at 13:24
Never ocurred to me that I would already have it since I run xampp on my windows machines. /xampp/apache/bin/ab.exe – Anonymous May 29 '12 at 13:31
@mulaz - I'm getting very fast response times for plain html, so you're right! – Anonymous May 30 '12 at 8:13

1.) The first hit on the server and the first invocation of the PHP script in question is actually causing a number of configurations to be parsed, interpreters (possibly) loaded, scripts loaded, modules in the web server coming online, etc. In subsequent queries it's almost invariably faster.

2.) Even under ideal conditions there are a number of moving parts in play during your 0.5 - 2 sec - between your machine going through the setup of several TCP sessions (each requiring a few msec of handshaking), your browser identifying itself and working out capabilities with the server, your browser finally submitting its request and then the server having to parse that information and pass it up and down the stack to then finally format it into HTML to send back to you.

There's quite a bit of sophistication in the implementation of modern scripting / web platforms. It may seem a bit heavy when compared to pinging a server or putting up a static "Hello world!" html page, but the generalized capabilities are pretty impressive.

The other point, of course, is that you're describing a completely stock system. There are almost always things that can be done to tune it to better respond to your particular workload.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.