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

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

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

Eb5c860fdb2eb27dd54e1528475b0a00?s=128

Takatoshi Maeda

June 12, 2019
Tweet

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 買い物情報サービス「トクバイ」
  11. © 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.
  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 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
  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 コンテナ実行環境の選択 コンテナの構成 配置戦略 Deployment & Rollback アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン ίϯςφ࣮ߦ؀ڥͷબ୒ͱΦʔτεέʔϦϯάʹϑΥʔΧε
  17. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

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

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

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

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

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

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

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

    rights reserved. S U M M I T Amazon EC2 スポットインスタンスのコスト削減効果 Amazon EC2 スポットインスタンス適⽤後のAmazon EC2インスタンスコスト推移
  31. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. S U M M I T
  32. © 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
  33. © 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 → オートスケーリングの仕組みで緩和
  34. © 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.
  35. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

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

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

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

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

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

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

    rights reserved. S U M M I T オートスケーリングまとめ
  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
  53. © 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.
  54. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

    rights reserved. S U M M I T エンジニア絶賛募集中です https://corp.tokubai.co.jp/recruit/
  56. © 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
  57. © 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.
  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 アプリ関連リソースの取扱 秘匿値の取扱 オートスケーリング CI ロギング 起動時処理 etc… 安全なシャットダウン
  60. © 2019, Amazon Web Services, Inc. or its affiliates. All

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

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

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

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

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

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

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

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

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

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