迁移后会忽略MediaWiki的文件缓存

时间:2016-09-18 03:24:22

标签: php mysql apache caching mediawiki

问题:我已经设置 MediaWiki 并启用了文件缓存,但是当我将文件缓存迁移到另一个MediaWiki时,缓存绕过了。

后台:我已将MediaWiki 1.26.2设置为apache2作为前端Web服务器,将mariadb设置为MySQL数据库,填充丹麦维基百科

我已启用file cache以加快LocalSettings.php中的效果:

# Enable file caching.
$wgUseFileCache = true;
$wgFileCacheDirectory = "/tmp/wikicache";
$wgShowIPinHeader = false;

# Enable sidebar caching.
$wgEnableSidebarCache=true;

# Enable page compression.
$wgUseGzip = true;

# Disable pageview counters.
$wgUseGzip = true;

# Enable miser mode.
$wgMiserMode = true;

目标:将位于/tmp/wikicache下的文件缓存迁移到另一个MediaWiki服务器。这似乎不起作用,因为跳过了缓存。

用例:节点server托管MediaWiki,我从另一个MediaWiki服务器迁移(复制)了文件缓存,以及相同的LocalSettings.php

这是一个缓存页面:

root@server:~# find /tmp/ -name DNA*
/tmp/wikicache/3/39/DNA.html.gz

在另一个节点client上,我使用apache benchmark ab来衡量请求该页面时的连接时间。 TL; DR; 只有10%的请求成功,时间约为20秒,这大致是查询数据库和检索整个页面所需的时间。

root@client:~# ab -n 100 -c 10 http://172.16.100.3/wiki/index.php/DNA
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.100.3 (be patient).....done
Server Software:        Apache/2.4.7
Server Hostname:        172.16.100.3
Server Port:            80

Document Path:          /wiki/index.php/DNA
Document Length:        1184182 bytes

Concurrency Level:      10
Time taken for tests:   27.744 seconds
Complete requests:      100
Failed requests:        90
   (Connect: 0, Receive: 0, Length: 90, Exceptions: 0)
Total transferred:      118456568 bytes
HTML transferred:       118417968 bytes
Requests per second:    3.60 [#/sec] (mean)
Time per request:       2774.370 [ms] (mean)
Time per request:       277.437 [ms] (mean, across all concurrent requests)
Transfer rate:          4169.60 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   123 2743 7837.1    145   27743
Waiting:      118 2735 7835.6    137   27723
Total:        123 2743 7837.2    145   27744

Percentage of the requests served within a certain time (ms)
  50%    145
  66%    165
  75%    168
  80%    170
  90%  24788
  95%  26741
  98%  27625
  99%  27744
 100%  27744 (longest request)

如果我随后再次请求同一页面,则会在~0.15秒内提供。即使我用RESET QUERY CACHE刷新MySQL的缓存,我也会观察到相同的性能:

root@client:~# ab -n 100 -c 10 http://172.16.100.3/wiki/index.php/DNA
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.100.3 (be patient).....done


Server Software:        Apache/2.4.7
Server Hostname:        172.16.100.3
Server Port:            80

Document Path:          /wiki/index.php/DNA
Document Length:        1184179 bytes

Concurrency Level:      10
Time taken for tests:   1.564 seconds
Complete requests:      100
Failed requests:        41
   (Connect: 0, Receive: 0, Length: 41, Exceptions: 0)
Total transferred:      118456541 bytes
HTML transferred:       118417941 bytes
Requests per second:    63.93 [#/sec] (mean)
Time per request:       156.414 [ms] (mean)
Time per request:       15.641 [ms] (mean, across all concurrent requests)
Transfer rate:          73957.62 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       0
Processing:   129  150  18.8    140     189
Waiting:      120  140  18.0    130     171
Total:        129  150  18.8    141     189

Percentage of the requests served within a certain time (ms)
  50%    141
  66%    165
  75%    169
  80%    170
  90%    175
  95%    181
  98%    188
  99%    189
 100%    189 (longest request)

那么,当我将文件缓存迁移到另一个MediaWiki服务器时,为什么文件缓存不起作用?

0 个答案:

没有答案