Which PHP opcode cacher should I use to improve pe

2019-01-20 23:40发布

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

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

Currently running on a stock Debian Etch with Apache 2 and PHP 5.2

[Update 1]

HowtoForge installation links added

[Update 2]

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

  • Login
  • Access Home Page

With 50 concurrent connections, the results are as follows:

No Opcode Caching
No Opcode Caching

APC
APC

eAccelerator
eAccelerator

XCache
XCache

Performance Graph (smaller is better)
Performance Graph

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.

I have decided to use APC due to the following 2 reasons:

  • Package is available in official Debian repository
  • More functional control panel

To summarize my experience:

Ease of Installation: APC > eAccelerator > XCache
Performance: eAccelerator > APC, XCache
Control Panel: APC > XCache > eAccelerator

7条回答
走好不送
2楼-- · 2019-01-21 00:42

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.

So I'd say:

  1. Don't use any of the above. Buy more tin instead, it's a more reliable (i.e. error-free) way of increasing performance. OR
  2. Go with whichever of the above is the most robust, having tested the pants off your application.

But I'd say:

  1. 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.
查看更多
登录 后发表回答