time: time from commit to deploy • Deployment frequency: deploys per developer per day • Reliability • Change failure rate: % of deployments that cause an outage • Mean time to recover from a deployment failure
distributed data • Testing: integration, end to end, … • Infra: monitoring, deploy, … • Correctly identifying service boundaries → bounded context • Refactoring a monolithic application to a microservice architecture
SELECT OrderTotal FROM Orders WHERE CustomerID = ? … SELECT CreditLimit FROM Customers WHERE CustomerID = ? … INSERT INTO Orders … … COMMIT TRANSACTION
• Domain model → collection of loosely connected aggregates Order customerID Address City Street OrderItem Quantity productID Customer CreditLimit Product Price Name
• Aggregate scope = Transaction scope → Service Order customerID Address City Street OrderItem Quantity productID Customer CreditLimit Product Price Name Order Service Customer Service Product Service
must be handled by a single aggregate. • Granularity leads different consistency and scalability Customer Order Product Customer Order Product Order Customer Product Consistency Scalability
gRPC, …) • Availability(N) = Availability(N1) x Availability(N2) x Availability(N3) x … • Recovering mechanism: retry Order Service Customer Service createOrder() POST /order reseveCredit() PUT /customer/id/credit
At least once delivery • Ordered delivery • Availability(N) = Availability(N1) Order Service Customer Service createOrder() POST /order reseveCredit() Message Broker
logic is easier to understand • Reduce cyclic dependencies • Simplified the business logic • Drawbacks • smart orchestrator tells dumb services what to do
data consistency • Preserve history → replay whole data • Support temporal queries • Simplify retroactive correction • Built-in auditing • Drawbacks • Unfamiliar programming model • Evolving the schema of long-lived events • Only supports PK-based access → CQRS
Data is distributed which create challenges • Use event-driven architecture for eventual consistency • Use Sagas to maintain data consistency across service • Understand Event Sourcing and CQRS