EBS VS EFS 〜東京襲来〜
2018年、初夏EFSが東京に来ました。
VSといったものの、いやいやEFSってそういうんやないから!って感じですけどね。
単純にルートデバイスのEBS(マグネティック)に置いたWordPressから、EFSに置いたWordPressに変更してアクセスしてみると、どれくらい速度下がるんだろうかっていう。
とりあえず、コチラから配布しているAMIをnginxをチョイスして、t2microでインスタンスを起動。
配布されているAMIには最初からWordPressが入ってるので、そのまま初期設定を終わらせて速度テストしていきます。
〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
2018/07/18追記
配布AMIでは内部のphp部分はopcacheでキャッシュしており、実質読み込まれていないため早かった模様。
ので、下の記事は測定として間違っています。WordPressの記事投稿だけする&別にサイトイジらないなら問題ない・・・かもしれない。
けどそれならFastCGIキャッシュとか使って高速化すれば・・・
【東京リージョン対応】Amazon EFS の速度計測してみた結果【祝】
〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
回線の不調とかでバラけるのが嫌なので、同VPC内にいる別インスタンスから、abで速度を取ります。
通常のEBSに置いたWordPress
まずはただの速度テストをしてみる。アクセス総数500、同時接続最大50で行ってみます。
[root@ ~]# ab -n 500 -c 50 http://作ったインスタンスのIP/
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 作ったインスタンスのIP (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Finished 500 requests
Server Software: nginx
Server Hostname: 作ったインスタンスのIP
Server Port: 80
Document Path: /
Document Length: 53349 bytes
Concurrency Level: 50
Time taken for tests: 7.008 seconds
Complete requests: 500
Failed requests: 0
Total transferred: 26783500 bytes
HTML transferred: 26674500 bytes
Requests per second: 71.35 [#/sec] (mean)
Time per request: 700.798 [ms] (mean)
Time per request: 14.016 [ms] (mean, across all concurrent requests)
Transfer rate: 3732.28 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 3 1.7 2 8
Processing: 21 686 158.3 653 1206
Waiting: 17 651 162.5 607 1114
Total: 21 688 157.7 655 1208
Percentage of the requests served within a certain time (ms)
50% 655
66% 700
75% 742
80% 801
90% 940
95% 1001
98% 1094
99% 1146
100% 1208 (longest request)
Requests per second: 71.35 [#/sec] (mean)
ですので、秒間71リクエストさばけます。まぁまぁな速度。t2microであればこれくらいでしょう。さて次が本番
efs
さてさて。お次が本番EFS。単純にガシャコン接続させるだけなので、
https://dev.classmethod.jp/cloud/aws/elastic-file-system-ga-in-tokyo/
こちらの指示どおりに。作ってて注意したいのは、作ったばっかりのを繋ごうとすると、DNSが浸透しておらずエラーになるという点。
[root@ /]# sudo mount -t efs fs-hogehoge:/ efs Failed to resolve "fs-hogehoge.efs.ap-northeast-1.amazonaws.com" - check that your file system ID is correct. See https://docs.aws.amazon.com/console/efs/mount-dns-name for more detail.
即接続するとこんな感じになります。 さて、直下に置いた後、
[root@ /]# df -h ファイルシス サイズ 使用 残り 使用% マウント位置 devtmpfs 476M 0 476M 0% /dev tmpfs 493M 0 493M 0% /dev/shm tmpfs 493M 13M 481M 3% /run tmpfs 493M 0 493M 0% /sys/fs/cgroup /dev/xvda1 10G 2.8G 7.3G 28% / tmpfs 99M 0 99M 0% /run/user/0 tmpfs 99M 0 99M 0% /run/user/1000 fs-hogehoge.efs.ap-northeast-1.amazonaws.com:/ 8.0E 0 8.0E 0% /efs
8.0E!こんなサイズフルで使った日には請求書をなかったことにするしか・・・。 正しく/efsに置けたので、WordPressファイル群をコピー&nginxの設定を
server {
listen 80 default_server;
server_name localhost;
root /efs;
~~~
のように変更。nginxをリスタートさせて、さぁ速度テスト。
[root@ ~]# ab -n 500 -c 50 http://作ったインスタンスのIP/
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 作ったインスタンスのIP (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Finished 500 requests
Server Software: nginx
Server Hostname: 作ったインスタンスのIP
Server Port: 80
Document Path: /
Document Length: 53349 bytes
Concurrency Level: 50
Time taken for tests: 7.611 seconds
Complete requests: 500
Failed requests: 0
Total transferred: 26783500 bytes
HTML transferred: 26674500 bytes
Requests per second: 65.69 [#/sec] (mean)
Time per request: 761.109 [ms] (mean)
Time per request: 15.222 [ms] (mean, across all concurrent requests)
Transfer rate: 3436.53 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 1.5 2 9
Processing: 425 709 130.1 682 1393
Waiting: 417 673 133.6 648 1320
Total: 425 711 130.0 685 1394
Percentage of the requests served within a certain time (ms)
50% 685
66% 714
75% 739
80% 754
90% 845
95% 1008
98% 1162
99% 1198
100% 1394 (longest request)
Requests per second: 71.35 [#/sec] (mean)
↓
Requests per second: 65.69 [#/sec] (mean)
お、思ったよりも下がっていない・・・。この速度を代償に冗長化可能であればありがたい。
EFSの本気
さて、ここまではデフォルト通りの設定ですが、EFSにはAmazon EFS プロビジョンドスループットモードに変更することが出来ます。
https://aws.amazon.com/jp/efs/pricing/
https://docs.aws.amazon.com/ja_jp/efs/latest/ug/limits.html
お金をガソリンに、常にエンジン全開で動かすことが出来るみたいなので、速度が少しは上がるはず・・・!
このあたりを行う・・・と思いましたが、いくら掛かるのかまだ試算出来てないので、一旦ここまで。
調べたら測定して載せます。


