<p>Does anybody have experience working with PHP accelerators such as <a href="http://turck-mmcache.sourceforge.net/" rel="noreferrer">MMCache</a> or <a href="http://www.zend.com/en/" rel="noreferrer">Zend Accelerator</a>?  I'd like to know if using either of these makes PHP comparable to <em>faster</em> web-technologies.  Also, are there trade offs for using these?</p>

[{'answer_id': 12947, 'author': 'Andrew Grant', 'author_id': 1043, 'author_profile': 'https://Stackoverflow.com/users/1043', 'pm_score': 2, 'selected': False, 'text': "<p>Depending on how much of your PHP code is actually executed and how long that execution takes they can be a really big win. It certainly isn't going to hurt, but the gain you see will very much depend on where your time is currently spent.</p>\n\n<p>btw mmcache has been rolled into a different project now, I forget the name but Google will tell you.</p>\n"}, {'answer_id': 12967, 'author': 'Vincent', 'author_id': 1508, 'author_profile': 'https://Stackoverflow.com/users/1508', 'pm_score': 2, 'selected': False, 'text': '<p>Both are interesting and will provide speed boost since they compile source code into binary representation which is then executed by the PHP engine.</p>\n\n<p>Any huge web site running with PHP (Facebook for example) is running some sort of opcode cache system like MMCache.</p>\n\n<p>The problem is that they are not very easy to set up depending on your system.</p>\n'}, {'answer_id': 12980, 'author': 'airrob', 'author_id': 1513, 'author_profile': 'https://Stackoverflow.com/users/1513', 'pm_score': 3, 'selected': False, 'text': '<p>MMCache has been deprecated. I recommend either <a href="http://pecl.php.net/package/APC" rel="noreferrer">http://pecl.php.net/package/APC</a> or <a href="http://xcache.lighttpd.net/" rel="noreferrer">http://xcache.lighttpd.net/</a>, both of which also give you variable storage (like Memcache).</p>\n'}, {'answer_id': 13029, 'author': 'Jon Galloway', 'author_id': 5, 'author_profile': 'https://Stackoverflow.com/users/5', 'pm_score': 0, 'selected': False, 'text': '<p>Have you checked out Phalanger? It compiles PHP to .NET code. Here are <a href="http://web.archive.org/web/20101126094453/http://php-compiler.net/doku.php?id=core%3abenchmarks" rel="nofollow noreferrer">some benchmarks</a> which show that it can dramatically improve performance.</p>\n'}, {'answer_id': 13104, 'author': 'Matt Sheppard', 'author_id': 797, 'author_profile': 'https://Stackoverflow.com/users/797', 'pm_score': 0, 'selected': False, 'text': "<p>I used Zend Accelerator a little back in the day (2004-ish). It certainly gave some significant performance wins on code it could work with, but unfortunately the system I was using was designed to quite often dynamically load code and then eval it, which Zend Accelerator couldn't do much with at the time (and I'd guess still can't).</p>\n\n<p>On the down side, we certainly saw some caching issues (where the code would be changes, but the compiled version sync with the change for one reason or another). I imagine those problems have likely been ironed out by now.</p>\n\n<p>Anyway, I don't have any hard comparison numbers, and certainly didn't write the same system in different environments for comparison, but for the vast majority of systems, PHP isn't going to kill you performance wise.</p>\n"}, {'answer_id': 13515, 'author': 'dragonmantank', 'author_id': 204, 'author_profile': 'https://Stackoverflow.com/users/204', 'pm_score': 2, 'selected': False, 'text': "<p>I use APC on my production servers and it works pretty well out of the box. Compile it and add it to PHP and there isn't much tweaking left to do for it. I check it every once in a while just to review stats but since I use MVC a lot all of the main files (routers, controllers, etc) rarely change on a day-to-day basis so that code stays compiled and runs pretty efficiently. </p>\n"}, {'answer_id': 13821, 'author': 'Brendon-Van-Heyzen', 'author_id': 1425, 'author_profile': 'https://Stackoverflow.com/users/1425', 'pm_score': 1, 'selected': False, 'text': "<p>currently we use apc, free and was just a simple plug and play on our live servers. Provided a huge performance increase for our site, especially as the project size increased. I also have the apc.stat disabled so it doesn't check if the code has been updated, so whenever we need to update the code on the live site we restart apache.</p>\n"}, {'answer_id': 16749, 'author': 'BlaM', 'author_id': 999, 'author_profile': 'https://Stackoverflow.com/users/999', 'pm_score': 5, 'selected': True, 'text': '<p>Note that Zend Optimizer and MMCache (or similar applications) are totally different things. While Zend Optimizer tries to optimize the program opcode MMCache will cache the scripts in memory and reuse the precompiled code.</p>\n\n<p>I did some benchmarks some time ago and you can find the <a href="http://blogs.interdose.com/dominik/2008/04/11/benchmarking-php-eaccelerator-und-andere-opcode-caches/" rel="nofollow noreferrer">results</a> in my blog (in German though). The basic results:</p>\n\n<p>Zend Optimizer alone didn\'t help at all. Actually my scripts were slower than without optimizer.</p>\n\n<p>When it comes to caches:\n* fastest: <a href="http://eaccelerator.net/" rel="nofollow noreferrer">eAccelerator</a>\n* <a href="http://xcache.lighttpd.net/" rel="nofollow noreferrer">XCache</a>\n* <a href="http://www.php.net/manual/en/book.apc.php" rel="nofollow noreferrer">APC</a></p>\n\n<p>And: You DO want to install a opcode cache!</p>\n\n<p>For example:\n<a href="http://blogs.interdose.com/dominik/wp-content/uploads/2008/04/opcode_wordpress.png" rel="nofollow noreferrer">alt text http://blogs.interdose.com/dominik/wp-content/uploads/2008/04/opcode_wordpress.png</a></p>\n\n<p>This is the duration it took to call the wordpress homepage 10.000 times.</p>\n\n<p><em>Edit:</em> BTW, eAccelerator contains an optimizer itself.</p>\n'}, {'answer_id': 31990, 'author': 'John Douthat', 'author_id': 2774, 'author_profile': 'https://Stackoverflow.com/users/2774', 'pm_score': 1, 'selected': False, 'text': '<p>I use APC, and can attest that it can dramatically reduce the CPU and I/O load on an app server if you maintain a high cache-hit rate. It not only saves you from having to compile, it can save you from having to read the php files from disk at all. (i.e. the bytecodes are served directly from main memory, so it\'s super fast) It lowers the speed to render a single page, and increases the requests per second your server can handle.</p>\n\n<p>If you use RedHat or CentOS, installing APC is super simple:</p>\n\n<pre><code>yum install php-devel httpd-devel php-pear\npecl install apc \necho "extension=apc.so" &gt; /etc/php.d/apc.ini\n# if you\'re using SELinux:\nchcon "system_u:object_r:textrel_shlib_t" /usr/lib/php/modules/apc.so\n/etc/init.d/httpd restart\n</code></pre>\n\n<p>You asked about downsides. The only downside is that it requires some memory. The default on APC is 30MB, but it can be adjusted, and the cost of a little bit of memory more than pays for itself with the increased speed and response rate.</p>\n'}, {'answer_id': 36240, 'author': 'Steve Clay', 'author_id': 3779, 'author_profile': 'https://Stackoverflow.com/users/3779', 'pm_score': 1, 'selected': False, 'text': "<p>BlaM's testing included all the DB calls made by WordPress. When you're making fewer DB calls, you'll see the performance gain of opcode caches be even more dramatic.</p>\n"}]
['https://Stackoverflow.com/questions/12936', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/40/']