どの程度に効果があるものか。localhostでのテストなので前後比較しか参考にはならない。
導入前:秒間331.45リクエスト。
$ ab -n 500 -c 50 http://blog.kenji00.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking blog.kenji00.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 500 requests
Server Software: Apache
Server Hostname: blog.kenji00.com
Server Port: 80
Document Path: /
Document Length: 47020 bytes
Concurrency Level: 50
Time taken for tests: 1.508537 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 23677463 bytes
HTML transferred: 23589613 bytes
Requests per second: 331.45 [#/sec] (mean)
Time per request: 150.854 [ms] (mean)
Time per request: 3.017 [ms] (mean, across all concurrent requests)
Transfer rate: 15327.43 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 9 24.0 2 159
Processing: 12 134 61.3 129 279
Waiting: 11 118 61.4 114 244
Total: 29 144 59.8 134 285
Percentage of the requests served within a certain time (ms)
50% 134
66% 185
75% 197
80% 203
90% 213
95% 239
98% 247
99% 249
100% 285 (longest request)
モジュールを有効化
# vi /etc/httpd/conf/httpd.conf
LoadModule cache_module modules/mod_cache.so
#LoadModule suexec_module modules/mod_suexec.so
#LoadModule disk_cache_module modules/mod_disk_cache.so
#LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
このサイトはバーチャルホストで運用しているので、マニュアル見ながら設定
# vi /etc/httpd/conf.d/バーチャルホストのconf
ServerName blog.kenji00.com
.
.
CacheEnable mem /
MCacheSize 12800
MCacheMaxObjectCount 1000
MCacheMinObjectSize 1
MCacheMaxObjectSize 128000
MCacheMaxStreamingBuffer 128000
.
.
で、再度ab(Apache bench)
導入後:秒間449.19リクエスト
$ ab -n 500 -c 50 http://blog.kenji00.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/Benchmarking blog.kenji00.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 500 requests
Server Software: Apache
Server Hostname: blog.kenji00.com
Server Port: 80Document Path: /
Document Length: 47020 bytesConcurrency Level: 50
Time taken for tests: 1.113118 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 23691890 bytes
HTML transferred: 23604040 bytes
Requests per second: 449.19 [#/sec] (mean)
Time per request: 111.312 [ms] (mean)
Time per request: 2.226 [ms] (mean, across all concurrent requests)
Transfer rate: 20784.86 [Kbytes/sec] receivedConnection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 9.3 1 126
Processing: 9 104 53.1 95 286
Waiting: 7 96 51.9 87 278
Total: 9 106 52.8 101 287Percentage of the requests served within a certain time (ms)
50% 101
66% 142
75% 164
80% 168
90% 175
95% 178
98% 181
99% 185
100% 287 (longest request)
ちょい早。当社比135.5%
コメントする