Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DDD BELGIUM 2017 - The Dark Side of Event Sourcing

DDD BELGIUM 2017 - The Dark Side of Event Sourcing

Evolving software systems often includes data schema changes, and those cause the need for data conversion. This is no different in event sourced systems.

Converting data between schemas while continuing the operation of the system is a challenge.

In this talk, we will look at the possible conversion operations, the techniques to execute them, and strategies for deployment with zero-downtime.

We will look at the possibilities and the trade-offs for designing and implementing upgrades for event sourced systems.

Michiel Overeem

March 22, 2017
Tweet

More Decks by Michiel Overeem

Other Decks in Technology

Transcript

  1. type Attribute = string * System.Object type Event = string

    * Attribute[] type EventStream = string * (Event[] * System.DateTime)[] type EventStore = EventStream[] The structure of an Event Store
  2. But there is also a schema Which streams are known

    in the system? Which events are allowed in which streams? Which attributes are allowed in which events?
  3. Store level operations Add / remove streams Merge streams /

    split / … streams Stream level operations Add / remove events Merge events / split / … events Event level operations Add / update / remove attributes Merge attributes / split / … attributes How can we change it?
  4. Multiple versions: always extend Webshop EventStore Customer Stream ShoppingCart Stream

    CustomerSignedUp PriviligeUpgraded … AddedToChart ChangedQuantity …
  5. Multiple versions: always extend Webshop EventStore Customer Stream ShoppingCart Stream

    CustomerSignedUp PriviligeUpgraded … AddedToChart ChangedQuantity … Article Stream AddedToAssortment SoldOut …
  6. Multiple versions: always extend Webshop EventStore Customer Stream ShoppingCart Stream

    CustomerSignedUp PriviligeUpgraded … AddedToChart ChangedQuantity … Article Stream AddedToAssortment SoldOut … ChangedQuantity_V2
  7. Weakening the schema Which attributes can occure in which events?

    Which events can occure in which streams? Which streams can originate in the system?
  8. Webshop EventStore Customer Stream ShoppingCart Stream CustomerSignedUp PriviligeUpgraded … Upcasters:

    Evolve the events AddedToChart ChangedQuantity … ChangedQuantity_V2 CustomerSignedUp_V2
  9. Store level operations Add / remove streams Merge streams /

    split / … streams Stream level operations Add / remove events Merge events / split / … events Event level operations Add / update / remove attributes Merge attributes / split / … attributes Can we perform all operations?
  10. Store level operations Add / remove streams Merge streams /

    split / … streams Stream level operations Add / remove events Merge events / split / … events Event level operations Add / update / remove attributes Merge attributes / split / … attributes Can we perform all operations?
  11. Multiple versions Weak schema Upcasters Lazy transformation In place transformation

    Copy and transformation Functional suitability +/- - +/- +/- + + Comparing the approaches
  12. Multiple versions Weak schema Upcasters Lazy transformation In place transformation

    Copy and transformation Maintainability Comparing the approaches - +/- +/- +/- + +
  13. Multiple versions Weak schema Upcasters Lazy transformation In place transformation

    Copy and transformation Performance efficiency + + + +/- +/- - Comparing the approaches
  14. Multiple versions Weak schema Upcasters Lazy transformation In place transformation

    Copy and transformation Reliability + + + - - + Comparing the approaches
  15. Schema versioning Multiple versions Weak schema Upcasters Lazy transformation In

    place transformation Copy and transformation Schema evolution
  16. Runtime techniques Multiple versions Weak schema Upcasters Lazy transformation In

    place transformation Copy and transformation Non-runtime techniques
  17. Combining everything into a framework Data upgrade Deployed with Executed

    by Executed by Data upgrade Application upgrade Lazy transformation Upcasting In place transfor- mation Multiple versions Copy and transfor- mation Basic & Complex Event Basic & Complex Stream Basic Store Complex Store Big Flip Rolling Upgrade Blue-Green Expand- Contract Blue- Green Deployed with Combined with Weak schema
  18. What’s next? 1. Do interviews. Interested? Contact me! https://goo.gl/forms/7tuBKW39EPkWnZLG3 1.

    Write a follow up paper with more information. 2. Publish the experiences in some form.