WinCache – Preliminary tests look REALLY good.
Dear Reader,
UPDATE:
My tests were performed on a Release Candidate of the code. The final code has now been released and Ibuildings has published a benchmark of WinCache 1.0.
Those of you who follow me on twitter know that recently, I tweeted that I had installed Microsoft’s new PHP Opcode Cache, WinCache on a test machine and didn’t see much difference in performance. I then later tweeted that it was probably due to my inexperience in managing II7 and not necessarily a failing of WinCache. In between those two posts, I received 2 messages from people working with Microsoft, the most helpful being from Ruslan Yakushev. If you recognize that name it’s because he writes a lot of good stuff over at iis.net including the getting started guide for WinCache.
Ruslan picked up on the tweet and wrote me a very nice “How can I help” email. It started a conversation that eventually let me to the problem I was having, but I’ve only just now had a chance to finish my rudimentary testing. I can now say that yes, it was my configuration that I had wrong and once I took Ruslan’s advice, I am seeing a tremendous improvement.
Benchmarks suck
Before I go any further I need to say, yes, benchmarks suck. I would never do a PHP on Linux vs PHP on Windows benchmark because there are just too many variables. There is no way to reliably isolate any tests to only compare the performance of the language. However, in this case, I am using PHP on Windows for both tests with a single variable between the tests, WinCache.
I do not pretend that this benchmark will mirror real-world results. It is simply an indicator that WinCache may improve the performance of your application because it did in the case of this one.
Ok, so now we are clear about what we are seeing here. it’s not a guarantee, it’s just a pointer in the right direction. Let me take you through what I did and how I tested.
My Setup
- MySQL
- Web Platform Installer 2.0RC
- PHP 5.2.10 (Sorry, it was all that WebPI would install)
The steps I took
- I installed Window 7 (Build 7600) fresh on the machine, wiping all other partitions.
- I installed all the updates suggested by the Windows Updater
- I installed WebPI
- I installed MySQL
- Using WebPI, I installed Url Re-Writer, WebCache and WordPress
- I configured WordPress
Once I could pull WordPress up in a browser on another machine, I used
This is where Ruslan joined the picture. He emailed me and through our discussion he let me know that the only way to disable WinCache is to actually comment out the dll in the PHP.ini and bounce IIS. I had mistaken wincache.fcenabled for a flag to actually enable or disable all of WinCache.
So, armed with this new knowledge, I disabled WinCache by commenting out the DLL in the PHP.ini and bounced IIS. Here are ab’s results without WinCache.
WITHOUT: Requests per second: 2.90 [#/sec] (mean) Time per request: 344.851 [ms] (mean)
Now, the same test run with WinCache enabled.
WITH: Requests per second: 9.32 [#/sec] (mean) Time per request: 107.276 [ms] (mean)
So, as you can see, in this non-real-world example setup, the improvement is significant. I need to add this caveat here.
ab was running single concurrency on purpose. I did not specify a -c x because once I do that where do I stop? there was no good concurrency number I could specify?
Conclusion
WinCache does seem to provide a significant improvement in PHP’s performance on Windows/IIS7/FastCGI over running that combination without it. If your application current runs on that stack, I would strongly suggest that you load WinCache on your staging server and run your standard benchmarks to see how your application performs with and without it. DO NOT TAKE MY SIMPLE TEST AS PROOF THAT YOUR APPLICATION WILL BENEFIT FROM WINCACHE! (If you don’t currently have a standard set of benchmarks that you run against your application between releases, you’ve got bigger problems than WinCache will solve…but that’s for another day)
Thanks all around
I want to say thanks to Ruslan because even though it was obviously my fault that the tests weren’t coming out right but he was nice enough to walk me through it and help me find where I was going wrong.
Also, once again, I find myself saying thanks to Microsoft in general for helping advance PHP. I find that as I meet more and more people inside of Microsoft and get to know them, that I am less anxious about their interest in PHP and more encouraged by their presence.
As always, thanks to Ibuildings because they provided the hardware. (believe it or not, I don’t just have machines laying around to play with.) :)
Until Next Time,
I <3 |<
=C=
Tags: microsoft, opcode cache, PHP, Ruslan Yakushev, webpi, wincache, window 7, windows



September 6th, 2009 at 10:16 am
Interesting – would be even more interesting to test it vs. APC or $insert_other_PHP_opcode_cache
But I hate benchmarks too much to do it – someone always has a fit ;)
September 6th, 2009 at 12:48 pm
Hi Liz!
I think I’ll leave the actual comparisons to those better suited to the task than myself. I am planning techPortal article on “caching roundup” While it won’t compare performance against the various options, it will give a list of the options for caching and their strnegths and weaknesses.
Thanks for the comment!
=C=
September 7th, 2009 at 10:00 am
[...] Evans has run some initial benchmarks on the newly released Windows PHP cache accelerator (see here) and the results are promising. I [...]
September 8th, 2009 at 12:55 pm
There are two switches that can be used to control WinCache:
wincache.fcenabled – this switch controls the file cache
wincache.ocenabled – this switch controls the opcode cache
To completely disable the wincache extension you can just comment it out in the php.ini file (as Cal did), or you can set BOTH of these settings to FALSE.
September 13th, 2009 at 7:21 pm
[...] WinCache – Preliminary tests look REALLY good. (4) [...]
September 26th, 2009 at 8:07 pm
Thanks for the awesome post, it helped me out a lot.
September 27th, 2009 at 7:03 am
@Paul,
I’m glad it was useful to you. I’m planning a more complete review of all Opcode caching options for PHP that will be published on http://techportal.ibuildings.com soon.
=C=