Upgrade to Pro — share decks privately, control downloads, hide ads and more …

B2Cビジネスの本番環境で必要な継続性と高レスポンス性能を支えるコンテナアーキテクチャ / AWSSummit 2019 Tokyo

B2Cビジネスの本番環境で必要な継続性と高レスポンス性能を支えるコンテナアーキテクチャ / AWSSummit 2019 Tokyo

Takatoshi Maeda

June 12, 2019
Tweet

More Decks by Takatoshi Maeda

Other Decks in Technology

Transcript

  1. © 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
  2. © 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
  3. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T ⾃⼰紹介 • 前⽥ 卓俊(@takatoshi-maeda) • 株式会社トクバイ 取締役CTO • 経歴 • SIer -> スタートアップCTO -> Web サービス事業会社 -> 2016年より現職 • インターネットサービス開発全般を担当
  4. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Agenda
  5. © 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.
  6. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 買い物情報サービス「トクバイ」 国内最⼤級のチラシ・買い物情報配信サービス
  7. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 買い物情報サービス「トクバイ」 •جૅͱͳΔνϥγܝࡌ঎඼ͷ ࣄલ౤ߘ •౰೔ܾ·Δʮ΢Ϧʯ঎඼ͷ౰ ೔౤ߘ ΠϚͷ͓ങ͍ಘ঎඼Λಧ͚Δ
  8. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 買い物情報サービス「トクバイ」 お店から⼊稿された情報をワンストップでマルチプラットフォームに展開
  9. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 買い物情報サービス「トクバイ」
  10. © 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.
  11. © 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
  12. © 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
  13. © 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
  14. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン ຊ൪؀ڥͰͷӡ༻Ͱͷ޻෉ϙΠϯτઃܭ൑அ͸ଟ͍
  15. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン ίϯςφ࣮ߦ؀ڥͷબ୒ͱΦʔτεέʔϦϯάʹϑΥʔΧε
  16. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実⾏環境の選択 "NB[PO&$εϙοτΠϯελϯεΛར༻ͨ͠ίετઓུ
  17. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T オートスケーリング 4QPU'MFFUΛओ࣠ͱͨ͠ΦʔτεέʔϦϯά
  18. © 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.
  19. © 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
  20. © 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
  21. © 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
  22. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T τΫόΠͰ͸"NB[PO&$ "NB[PO&$εϙοτΠϯελϯε Λར༻
  23. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Amazon EC2 スポットインスタンス
  24. © 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
  25. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T AWS FargateとEC2 Launch Typeのコスト⽐較 ˞ݫີʹൺֱ͢ΔͱNγϦʔζͷΈ&$6͕ҟͳΔ
  26. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T εϙοτΠϯελϯεͰՔಇͤͨ͞৔߹ͷ ίετޮՌ
  27. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Amazon EC2インスタンス全体のスポット⽐率
  28. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Amazon ECSクラスタのSpot⽐率
  29. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T Amazon EC2 スポットインスタンスのコスト削減効果 Amazon EC2 スポットインスタンス適⽤後のAmazon EC2インスタンスコスト推移
  30. © 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
  31. © 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 → オートスケーリングの仕組みで緩和
  32. © 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.
  33. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T (改めて)なぜオートスケーリングが必要か ࣌ؒଳʹΑͬͯඞཁͳίϯϐϡʔςΟϯάϦιʔεྔ͸มಈ αʔϏε͸೥݄ͱͱ΋ʹ੒௕͢Δ
  34. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 解決する問題 需要に応じたAmazon EC2インスタンスの調整 Amazon EC2スポットインスタンスの中断耐性
  35. © 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
  36. © 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
  37. © 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
  38. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 解決する問題 需要に応じたAmazon EC2インスタンスの調整 Amazon EC2スポットインスタンスの中断耐性
  39. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T スケールアウト ecs-scaler Cloudwatch Alarm
  40. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T スケールイン ecs-scaler Cloudwatch Alarm
  41. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 解決する問題 インスタンスプールの分散 Amazon EC2スポットインスタンスの中断耐性 需要に応じたAmazon EC2インスタンスの確保 稼働タスクのオフロード
  42. © 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
  43. © 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
  44. © 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
  45. © 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
  46. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 解決する問題 需要に応じたAmazon EC2インスタンスの調整 Amazon EC2スポットインスタンスの中断耐性
  47. © 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
  48. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T オートスケーリングまとめ
  49. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 現状の課題
  50. © 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.
  51. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T まとめ
  52. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T エンジニア絶賛募集中です https://corp.tokubai.co.jp/recruit/
  53. © 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
  54. © 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.
  55. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン
  56. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン
  57. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T CI CircleCI ECR CodeBuild build
  58. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン
  59. © 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
  60. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 設定値の取扱
  61. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T 設定値の取扱
  62. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 設定値の取扱
  63. © 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
  64. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 設定値の取扱
  65. © 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
  66. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 設定値の取扱
  67. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナの構成 front app fluentd haproxy xray
  68. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 設定値の取扱
  69. © 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)
  70. © 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.
  71. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T まとめ