More Related Content Similar to Best Practices for Building Multi-Region, Active-Active Serverless Applications (SRV425-R1) - AWS re:Invent 2018 (20) More from Amazon Web Services (20) Best Practices for Building Multi-Region, Active-Active Serverless Applications (SRV425-R1) - AWS re:Invent 20182. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Best Practices for Building Multi-region,
Active-active Serverless Application
Adrian Hornsby
Technical Evangelist
Amazon Web Services
S R V 4 2 5
3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Breakout repeats
Wednesday
Best Practices for Building Multi-Region, Active-Active Serverless Applications
2:30 PM - Venetian, Level 2, Venetian H
Friday
Best Practices for Building Multi-Region, Active-Active Serverless Applications
10:00 AM - Mirage, Antigua A
4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Before we get started, let’s take a look at some
fundamentals.
5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
About availability
Availability Downtime per year
99% (2-nines) 3 days 15 hours
99.9% (3-nines) 8 hours 45 minutes
99.99% (4-nines) 52 minutes
99.999% (5-nines) 5 minutes
99.9999% (6-nines) 31 seconds
6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Availability in series
Part X Part Y
A = Ax Ay
7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Availability in series
Component Availability Downtime
X 99% (2-nines) 3 days 15 hours
Y 99.99% (4-nines) 52 minutes
X and Y Combined 98.99% 3 days 16 hours 33 minutes
8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Availability in parallel
A = 1 – (1 – Ax)2
Part X
Part X
9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Availability in parallel
Component Availability Downtime
X 99% (2-nines) 3 days 15 hours
Two X in parallel 99.99% (4-nines) 52 minutes
Three X in parallel 99.9999% (6-nines) 31 seconds
10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Component redundancy increases availability
significantly!
11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
18 Geographic Regions
55 Availability Zones (AZs)
4 regions and 12 more Availability Zones announced
12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Region and Availability Zones
Region
Availability Zone a Availability Zone b Availability Zone c
data center
data center
data center
data center
data center
data center
data center
data center
data center
13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Multi-AZ architecture
Region
Availability zone a Availability zone b Availability zone c
Application
14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Serverless components
Region
Availability zone a Availability zone b Availability zone c
Serverless Components
15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
No servers to provision
or manage
Scales with usage
Never pay for idle Availability and fault tolerance
built in
Why serverless components??
16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why build a multi-region active-active
architecture?
17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Improve latency for end-users
18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Disaster recovery
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
19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Customers doing multi-region active-active
architecture?
20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Netflix 2013
21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Netflix 2016
22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Prerequisites to building a multi-region
architecture.
23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
CAP Theorem
Consistency Availability Partition Tolerance
Data is consistent.
All nodes see the same state.
Every request is non-failing. Service still responds as expected
if some nodes crash.
Distributed System
In the presence of a network partition, you
must choose between consistency and
availability!
24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Embrase eventual consistency
… if no new updates are made to a
given data item, eventually all
accesses to that item will return
the last updated value.
Availability
An eventually consistent system can
return any value before it converges!!
https://en.wikipedia.org/wiki/Eventual_consistency
Distributed System
Every request is non-failing.
25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Secure and reliable global network
26. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
27. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
28. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Global routing
29. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Routing policies with Route 53
RegionRegion
Application Application
30. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Latency based routing
RegionRegion
Application Application
31. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Geo-based routing
Region us-east-1Region us-west-2
Application Application
32. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Weighted round robin routing
Region us-east-1Region us-west-2
Application Application
33. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DNS failover
Region us-east-1Region us-west-2
Application Application
34. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Region us-east-1
Region us-west-2
https://globalddb.adhorn.me
Regional
API
Endpoint
Custom
Domain
Name
Regional
API
Endpoint
Custom
Domain
Name
API Gateway
35. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Build high performance, globally distributed applications
Low latency reads & writes to locally available tables
Disaster proof with multi-region redundancy
Easy to set up and no application rewrites required
Globally dispersed users
Replica (N. America)
Replica (Europe)
Replica (Asia)
Global App
Global Table
Amazon DynamoDB Global Tables
Fully managed, multi-master, multi-region database
36. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon S3 cross-region replication
Bucket with
objects
Bucket with
objects
37. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Multi-region multi-VPC connectivity
Region Region
VPC VPC
VPC
VPC
VPC
VPC
Peering
Amazon Backbone
Peering
https://aws.amazon.com/answers/networking/aws-multiple-region-multi-vpc-connectivity/
38. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Testing multi-region architecture.
39. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GameDay at Amazon
https://www.youtube.com/watch?v=zoz0ZjfrQ9s
40. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Chaos engineering
https://github.com/Netflix/SimianArmy
41. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
42. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Region us-east-1
Region us-west-2
Global Table
https://globalddb.adhorn.me
43. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Region us-east-1
Region us-west-2
Global Table
49. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Region us-east-1
Region us-west-2
Global Table
51. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Region us-east-1
Region us-west-2
Global Table
53. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Health checks with Route 53
54. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Shallow health check
Instance
Cache node
Email
database
Cluster
Are you healthy?
yes
55. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Shallow health check
Instance
Cache node
Email
database
Cluster
Are you healthy?
yes
56. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deep health check
Instance
Cache node
Email
database
Cluster
Are you healthy?
yes
Are you healthy?
yes
yes
yes
yes
57. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deep health check
Instance
Cache node
Email
database
Cluster
Are you healthy?
no
Are you healthy?
no
yes
yes
yes
58. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Region us-east-1
Region us-west-2
Global Table
https://globalddb.adhorn.me
Voilà!
59. Thank you!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Adrian Hornsby
@adhorn
60. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.