WordPress 缓存插件性能对比

WordPress 缓存插件性能对比

我想我应该收回之前文章 《如果要把网站做大,切忌 WordPress 的滥用》 的观点,虽然原生态的 WordPress 效率实在底下,但是 WordPress 提供了很多插件,国外服务器领域里也有很多开源的缓存软件,这几天在Jerry 的帮忙下,萝卜网的服务器用上了 Varnish 缓存加速,现在每天轻松应付流量,系统的负载也不再升高,呵呵。这里贴一篇国外高手的文章,一些主流的 WordPress 缓存插件,以及和用上 Varnish 的 WordPress 性能的对比。

WordPress

原文《WordPress Cache Plugin Benchmarks

1、作者使用的插件下载以及版本号:

DB Cache (version 0.6)
DB Cache Reloaded
(version 2.0.2)
W3 Total Cache
(version 0.8.5.1)
WP Cache
(version 2.1.2)
WP Super Cache
(version 0.9.9)
WP Widget Cache
(version 0.25.2)
WP File Cache
(version 1.2.5)
WP Varnish
(in beta)
WP Varnish ESI Widget
(in beta)

2、生产环境:

Debian 3.1/Squeeze VPS
Linux Kernel 2.6.33
Single core of a Xen Virtualized Xeon X3220 (2.40ghz)
2gb RAM
CoW file is written on a Raid-10 System using 4x1tb 7200RPM Drives
Apache 2.2.14 mpm-prefork
PHP 5.3.1
WordPress 官方主题测试数据

Tests are performed from a Quadcore Xeon machine connected via 1000 Base T on the same switch and /24 as the VPS machine

3、测试使用的Bash代码:

#!/bin/sh

FETCHES=1000
PARALLEL=10

/usr/sbin/apache2ctl stop
/etc/init.d/mysql restart
apache2ctl start
echo Sleeping
sleep 30
time (\
echo First Run;\
ab -n $FETCHES -c$PARALLEL http://example.com/;\
echo Second Run;\
ab -n $FETCHES -c$PARALLEL http://example.com/;\
\
echo First Run;\
./http_load -parallel $PARALLEL -fetches$FETCHES wordpresstest;\
echo Second Run;\
./http_load -parallel $PARALLEL -fetches$FETCHES wordpresstest;\
)

4、测试以下 URL 的 http_load:

http://example.com/

http://example.com/2010/03/hello-world/

http://example.com/2008/09/layout-test/

http://example.com/2008/04/simple-gallery-test/

http://example.com/2007/12/category-name-clash/

http://example.com/2007/12/test-with-enclosures/

http://example.com/2007/11/block-quotes/

http://example.com/2007/11/many-categories/

http://example.com/2007/11/many-tags/

http://example.com/2007/11/tags-a-and-c/

http://example.com/2007/11/tags-b-and-c/

http://example.com/2007/11/tags-a-and-b/

http://example.com/2007/11/tag-c/

http://example.com/2007/11/tag-b/

http://example.com/2007/11/tag-a/

http://example.com/2007/09/tags-a-b-c/

http://example.com/2007/09/raw-html-code/

http://example.com/2007/09/simple-markup-test/

http://example.com/2007/09/embedded-video/

http://example.com/2007/09/contributor-post-approved/

http://example.com/2007/09/one-comment/

http://example.com/2007/09/no-comments/

http://example.com/2007/09/many-trackbacks/

http://example.com/2007/09/one-trackback/

http://example.com/2007/09/comment-test/

http://example.com/2007/09/a-post-with-multiple-pages/

http://example.com/2007/09/lorem-ipsum/

http://example.com/2007/09/cat-c/

http://example.com/2007/09/cat-b/

http://example.com/2007/09/cat-a/

http://example.com/2007/09/cats-a-and-c/

5、最终性能对比:

Sorted in Ascending order in terms of higher overall performance

AddonApachebenchCold Start
Warm Start
http_loadCold Start
Warm Start

