WinCache – Preliminary tests look REALLY good. - No Fluff Just Stuff

WinCache – Preliminary tests look REALLY good.

Posted by: Cal Evans on September 6, 2009

Dear Reader,

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

Hardware
3GHX Dell with 2GB of RAM.
OS
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.

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

Related posts

Cal Evans

About Cal Evans

Many moons ago, at the tender age of 14, Cal touched his first computer. (We're using the term “computer” loosely here, it was a TRS-80 Model 1) Since then his life has never been the same. He graduated from TRS-80s to Commodores and eventually to IBM PC's.

For the past 8 years Cal has worked with PHP and MySQL on Linux OSX, and when necessary, Windows. He has built on a variety of projects ranging in size from simple web pages to multi-million dollar web applications. When not banging his head on his monitor, attempting a blood sacrifice to get a particular piece of code working, he enjoys building and managing development teams using his widely imitated but never patented management style of “management by wandering around”.

These days, Cal's hobby is photography. As a photographer, Cal is a pretty good programmer. He continually tries, none-the-less, to improve his skills.

Cal is currently based in Nashville, TN where is the full-time father of two and fills the rest of his day as the Editor of DevZone, for Zend Technologies.

Cal is happily married to wife 1.23, the lovely and talented Kathy. Together they have 2 kids who are infinitely more intelligent but not nearly as entertaining as his two dogs, Sparky and Linus.

Cal blogs at http://blog.calevans.com.

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »