いい品を高く買い取るのがブックジーです

‘チューニング’ タグのついている投稿

サイトの負荷対策を実行

2009 年 2 月 25 日 水曜日

これまでブックジーではさくらの500円コースを使っていましたが、夜間の重さと、ときどき503エラーが出る問題に悩まされていました。そこで本日、WEBARENAに引っ越しを敢行しました。
ついでにabでベンチを取っておきましたので、華麗なる(?)その過程をブログに記録しておきます。

//さくら(昼間)
Benchmarking book-g.com (be patient)
Finished 146 requests

Server Software: Apache/1.3.39
Server Hostname: book-g.com
Server Port: 80

Document Path: /
Document Length: 10363 bytes

Concurrency Level: 10
Time taken for tests: 60.312500 seconds
Complete requests: 146
Failed requests: 12
(Connect: 0, Length: 12, Exceptions: 0)
Write errors: 0
Non-2xx responses: 5
Total transferred: 1481334 bytes
HTML transferred: 1458429 bytes
Requests per second: 2.42 [#/sec] (mean)
Time per request: 4130.993 [ms] (mean)
Time per request: 413.099 [ms] (mean, across all concurrent requests)
Transfer rate: 23.98 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 15 20 7.6 15 31
Processing: 31 3980 2162.5 3906 9985
Waiting: 31 3770 2114.7 3687 9765
Total: 46 4000 2163.3 3921 10000

Percentage of the requests served within a certain time (ms)
50% 3921
66% 4765
75% 5234
80% 5734
90% 6718
95% 7640
98% 9000
99% 9093
100% 10000 (longest request)

昼間のべンチにもかかわらずすでにFailerが12あるのがわかります。これが夜間になると、あろうことか半分以上Failerになるという衝撃の数字が出てしまいました。引っ越しを決断した最大の理由です。いちおうこれでも最安値コースではなく真ん中のコースなのですが……。

1秒間に処理されたリクエスト数(Requests per second)は2.42。
Requests per second: 2.42 [#/sec] (mean)

C:\Documents and Settings\main>

//VPSに引っ越した後の数字
This is ApacheBench, Version 2.0.41-dev < $Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking book-g.com (be patient)
Finished 112 requests

Server Software: Apache/2.2.8
Server Hostname: book-g.com
Server Port: 80

Document Path: /
Document Length: 13537 bytes

Concurrency Level: 10
Time taken for tests: 60.484375 seconds
Complete requests: 112
Failed requests: 0
Write errors: 0
Total transferred: 1536262 bytes
HTML transferred: 1517391 bytes
Requests per second: 1.85 [#/sec] (mean)
Time per request: 5400.391 [ms] (mean)
Time per request: 540.039 [ms] (mean, across all concurrent requests)
Transfer rate: 24.80 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 15 18 6.9 15 31
Processing: 2313 5147 1424.9 5235 8953
Waiting: 2234 5077 1424.5 5171 8875
Total: 2328 5166 1425.8 5250 8968

Percentage of the requests served within a certain time (ms)
50% 5250
66% 5562
75% 6109
80% 6343
90% 7140
95% 7656
98% 8093
99% 8765
100% 8968 (longest request)

VPSに移行したあとの数字です。Failed requestsこそ0なものの、Requests per secondは 1.85 [#/sec] (mean) と、共用レンタルサーバに負けてしまっています。

いくら夜間だからとはいえこれはひどい。

と思ったら、PHPのアクセラレータを入れていないことに気がつきました。

//というわけでeAcceralatorを入れてみました。
C:\Documents and Settings\main>”C:\Program Files\Apache Group\Apache2\bin\ab” -c
10 -t 60 http://book-g.com/
This is ApacheBench, Version 2.0.41-dev < $Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking book-g.com (be patient)
Finished 497 requests

Server Software: Apache/2.2.8
Server Hostname: book-g.com
Server Port: 80

Document Path: /
Document Length: 13537 bytes

Concurrency Level: 10
Time taken for tests: 60.000 seconds
Complete requests: 497
Failed requests: 1
(Connect: 0, Length: 1, Exceptions: 0)
Write errors: 0
Total transferred: 6819709 bytes
HTML transferred: 6736376 bytes
Requests per second: 8.28 [#/sec] (mean)
Time per request: 1207.243 [ms] (mean)
Time per request: 120.724 [ms] (mean, across all concurrent requests)

Transfer rate: 110.98 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 15 18 6.6 15 31
Processing: 203 936 2924.6 516 43312
Waiting: 140 870 2924.7 453 43250
Total: 218 954 2925.2 531 43343

Percentage of the requests served within a certain time (ms)
50% 531
66% 625
75% 796
80% 843
90% 1093
95% 1218
98% 3453
99% 14765
100% 43343 (longest request)

C:\Documents and Settings\main>

見事Requests per secondは 8.28 [#/sec] (mean)に。まずは納得の結果となりました。ヤレヤレ。

P.S
これを書いているのが午前1時ごろで、終わったのが今さっきなのがとてもIT業界らしいですね。