Immutable Data for Scale, Flexibility and Safety: Event Sourcing and CQRS from the Trenches
At Atlassian, we are in the midst of rearchitecting our systems as microservices run in AWS to support the scale and flexibility we need. We have been building out a core identity component of our Cloud infrastructure in Scala, based on event sourcing and command-query responsibility separation (CQRS) in order to achieve this safely. With event sourcing, data is captured streams of immutable events to represent data instead of the traditional update-in-place paradigm. Streams can be easily replayed to restore system state up to any point in time to recover from bugs or failures. In combination with the CQRS pattern, we can seamlessly bring online new functionality requiring schema changes or new query patterns, and re-architect later for more scale simply by replaying and reinterpreting events into new microservices and ephemeral data stores. In this talk, we will describe the architecture of our system using AWS (DynamoDB, Kinesis and Lambda), design principles we’ve used, and most importantly technical and organisational lessons learned to help attendees avoid pitfalls we’ve come across.
Goals: By the end of the presentation, the audience should:
- have an understanding of event sourcing and CQRS including benefits and how it works
- have an understanding of design principles for event sourcing and CQRS, including event design, and surfacing eventual consistency through the application stack and in APIs.
- have an understanding of an architecture for an event sourced/CQRS-based application.
- have an appreciation of the challenges faced when building a system using techniques presented in the talk.