Share
Embed
B2Cビジネスの本番環境で必要な継続性と高レスポンス性能を支えるコンテナアーキテクチャ / AWSSummit 2019 Tokyo
Takatoshi Maeda
June 12, 2019
Transcript
74 slides
-
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T S U M M I T TO KYO -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. S U M M I T B2Cビジネスの本番環境で必要な継続性と ⾼レスポンス性能を⽀えるコンテナアーキ テクチャ 前⽥ 卓俊 取締役 CTO 株式会社トクバイ I 1 - 0 4 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T ⾃⼰紹介 • 前⽥ 卓俊(@takatoshi-maeda) • 株式会社トクバイ 取締役CTO • 経歴 • SIer -> スタートアップCTO -> Web サービス事業会社 -> 2016年より現職 • インターネットサービス開発全般を担当 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Agenda -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 買い物情報サービス「トクバイ」 国内最⼤級のチラシ・買い物情報配信サービス -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 買い物情報サービス「トクバイ」 •جૅͱͳΔνϥγܝࡌͷ ࣄલߘ •ܾ·ΔʮϦʯͷ ߘ ΠϚͷ͓ങ͍ಘΛಧ͚Δ -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 買い物情報サービス「トクバイ」 お店から⼊稿された情報をワンストップでマルチプラットフォームに展開 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 買い物情報サービス「トクバイ」 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T receipon digdag staff-admin ssh-gw redash zabbix staging ETL bargain-web kuroko2 stns prometheus tokubai-news kago ecs-scaler redash fluentd misc admin kinu batch-worker search mail backyard(API) logend mobile-pusher rproxy varnish batch background- job(sidekiq) loconavi-web remote-build prometheus -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T receipon digdag staff-admin ssh-gw redash zabbix staging ETL bargain-web kuroko2 stns prometheus tokubai-news kago ecs-scaler redash fluentd misc admin kinu batch-worker search mail backyard(API) logend mobile-pusher rproxy varnish batch background- job(sidekiq) loconavi-web remote-build prometheus -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T receipon digdag staff-admin ssh-gw redash zabbix staging ETL bargain-web kuroko2 stns prometheus tokubai-news kago ecs-scaler redash fluentd misc admin kinu batch-worker search mail backyard(API) logend mobile-pusher rproxy varnish batch background- job(sidekiq) loconavi-web remote-build prometheus -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン ຊ൪ڥͰͷӡ༻ͰͷϙΠϯτઃܭஅଟ͍ -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン ίϯςφ࣮ߦڥͷબͱΦʔτεέʔϦϯάʹϑΥʔΧε -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実⾏環境の選択 "NB[PO&$εϙοτΠϯελϯεΛར༻ͨ͠ίετઓུ -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T オートスケーリング 4QPU'MFFUΛओ࣠ͱͨ͠ΦʔτεέʔϦϯά -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実⾏環境の選択 AWS Fargate Amazon EC2 Elastic Container Service Service EC2 Cluster Fargate Cluster -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実⾏環境の選択 Amazon EC2 Elastic Container Service Service EC2 Cluster -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実⾏環境の選択 Elastic Container Service Service AWS Fargate Fargate Cluster -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T τΫόΠͰ"NB[PO&$ "NB[PO&$εϙοτΠϯελϯε Λར༻ -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Amazon EC2 スポットインスタンス -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Amazon EC2 スポットインスタンスの中断 Private subnet VPC AWS Cloud Availability Zone 1 Elastic Container Service Service EC2 Cluster x x -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T AWS FargateとEC2 Launch Typeのコスト⽐較 ˞ݫີʹൺֱ͢ΔͱNγϦʔζͷΈ&$6͕ҟͳΔ -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T εϙοτΠϯελϯεͰՔಇͤͨ͞߹ͷ ίετޮՌ -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Amazon EC2インスタンス全体のスポット⽐率 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Amazon ECSクラスタのSpot⽐率 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Amazon EC2 スポットインスタンスのコスト削減効果 Amazon EC2 スポットインスタンス適⽤後のAmazon EC2インスタンスコスト推移 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実⾏環境の選択 Amazon EC2 Elastic Container Service Service EC2 Cluster -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実⾏環境の選択 Amazon EC2 Elastic Container Service Service EC2 Cluster → オートスケーリングの仕組みで緩和 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T (改めて)なぜオートスケーリングが必要か ࣌ؒଳʹΑͬͯඞཁͳίϯϐϡʔςΟϯάϦιʔεྔมಈ αʔϏε݄ͱͱʹ͢Δ -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 解決する問題 需要に応じたAmazon EC2インスタンスの調整 Amazon EC2スポットインスタンスの中断耐性 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Private subnet VPC AWS Cloud Availability Zone 1 Elastic Container Service Service EC2 Cluster 需給に応じたAmazon EC2インスタンスの調整 x -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Amazon EC2 スポットインスタンスの中断耐性 Private subnet VPC AWS Cloud Availability Zone 1 Elastic Container Service Service EC2 Cluster x x -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T ecs-scaler Private subnet VPC AWS Cloud Availability Zone 1 Availability Zone 2 ecs-scaler spotfleet(lowest) spotfleet (diversified) ondemand autoscaling group -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 解決する問題 需要に応じたAmazon EC2インスタンスの調整 Amazon EC2スポットインスタンスの中断耐性 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T スケールアウト ecs-scaler Cloudwatch Alarm -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T スケールイン ecs-scaler Cloudwatch Alarm -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 解決する問題 インスタンスプールの分散 Amazon EC2スポットインスタンスの中断耐性 需要に応じたAmazon EC2インスタンスの確保 稼働タスクのオフロード -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T インスタンスプールの分散 Private subnet VPC AWS Cloud Availability Zone 1 Availability Zone 2 ecs-scaler spotfleet(lowest) spotfleet (diversified) ondemand autoscaling group -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Amazon EC2 SpotFleet lowest fleet(m5.large, r5.large, c5.large) diversified fleet(m5.large, r5.large, c5.large) m5.large m5.large m5.large m5.large m5.large m5.large m5.large m5.large m5.large m5.large r5.large c5.large m5.large r5.large c5.large m5.large r5.large c5.large -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 稼働タスクのオフロード ecs-scaler spotfleet(lowest) spotfleet (diversified) ondemand autoscaling group Cloudwatch Alarm Cloudwatch Event -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 中断時タスク停⽌の注意点 ecs-scaler spotfleet(lowest) spotfleet (diversified) ondemand autoscaling group Cloudwatch Alarm Cloudwatch Event -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 解決する問題 需要に応じたAmazon EC2インスタンスの調整 Amazon EC2スポットインスタンスの中断耐性 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実⾏環境の選択 Amazon EC2 Elastic Container Service Service EC2 Cluster -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T オートスケーリングまとめ -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 現状の課題 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T まとめ -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T エンジニア絶賛募集中です https://corp.tokubai.co.jp/recruit/ -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Thank you! S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Takatoshi Maeda https://twitter.com/takatoshimaeda -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T CI CircleCI ECR CodeBuild build -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T Deployment & Rollback Slack AWS Cloud VPC Availability Zone 1 Availability Zone 2 Private subnet Ruboty(chatbot) Auto Scaling group Auto Scaling group Deploy Target -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 設定値の取扱 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 設定値の取扱 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 設定値の取扱 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 起動時に必要なリソースの取扱 Private subnet VPC AWS Cloud Availability Zone 1 Availability Zone 2 S3 Asset bucket -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 設定値の取扱 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T ログなどの⽣成物の取扱 Private subnet VPC AWS Cloud Availability Zone 1 Availability Zone 2 Fluentd S3 system logs bucket -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 設定値の取扱 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナの構成 front app fluentd haproxy xray -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 設定値の取扱 -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T 配置戦略 Spread – InstanceId (HTTP Server / BackgroundJob) binpack – memory (BatchJob) -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. -
© 2019, Amazon Web Services, Inc. or its affiliates. All
rights reserved. S U M M I T まとめ