Application Load Balancer
2016年9月21日
アマゾン ウェブ サービス ジャパン株式会社
ソリューションアーキテクト 辻 正史
本資料では2016年9月21日時点のサービス内容および価格についてご説明しています。
最新の情報はAWS公式ウェブサイト(http://aws.amazon.com)にてご確認ください。
資料作成には十分注意しておりますが、資料内の価格とAWS公式ウェブサイト記載の
価格に相違があった場合、AWS公式ウェブサイトの価格を優先とさせていただきます。
内容についての注意点
AWS does not offer binding price quotes. AWS pricing is publicly available and is subject to change in
accordance with the AWS Customer Agreement available at http://aws.amazon.com/agreement/. Any
pricing information included in this document is provided only as an estimate of usage charges for AWS
services based on certain information that you have provided. Monthly charges will be based on your actual
use of AWS services, and June vary from the estimates provided.
価格は税抜表記となっています。日本居住者のお客様がサービスを使用する場合、
別途消費税をご請求させていただきます。
アジェンダ
• Application Load Balancer 概要
• コンテントベースルーティング
• 複数ポート対応と動的ポートマッピング
• その他のアップデート
Application Load Balancer 概要
AWS Summit New York 2016 - Keynote
Werner Vogels が “Application Load Balancer” を発表!!
https://www.youtube.com/watch?v=b7yqd7z1RBQ
Application Load Balancer (ALB)
• 特徴 (https://aws.amazon.com/elasticloadbalancing/applicationloadbalancer/)
– レイヤー7のコンテントベースで、
ターゲットグループに対してルーティング
– コンテナベースのアプリケーションのサポート
– WebSocket と HTTP/2 のサポート
– 複数のアベイラビリティゾーンに跨って、高レベルの
耐障害性を実現
– ALB自体が自動的にキャパシティを増減
• 価格体系
(https://aws.amazon.com/jp/elasticloadbalancing/applicationloadbalancer/pricing/)
– ALBの起動時間
– Load Balancer Capacity Units (LCU)の使用量
レイヤー7のコンテントベースのロードバランサー
アベイラビリティ ゾーン a
ユーザー
アベイラビリティ ゾーン b
ALB
EC2
myLB-xxx.elb.amazonaws.com
EC2 EC2
ターゲットグループ ターゲットグループ
従来の ELB の位置づけ
Elastic Load Balancing(ELB)
L4 および一部 L7 機能を提供する
ロードバランサ―
Elastic Load Balancing(ELB)
意味として ALB/CLB を含んだ総称
Classic Load Balancer(CLB)
標準ロードバランサ―
L4 および一部 L7 機能を提供するロードバランサ―
Application Load Balancer(ALB)
アプリケーションロードバランサ―
L7 のコンテントベースのロードバランサ―
名称変更
コンテントベースルーティング
従来の ELB(現在の CLB)
http://www.example.com/products
一つの Endpoit に対して、
同一アプリケーション機能
を持つ複数のEC2に負荷分
散を行う
www.example.com
products 機能
order 機能
products 機能
order 機能
products 機能
order 機能
products 機能
order 機能
CLB によるコンテントベースルーティング
従来の ELB のみによるコンテントベースルーティングは
出来ないため、次の方式を検討
• サブドメインによるセグメンテーション
• Nginx によるセグメンテーション
サブドメインによるセグメンテーション方式
アプリケーションを複数の
サブ機能(サービス)に分
割する場合、従来は複数の
ELB を利用しサブドメイ
ンで Endpoint の分割を
行う等が必要
order.example.com
products.example.com products 機能
products 機能
order 機能
order 機能
CLB
CLB
Nginx によるセグメンテーション方式
www.example.com
products 機能
products 機能
order 機能
order 機能
Nginx
Proxy
Nginx
Proxy
CLB
Internal
CLB
Internal
パスによる
ルーティング
CLB
ALB によるコンテントベースルーティング
• 単一のロードバランサーで異なるアプリケーションへ
リクエストをルーティング可能
• EC2インスタンスはターゲットグループに登録され、
ルールに従いリクエストをターゲットグループに
ルーティング
• ターゲットグループ内で負荷分散
ALB によるコンテントベースルーティング
ALB を利用することで、
一つの ALB の背後に
複数の機能(サービス)を
提供することが可能
products 機能
products 機能
order 機能
order 機能
http://www.example.com/products
パス部分のパターンでターゲットグループに
振り分ける
/products
/order
www.example.com
ターゲットグループ
複数ポート対応と動的ポートマッピング
CLB:コンテナ化されたアプリでの制限
• コンテナ化されたアプリケーションは、1つのサーバー上で、
アプリごとに特定のポートを使ってサービスを提供
• ポートを分けることで、1つのEC2インスタンス上で、同じ
アプリを複数実行することができる
• これまでのELBでは、コンテナ化されたアプリの利用に制限
があった
– リスナーポートとアプリケーションが1対1でマッピング
– 個々のアプリケーションが使うポートを管理する必要性
– EC2インスタンス毎に1タスクにしか負荷分散できず、クラスタの
効率性が低い
CLB:コンテナ化されたアプリでの制限
タスクA
タスクA
Port 80
Port 100
タスクA
タスクA
Port 80
Port 80
インスタンス A
インスタンス A
インスタンス B
CLB CLB
ALB の対応: 複数ポートと動的ポートマッピング
• EC2インスタンスをターゲットグループに割り当てる際、
複数ポートを個別のターゲットとして登録することが可能
• 1つのEC2インスタンスに対して、複数ポートでの負荷分
散が可能
• ECSのServiceは、タスクがEC2上でスケジュールされる
時点で未使用のポートを選択
• ECSのServiceは、自動的にそのポートでタスクをロード
バランサに登録
ALB の対応: 複数ポートと動的ポートマッピング
タスクA
タスクA
Port 80
Port 100
インスタンス A
タスクA
タスクA
Port 80
Port 100
インスタンス A
インスタンス A
個別のターゲットとして、
ターゲットグループに登録
ターゲットグループ
タスクAPort 120
異なるポートにバランス可能
動的に追加可能
ALB
ALB のコンテナベースアプリケーション対応
ターゲットグループはECS
コンテナをサポート。
ロードバランサーのバック
エンドで、EC2とECSコン
テナの混在も可能
ターゲットグループ
Task
Task
Task
Task
EC2
EC2
ECS
Container
ECS
Container
その他のアップデート
プロトコルの追加サポートとメトリクスの改善
• Websocket
WebSocket は株価やスポーツの得点などページ内の動的な
データを配信するのに利用可能
• HTTP/2
HTTP 1.1プロトコルから多数の改善が行われ、1つのコネク
ションで上で複数のリクエストをサポート
• メトリクスの改善
ヘルスチェックをポートベースで実施し、許容するHTTPのレ
スポンスのレンジを指定でき、詳細なエラーコードも含まれる
ALB のリソース(1/2)
• ロードバランサー – ロードバランサーを表す最上位のリソー
ス (CLBでは唯一のリソース)
• リスナー – LB側の他の接続設定と同様に、ロードバランサで
Listenするポートとプロトコルを含む
• ターゲットグループ – EC2インスタンスなどのターゲットの
集合。インスタンス側の設定として、インスタンスで公開する
ポート、プロトコル、設定を含む
• ターゲット – ロードバランサーがトラフィックを転送するリ
ソースやエンドポイント
• ルール – リクエストがどのように転送されるかを条件とアク
ションで定義。パスベースの条件で、リクエストを転送するア
クションがサポートされる
ALB のリソース(2/2)
products 機能
products 機能
order 機能
order 機能
/products
/order
HTTP:80
HTTPS:443
リスナー
ルール
ターゲット
ターゲットグループ
CLBとALBの機能比較
Feature Classic Load Balancer Application Load Balancer
Protocols HTTP, HTTPS, TCP, SSL HTTP, HTTPS
Platforms EC2-Classic, EC2-VPC EC2-VPC
Sticky sessions (cookies) ✔ load balancer generated
Back-end server authentication ✔
Back-end server encryption ✔ ✔
Idle connection timeout ✔ ✔
Connection draining ✔ ✔
Cross-zone load balancing † ✔ Always enabled
Health checks † † ✔ Improved
CloudWatch metrics ✔ Improved
Access logs ✔ Improved
Path-based routing ✔
Route to multiple ports on a single instance ✔
HTTP/2 support ✔
Websockets support ✔
Load balancer deletion protection ✔
† ALBではクロスゾーン負荷分散は常に有効。
† † ALBでは、ヘルスチェックでHealthyとみなすHTTPレスポンスコードを設定可能。ALBではヘルスチェック失敗の情報提供を改善。
料金
ALB の使用時間と、Load Balancer Capacity Units(LCU)
の使用量で課金
• $0.0225/時間
• $0.008/LCU/時間
時間単価はCLBより 10% 安価
Load Balancer Capacity Units(LCU)
以下の 3 つのディメンションを測定し、使用量が最も高い
ディメンションのみ請求
• 新規接続数: 1 秒あたりの新しく確立された接続数
• アクティブ接続数: 1 分あたりのアクティブ接続数
• 帯域幅: ロードバランサーで処理されたトラフィック量(Mbps)
1 LCU には次のものが含まれる
• 2 KBの証明書の場合:1 秒あたり最大 25 個の新規接続
4 KBの証明書の場合:1 秒あたり最大 5 個の新規接続
• 1 分あたり最大 3000 個のアクティブ接続
• 最大 2.22 Mbps の帯域幅
移行ツール
Classic load balancer to
Application load balancer copy utility
https://github.com/aws/elastic-load-balancing-tools
既存のクラシックロードバランサと同じ設定で、
新しいアプリケーションロードバランサを作成可能
Application Load Balancer

Application Load Balancer

Editor's Notes

  • #4 Given that Containerized applications can send traffic to specific ports on a sever customer can then run many copies of an application on a single instance, However for the Standard LoadBalancer we are unable to take advantage of this due to the 1:1 Mapping of the Listener port to the Instance port Application.
  • #8 So at launch we will provide Path Based Routing . We will then release new features incrementally throughout the year. Future features will include: Websockets SNI CBR with Hostnames, cookies Custom error messages Custom headers. We are also working with other services, integrating with the likes of : Auto Scaling, Cloud formation, Elastic Beanstalk, ECS, AWS Config, AWS Certificate Manager and IAM
  • #10 So in the new Application LoadBalancer, you can have : one URL path that goes to one set of BE instances and another URL path the goes to another set of BE instances You can also set up the Application Loadbalancer to have one single Front end port (e.g. port 80), But now route traffic to 80:81 on the BE, or you can route traffic to 80:80 on the other BE. * So this gives us true multiple Port support on the BE!
  • #11 So at launch we will provide Path Based Routing . We will then release new features incrementally throughout the year. Future features will include: Websockets SNI CBR with Hostnames, cookies Custom error messages Custom headers. We are also working with other services, integrating with the likes of : Auto Scaling, Cloud formation, Elastic Beanstalk, ECS, AWS Config, AWS Certificate Manager and IAM
  • #12 So in the new Application LoadBalancer, you can have : one URL path that goes to one set of BE instances and another URL path the goes to another set of BE instances You can also set up the Application Loadbalancer to have one single Front end port (e.g. port 80), But now route traffic to 80:81 on the BE, or you can route traffic to 80:80 on the other BE. * So this gives us true multiple Port support on the BE!
  • #13 So in the new Application LoadBalancer, you can have : one URL path that goes to one set of BE instances and another URL path the goes to another set of BE instances You can also set up the Application Loadbalancer to have one single Front end port (e.g. port 80), But now route traffic to 80:81 on the BE, or you can route traffic to 80:80 on the other BE. * So this gives us true multiple Port support on the BE!
  • #14 So at launch we will provide Path Based Routing . We will then release new features incrementally throughout the year. Future features will include: Websockets SNI CBR with Hostnames, cookies Custom error messages Custom headers. We are also working with other services, integrating with the likes of : Auto Scaling, Cloud formation, Elastic Beanstalk, ECS, AWS Config, AWS Certificate Manager and IAM
  • #15 So in the new Application LoadBalancer, you can have : one URL path that goes to one set of BE instances and another URL path the goes to another set of BE instances You can also set up the Application Loadbalancer to have one single Front end port (e.g. port 80), But now route traffic to 80:81 on the BE, or you can route traffic to 80:80 on the other BE. * So this gives us true multiple Port support on the BE!
  • #17 Given that Containerized applications can send traffic to specific ports on a sever customer can then run many copies of an application on a single instance, However for the Standard LoadBalancer we are unable to take advantage of this due to the 1:1 Mapping of the Listener port to the Instance port Application.
  • #18 So in the new Application LoadBalancer, you can have : one URL path that goes to one set of BE instances and another URL path the goes to another set of BE instances You can also set up the Application Loadbalancer to have one single Front end port (e.g. port 80), But now route traffic to 80:81 on the BE, or you can route traffic to 80:80 on the other BE. * So this gives us true multiple Port support on the BE!
  • #19 Look at FAQ regarding ECS!
  • #20 So in the new Application LoadBalancer, you can have : one URL path that goes to one set of BE instances and another URL path the goes to another set of BE instances You can also set up the Application Loadbalancer to have one single Front end port (e.g. port 80), But now route traffic to 80:81 on the BE, or you can route traffic to 80:80 on the other BE. * So this gives us true multiple Port support on the BE!
  • #21 So in the new Application LoadBalancer, you can have : one URL path that goes to one set of BE instances and another URL path the goes to another set of BE instances You can also set up the Application Loadbalancer to have one single Front end port (e.g. port 80), But now route traffic to 80:81 on the BE, or you can route traffic to 80:80 on the other BE. * So this gives us true multiple Port support on the BE!
  • #23 And here are the definitions of the new resources we have just specified . We’ve talked about LBs We’ve talked about Listeners We’ve talked about TGs and Targets and how to register them. And we’ve introduced Rules – being made up of conditions and actions.
  • #24 And here are the definitions of the new resources we have just specified . We’ve talked about LBs We’ve talked about Listeners We’ve talked about TGs and Targets and how to register them. And we’ve introduced Rules – being made up of conditions and actions.
  • #25 So in the new Application LoadBalancer, you can have : one URL path that goes to one set of BE instances and another URL path the goes to another set of BE instances You can also set up the Application Loadbalancer to have one single Front end port (e.g. port 80), But now route traffic to 80:81 on the BE, or you can route traffic to 80:80 on the other BE. * So this gives us true multiple Port support on the BE!