AWSのコンソールツールの実行負荷の比較
AWSのコンソールツール実行時の負荷について検証してみた。
- 対象のコマンド,コード
- 検証環境
- それぞれのツールの導入方法などは割愛。
- 実行するコマンド, コードは以下の通り
EC2 API Tools
$ ec2-describe-regions
AWS SDK for PHP
# describe_regions.php <?php require_once 'AWSSDKforPHP/sdk.class.php'; $ec2 = new AmazonEC2(); $response = $ec2->describe_regions(); var_dump($response->body);
負荷(dstatコマンドで実行時の負荷を計測)
平常時
$ dstat ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system-- usr sys idl wai hiq siq| read writ| recv send| in out | int csw 0 0 100 0 0 0| 592B 2362B| 0 0 | 0 0 |1004 435 0 0 100 0 0 0| 0 0 |1164B 242B| 0 0 |1021 16 0 0 100 0 0 0| 0 0 | 246B 258B| 0 0 |1006 23
EC2 API Tools
$ dstat ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system-- usr sys idl wai hiq siq| read writ| recv send| in out | int csw 0 0 100 0 0 0| 0 0 | 672B 746B| 0 0 |1005 49 14 1 85 0 0 0| 0 0 | 792B 388B| 0 0 |1006 152 59 2 39 0 0 0| 0 0 | 552B 388B| 0 0 | 999 488 75 3 22 0 0 0| 0 0 | 492B 388B| 0 0 |1009 507 64 2 34 0 0 0| 0 0 | 432B 388B| 0 0 |1011 353 67 1 32 0 0 0| 0 0 | 492B 534B| 0 0 |1021 422 25 1 74 0 0 1| 0 536k|4028B 1274B| 0 0 |1028 277 31 0 68 0 0 0| 0 0 |1737B 5226B| 0 0 |1029 105 89 2 10 0 0 0| 0 0 | 486B 258B| 0 0 |1012 190 21 1 77 0 0 0| 0 0 | 552B 706B| 0 0 |1015 145
AWS SDK for PHP
$ dstat ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system-- usr sys idl wai hiq siq| read writ| recv send| in out | int csw 0 0 100 0 0 0| 0 0 | 432B 388B| 0 0 |1011 19 1 1 99 0 0 0| 0 0 | 678B 1119B| 0 0 |1015 50 1 0 100 0 0 0| 0 0 |4155B 1247B| 0 0 |1024 29 0 0 100 0 0 0| 0 0 |1363B 1972B| 0 0 |1023 34
実行時間(timeコマンドで実行時間を計測)
EC2 API Tools
$ time ec2-describe-regions > /dev/null real 0m7.565s user 0m8.366s sys 0m0.231s
AWS SDK for PHP
$ time php describe_regions.php > /dev/null real 0m1.423s user 0m0.039s sys 0m0.008s
結論
- 圧倒的にSDK for PHPの方がサーバーにやさしかった。