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

A Monolith on the Dissecting Table: The Strangler Fig Pattern in Action @ Devoxx Poland 2023

A Monolith on the Dissecting Table: The Strangler Fig Pattern in Action @ Devoxx Poland 2023

Abstract:

Many existing companies cannot just start over on the green field. Instead, significant maintenance efforts are necessary for aged applications, which usually exhibit a monolithic architecture based on traditional, potentially outdated tech stacks. Companies willing to shift towards distributed architectures and modern technologies are struggling because they don't know where and how to start.

This talk briefly introduces the strangler fig pattern, which enables a smooth and step-wise transformation of monolithic applications into separate (micro)services. The main focus of this practical session is a demo scenario, showing step-by-step how to extract a particular part of an existing monolith into a separate service. During the demo, we will also get in touch with popular technologies such as Kubernetes, Apache Kafka, Debezium, and MongoDB.

This session helps you to understand what it means to apply the strangler fig pattern to extract functionality from your monoliths. The learnings will empower you to gradually evolve existing applications into a (micro)service architecture and an en-vogue tech stack.

Demo Repository: https://github.com/hpgrahsl/sfp-devoxxpl23

Video Recording: https://www.youtube.com/watch?v=ty3pdFQgSRg

Hans-Peter Grahsl

June 02, 2023
Tweet

More Decks by Hans-Peter Grahsl

Other Decks in Programming

Transcript

  1. A Monolith
    on the Dissecting Table:
    The Strangler Fig Pattern
    in Action
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023

    View Slide

  2. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    2

    View Slide

  3. !
    It's me ... Hans-Peter
    • Developer
    !
    Advocate @ Red Hat
    • Open-Source Enthusiast
    • 4x Confluent Community Catalyst
    • MongoDB Champion since 2020
    • based in Graz, Austria
    "
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    3

    View Slide

  4. system migrations are challenging
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    4

    View Slide

  5. !
    What about
    the big rewrite
    and a hard cut-over? !
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    5

    View Slide

  6. BIG BANG migrations
    often doomed to failure
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    6

    View Slide

  7. "If you do a big bang
    rewrite, the only thing
    you're certain of is a big
    bang."
    — Martin Fowler
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    7

    View Slide

  8. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    8

    View Slide

  9. Migration Goal
    • gradually evolve from old into new
    • support (temporary) coexistence
    • avoid risky big bang rewrite
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    9

    View Slide

  10. strangler fig pattern
    to the rescue
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    10

    View Slide

  11. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    11

    View Slide

  12. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    12

    View Slide

  13. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    13

    View Slide

  14. strangler fig pattern
    by example
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    14

    View Slide

  15. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    15

    View Slide

  16. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    16

    View Slide

  17. Change-Data-Capture
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    17

    View Slide

  18. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    18

    View Slide

  19. Debezium's supported Databases
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    19

    View Slide

  20. Open-Source Change-Data-Capture
    • captures data changes by tapping into DB's TX log
    • change events propagated via Apache Kafka / Connect
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    20

    View Slide

  21. Open-Source Change-Data-Capture
    • captures data changes by tapping into DB's TX log
    • change events propagated via other messaging systems
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    21

    View Slide

  22. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    22

    View Slide

  23. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    23

    View Slide

  24. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    24

    View Slide

  25. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    25

    View Slide

  26. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    26

    View Slide

  27. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    27

    View Slide

  28. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    28

    View Slide

  29. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    29

    View Slide

  30. CDC Pipeline Concern #1
    We're leaking our
    data / domain model.
    I want an anti-corruption layer.
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    30

    View Slide

  31. Single Message Transforms
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    31

    View Slide

  32. Single Message Transforms
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    32

    View Slide

  33. CDC Pipeline Concern #2
    But this only replicates data
    "row by row".
    I might need aggregate structures.
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    33

    View Slide

  34. Stream Processor for Joining
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    34

    View Slide

  35. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    35

    View Slide

  36. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    36

    View Slide

  37. Wrapping Up
    • incremental migration → baby steps
    • pause / stop without losing spent $$$
    • extraction steps ideally reversible
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    37

    View Slide


  38. minimize migration risk
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    38

    View Slide

  39. Let's stay in touch!
    !
    @hpgrahsl
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    39

    View Slide

  40. !
    Give it a try!
    "
    • Strangler Fig Pattern Demo
    https://bit.ly/sfp-devoxxpl23
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    40

    View Slide

  41. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    41

    View Slide

  42. Links & Resources
    • Demo Repository
    https://github.com/hpgrahsl/sfp-devoxxpl23
    • Developer Sandbox for Openshift
    https://developers.redhat.com/developer-sandbox
    • Debezium Website
    https://debezium.io
    • Quarkus
    https://quarkus.io
    @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023
    42

    View Slide

  43. @hpgrahsl | #DevoxxPL - Kraków, Poland | 2023

    View Slide