際際滷s for the Split my monolith workshop.
How to split a monolith without sharing the database.
Whether you want to split into micro services or simply modularise your monolith into a "modular monolith" this worksop gives you some guidance.
7. How?
We all have seen failed
modularisations.
Our hypothesis is that it's often about
the database
https://twitter.com/mathiasverraes/status/711168935798902785?lang=en
8. Why is a shared DB bad?
- Is it a clear interface?
- Independent deployment?
- Where is the code that writes to / read from a column?
- Can we evolve the DB schema?
12. Train management
- Train routing:
- Specify itinerary between two stations
- Specify train topologies
- Schedule train
=> a train makes the same trip every day
- Booking:
- Allows our customers to book a train
- Tra鍖c info:
- Track train on a trip
- Detect delay
- Invoicing:
- Generate invoices and credits notes
19. Which domain depends on which data?
T: Tra鍖c info
B: Booking
R: Train routing
I: Invoicing
T,B,R
B,R
T,B,R
T,B,R
T,R,I
T,R,I
T,R,I
T,I
T
T
T,R,I
T,B,I
I
I
B, I
B, R, I
B, I
T, B, R, I
T, B, R, I
B
T, B, R, I
T,B
T, B, R, I
B, I
B, I
B, I
B, R, I
T, B, I
B, I
B, I
28. Scenario 1
Today is the day!
Everything is 鍖ooded!
Panic on board!
Lots of late trains, we need an
immediate solution.
Deadline: Yesterday
29. Scenario 1
Many technical problems occur
regularly in recent days
Deadline: Yesterday
We want to quickly set up a
dashboard indicating in "real time"
the number of people impacted.
We cannot a鍖ord to re-deploy the
legacy
Expected :
- Schema with modules, DB, API,
messages, models (use the legend)
- Messages frequency / data refresh
rate
- Make explicit any isolation
- Detail data for each post-its
31. Scenario 2
The storm is over.
The dashboard made it a lot
easier to prioritize various
incidents. We'll need a solid
architecture to build upon.
Deadline: Not de鍖ned
32. Scenario 2
Expected :
- Schema with modules, DB, API,
messages, models (use the legend)
- Messages frequency / data refresh
rate
- Make explicit any isolation
- Detail data for each post-its
The dashboard made it a lot
easier to prioritize various
incidents. We'll need a solid
architecture to build upon.
How would you do that given
enough time?
Deadline: Not de鍖ned
34. Scenario 2 - data
Expected :
- Which data is duplicated
- Where does it come from
- Who is the
Writer
Reader
Many technical problems occur
regularly in recent days
Try another representation based
on data model.
37. Scenario 3
We have a new nonon o鍖er (nogo train).
Improve business opportunity, but success
is not guaranteed.
Need to test without impact legacy and
reuse maximum functionality to reduce
costs.
Deadline: Month
38. Scenario 3
We have a new nonon o鍖er (nogo train).
How to integrate this o鍖er with the current
system?
- New commercial o鍖er : other
reduction cards, options to buy (wi鍖,
breakfast, cancellation insurance)
- Tra鍖c info and seat reservation
remain in the legacy
- A train is either completely nonon or
legacy o鍖er
Deadline: Month
Expected (context and data) :
- Schema with modules, DB, API,
messages, models (use the legend)
- Messages frequency / data refresh
rate
- Make explicit any isolation
- Which data is duplicated
- Where does it come from
45. Eventual Consistency is key
Most things can be
decoupled if allow a delay
in consistency (1s, 1min, )
Ex : The csv exports
CALM theorem
- State will ALWAYS be
consistent if we don't delete
information
Counter examples:
- Set di鍖erence
- Multiple processes doing
increment