<p>I'm trying to improve performance under high load and would like to implement opcode caching. Which of the following should I use?</p>

<ul>
<li>APC - <a href="http://www.howtoforge.com/apc-php5-apache2-debian-etch" rel="noreferrer">Installation Guide</a></li>
<li>eAccelerator - <a href="http://www.howtoforge.com/eaccelerator_php5_debian_etch" rel="noreferrer">Installation Guide</a></li>
<li>XCache - <a href="http://www.howtoforge.com/xcache-php5-apache2-debian-etch" rel="noreferrer">Installation Guide</a></li>
</ul>

<p>I'm also open to any other alternatives that have slipped under my radar.</p>

<p>Currently running on a stock Debian Etch with Apache 2 and PHP 5.2</p>

<p><strong>[Update 1]</strong></p>

<p>HowtoForge installation links added</p>

<p><strong>[Update 2]</strong></p>

<p>Based on the answers and feedback given, I have tested all 3 implementations using the following Apache JMeter test plan on my application:</p>

<ul>
<li>Login</li>
<li>Access Home Page</li>
</ul>

<p>With 50 concurrent connections, the results are as follows:</p>

<p>No Opcode Caching<br>
<img src="https://i.stack.imgur.com/ueCBW.jpg" alt="No Opcode Caching"></p>

<p>APC<br>
<img src="https://i.stack.imgur.com/ggqC8.jpg" alt="APC"></p>

<p>eAccelerator<br>
<img src="https://i.stack.imgur.com/puxe5.jpg" alt="eAccelerator"></p>

<p>XCache<br>
<img src="https://i.stack.imgur.com/GybYH.jpg" alt="XCache"></p>

<p>Performance Graph (smaller is better)<br>
<img src="https://i.stack.imgur.com/oXTe9.png" alt="Performance Graph"></p>

<p>From the above results, eAccelerator has a slight edge in performance compared to APC and XCache. However, what matters most from the above data is that any sort of opcode caching gives a tremendous boost in performance.</p>

<p>I have decided to use APC due to the following 2 reasons:</p>

<ul>
<li>Package is available in official Debian repository</li>
<li>More functional control panel</li>
</ul>

<p>To summarize my experience:</p>

<p>Ease of Installation: APC > eAccelerator > XCache<br>
Performance: eAccelerator > APC, XCache<br>
Control Panel: APC > XCache > eAccelerator</p>

[{'answer_id': 28719, 'author': 'Thomas Owens', 'author_id': 572, 'author_profile': 'https://Stackoverflow.com/users/572', 'pm_score': 2, 'selected': False, 'text': '<p>I can\'t tell you for sure, but the place where I am working now is looking at APC and eAccelerator. However, this might influence you - <a href="http://www.php.net/~derick/meeting-notes.html#add-an-opcode-cache-to-the-distribution-apc" rel="nofollow noreferrer">APC will be integrated into a future release of PHP</a> (thanks to Ed Haber for the link).</p>\n'}, {'answer_id': 28732, 'author': 'Dana the Sane', 'author_id': 2567, 'author_profile': 'https://Stackoverflow.com/users/2567', 'pm_score': 2, 'selected': False, 'text': "<p>I've had good success with eAccelerator (speed improvement with no load is noticable) but XCache also seems pretty promising. You may want to run some trials with each though, your application might scale differently on each.</p>\n"}, {'answer_id': 28735, 'author': 'mercutio', 'author_id': 1951, 'author_profile': 'https://Stackoverflow.com/users/1951', 'pm_score': 5, 'selected': True, 'text': "<p>I think the answer might depend on the type of web applications you are running. I had to make this decision myself two years ago and couldn't decide between Zend Optimizer and eAccelerator.</p>\n\n<p>In order to make my decision, I used ab (apache bench) to test the server, and tested the three combinations (zend, eaccelerator, both running) and proved that eAccelerator on its own gave the greatest performance.</p>\n\n<p>If you have the luxury of time, I would recommend doing similar tests yourself, and making the decision based on your results.</p>\n"}, {'answer_id': 28744, 'author': 'The How-To Geek', 'author_id': 291, 'author_profile': 'https://Stackoverflow.com/users/291', 'pm_score': 1, 'selected': False, 'text': "<p>I've been using XCache for more than a year now with no problems at all.</p>\n\n<p>I tried to switch to eAccelerator, but ended up with a bunch of segmentation faults (it's less forgiving of errors). The major benefit to eAccelerator is that it's not just an opcode cache, it's also an optimizer.</p>\n\n<p>You should fully test out your application with each one of them to make sure there aren't any problems, and then I'd use apachebench to test it under load.</p>\n"}, {'answer_id': 28859, 'author': 'Ed Haber', 'author_id': 2926, 'author_profile': 'https://Stackoverflow.com/users/2926', 'pm_score': 3, 'selected': False, 'text': '<p>I use APC because it was easy to install in windows and I\'m developing on WAMP.</p>\n\n<p>Integrating APC into PHP6 was discussed here: \n<a href="http://www.php.net/~derick/meeting-notes.html#add-an-opcode-cache-to-the-distribution-apc" rel="noreferrer">http://www.php.net/~derick/meeting-notes.html#add-an-opcode-cache-to-the-distribution-apc</a></p>\n\n<p>And there are directions on installing APC on Debian Etch here:\n<a href="http://www.howtoforge.com/apc-php5-apache2-debian-etch" rel="noreferrer">http://www.howtoforge.com/apc-php5-apache2-debian-etch</a></p>\n'}, {'answer_id': 28937, 'author': 'BlaM', 'author_id': 999, 'author_profile': 'https://Stackoverflow.com/users/999', 'pm_score': 3, 'selected': False, 'text': '<p>I have run several <a href="http://blogs.interdose.com/dominik/2008/04/11/benchmarking-php-eaccelerator-und-andere-opcode-caches/" rel="nofollow noreferrer">benchmarks with eAcclerator, APC, XCache</a>, and Zend Optimizer (even though Zend is an optimizer, not a cache).  </p>\n\n<p><a href="http://blogs.interdose.com/dominik/wp-content/uploads/2008/04/opcode_wordpress.png" rel="nofollow noreferrer">Benchmark Results http://blogs.interdose.com/dominik/wp-content/uploads/2008/04/opcode_wordpress.png</a></p>\n\n<p>Result: eAccelerator is fastest (in all tests), followed by XCache and APC. (The one in the diagram is the number of seconds to call a WordPress home page 10,000 times).</p>\n\n<p>Zend Optimizer made everything slower (!).</p>\n'}, {'answer_id': 77286, 'author': 'MarkR', 'author_id': 13724, 'author_profile': 'https://Stackoverflow.com/users/13724', 'pm_score': 1, 'selected': False, 'text': "<p>These add-ons have historically introduced lots of weird bugs to track down. These bugs can cause inconsistent behaviour which can't be diagnosed easily because it depends on the state of the cache.</p>\n\n<p>So I'd say:</p>\n\n<ol>\n<li>Don't use any of the above. Buy more tin instead, it's a more reliable (i.e. error-free) way of increasing performance.\nOR</li>\n<li>Go with whichever of the above is the most robust, having tested the pants off your application.</li>\n</ol>\n\n<p>But I'd say:</p>\n\n<ol>\n<li>Make sure it's REALLY PHP code parsing that is causing your performance problems by profiling your application. I think it's extremely likely that it isn't - in which case you'd be wasting your time (actually, using your time negatively productively)  by installing any of them.</li>\n</ol>\n"}]
['https://Stackoverflow.com/questions/28716', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2633/']