wordpress的WP Super Cache插件安装及性能测试

November 5, 2008 by admin · 4 Comments
Filed under: wordpress 

 

很多wordpress的博主都会遇到网站速度慢的问题,原因很简单,wordpress本身的性能就不是很高,wordpress最强大的地方在于它的plugins机制,因此,解决性能的问题也需要通过插件来解决。

wordpress有两个著名的cache插件:WP Super CacheWP-Cachewp super cache性能更super。在wordpress官方插件的cache类插件中,wp super cache下载量为16.7万,rating4星,wp-cache下载量为10万,rating接近4星。本博客选择wp super cache

安装wp super cache

首先,apache需要支持mod mimemod rewritewordpress需要启用permalinks机制,PHP safe需要disabled

如果已安装wp-cache,需要首先把wp-cache卸载,并且修改wp-config.php文件,确认WP_CACHE的定义已经被删除,删除wp-content/wp-cache-config.php wp-content/advanced-cache.php文件;

wp-super-cache上传到wp-content/plugins/目录;

进入wordpress后台plugins页面,激活wp-super-cache

进入wordpress后台settings–>wp super cache管理界面,可以启用wp super cache,如果出现错误,或者空白页面,则需要进一步查找错误所在。

mod-rewrite 规则被安装在网站根目录的.htaccess文件中,类似于下面的格式:

       `—————–.htaccess—————–`

       `RewriteEngine On`

       `RewriteBase /`

      

       `RewriteCond %{REQUEST_METHOD} !=POST`

       `RewriteCond %{QUERY_STRING} !.*=.*`

       `RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$`

       `RewriteCond %{HTTP:Accept-Encoding} gzip`

       `RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f`

       `RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]`

      

       `RewriteCond %{REQUEST_METHOD} !=POST`

       `RewriteCond %{QUERY_STRING} !.*=.*`

       `RewriteCond %{QUERY_STRING} !.*attachment_id=.*`

       `RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$`

       `RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f`

       `RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L]`

      

       `RewriteCond %{REQUEST_FILENAME} !-f`

       `RewriteCond %{REQUEST_FILENAME} !-d`

       `RewriteRule . /index.php [L]`

       `—————–.htaccess—————–`

 

wordpress性能测试

测试工具:

微软的Web Application Stress Tool,下载地址:http://www.microsoft.com/downloads/details.aspx?FamilyID=e2c0585a-062a-439e-a67d-75a89aa36495&displaylang=en

测试方法:

测试使用GET方法,选取了以下地址:

url

desc

/

首页

/about/

测试静态页面的性能

/catalog/django/

catalog页面

/catalog/protocol/

catalog页面

/tag/django/

tag页面

/2008/11/xxxx

博客文章页面

/2008/11/xxxx

博客文章页面

/2008/11/xxxx

博客文章页面

测试时间:2分钟

测试线程:20

测试multiper10

最大延迟:4微妙

最小延迟:2微妙

 

测试结果:

Web Application Stress给出了很多测试统计结果,有很多不是很明白其中的含义,仅列举以下数据说明cache的效果。

结果对比简表:

 

测试项目

未使用wp super cache

使用wp super cache

hits总数

4982

10367

hits/per sec

41.52

86.39

socket connection

5166

10550

返回200

523

855

返回404

201

338

返回500

4258

9174 

 

详细测试结果:

未使用wp-super-cache之前的测试数据:

Notes

——————————————————————————–

Sample Microsoft Web Application Stress Script

 

Number of test clients:       1

 

Number of hits:               4982

Requests per Second:          41.52

 

Socket Statistics

——————————————————————————–

Socket Connects:              5166

Total Bytes Sent (in KB):     1037.12

Bytes Sent Rate (in KB/s):    8.64

Total Bytes Recv (in KB):     7424.00

Bytes Recv Rate (in KB/s):    61.87

 

Socket Errors

——————————————————————————–

Connect:                      57

Send:                         0

Recv:                         0

Timeouts:                     0

 

RDS Results

——————————————————————————–

