* EC2上のExpressのパフォーマンス検証 [#mbb64c4b] #setlinebreak(on); [[AWS EC2上で Expressアプリ起動]] でEC2に配備したアプリのパフォーマンスを検証してみた。 結果から書くと、かなり結果にバラつきが出た。 早い時は コネクションプール有りの Spring Boot よりも速かったが、たまに物凄く遅い時がある。 Express側の処理は 全てトランザクションを張るように変更したものを使用し、コネクションプール数は10から30で検証してみたが、 遅い時は、最速時の10倍以上の時間がかかる事があった。 ソースからインストールした nodejs のバージョンが v10.0.0-pre だった事が原因? (Express は 4.15.5) &br; #contents --関連 --- [[AWS LambdaでRDS接続時のパフォーマンス調査]] --- [[AWS EC2上で Spring Bootアプリ起動]] --- [[AWS EC2上で Expressアプリ起動]] --- [[Express(Nodejs)でWebAPI作成]] #html(<div style="width:40%;display:inline-block">) ** 環境等 [#of2a0cee] Nodejs : v8.9.0 Express : 4.15.5 コネクションプール数:10 - 30 で計測。 ※他、負荷の掛け方 、EC2インスタンスのスペック等は [[AWS LambdaでRDS接続時のパフォーマンス調査]] と同じ。 ** 結果 [#j6ab8dfc] Spring Boot と殆ど変わらない。(物凄く速い時もある) この程度の負荷だと、リソースの食い方も問題ないように見える。(貼ってないけど) &br; ** 詳細 [#m0500cf4] ◆express に 100ユーザが10回ずつアクセス(最速) #code(myterm2 nolinenums){{ Document Path: /book Document Length: 637 bytes Concurrency Level: 100 Time taken for tests: 6.594 seconds Complete requests: 1000 Failed requests: 0 Total transferred: 846000 bytes HTML transferred: 637000 bytes Requests per second: 151.65 [#/sec] (mean) Time per request: 659.394 [ms] (mean) Time per request: 6.594 [ms] (mean, across all concurrent requests) Transfer rate: 125.29 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 41 307 125.3 318 953 Processing: 81 314 59.2 329 428 Waiting: 81 313 59.3 329 427 Total: 122 621 153.9 651 1303 Percentage of the requests served within a certain time (ms) 50% 651 66% 660 75% 665 80% 670 90% 691 95% 712 98% 1086 99% 1136 100% 1303 (longest request) }} #html(</div>) #html(<div style="width:5%;display:inline-block">) #html(</div>) #html(<div style="width:40%;display:inline-block">) ◆express に 100ユーザが10回ずつアクセス(最遅) #code(myterm2 nolinenums){{ Document Path: /book Document Length: 637 bytes Concurrency Level: 100 Time taken for tests: 26.975 seconds Complete requests: 1000 Failed requests: 0 Total transferred: 846000 bytes HTML transferred: 637000 bytes Requests per second: 37.07 [#/sec] (mean) Time per request: 2697.520 [ms] (mean) Time per request: 26.975 [ms] (mean, across all concurrent requests) Transfer rate: 30.63 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 17 489 1123.3 292 11944 Processing: 21 457 1583.2 303 21544 Waiting: 21 455 1583.3 302 21544 Total: 46 946 1937.8 612 22231 Percentage of the requests served within a certain time (ms) 50% 612 66% 637 75% 651 80% 660 90% 1126 95% 4015 98% 4349 99% 13230 100% 22231 (longest request) #html(</div>) }}