I was interested in the performance of PHP’s APC cache vs the new Wincache touted by Microsoft. Essentially Wincache is APC for Windows (no duh!). I am only interested in their performance at storing variables and arrays in memory, and not any of the OPCODE stuff. Part of the reason is because I think they would be equally performant, and another part is that I have no f’ing idea about OPCODEs. Another thing is that I am not testing on server farms, so I was only evaluating single-server solutions (i.e. ignoring memcache) Enough with the hors d’oeuvres, let’s get to the meat of it.
My setup:
- Windows 7 SP1 running IIS 7.5
- Intel Macbook Pro Core 2 Duo 2.6 Ghz
- 4GB RAM
- PHP 5.3 with php_apc installed (VC6 I think, non threadsafe) and Wincache from [here](http://www.iis.net/download/wincacheforphp).
I wrote a result script that created 20,000 variables with random strings inside each cache. Then read those items out into a variable. Pretty simple, not much to it. The results:
APC: 0.61s
WinCache: **0.59s**
They are basically identical. Not much more to say here. Wincache beats it by a slight amount, but not much that you’d notice. For me, I think going with APC gives you the benefit of being platform independent. On the other side Wincache seems to be better built for a Windows environment and has an automatic way to handle sessions in memory (rather than cumbersome filesystem).
They are both really easy to install as well, so it’s a tossup there. Personally I am sticking with APC due to platform independence, and the fact that CodeIgniter has a **very** nice caching library that already has APC code written. Maybe I’ll stop being lazy and write a Wincache library for CI’s cache class.
Edit: I have actually created a Wincache library for CodeIgniter because it actually works much better in a production Windows environment. APC throws random errors, and there isn’t much support running it on Windows. Wincache just works (TM). Here is a link to my first contribution to the CodeIgniter project.
I am a PHP-Windows geek, and I approve this message.
-Mike

