みんなの動画サーチの機能追加もだいたい一巡しましたので、負荷対策に注力してみました。
その結果、けっこういい数字があがっています。
ABで負荷テストをインデックスページにかけてみて
ab -n 100 -c 10 http://www.movie-search.info/
最初この結果だったものが
Requests per second: 3.17 [#/sec] (mean)
対策をとった結果こうなりました。
Requests per second: 13.10 [#/sec] (mean)
パフォーマンスが4倍以上になっています。
これをもしハードウェアの増強だけで同じ数字を出そうと思ったら、単純に考えればサーバーと回線の数を4倍にしないといけないところです。それを考えると大いに価値がある作業だったといえるのではないでしょうか(と自画自賛)。
具体的になにやったのかについては、次回詳しく書いていきます。
けっこうボリュームがあるので、複数回に分けようと思っています。こうご期待。
【おまけ:ABを使った負荷テストの結果の詳細】
対策とる前 インデックスページ
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 www.movie-search.info (be patient).....done
Server Software: Apache/2.2.3
Server Hostname: www.movie-search.info
Server Port: 80
Document Path: /
Document Length: 39662 bytes
Concurrency Level: 10
Time taken for tests: 31.499898 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 3983300 bytes
HTML transferred: 3966200 bytes
Requests per second: 3.17 [#/sec] (mean)
Time per request: 3149.990 [ms] (mean)
Time per request: 314.999 [ms] (mean, across all concurrent requests)
Transfer rate: 123.46 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 24 27 3.0 26 43
Processing: 1732 3049 713.0 3048 5092
Waiting: 1628 2829 674.1 2884 4695
Total: 1760 3076 713.1 3073 5120
Percentage of the requests served within a certain time (ms)
50% 3073
66% 3284
75% 3434
80% 3631
90% 4094
95% 4366
98% 4810
99% 5120
100% 5120 (longest request)
対策とった後 インデックページ
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 www.movie-search.info (be patient).....done
Server Software: Apache/2.2.3
Server Hostname: www.movie-search.info
Server Port: 80
Document Path: /
Document Length: 39555 bytes
Concurrency Level: 10
Time taken for tests: 7.631006 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 4010454 bytes
HTML transferred: 3993183 bytes
Requests per second: 13.10 [#/sec] (mean)
Time per request: 763.101 [ms] (mean)
Time per request: 76.310 [ms] (mean, across all concurrent requests)
Transfer rate: 513.17 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 24 90 421.9 27 3029
Processing: 121 611 475.2 518 2716
Waiting: 32 70 63.2 42 351
Total: 148 701 597.0 554 3344
Percentage of the requests served within a certain time (ms)
50% 554
66% 645
75% 933
80% 991
90% 1283
95% 2164
98% 3150
99% 3344
100% 3344 (longest request)
tag : php 負荷対策 サーバー 構築