Successful Queries:           0

 

 

Script Settings

================================================================================

Server:                       www.9say.com

Number of threads:            200

 

Test length:                  00:02:00

Warmup:                       00:00:00

Cooldown:                     00:00:00

 

Use Random Delay:             Yes

Min Delay Time:               2

Max Delay Time:               4

 

Follow Redirects:             Yes

Max Redirect Depth:           15

 

 

Clients used in test

================================================================================

localhost

 

Clients not used in test

================================================================================

 

 

Result Codes

Code      Description                   Count    

================================================================================

200       OK                            523      

404       Not Found                     201      

500       Internal Server Error         136      

503       Service Unavailable           4050     

NA        HTTP result code not given    72       

 

 

Page Summary

Page                            Hits      TTFB Avg  TTLB Avg  Auth      Query    

================================================================================

GET /                           706       7046.90   7106.76   No        No       

GET /about/                     686       6843.09   6866.01   No        No       

GET /2008/11/pinax安装,运行,demo效果  661       3101.65   3135.07   No        No       

GET /2008/11/django应用集合:pinax/  639       3478.41   3503.64   No        No       

GET /category/django/           598       3005.13   3007.01   No        No       

GET /tag/django/                583       2854.88   2878.12   No        No       

GET /2008/11/discuz7源码分析1-数据表/  564       3440.88   3444.70   No        No       

GET /category/protocol/         545       3392.66   3392.71   No        No 

 

使用cache之后:

Number of test clients:       1

 

Number of hits:               10367

Requests per Second:          86.39

 

Socket Statistics

——————————————————————————–

Socket Connects:              10550

Total Bytes Sent (in KB):     2119.25

Bytes Sent Rate (in KB/s):    17.66

Total Bytes Recv (in KB):     13317.23

Bytes Recv Rate (in KB/s):    110.97

 

Socket Errors

——————————————————————————–

Connect:                      15

Send:                         0

Recv:                         0

Timeouts:                     0

 

RDS Results

——————————————————————————–

Successful Queries:           0

 

 

Script Settings

================================================================================

Server:                       www.9say.com

Number of threads:            200

 

Test length:                  00:02:00

Warmup:                       00:00:00

Cooldown:                     00:00:00

 

Use Random Delay:             Yes

Min Delay Time:               2

Max Delay Time:               4

 

Follow Redirects:             Yes

Max Redirect Depth:           15

 

 

Clients used in test

================================================================================

localhost

 

Clients not used in test

================================================================================

 

 

Result Codes

Code      Description                   Count    

================================================================================

200       OK                            855      

404       Not Found                     338      

503       Service Unavailable           9174     

 

 

Page Summary

Page                            Hits      TTFB Avg  TTLB Avg  Auth      Query    

================================================================================

GET /                           1389      2026.47   2082.56   No        No       

GET /about/                     1357      1950.76   1956.74   No        No       

GET /2008/11/pinax安装,运行,demo效果  1331      2029.72   2164.14   No        No       

GET /2008/11/django应用集合:pinax/  1309      1967.72   2091.15   No        No       

GET /category/django/           1280      1900.40   1906.75   No        No       

GET /tag/django/                1255      1971.05   1971.10   No        No       

GET /2008/11/discuz7源码分析1-数据表/  1234      2075.45   2189.95   No        No       

GET /category/protocol/         1212      1859.00   1867.88   No        No        


相关文章:

  1. pinax安装,运行,demo效果展示
  2. 2009年1月经济统计数据

Comments

4 Responses to “wordpress的WP Super Cache插件安装及性能测试”
  1. 爱燕博客 says:

    你首页上边的468*60空着真是可惜。。。呵呵!

  2. admin says:

    呵呵,今天才建的站点。。。

  3. Betty says:

    WP Super Cache就是WP Cache的升级版吧

  4. admin says:

    这个不太清楚。
    不过后台的管理界面里,wp super cache显示缓存页面时,显示wp cache xxx页,然后是wp super cache xxx页,如此,应该是升级版吧,我想。

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!