Microservices Lessons Learned
CTO at Just Software @JustSocialApps Susanne Kaiser Independent Tech Consultant @suksr
@suksr #VoxxedMicroservices
Microservices Lessons Learned Susanne Kaiser Independent Tech - - PowerPoint PPT Presentation
Microservices Lessons Learned Susanne Kaiser Independent Tech Consultant @suksr CTO at Just Software @JustSocialApps #VoxxedMicroservices @suksr Each Journey is Different People try to copy Netflix, but they can only copy what they see.
@suksr #VoxxedMicroservices
Adrian Cockcroft, AWS VP Cloud Architect, former Netflix Chief Cloud Architect
@suksr #VoxxedMicroservices
Team
Structure Skillset Size
Journey
@suksr #VoxxedMicroservices
Team
Structure Skillset Size
Journey Legacy
Maintenance effort Runtime environment
@suksr #VoxxedMicroservices
Team
Structure Skillset Size
Journey Legacy
Maintenance effort Runtime environment
Strategy
New Features Timeline / Milestones
@suksr #VoxxedMicroservices
JUST DRIVE JUST CONNECT JUST LIST JUST WIKI JUST PEOPLE JUST NEWS JUST SOCIAL @suksr #VoxxedMicroservices
One team Single Unit One collaboration product One technology stack
@suksr #VoxxedMicroservices
@suksr #VoxxedMicroservices
Productivity suffered
@suksr #VoxxedMicroservices
Productivity suffered Usability/UX suffered
@suksr #VoxxedMicroservices
Productivity suffered Usability/UX suffered New features released slowly
@suksr #VoxxedMicroservices
JUST DRIVE JUST CONNECT JUST LIST JUST WIKI JUST PEOPLE JUST NEWS JUST SOCIAL
@suksr #VoxxedMicroservices
Well-defined responsibilites @suksr #VoxxedMicroservices
Organisation Product Software
@suksr #VoxxedMicroservices
Autonomous teams Develop independently Deploy independently Work at different parts independently Scale independently At different speed @suksr #VoxxedMicroservices
High cohesion within a service Loose coupling between services @suksr #VoxxedMicroservices
High cohesion within a service Loose coupling between services Bounded Context Related behaviour Semantic boundary around domain model Well-defined business function @suksr #VoxxedMicroservices
JUST DRIVE JUST CONNECT JUST LIST JUST WIKI JUST PEOPLE JUST NEWS
@suksr #VoxxedMicroservices
JUST DRIVE
@suksr #VoxxedMicroservices
JUST DRIVE
JUST PEOPLE @suksr #VoxxedMicroservices
state
REST API Application-Service Domain-Model DB Adapter Monolith
JUST DRIVE @suksr #VoxxedMicroservices
state
state document created by author
Monolith REST API Application-Service Domain-Model DB Adapter
@suksr #VoxxedMicroservices
state
state
Events
local copy
Message Broker
REST API Application-Service Domain-Model DB Adapter Message Broker Adapter Monolith publish subscribe
@suksr #VoxxedMicroservices
DB Adapter Message Broker Adapter Application-Service Domain-Model REST API Domain-Event
New UI New Business Logic New Data Structure
vs.
@suksr #VoxxedMicroservices
Monolith REST API REST API REST Client
@suksr #VoxxedMicroservices
Monolith REST API
Application-Service Domain-Model DB Adapter REST Client
Monolith uses extracted business logic @suksr #VoxxedMicroservices
Monolith
REST API Application-Service Domain-Model DB Adapter Events Message Broker Message Broker Adapter publish subscribe
@suksr #VoxxedMicroservices
vs.
@suksr #VoxxedMicroservices
JUST DRIVE JUST WIKI Fine-grained authorization Inter-service dependency @suksr #VoxxedMicroservices
I have a new service that needs authorization. Where is the authz service I could use? Not there, yet. Sorry! Ok, then I am putting my code to the place where authz handling exists … to the monolith.
Ok, then I am implementing authz in my local service.
@suksr #VoxxedMicroservices
Feeding the monolith Re-implementing authz w/ every new service
@suksr #VoxxedMicroservices
Authz Service @suksr #VoxxedMicroservices
Authz Service
translate
One stable common contract
translate translate
@suksr #VoxxedMicroservices
command query Events Message Broker publish subscribe command query
Events Message Broker publish subscribe
@suksr #VoxxedMicroservices
Message Broker
REST API
Remote query directly to source Events for notification @suksr #VoxxedMicroservices
Message Broker
Local copy of profile data ProfileUpdatedEvent
Events for data duplication @suksr #VoxxedMicroservices
Internal source of truth External source of truth
Multiple sources of truth Single source of truth
Events as first-class citizens
“Traditional” Event-Driven System Event Store
Event Log @suksr #VoxxedMicroservices
Messaging System Storage System Streaming Platform
Message Broker Event Log Event Stream @suksr #VoxxedMicroservices
Unbounded, ordered sequence
Key-value pair Continuously updating
@suksr #VoxxedMicroservices
Kafka Topic Lightweight embedded state store (disk-backed) Service Running in the same process
Loaded on startup of Microservice
@suksr #VoxxedMicroservices
Kafka Streams API
join filter group by aggregate etc. Changelog of state changes
KStream KTable
Snapshot of the latest value for each key
Kafka Stream-Table Duality
(key1, value1), (key2, value2), (key 1, value 3) key1 value3 → key2 value2 →
@suksr #VoxxedMicroservices
Kafka Table for enrichment Document Service Stream
REST API
Materialized View as State Store Stream-Table-Join @suksr #VoxxedMicroservices
Events for notification Events for data duplication
better decoupling
local dataset
Event streams as a shared source of truth
duplicating effort
service @suksr #VoxxedMicroservices
Hardware Data Store API API-Gateway Service Discovery Load-Balancer Message Broker Timeout-Handling Retries Idempotency Bulkheads Circuit Breaker Config-Mngmt. Monitoring Log Aggreation Metrics Distributed Tracing Health Checks SCM O/S Virtualization Container Runtime
Checkout Test Build
CI/CD Pipeline
Deploy
µService Backup Recovery
@suksr #VoxxedMicroservices
@suksr #VoxxedMicroservices
Hardware O/S Virtualization Container Runtime
O/S Orchestration Data Store µService
Start small
Handle cross-cutting concerns early Avoid a distributed monolith Be aware of affecting circumstances & Each journey is different :) Design event-driven & consider event streams as shared source of truth @suksr #VoxxedMicroservices Consider managed services to offload infrastructure complexities