Skip to content

WinCache – Preliminary tests look REALLY good.

Dear Reader,

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 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

3GHX Dell with 2GB of RAM.
Fresh install of Windows 7, fully patched
Other software

The steps I took

  1. I installed Window 7 (Build 7600) fresh on the machine, wiping all other partitions.
  2. I installed all the updates suggested by the Windows Updater
  3. I installed WebPI
  4. I installed MySQL
  5. Using WebPI, I installed Url Re-Writer, WebCache and WordPress
  6. I configured WordPress

Once I could pull WordPress up in a browser on another machine, I used ab on a separate machine, to run a rudimentary test of 1,000 hits against the web site. Then, going by the WinCache guide, I did what I thought would disable WinCache and re-ran the same test. The difference between the initial results were disappointing and not worth mentioning here. Since I had a webcast to prep for, I fired off a quick tweet (mistake) and moved on to my next project. In the back of my mind I knew that even given their past record, Microsoft wouldn’t have released WinCache without it actually working.

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.

Requests per second:    2.90 [#/sec] (mean)
Time per request:       344.851 [ms] (mean)

Now, the same test run with WinCache enabled.

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?


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 |<

7 thoughts on “WinCache – Preliminary tests look REALLY good.

  1. 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 ;)

  2. 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!


  3. 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.

  4. Pingback: [Cal Evans] CodeWorks 09 Journal – techPortal

Comments are closed.