Identify a candidate Does this feature need many changes? Is this feature causing technical risk? Choose an integration approach How to integrate the extracted service? Choose a migration strategy for data How to move the data to its own storage? Extracting services The process 1 2 3
Identify a candidate Does this feature need many changes? Is this feature causing technical risk? Choose an integration approach How to integrate the extracted service? Choose a migration strategy for data How to move the data to its own storage? Extracting services The process 1 2 3
Introduce a service layer for the feature If you don’t have it already Add an alternate path under a feature flag Beware that in-memory joins than may be needed Switch the traffic Now the code can be cleaned up Monolith as a gateway The process 2.1 2.2 2.3
def index likes = user_likes_service.public_track_likes( @user, pagination) respond collection_for(likes) end Monolith as a gateway Introduce a service layer for the feature
Introduce a service layer for the feature If you don’t have it already Add an alternate path under a feature flag Beware that in-memory joins than may be needed Switch the traffic Now the code can be cleaned up Monolith as a gateway The process 2.1 2.2 2.3
def public_track_likes(user, pagination) if $feature.active?(:use_likes_service, user) … else … end end Monolith as a gateway Add an alternate path under a feature flag
Introduce a service layer for the feature If you don’t have it already Add an alternate path under a feature flag Beware that in-memory joins than may be needed Switch the traffic Now the code can be cleaned up Monolith as a gateway The process 2.1 2.2 2.3
Introduce handlers for the paths This allows for intervention Add an alternate path under a feature flag This may imply invoking not only the new service Switch the traffic Now the code can be cleaned up Strangler The process 2.1 2.2 2.3
Introduce handlers for the paths This allows for intervention Add an alternate path under a feature flag This may imply invoking not only the new service Switch the traffic Now the code can be cleaned up Strangler The process 2.1 2.2 2.3
Introduce handlers for the paths This allows for intervention Add an alternate path under a feature flag This may imply invoking not only the new service Switch the traffic Now the code can be cleaned up Strangler The process 2.1 2.2 2.3
Identify a candidate Does this feature need many changes? Is this feature causing technical risk? Choose an integration approach How to integrate the extracted service? Choose a migration strategy for data How to move the data to its own storage? Extracting services The process 1 2 3
● Allows changing the storage engine ● Adds risk to the migration project ● I haven’t used it personally, more suitable for services extracted for feature changes. Choose a migration strategy for data New schema
● Low risk migration ● We usually move the reads slowly and then do a quick write path cut-over ● We’ve chosen this approach for services extracted due to technical risk Choose a migration strategy for data Same schema
● Systems that were reading directly from the DB ● How to cut-over writes ● Migrating events from the monolith to the service ● Outages Extracting services Some details I omitted