Well, let me start off by saying this. Query cache will most likely NOT reduce the time it takes for your page to load. With that said, what it does do, is reduce the load put on your server. Benchmarks can show a lot of things, but what I wanted was real world data. One of the sites I run (BagsOfCrap - For All Things Woot) gets EXTREEME amounts of traffic, but only about one to three days per month. What a perfect real world benchmark to see how good QueryCache is...
The Back Story
I started BagsOfCrap almost a year ago (a year tomorrow actually) for fun. What I didn't realize, is that other users liked what I did, and used my site. A lot of other users. Basically, in those days, I was on a little VPS with 512 Megs of Ram, and 1/16 of a Opteron. Not much (but it didn't cost much either)... After about 25 users online at once, the site started to crawl. So I picked up Lighttpd. Now, I could support about 150 users online at once. Then I wrote PageCache (because of this problem), and the number of users spiked past 500. I eventually moved to a dedicated server, and I was able to support over 3,000 users online with PageCache. CPU load sat around 30% (with MySQL using 25% of that). So that brings us to 2 weeks ago.
The Test
Durring one of these "high load" events, I installed QueryCache for J1.0. The server was sitting at about 400 requests per second, and 500 users on Joomla itself (there's more to the site outside of Joomla where 90% of users stay most of the time). I decided to enable QueryCache. Beforehand, I was using 30% CPU (25% MySQL), and 25mbit bandwidth out of MySQL (into php). Using the Xcache backend, I enabled the mysqli driver.
WOW!
That's all I can say. My server load instantly dropped to 5% (MySQL dropped off the list below everything else). I thought "Oh no, I screwed the front end". But when I opened the front end, it worked fine. I looked at the numbers again. Still 5%. So I disabled caching. Shot up to 30% again. I enabled it, and it dropped to 5%. Then I looked at MySQL's bandwidth... 128 kbps... (Down from 25mbps). So, I decided, I will let it run, and see what happens. Memory usage climbed (and held firm) at about 5 megs)... So I thought, I wonder what'll happen if I disable PageCache. Server load bumped to about 50%, but all in php. So then, I got dumb... I disabled QueryCache. Cpu load hit 95% before I could re-enable both. I had users complaining that the site got slow when I did this.
Conclusions
While QueryCache does not usually speed up your site, it does increase the capacity tremendously. It compliments PageCache well, and as such, they should both be used together... Give it a try, unless you like buying expensive hardware when you don't need to...
Discuss this article on the forums. (8 posts) |