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

I have a fairly low-budget VPS (1GB RAM + 2 CPU's) to run a few (5 - 10) different small websites (both static and dynamic). These websites have (very) low traffic (average of 500 unique visits for all websites).

The problem I have is that apache2 is very slow for HTML files (and dynamic pages) but not for other static content: Static html files are handled at only 16 requests / second,dynamic pages (wordpress) about half of that and other static content (like images and .txt) at 400 requests / second.

I'm running apache2 with mod_php and am looking for an explanation why an html file takes 25 times longer to load than a .txt copy of exactly the same file?

Tests with apachebench (run on the same server):

$ ab -n 1000 -c 30 http://mysite/index.html
Concurrency Level:      30
Time taken for tests:   58.987 seconds
Complete requests:      1000
Failed requests:        962
(Connect: 0, Receive: 0, Length: 962, Exceptions: 0)
Write errors:           0
Total transferred:      6619655 bytes
HTML transferred:       6337655 bytes
Requests per second:    16.95 [#/sec] (mean)
Time per request:       1769.599 [ms] (mean)
Time per request:       58.987 [ms] (mean, across all concurrent requests)
Transfer rate:          109.59 [Kbytes/sec] received


$ ab -n 1000 -c 30 http://mysite/index.txt
Concurrency Level:      30
Time taken for tests:   2.314 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      6564000 bytes
HTML transferred:       6284000 bytes
Requests per second:    432.19 [#/sec] (mean)
Time per request:       69.414 [ms] (mean)
Time per request:       2.314 [ms] (mean, across all concurrent requests)
Transfer rate:          2770.40 [Kbytes/sec] received

I noticed that apachebench of the .html file gives me a lot of length fails while the .txt does not. I have no explanation for this however, as the contents of the .html files are purely static (except some javascript wich ab does not parse).

Extra: I have tuned the maxClients so that the server is not swapping:

StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 20
MaxClients 20 
MaxRequestsPerChild 5000
KeepAlive Off
HostnameLookups Off

I have also disabled the apache access log and AllowOverride equals None

During stress-testing of the html files, cpu does not spike above 20%

What could cause this behaviour?

share|improve this question
Maybe your VPS provider is forcing compression on text/html content? And is doing it poorly. Or using some kind of malware protection for hosted HTML. Try the same ab commands using localhost. – Tometzky Apr 11 '14 at 12:55
Your comment got me thinking that I had once enabled mod_pagespeed in my testing environment. Somehow that config must've gotten in production. Anyway: I disabled it and performance improved immediately (over 700 requests per second handled). Thank you for putting me on the right track! – Chris Apr 11 '14 at 13:29

Your Answer


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

Browse other questions tagged or ask your own question.