Today I had a really interesting and strange problem with the Apache WWW server. It served images very slowly under even light loads and there was really no explanation for this. The CPU on the host machine almost idle and network throughput was nominal too.
After some digging on the internet I found other people also had had this problem, and had suggested various methods to remedy this, like enabling caching and putting images on a separate machine and disabling the KeepAlive feature.
After reading about the KeepAlive, I tried disabling it and suddenly got 10x more load through! Apache’s HTTP KEEPALIVE had been active (“On” by default). Turning this off with “KEEPLIVE OFF” in httpd.conf solved the problem.
Previously I had around 4 pages/sec (10 hits/sec) as the maximum speed, but after the change I’m seeing more than 40 pages/sec and the host machine CPU is around 35%. This leads me to beliwve that I can get as much as 100 pages/sec from the current hardware configuration without problems.
The application was a test-bed app that uses the FireBird SQL database to handle sessions and dynamic data, all on the same machine.
Machine specifications are:
- ThinkPad T61p (Laptop)
- Intel 2.2 GHz DualCore (T7500)
- Windows XP SP2, 4 Gig’s RAM
- Apache v2.2.9 (Win32) / PHP v5.2.6
The configurations are “out of the box” and the only changes made to the configurations are enabling PHP support in Apache.
This leads me to conclude that there is something wrong with the “KeepAlive” in Apache, but I do not have time to look into this any further now, maybe later..
EDIT: I was in error to assume there was somehting amiss with the KeepAlive feature, there is nothing wrong with it. The test-bed app only has a one or two images/page but thousands of users accessing it so the KeepAlive feature slows down more than it helps. It’s just the nature of the Keepalive feature to do what it did!