reactive microservices architecture on aws
TRANSCRIPT
![Page 1: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/1.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sascha Möllering
Solutions Architect, @sascha242, Amazon Web Services Germany GmbH
Reactive Microservices Architecture
on AWS
![Page 2: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/2.jpg)
https://secure.flickr.com/photos/mgifford/4525333972
Why are we
here today?
![Page 3: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/3.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
What is Reactive Architecture?
How to build Reactive Architectures on AWS?
Application Architecture
Deployment
![Page 4: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/4.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Reactive Architecture?
What is Reactive Architecture?
![Page 5: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/5.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Database
Synchronous
User waits
for update
N-Tier architecture
StorageAPI
Frontend
Servers
Poll PollQueries
![Page 6: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/6.jpg)
Software moves
faster today
![Page 7: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/7.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Traditional style of
applications cannot deliver
on these requirements any
longer
![Page 8: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/8.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Responsive
Elastic Resilient
Message-driven
Reactive Applications
![Page 9: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/9.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Reactive Architecture
“A development model focusing
on the observation of data
streams, reacting on changes,
and propagating them.”
Reactive programming
“An architecture style used to
build responsive and robust
distributed systems based on
asynchronous message-
passing.”
Reactive system
![Page 10: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/10.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Reactive Architecture
• Asynchronous message passing
• Non-blocking
• Higher throughput
• Efficient compute utilization and lower costs
![Page 11: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/11.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Reactive Architecture
• Loosely coupled
• Location independent
• Easy to extend and maintain
• Push-based
![Page 12: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/12.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Microservices
![Page 13: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/13.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Microservices should be
stateless.
Keep state in managed services.
![Page 14: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/14.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
No shared libraries or
shared SDKs.
![Page 15: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/15.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Avoid
Host-Affinity.
![Page 16: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/16.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Use lightweight
protocols for
communication.
![Page 17: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/17.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Use mechanisms for
registration.
![Page 18: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/18.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How to build Reactive Architectures
on AWS?
![Page 19: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/19.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Customer visits
websiteCustomer clicks
on a banner
Customer buys
from online-shop
Example use case
Banner
![Page 20: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/20.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
High Level Architecture
![Page 21: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/21.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Elastic
Container Service
Application
Load Balancer
Amazon Elastic
Container Registry
Amazon
Kinesis Data
Streams
Amazon
Kinesis Data
Streams
AWS
Lambda
AWS
LambdaAmazon
ElastiCache
Data ingestion
Core data
update
Amazon
DynamoDB
Core data updates
Data Collection
![Page 22: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/22.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
High Level Architecture
• Amazon ECS and Docker used for the main
application
• Fargate launch type
• Resiliency and elasticity implemented by
using auto scaling
Amazon Elastic
Container Service
![Page 23: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/23.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
High Level Architecture
• AWS Lambda functions consume messages
• Persist data in NoSQL-store
• Update core-data in Redis
• Send notifications to main application
• Resiliency and scalability part of the service
AWS Lambda
![Page 24: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/24.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
High Level Architecture
• Amazon Kinesis Data Streams used to
decouple components
• Asynchronously push event data to NoSQL-
store
• Update core-data in Redis
Amazon Kinesis
Data Streams
![Page 25: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/25.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
High Level Architecture
• Amazon ElastiCache with Redis 3 engine
• Multi-AZ setup with failover and one shard
• Used to store core-data
• Notification channel
• Redis supports pub/sub
Amazon ElastiCache
![Page 26: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/26.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
High Level Architecture
• Amazon DynamoDB NoSQL-store used to
persist event-data
• Backup and restore
• Encryption at rest
Amazon DynamoDB
![Page 27: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/27.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 28: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/28.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application Architecture
![Page 29: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/29.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application
Load Balancer
Amazon
Kinesis Data
Streams
Amazon
Kinesis Data
Streams
AWS
Lambda
AWS
LambdaAmazon
ElastiCache
Data ingestion
Core data
update
Amazon
DynamoDB
Core data updates
You are here now!Data Collection
Amazon Elastic
Container Service
Amazon Elastic
Container Registry
![Page 30: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/30.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application Architecture
![Page 31: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/31.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Source: http://vertx.io/docs/guide-for-java-devs/
Application Architecture
![Page 32: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/32.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Source: http://vertx.io/docs/guide-for-java-devs/
Application Architecture
![Page 33: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/33.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Source: http://vertx.io/docs/guide-for-java-devs/
Application Architecture
![Page 34: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/34.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application Architecture
• HttpVerticle: exposes HTTP endpoint
• CacheVerticle: implements L1 cache
• RedisVerticle: implements Redis access
• KinesisVerticle: messages to Amazon Kinesis Data
Stream
![Page 35: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/35.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Subscribe to event bus
Send data to Kinesis stream
Convert data
![Page 36: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/36.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application Architecture
![Page 37: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/37.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Subscribe to EB
Subscribe to
Redis channel
Consume
data from
event bus
Send data to
cache verticle
![Page 38: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/38.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application
Load Balancer
Amazon
Kinesis Data
Streams
Amazon
Kinesis Data
Streams
AWS
Lambda
AWS
LambdaAmazon
ElastiCache
Data ingestion
Core data
update
Amazon
DynamoDB
Core data updates
You are here now!Data Collection
Amazon Elastic
Container Registry
Amazon Elastic
Container Service
![Page 39: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/39.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda
Application Architecture
![Page 40: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/40.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda considerations and best practices
AWS Lambda is stateless—architect accordingly
• Assume no affinity with underlying compute
infrastructure
• Local filesystem access and child process may not
extend beyond the lifetime of the Lambda request
![Page 41: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/41.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Iterate over
batch of events
Unmarshal
protobuf messages
Map to struct
![Page 42: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/42.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Design principles
• Use push instead of pull
• Avoid blocking calls
• Decouple your services using async message passing
• Keep state in managed services
• Use caching
![Page 43: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/43.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deployment
![Page 44: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/44.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deployment
AWS CloudFormation
![Page 45: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/45.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda function
configuration
S3 Bucket
and
filename
![Page 46: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/46.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ECS
Launch
Type
CPU and
RAM
Network
mode
![Page 47: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/47.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon API
GatewayAWS Lambda Amazon
DynamoDB
Go build something!
![Page 48: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/48.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Related Sessions
Container-based Architectures on AWS (Blackfoot)
Kubernetes Running on AWS (Blackfoot)
Serverless Architectural Patterns (Amelia)
Deep Dive into Concepts and Tools for Analyzing
Streaming Data on AWS (Coral)
![Page 49: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/49.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Question? Ask this guy
at the Ask an Architect
booth:
![Page 50: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/50.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Please complete the session
survey in the summit mobile app.
![Page 51: Reactive Microservices Architecture on AWS](https://reader030.vdocuments.us/reader030/viewer/2022012703/61a5bb981545a57bc8435eab/html5/thumbnails/51.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!