Req/SecondTime/Request50% within x msFetches/SecondMin First ResponseAvg First Response
Baseline4.97201.006200415.1021335.708583.363

5.00200.089200015.1712304.446583.684
DB Cache4.80208.436208715.1021335.708583.363
Cached all SQL queries4.81207.776209115.1712304.446583.684
DB Cache4.87205.250203514.1992302.335621.092
Out of Box config4.94202.624202614.432114.983618.434
WP File Cache4.95201.890200915.8869158.597549.176

4.99200.211200416.175899.728544.107
DB Cache Reloaded5.02199.387198315.0167187.343589.196
All SQL Queries Cached5.03200.089198514.9233150.145586.443
DB Cache Reloaded5.06197.636196814.9697174.857589.161
Out of Box config5.08196.980196815.181257.533587.737
Widgetcache6.667149.903149215.0264245.332602.039

6.72148.734148715.1887299.65598.017
W3 Total Cache153.4565.16760133.18988.91685.7177
DB Cache off, Page Caching with Memcached169.4659.01157188.49.10750.142
W3 Total Cache173.4957.63952108.8987.66886.4077
DB Cache off, Minify Cache with Memcached189.7652.69848203.5228.12243.8795
W3 Total Cache171.3458.36450203.7188.09744.1234
DB Cache using Memcached190.0152.26948206.1878.18642.4438
W3 Total Cache175.2957.0484887.4237.515107.973
Out of Box config191.1552.31447204.3878.28843.217
W3 Total Cache175.2957.04751204.5578.19942.9365
Database Cache using APC191.1952.30448200.6128.1144.6691
W3 Total Cache114.0287.70349114.3938.20682.0678
Database Cache Disabled191.7652.15049203.7818.09542.558
W3 Total Cache175.8056.88451107.8427.28187.2761
Database Cache Disabled, Minify Cache using APC192.0152.08250205.668.24443.1231
W3 Total Cache104.9095.32551123.0417.86874.5887
Database Cache Disabled, Page Caching using APC197.5550.62046210.4457.90741.4102
WP Super Cache336.882.9681615.1021335.708583.363
Out of Box config, Half On391.592.5541615.1712304.446583.684
WP Cache161.636.1871215.1021335.708583.363

482.2920.7351115.1712304.446583.684
WP Super Cache919.111.0883190.1171.47347.9367
Full on, Lockdown mode965.691.0363975.9791.4559.67185
WP Super Cache928.451.0773210.1061.46843.8167
Full on970.451.0303969.2561.4889.78753
W3 Total Cache1143.948.7422165.5470.95856.7702
Page Cache using Disk Enhanced1222.168.18231290.430.9617.15632
W3 Total Cache1153.508.6693165.7250.91656.5004
Page Caching – Disk Enhanced, Minify/Database using APC1211.228.25621305.940.9486.97114
Varnish ESI2304.180.4344349.3510.22128.1079

2243.330.4468944312.780.1522.09931
WP Varnish1683.890.5943369.5430.15526.8906

3028.410.33034318.480.1482.15063

6、总结:

Varnish 用来做缓存,因为是内存级别的,读取速度相当之快,所有其他的缓存插件都是浮云,唯一能媲美的是启用了Page Caching – Disk (Enhanced), Minify Caching – Alternative PHP Cache (APC), Database Caching – Alternative PHP Cache (APC)的 W3 Total Cache 插件。

萝卜网目前使用的方案是 Nginx (82端口) + Varnish (反向监听81)+ Nginx (再反向监听80),当然也可以尝试 Apache (82)+ Varnish(81) + Nginx (80),具体怎么配置就不是本文的讨论范围了。

至于为什么不用 Apache (81) + Nginx (80),因为 Nginx 用来做反向代理+缓存加速的话,是在硬盘读取的,而Varnish直接读取内存,速度明显加快,唯一头疼的就是太损耗内存,服务器8G的内存瞬间跑满,看来得花钱加大内存了 T_T


ref http://zou.lu/wordpress-cache-plugin-benchmarks/


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值