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

问题描述

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

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.

目前正在使用 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:

无操作码缓存

APC

电子加速器

XCache

性能图(越小越好)

Performance Graph (smaller is better)

从以上结果来看,eAccelerator 在性能上比 APC 和 XCache 略有优势.然而,从上述数据中最重要的是,任何类型的操作码缓存都可以极大地提高性能.

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 bench)来测试服务器,并测试了三种组合(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