Monday
Jul272009
Handle 700 Percent More Requests Using Squid and APC Cache
Monday, July 27, 2009 at 3:25AM
This post on www.ilovebonnie.net documents some impressive system performance improvements by the addition of Squid Cache (a caching proxy) and APC Cache (opcode cache for PHP).
- Apache is able to deliver roughly 700% more requests per second with Squid when serving 1KB and 100KB images.
- Server load is reduced using Squid because the server does not have to create a bunch of Apache processes to handle the requests.
- APC Cache took a system that could barely handle 10-20 requests per second to handling 50-60 requests per second. A 400% increase.
- APC allowed the load times to remain under 5 seconds even with 200 concurrent threads slamming on the server.
- These two caches are easy to setup and install and allow you to get a lot more performance out of them.
Reader Comments (11)
This stuff is basic and well known. I would expect more from this site than level of advice.
Detailed benchmarks are always interesting and useful in my opinion. Thanks for posting.
I notice that squid now supports Windows... Has anyone had any experience in using Squid with Windows? I'd love to see some stats for that!
Stop hating. It may be common knowledge to you, but also remember this site caters for all sorts. Including the uninitiated.
As a newbie I think this is a great post and its for posts like this that I personally come to this site. Not all of us are born experts
The test are not revelant of real-life load. For instance, the PHP Hello World is not dynamic at all : this piece of code always print the same thing. So most of the time is used for compiling Hello World. In real-life PHP Code, you need to open socket and communicate with MySQL/PgSQL/Memcached/... . With real-life workload, most of time is spent executing the code and waiting for data. So the gain is not 700 percent.
Hi,
Thanks for sharing. Already known, but good article. I think squid is a kind of slow. And APC is "cute", but a combination of squid and apc sounds a litle bit strange, but just because of the speed of squid. Good in to an office or if you are serving pretty large files but for highly visited sites, its always was slow for me.
What i would recommend instead is a varnish frontend w/ apache/apc backend.
But the article is good.
Had you of bothered to carefully read the article, you would have seen that the PHP hello world INCLUDES the prepend. The prepend makes connections to PGSQL, Memcache, loads dynamic style/configuration information, etc.
It's a very acceptable real world test.
I agree, a simple: echo $hello world; wouldn't have sufficed.
Hope that helps to clear things up.
-ILoveBonnie.net
What if you just use a faster webserver like lighttpd?
Hell, handaling 50 requests/sec is just sick! That's just 2 things: very poor PHP aplication desing or programmers are really stupid! After I wrote this lines, I gone to the site mentioned and I saw a stand alone blog. Owner of the blog is seriously screwd by the performance that's for sure!
Handling only 10-20 request a sec on a modern server is just not acceptable. 50 request a sec is poor at most. I do not know what exactly you're doing but it just does not look good. Personally I wrote an ad server capable of serving 1200 request a sec, with sustainable loads (can be pushed higher). To me any average website should be able to serve ~300 request per second, no questions asked. Back to the drawing board ! :)
surely the date on this article is wrong. for July 2009 those figures are apalling. for 1990 maybe not so bad.