Learn Adopt
Innovate #lai
Microservice Architectures
Danilo Poccia ‒ AWS Technical Evangelist@danilop
Why Microservices?
http://en.wikipedia.org/wiki/Multitier_architecture
As a Project scales Complexity arises
“Complexity arises when the dependencies among the elements
become important.”
Complex Adaptive Systems: An Introduction to Computational Models of Social Life
Scott E. Page, John H. Miller
Business Domain+
Loosely Coupled +
Bounded Context
Microservices
Independent Deployment
Single Responsibility Principle
“Gather together those things that change for the same reason, and
separate those things that change for different reasons.”
Robert C. Martin
Microservices
Choose the Right Tool
Microservices
Adopt New Technologies
Microservices
Culture of Automation
Adrian Cockcroft, Technology Fellow at Battery Ventures http://www.slideshare.net/adriancockcroft/goto-berlin
# Services > # Developers
How small is small?
Gall’s law
“A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
You have to start over with a working simple system.”
Systemantics: How Systems Really Work and How They Fail, John Gall,1975
“something that could be rewritten in two weeks”
Two Pizza Teams
Conway’s law
“organizations which design systems ... are constrained to produce designs which
are copies of the communication structures of these organizations”
Melvin Conway, 1968
Architecture
Dev
Ops
Microse
rvice
s
Feature Teams
Internal Open Source
SynchronousVs
Asynchronous
OrchestrationVs
Choreography
Distributed Systems
Independent ScalabilityAuto Scaling
Distributed Systems
Eventual ConsistencyIdempotent Operations
Robustness Principle / Postel's law
“be conservative in what you do,be liberal in what you accept
from others”
(form an early TCP specification)
Security
Least Privileges
Single Sign-On
Confused Deputy Problem (downstream calls
after authentication)
Testing
Automate
Service Tests
End-to-end Tests
Synthetic Transactions
Monitoring
Correlation ID
Standard Log format
Expose Service Metrics
From Log collection to Near Real-Time Event routing
Amazon CloudWatch Logs Amazon Kinesis
Understand your trends
Discovery
Self-Describing System
Amazon Route 53 (DNS)
AWS Resource Tagging
Amazon CloudWatch Events
Deployment Pipeline
Developer
Developer
Developer
Developer
Developer
Build
Stage #1 Stage #2 … Stage #N Production
Build Build Build Build
Developer
Developer
Developer
Developer
Developer
Build
Stage #1 Stage #2 … Stage #N Production
Build Build Build Build
Bug!
Developer
Developer
Developer
Developer
Developer
Build
Stage #1 Stage #2 … Stage #N Production
Build Build Build Build
Build Build Build Build Build
Build Build Build Build Build
Developer
Developer
Developer
Developer
Developer
Build
Stage #1 Stage #2 … Stage #N Production
Build Build Build Build
Bug!
Build Build Build Build Build
Build Build Build Build Build
Design for Failure
Degrade Functionality
"Jtecul" by own - Own work. Licensed under CC BY-SA 3.0 via Wikimedia Commons
http://commons.wikimedia.org/wiki/File:Jtecul.jpg#/media/File:Jtecul.jpg
CircuitBreakers
Amazon Route 53 Private DNS in VPC
Elastic / Application Load Balancing
CircuitBreakers Health
Checks
Migration from Legacy Monolith?
Look for the right “seam”
Disposable Infrastructure
Immutable Deployments
Why Docker?
VM Container
Amazon EC2 Container Service
A highly scalable, high performance container management service
Manage containers at any scale
Launch and terminate containers to clusters of instances on EC2
Run specific tasks or long-living services
https://github.com/aws/amazon-ecs-agent
Case
Studies
Why AWS Lambda?
AWS Lambda
Event driven,fully managed compute
Amazon EC2 Containers AWS LambdaOn-Premises
Weeks Minutes Seconds Milliseconds
Netflix Architecture
Netflix Architecture
Asgard, Amimator, Hystrix, Eureka, Cassandra, JVM,
Docker, …
On AWS
Hailo Architecture
Hailo Architecture
Hubot, Janky, Jenkins, Go, RabbitMQ, Cassandra,
Docker, …
On AWS
Sample Architecture
Sample Architecture
Content Management System Prototype
On AWS
Lambda Function
S3 Bucket#1
S3 Bucket#2
DynamoDBTable
ECSTask
ECSCluster
Images +
Medatada
UploadEvent
Notification
Thumbnail
Write Metadata
Run
Schedule
Read Metadata
Write “index.html”
1
2
3
CloudFront Distribution
Edge Location
User S3 Bucket#1
S3 Bucket#2
Iterate Continous Improvement
Kaizen
Microservice Architectures
Danilo Poccia ‒ AWS Technical Evangelist@danilop