【发布时间】:2017-04-04 20:09:52
【问题描述】:
我在我的 VPS 上配置了一个 Apache2 网络服务器,它运行良好。服务器托管一个 WordPress 博客,直到现在我都在使用一些 WP Super Cache 插件。我想切换到 OPcache。新的缓存正在工作,至少我是这么认为的。这是 phpinfo 脚本的一些输出:
Zend OPcache
Opcode Caching Up and Running
Optimization Enabled
Startup OK
Shared memory model mmap
Cache hits 46539
Cache misses 455
Used memory 34701752
Free memory 99515976
Wasted memory 0
Interned Strings Used memory 4194296
Interned Strings Free memory 8
Cached scripts 454
Cached keys 507
Max keys 7963
OOM restarts 0
Hash keys restarts 0
Manual restarts 0
如您所见,我有很多缓存命中,但问题是缓存不起作用。我的意思是,也许它正在工作,但我没有看到任何性能提升。
当我发出以下命令时,我尝试查看每秒可以获得多少请求:
$ ab -kc 10 -n 1000 https://wp.blog.tld/
当我禁用 OPcache 时,我得到大约 4/s。启用 OPcache 后,我得到完全相同的数字,大约是 4/s。相反,当我禁用 OPcache 并启用 WP Super Cache 时,我接近 200/s。那么 OpCache 有什么问题呢?它是否缓存或者我的服务器配置有问题?
VPS:
Debian stable
Server version: Apache/2.4.10 (Debian)
Server built: Feb 24 2017 18:40:28
PHP 5.6.30-0+deb8u1 (cli) (built: Feb 8 2017 08:50:21)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
【问题讨论】:
标签: php wordpress apache caching