WordPress 缓存插件性能对比 -管理资料

管理资料 时间:2019-01-01 我要投稿
【meiwen.anslib.com - 管理资料】

    虽然原生态的 WordPress 效率实在底下,但是 WordPress 提供了很多插件,国外服务器领域里也有很多开源的缓存软件,这几天在 Jerry 的帮忙下,萝卜网的服务器用上了 Varnish 缓存加速,现在每天轻松应付流量,系统的负载也不再升高,呵呵,

WordPress 缓存插件性能对比

。这里贴一篇国外高手的文章,一些主流的 WordPress 缓存插件,以及和用上 Varnish 的 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

    echoSleeping

    sleep 30

    time( \

    echoFirst Run; \

    ab -n $FETCHES -c $PARALLEL http://example.com/; \

    echoSecond Run; \

    ab -n $FETCHES -c $PARALLEL http://example.com/; \

    \

    echoFirst Run; \

    ./http_load -parallel $PARALLEL -fetches $FETCHES wordpresstest; \

    echoSecond 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 Starthttp_loadCold Start

    Warm StartReq/SecondTime/Request50% within x msFetches/SecondMin First ResponseAvg First ResponseBaseline4.97201.006200415.1021335.708583.3635.00200.089200015.1712304.446583.684DB Cache4.80208.436208715.1021335.708583.363Cached all SQL queries4.81207.776209115.1712304.446583.684DB Cache4.87205.250203514.1992302.335621.092Out of Box config4.94202.624202614.432114.983618.434WP File Cache4.95201.890200915.8869158.597549.1764.99200.211200416.175899.728544.107DB Cache Reloaded5.02199.387198315.0167187.343589.196All SQL Queries Cached5.03200.089198514.9233150.145586.443DB Cache Reloaded5.06197.636196814.9697174.857589.161Out of Box config5.08196.980196815.181257.533587.737Widgetcache6.667149.903149215.0264245.332602.0396.72148.734148715.1887299.65598.017W3 Total Cache153.4565.16760133.18988.91685.7177DB Cache off, Page Caching with Memcached169.4659.01157188.49.10750.142W3 Total Cache173.4957.63952108.8987.66886.4077DB Cache off, Minify Cache with Memcached189.7652.69848203.5228.12243.8795W3 Total Cache171.3458.36450203.7188.09744.1234DB Cache using Memcached190.0152.26948206.1878.18642.4438W3 Total Cache175.2957.0484887.4237.515107.973Out of Box config191.1552.31447204.3878.28843.217W3 Total Cache175.2957.04751204.5578.19942.9365Database Cache using APC191.1952.30448200.6128.1144.6691W3 Total Cache114.0287.70349114.3938.20682.0678Database Cache Disabled191.7652.15049203.7818.09542.558W3 Total Cache175.8056.88451107.8427.28187.2761Database Cache Disabled, Minify Cache using APC192.0152.08250205.668.24443.1231W3 Total Cache104.9095.32551123.0417.86874.5887Database Cache Disabled, Page Caching using APC197.5550.62046210.4457.90741.4102WP Super Cache336.882.9681615.1021335.708583.363Out of Box config, Half On391.592.5541615.1712304.446583.684WP Cache161.636.1871215.1021335.708583.363482.2920.7351115.1712304.446583.684WP Super Cache919.111.0883190.1171.47347.9367Full on, Lockdown mode965.691.0363975.9791.4559.67185WP Super Cache928.451.0773210.1061.46843.8167Full on970.451.0303969.2561.4889.78753W3 Total Cache1143.948.7422165.5470.95856.7702Page Cache using Disk Enhanced1222.168.18231290.430.9617.15632W3 Total Cache1153.508.6693165.7250.91656.5004Page Caching – Disk Enhanced, Minify/Database using APC1211.228.25621305.940.9486.97114Varnish ESI2304.180.4344349.3510.22128.10792243.330.4468944312.780.1522.09931WP Varnish1683.890.5943369.5430.15526.89063028.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 插件,

管理资料

WordPress 缓存插件性能对比》(http://meiwen.anslib.com)。

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

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

最新文章
推荐文章