際際滷

際際滷Share a Scribd company logo
Split my monolith
The workshop
Photo : wikimedia
2022
Merci  nos sponsors
束Etoile損
束Flocon損
@florentpellet
LyonTechHub
@clem_bouillier @johan_alps
Split?
System resilience / Team scalability
Manage complexity
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
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?
Micro-services ?
Availability
99.999% uptime ?
Ex 99%^20 = 81%
Our Domain for
today
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
Database schema
Exercice 1:
Identify contexts in
data model
Split database
Ideal split of Trip table
Example: Table Trip
Exercise: Split the Booking table
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
How?
Bubble context
Autonomous bubble - synchronous
Autonomous bubble - state stream
Autonomous bubble - events
Autonomous bubble - notif. stream
Exposing legacy assets as services
Exercices
Scenario 1
Today is the day!
Everything is 鍖ooded!
Panic on board!
Lots of late trains, we need an
immediate solution.
Deadline: Yesterday
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
Scenario 1 - solution
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
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
Scenario 2 - a solution
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.
Scenario 2 - data, new point of view
Scenario 2 - data - solution
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
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
Scenario 3 - solution
Scenario 3 - solution
Final Notes
In-process sync event (method call)
Strangler 鍖g pattern
Strangler 鍖g pattern
paulhammant.com
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
Questions
La passion d'apprendre
formation.hackyourjob.com
https://www.domainlanguage.com/wp-content/uploads/2016/04/GettingStar
tedWithDDDWhenSurroundedByLegacySystemsV1.pdf
2022
Merci  nos sponsors
束Etoile損
束Flocon損
Thank you !

More Related Content

Split my monolith! Workshop