我有一个配置在我的VPS上的Apache2 web服务器,它运行良好。该服务器承载的WordPress博客直到现在我用一些可湿性粉剂超高速缓存插件。我想切换到OPcache。新的缓存正在工作,至少我认为是这样。下面是的phpinfo脚本的一些输出:OPcache计数缓存命中,但没有性能提升
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 /秒。当OPcache启用时,我得到完全相同的号码,这大约是4 /秒。相反,当我禁用OPcache并启用可湿性粉剂超高速缓存,我得到接近200 /秒。那么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
是的,当然我启用插件后重新启动Apache。所以我根本无法接近〜200/s的OPcache请求?我应该使用WP Super Cache + OPcache吗? –
是的。我猜只是你的apache和/或硬件是瓶颈。尝试使用php-fpm检查nginx。 – Juri