httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: [users@httpd] Why Would Apache be so slow??
Date Tue, 17 Feb 2009 23:57:58 GMT
In short, what your tests are showing you is that Apache on its own (not 
quite, but close enough) gives you the file in 20 ms. The rest (the 5000 
ms you measured before, minus 20 ms) is the network.
Score : Apache 1, network 249.
That should give you a pretty good indication of what to focus on next.

In many more words :

First about the Apache cache : get rid of it.
The server-side cache will only slow down things for this type of test. 
It only helps if you have many requests /for the same file/ in a given 
period of time. If you have only one, then you are just forcing the 
server not only to send the response to the browser, but also to copy 
this response to the cache.. You are also forcing the server to look in 
the cache each time, to see if the file is there.  And if it is there, 
it anyway has to read it before sending it to the browser.
In addition, if the cache is in memory, then you are also using up 
memory that could be better used somewhere else.

Note that it would be much better to do the tests below with a 
non-graphical barebones test program such as Apache's ab, or wget, or 
curl, or (my preferred one for this) lwp-request (perl).
Then you could write a script which measures the time from the client 
side, and which repeats the above accesses any number of times 
automatically.  But if you like typing..

Clear the browser cache.
Then try with 3 files, one after the other, with the browser on the same 
machine as Apache :
  - one fairly small, like the 20KB file you have been testing with
  - one say 250 KB
  - one say 1MB
To be fair and avoid secondary effects, make (or get) an "index page" 
showing links to your 3 files, and to measure the time right-click on 
each link and do a "save as..".  This way you are really measuring the 
time it takes Apache to serve it, and not for example the time it takes 
your browser to display the page, or image or whatever.
Got to eliminate the secondary effects.

I bet that the difference in time, with the browser on the same machine 
as Apache, will not be very large between the 3 above.
I don't remember what mod_logio exactly measures, but if it is the total 
time between the arrival of the request up to the time the complete 
response has gone out of Apache, then remember that
a) one fixed element is the time to process the request, finding the 
file etc..  That's the same no matter how big the file.
b) the variable element is the time to send the response, which depends 
on the response size and how fast the line is and ..how fast the client 
is to read and save the response.
With the server-local browser, (b) depends essentially on the speed of 
your disks.
You may want to repeat these tests a number of times, to also eliminate 
the fact that your server (apart from Apache) also has a disk cache. So 
the second time you ask for the same file is likely to be faster, 
independently of Apache.
So run the above 3 downloads 5-6 times each at least, discard the first 
one, then discard the longest and the shortest, and average the rest.
You may also want to make sure that there is nothing else significant 
running on your server, to eliminate those effects (email server ? 
automatic disk indexing ? automatic updates ?). Etc.. etc...
Running real benchmarks is not so easy.

Anyway, the above times are your baseline.
Now try again the same 3 files with a browser on another machine of your 
local network.
The difference with the first test will give you the time your local 
network is adding to the baseline.
Then try again, going through your Internet connection.
Then you will see how much that is adding.

When your ISP is renting you a DSL line for 3 Mbit/s, you have to 
realise that he is also renting the same to your 100 neighbours.  But he 
is not expecting you and all your 100 neighbours, at the same time, to 
be using the full 3 Mbit/s each.  So his line has a total capacity of 
say 100 Mbit/s at best (instead of 300 Mbit/s), and he figures that on 
average you and the neighbours will be satisfied.  If you read the fine 
print, you'll probably see that somewhere it says "/up to/ 3 Mbit/s".
So if your neighbours are reading this, and trying the same thing at the 
same time, don't be surprised if several tests show widely different 
answers.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message