Mais conteúdo relacionado Semelhante a [CTO Night & Day 2019] グローバルのサービス展開に向けたマルチリージョンアーキテクチャ- #ctonight (20) Mais de Amazon Web Services Japan (20) [CTO Night & Day 2019] グローバルのサービス展開に向けたマルチリージョンアーキテクチャ- #ctonight1. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Morning Session
グローバルのサービス展開に向けた
マルチリージョンアーキテクチャ
2. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
⾃⼰紹介
吉⽥ 英世
シニアソリューションアーキテクト/部⻑
アマゾン ウェブ サービス ジャパン株式会社
技術統括本部 ゲームエンターテイメントソリューション部
某ゲーム会社でMMORPGのインフラエンジニア、組み込み系会社で
IoTのソフトウェアアーキテクトを経て、2014年にAWS⼊社。
3. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
本⽇の内容
単⼀のサービスをアクティブ/アクティブの
マルチリージョンで構成するためのテクニックをご紹介
※: アクティブ/スタンバイは今回は触れません
4. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
なぜマルチリージョンか︖
1.事業継続 / ディザスタリカバリ
Applications
in US-West
Applications
in US-East
Users from
San Francisco
Users from
New York
Service 1
Service 2
Service 3
Service 4
Service 1
Service 2
Service 3
Service 4
5. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
なぜマルチリージョンか︖
1.事業継続 / ディザスタリカバリ
2.地理的に分散しているユーザベースへの対応
~300ms
~140ms
法令やデータのレギュレーションなどの
コンプライアンス対応
エンドユーザへのレイテンシ対応
6. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
マルチリージョンで解決すべき問題
7. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
"One important secret about doing
active-active multi-region
architectures. Don't do it.”
「Active-Active Multi-Regionアーキ
テクチャを検討する際の重要な秘密は
やらないことである」
8. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
本当にマルチリージョンにする必要はありますか︖
Core to mission
Multi-Region
DNS routing
Single Region
Scheduled
Replication
Master/
Master
Near Real-Time
Eventual Consistency
from Master Copy
Master/
Replica
Read-Only Read-Write
マルチリージョンは⽩⿊
どちらかを選択するものではない
9. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS上でどのように
マルチリージョンのサービスを
構成するか︖
10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S U M M I T
Amazon Global Network
Redundant 100 GbE network
Private network capacity between
all AWS Regions, except China
The AWS Cloud spans:
189 Points of Presence
69 availability zones
22 geographic regions around the world*
*with announced plans for 9 more availability zones and four more regions in
Cape Town, Jakarta, and Milan.
11. Pattern 1: Read local, write global
Snapshots
AMIs:
Web, App,
Database
Web
Serv
er
App1
Serv
er
Databas
e Master
App2
Serv
er
App3
Serv
er
Web
Serv
er
App1
Serv
er
Databas
e Replica
App2
Serv
er
App3
Serv
er
us-west-2 ap-northeast-1
Snapshots
AMIs:
Web, App,
Database
Users in
San Francisco
Users in
Tokyoread read& write
write
Snapshots
Synchronization
Database
Synchronization
12. Pattern 2: Read local, write partitioned
Snapshots
AMIs:
Web, App,
Database
Web
Serv
er
App1
Serv
er
Databas
e Replica
App2
Serv
er
App3
Serv
er
Web
Serv
er
App1
Serv
er
Databas
e Master
App2
Serv
er
App3
Serv
er
us-west-2 ap-northheast-1
Snapshots
AMIs:
Web, App,
Database
Tokyo User
read & write
Snapshots
Synchronization
Database
Synchronization
visits Los
Angeles
Tokyo User
@ homeread
write
(shard @ app layer)
write
(shard @ app layer)
13. Pattern 3: Read local, write local
Snapshots
AMIs:
Web, App,
Database
Web
Serv
er
App1
Serv
er
Databas
e Master
App2
Serv
er
App3
Serv
er
Web
Serv
er
App1
Serv
er
Databas
e Master
App2
Serv
er
App3
Serv
er
us-west-2 ap-northheast-1
Snapshots
AMIs:
Web, App,
Database
Users in
San Francisco
Users in
Tokyoread read
Database
Synchronization
Multi-master, multi-region
15. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
マルチリージョン構成を実現する
AWSのサービスたち
16. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
S3クロスリージョンレプリケーション
AWSの他のリージョンに⾃動でデータをレプリケーション
• オブジェクト、バケット、プレフィックスを指定
• サーバサイド暗号化やKMSによる暗号化をサポート
• オーナーシップの上書き
• 宛先リージョンのオブジェクトオーナーに変更
Region A Region B
Cross-region connectivity
17. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
クロスリージョンリードレプリカ
with Amazon RDS and Amazon Aurora
Readが多いワークロードを⽔平にスケール
レポーティングクエリのオフロード
不具合時は簡単に再作成可能
クロスリージョンリードレプリカは異なるリージョン
にあるアプリケーションからより近い位置で
データ参照を可能とする
災害時、リードレプリカをマスタにプロモート
することで迅速な復旧が可能
Source
Database
Read
Replica
Read
Replica
フルマネージドなRDBMSのレプリケーションを簡単に実現
18. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Aurora Multi-Master
複数のAZにまたがって複数の読み書き
できるインスタンスを作成
インスタンスに障害が発⽣しても継続的
な書き込みの可⽤性を実現
(アプリケーション側でFailoverが必要)
マルチリージョンに対応予定︕
⾼速な書き込みのFailoverを実現
19. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DynamoDB global tables
グローバルに分散した、⾼パフォーマンスな
アプリケーションを構築可能
read/writeはどのリージョンでも可能
リージョン間のデータのレプリケーションは
ほとんどの場合数秒で⾏われる
Eventual Convergence with last-writer-
wins (データの⼀貫性について、同⼀アイテム
でWriteの衝突が発⽣した場合、最後に書き込
んだものが優先される)
フルマネージドなNoSQLデータベースをグローバル規模で実現
26. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Global Accelerator
Global
Accelerator
AWS ApplicationsClient
可⽤性 パフォーマンス
単⼀のグローバルIP
⾼度なトラフィック分散
EC2とELBをターゲット
簡単なセットアップできめ細かな制御
信頼性が⾼く⾼速なAWSバックボーン利⽤
27. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S U M M I T
すべてのクライアントは同じStatic IPを
ポイントし、⼀番近いPoPにルーティングされる
Global Accelerator endpoint with anycast IP
e.g., 54.86.52.59
AWS Global Accelerator の動作
28. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S U M M I T
AWS Region 1 AWS Region 2
3.10.3.1253.10.3.125
VPC VPC
29. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
マルチリージョンのリソース管理
マルチリージョンおよびクロスアカウント対応
AWS
CloudFormation
StackSets
プロビジョン/設定
AWS Config
Data Aggregation
リソース更新の
トラック
AWS Systems
Manager
Automation &
Inventory
オペレーション管理
Amazon CloudWatch
モニタリング/ロギング
30. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
マルチリージョン構成の事例
31. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Netflix
https://medium.com/netflix-techblog/vizceral-open-source-acc0c32113fe
33. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Tipsなど
34. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ネットワーク分断に対する耐性を持つ
(Tolerance for network partitioning)
あるリージョンでの障害が、別のリージョンのアプリケーションの障害
を引き起こしてはならない
request servingに対するリージョンの独⽴性 – あるリージョンから別
のリージョンに対して API call をしない
Region BRegion A Backbone
35. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
データレプリケーション要件を最⼩限に
全てのデータがレプリケーションされる必要があるか︖
もしyesなら, それらは同期レプリケーションされる必要があるか︖
全てのデータが連続的にレプリケーションされる必要があるか︖
36. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
データレプリケーションの概念
同期レプリケーション
⾮同期のほぼ継続的な
レプリケーション
⾮同期のバッチ
レプリケーション
トランザクション
カタログ情報
管理が最も困難
管理が容易
イベント
37. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
レイテンシの確認
https://clients.amazonworkspaces.com/Health.html
ご利⽤のPCからAWSの各エンドポイントへのレイテンシを測定
38. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
まとめ
マルチリージョンのActive-Activeアーキテクチャに
よってシステムの複雑性を増すため、マルチリージョン
の必要性について今⼀度よく考える
read local/write global、もしくはpartitioned writeの
デザインでレースコンディションを避けることがベスト
プラクティス
AWSはマルチリージョンのトラフィックルーティング
やデータの永続化に便利なサービスが充実︕