LoginSignup
2
1

More than 5 years have passed since last update.

PublicとInternalのELBでどの程度レスポンスが違うのか気になったので見てみた

Posted at

ふと気になったので調べてみただけの話。あまり参考になる内容ではないかもしれないがメモとして。

ELBは2種類

Public

昔からあるやつ。インターネットからトラフィックを受け取ってVPC内のサーバーに割り振る。

Internal

VPC内に置ける内部割り振り用のELB。VPC内にあるので外に漏らしたくない通信や、中で完結出来る物はこちらを使うと良い。

Internal ELBはやはり速度も速いのか?

環境

  • ec2 instanceにnginxを立てる。publicに静的fileを一つだけ置いておいてそれを返すようにする。
  • publicなELBを立てて、作ったec2を紐づける。
  • internalなELBを立てて、作ったec2を紐づける。
  • 同じVPC内のec2上からパフォーマンスを計る。

コマンドはこんな感じ。

$ for i in $(seq 1 20); do curl -kL 'http://test.local/test.html' -o /dev/null -w "%{time_total}" 2> /dev/null; echo ""; sleep 0.5; done;

そこまで大きな差はなかった

internalの結果

誰がどう見ても安定している。どう見ても平均は約0.08。

$ for i in $(seq 1 20); do curl -kL 'http://test.local/test.html' -o /dev/null -w "%{time_total}" 2> /dev/null; echo ""; sleep 0.5; done;
0.008
0.008
0.008
0.008
0.010
0.008
0.008
0.008
0.008
0.008
0.008
0.008
0.008
0.008
0.008
0.008
0.008
0.008
0.008
0.008

Publicの結果

平均は、0.010。そんなにばらつきも無い。
差は、0.002秒。人間が分かる差ではない。

$ for i in $(seq 1 20); do curl -kL 'http://test.co.jp/test.html' -o /dev/null -w "%{time_total}" 2> /dev/null; echo ""; sleep 0.5; done;
0.017
0.012
0.008
0.011
0.008
0.010
0.008
0.012
0.008
0.011
0.008
0.012
0.009
0.011
0.008
0.011
0.009
0.010
0.008
0.010

まとめ

一度インターネットを経由するといっても地理的に同じところにまたアクセスするので予想以上に差がなかった。
まあパフォーマンス以前に内部で閉じる事が可能なトラフィックは内部で閉じるというのは鉄則ですね。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1