WHEN THE MONOLITH COLLAPSES Henning Teek PREVENT PITFALLS WHILE MIGRATING TO MICROSERVICES August 2019
WHEN THE MONOLITH COLLAPSES
Henning Teek
PREVENT PITFALLS WHILE MIGRATING TO MICROSERVICES
August 2019
!2
ABOUT ME
Henning Teek Senior Consultant / Cloud Native Developer
Storm Reply is Amazon AWS Premier Consulting Partner and is the company in the Reply group specialized in the design and implementation of innovative Cloud-based solutions and services.
• Software Architecture • Software Development • Build Management • CI / CD • DevOps
• Microservices • Databases • Event Driven Architecture • Domain Driven Design
• Conclusion
TODAY‘S AGENDA
MICROSERVICESFrom a monolith to multiple microservices
!5
MONOLITH VS MICROSERVICES
Does everythingMONOLITH
Does one thingMICROSERVICE
PROS
• Loose coupling • Scalability • Autonomy • Small teams
• Complexity • Eventual Consistency • Resource consumption
MICROSERVICESWhy?
CONS
• Build automation • Continuous Integration (CI) • Continuous delivery and deployment (CD)
!7
PREREQUESITESDon‘t even start without it!
!8
MONOLITH TO MICROSERVICEFirst steps
Loose coupling Scalability Autonomy Small teams
- - - - - - - -
!8
MONOLITH TO MICROSERVICEFirst steps
Loose coupling Scalability Autonomy Small teams
- - - -
DATABASESWhat about my data?
!10
DATABASE PER SERVICEDon’t touch my data!
- - - -
Loose coupling Scalability Autonomy Small teams
!10
DATABASE PER SERVICEDon’t touch my data!
Loose coupling Scalability Autonomy Small teams
+ + + + + +
PROS
• Flexibility • Performance
• Complexity
!11
POLYGLOT PERSISTENCERelational isn‘t always the answer!
CONS
RELATIONAL• Aurora • RDS • Redshift
• Dynamo DB • Document DB
!12
MANAGED SERVICES AWS Purpose-Built Databases
KEY-VALUE DOCUMENT
IN-MEMORY• Elasticache Redis • Elasticache
Memcached
• Neptune
GRAPH
• Timestream
TIME SERIES
EVENT DRIVEN ARCHITECTUREDon‘t ask, just listen!
+ + + + + +
!14
MESSAGE QUEUETo whom it may concern!
Loose coupling Scalability Autonomy Small teams
!14
MESSAGE QUEUETo whom it may concern!
Loose coupling Scalability Autonomy Small teams
+ + + + + + + +
PROS
• Loose coupling • Availabilty • Communication
patterns
• Complexity
!15
MESSAGINGHey you! Something happened!
CONS
AMAZON MQ• Apache Active MQ • JMS, NMS, AMQP, STOMP,
MQTT and WebSocket • Point-To-Point • Publish-Subscribe
• Standard / FIFO • High throughput • At-Least-Once Delivery • Exactly-Once Processing
• AWS Services as Source • Message Filtering / Fanout • Encryption • Mobile Push / SMS
!16
MANAGED SERVICES AWS Purpose-Built Messaging
AMAZON SQS AMAZON SNS
AMAZON PINPOINT• Customer centered • Email, Voice, Push
Notification and SMS • Audience Management • Campaings
• Real-time Video / Data • Scalable / Durable • Data Firehose • Data Analytics
AMAZON KINESIS
• Serverles Event Bus • Built-In / Custom Sources • At-Least-Once Delivery • IAM Integration
AMAZON EVENTBRIDGE
DOMAIN DRIVEN DESIGN
!18
EVENT SOURCINGHistory matters!
Status Total …
101
Shipped 1054.40 …
OrderCreated
OrderApproved
…
OrderShipped
Order 101
PROS
• Simplicity • Audit Log • Temporal Queries
• Queries
!19
EVENT SOURCINGHistory matters!
CONS
PROS
• Separation of concerns
• Multiple views
• Complexity • Code duplication • Eventual consistency
!20
CQRSCommand Query Responsibility Segregation
CONS
CONCLUSION
!22
CONCLUSION
• Database per Service• Polyglot persistence1DATABASES
• Loose coupling • Availabilty2EVENT DRIVEN
• Reduce complexity • Availabilty 3MANAGED SERVICES
• Optimised views • Audit log• Temporal queries
4DOMAIN DRIVEN DESIGN
THANK YOU