APC-> APCu/OPCache,性能较差 [英] APC -> APCu / OPCache, performance poor

查看:385
本文介绍了APC-> APCu/OPCache,性能较差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个今天更新为PHP 5.5.11m3.xlarge EC2实例.

I have an m3.xlarge EC2 instance that I updated to PHP 5.5.11 today.

在此更新中,它用php55-pecl-apcu覆盖了php55-pecl-apc.

With this update, it overwrote php55-pecl-apc with php55-pecl-apcu.

经过阅读和试验后,我的理解是,除了APC已替换为APC,除了可以使用APCu恢复的键值存储.

After reading and experimenting, my understanding is that APC has been replaced with OPCache, except for a key value store which can be brought back with APCu.

在将我的配置调整为看起来合理的配置后,登录时使用Wordpress的速度非常慢,至少差了300-900ms(前端通过清漆缓存,并且运行良好...但是当您使用时管理员是故意不缓存的,并且速度很慢).

After tweaking my config to something that looks reasonable, using Wordpress while logged in is now terribly slow, at least 300-900ms worse (the front end is cached via varnish, and works perfect... but when you're using the admin it is deliberately not cached, and slow as sin).

我在升级时做了一系列基准测试,每个步骤的样本量都很小.随着我的前进,它变得越来越糟.

I did a series of benchmarks as I upgraded, across a small sample size for each step. It degraded worse and worse as I went on.

  • APC(升级前)-->
  • OPCache +无APCu -->
  • 用于APCu的OPCache + APCu + WP插件
  • APC (before upgrade) -->
  • OPCache + no APCu -->
  • OPCache + APCu + WP Plugin for APCu

现在我只是和OPCache闲逛,没有APCu.

Right now I'm just hanging out with OPCache, and no APCu.

  1. 如何实现相同的性能?我喜欢管理界面,也喜欢它的速度.老实说,我根本看不出有什么改善,这确实令人沮丧……除非那里有我不知道的超级图书馆.当然不是我所拥有的,或者配置不正确.
  2. 假设#1的答案是您将其配置为球状",那么您介意看一下一下,看看这是否合理吗?

对于我的设置,我使用的是最新的wordpress,一些大型插件,但由于它们很重要,所以我无法取消它们.幸运的是,清漆可以处理大部分工作.我的网站根目录中有4核,16GB内存,约1万个文件.除了wordpress之外,我也没有真正的硬核应用程序或其他任何东西,这是一个非常原始的设置.我认为这就是可能有用的东西.

For my setup I'm using latest wordpress, a few large plugins but I can't take them off because they're important. Luckily varnish takes care of most of the work. I have 4 cores, 16GB memory, ~10k files in my website root. I also have no real hardcore apps or anything other than wordpress, it's a fairly vanilla setup. I think that's it for stuff that might help.

配置:

zend_extension=opcache.so
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.max_wasted_percentage=5
opcache.use_cwd=1
opcache.validate_timestamps=1
opcache.revalidate_freq=0
opcache.revalidate_path=0
opcache.save_comments=0
opcache.load_comments=0
opcache.fast_shutdown=1
opcache.enable_file_override=0
opcache.optimization_level=0xffffffff
opcache.inherited_hack=1
opcache.dups_fix=0
opcache.blacklist_filename=/etc/php-5.5.d/opcache*.blacklist
opcache.max_file_size=2M
opcache.consistency_checks=1
opcache.force_restart_timeout=180
opcache.error_log=/var/log/php-fpm/5.5/opcache.log
opcache.log_verbosity_level=1
opcache.preferred_memory_model=
opcache.protect_memory=0

推荐答案

现在,您正在检查每个更改请求上的每个文件,这可能不是生产系统上想要的.

Right now you are checking every file on every request for changes, which probably isn't what you want on a production system.

我通常只是禁用它(记住在进行更改后重新启动Web服务器):

I usually just disable it (remember to restart the web server after making changes):

opcache.validate_timestamps=0

或者,您可以尝试将频率设置为非0的值并保持启用状态:

Alternatively, you can try setting the frequency to something other than 0 and keep it enabled:

opcache.validate_timestamps=1  
opcache.revalidate_freq=300

理论上,这应该每5分钟检查一次更改.

This should theoretically only check for changes every 5 minutes.

这篇关于APC-> APCu/OPCache,性能较差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