本文介绍了我应该使用哪个PHP操作码缓存来提高性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在高负载下提高性能,并希望实现操作码缓存.我应该使用以下哪个?

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

  • APC - Installation Guide
  • eAccelerator - Installation Guide
  • XCache - Installation Guide

我也愿意接受其他任何在我的雷达下溜走的选择.

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

当前在具有Apache 2和PHP 5.2的普通Debian Etch上运行

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

[更新1]

添加了HowtoForge安装链接

HowtoForge installation links added

[更新2]

基于给出的答案和反馈,我已经在我的应用程序上使用以下Apache JMeter测试计划对所有3种实现进行了测试:

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

  • 登录
  • 访问主页

使用50个并发连接,结果如下:

With 50 concurrent connections, the results are as follows:

无操作码缓存

No Opcode Caching

APC

APC

eAccelerator

eAccelerator

XCache

XCache

性能图(越小越好)

Performance Graph (smaller is better)

根据以上结果,与APC和XCache相比,eAccelerator的性能略有下降.但是,从以上数据中最重要的是,任何类型的操作码缓存都可以极大地提高性能.

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.

由于以下两个原因,我决定使用APC:

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

  • 软件包可在Debian官方存储库中获得
  • 更多功能控制面板

总结我的经验:

易于安装:APC> eAccelerator> XCache
性能:eAccelerator> APC,XCache
控制面板:APC> XCache> eAccelerator

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

推荐答案

我认为答案可能取决于您所运行的Web应用程序的类型.我必须在两年前自己做出决定,无法在Zend Optimizer和eAccelerator之间做出决定.

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.

为了做出决定,我使用ab(apache台式)测试了服务器,并测试了三种组合(zend,eaccelerator,两者都在运行),并证明了eAccelerator本身可以提供最佳性能.

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.

如果时间充裕,我建议您自己进行类似的测试,并根据您的结果做出决定.

If you have the luxury of time, I would recommend doing similar tests yourself, and making the decision based on your results.

这篇关于我应该使用哪个PHP操作码缓存来提高性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 18:52