前提・実現したいこと
S3にアップした画像ファイルを配信するため、CloudFrontの導入を検討しており、
どの程度のアクセスをさばけるようになるのか、事前に計測しようとしております。
発生している問題
そこでabコマンドによる性能評価を行ったところ、
shell
1$ ab -n 300 -c 300 https://hoge.cloudfront.net/path_to_image.jpg 2$ ab -n 300 -c 300 https://hoge.s3.amazonaws.com/path_to_image.jpg
くらいまではほぼ同等で若干CloudFrontが有利かな?くらいの結果だったのですが、n,cがそれぞれ400以上になると途端にCloudFrontの結果が悪くなってしまいました。
shell
1$ ab -n 1200 -c 400 https://hoge.cloudfront.net/path_to_image.jpg 2$ ab -n 1200 -c 400 https://hoge.s3.amazonaws.com/path_to_image.jpg
abテストの仕方が悪いのか、CloudFrontの設定が悪いのか切り分けできず悩んでおります。
もしくはClousFrontは1箇所からの同時アクセス自体の処理は苦手なのでしょうか?
アドバイスを頂けたら嬉しいです。
補足情報1(CloudFront設定)
項目 | 設定 | 備考 |
---|---|---|
Restrict Bucket Access | No | S3へのダイレクトアクセスを許可 |
Allowed HTTP Methods | GET, HEAD | |
Viewer Protocol Policy | HTTPS Only | |
TTL(Min, Max, Default) | 31536000 | 1年。S3側ではmax-ageは設定してません |
Smooth Streaming | No | |
Restrict Viewer Access | No | |
Compress Objects Automatically | No | 画像だけなのでNoでいい? |
補足情報2 (abコマンドログ n:1200 c:400)
shell
1# CloudFront Test 2$ ab -n 1200 -c 400 https://hoge.cloudfront.net/path_to_image.jpg 3 4Server Software: AmazonS3 5Server Hostname: hoge.cloudfront.net 6Server Port: 443 7SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128 8 9Document Path: path_to_image.jpg 10Document Length: 52907 bytes 11 12Concurrency Level: 400 13Time taken for tests: 33.394 seconds 14Complete requests: 1200 15Failed requests: 1 16 (Connect: 0, Receive: 0, Length: 1, Exceptions: 0) 17Write errors: 0 18Total transferred: 63958693 bytes 19HTML transferred: 63435493 bytes 20Requests per second: 35.93 [#/sec] (mean) 21Time per request: 11131.288 [ms] (mean) 22Time per request: 27.828 [ms] (mean, across all concurrent requests) 23Transfer rate: 1870.39 [Kbytes/sec] received 24 25Connection Times (ms) 26 min mean[+/-sd] median max 27Connect: 0 672 385.3 631 4045 28Processing: 83 1170 987.2 1040 30028 29Waiting: 17 137 203.1 25 1792 30Total: 109 1842 1050.8 1718 30028 31 32Percentage of the requests served within a certain time (ms) 33 50% 1718 34 66% 1931 35 75% 2068 36 80% 2206 37 90% 2603 38 95% 3119 39 98% 3727 40 99% 4117 41 100% 30028 (longest request)
shell
1#S3 Test 2$ ab -n 1200 -c 400 https://hoge.s3.amazonaws.com/path_to_image.jpg 3 4Server Software: AmazonS3 5Server Hostname: hoge.s3.amazonaws.com 6Server Port: 443 7SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128 8 9Document Path: /path_to_image.jpg 10Document Length: 52907 bytes 11 12Concurrency Level: 400 13Time taken for tests: 6.685 seconds 14Complete requests: 1200 15Failed requests: 0 16Write errors: 0 17Total transferred: 63942000 bytes 18HTML transferred: 63488400 bytes 19Requests per second: 179.51 [#/sec] (mean) 20Time per request: 2228.295 [ms] (mean) 21Time per request: 5.571 [ms] (mean, across all concurrent requests) 22Transfer rate: 9340.98 [Kbytes/sec] received 23 24Connection Times (ms) 25 min mean[+/-sd] median max 26Connect: 205 587 200.6 532 1827 27Processing: 186 1259 402.1 1236 3355 28Waiting: 73 115 70.5 87 514 29Total: 391 1847 497.4 1801 3956 30 31Percentage of the requests served within a certain time (ms) 32 50% 1801 33 66% 2009 34 75% 2151 35 80% 2262 36 90% 2495 37 95% 2660 38 98% 2972 39 99% 3186 40 100% 3956 (longest request)
補足情報3(気になったところ)
CloudFrontの場合、abコマンドの処理中に出力される
Completed 120 requests
Completed 240 requests
Completed 360 requests
Completed 480 requests
Completed 600 requests
Completed 720 requests
Completed 840 requests
Completed 960 requests
Completed 1080 requests
Completed 1200 requests
Finished 1200 requests
の「Finished 1200 requests」の手前までは等速で処理できているように見えるのに、「Finished 1200 requests」が出力されるまでしばらく時間を要します。
S3の場合はほぼ等速で処理しているように見えます。
あなたの回答
tips
プレビュー