XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de...

12
MONOLITH TO SERVICES History of a pattern based transition Patrice Fricard - TechnicalArchitect

Transcript of XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de...

Page 1: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

MONOLITH TO SERVICESHistory of a pattern based transition

Patrice Fricard - TechnicalArchitect

Page 2: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

MONOLITH TO SERVICE: THE GENESIS

DAY 1:A simple business requirement is developed with different layer

DAY 2:We add new features keeping the good practices

DAY 5:The monster is born-hard to enhance functionally-hard to test-hard to upgrade technically

DAY 3:We add more and more features coupling layers

DAY 4:We take shortcuts to achieve go faster: no more layers

Any resemblance to real projects is purely coincidental.

Page 3: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

MONOLITH TO SERVICE: PREPARATION PHASE

HOW TO HUNT THE BEAST

« every battle is won before it is fought »

• KNOW YOUR ENEMY

• PREPARE YOUR WEAPONS

• APPLY YOUR STRATEGY

Page 4: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

Texte ici

THE CLOUD PATTERNS: THE MICROSERVICES ALLIES

Ambassador Valet Key

Throttling

Strangler

Command and Query Responsibility Segregation (CQRS)

Gateway Aggregation

Gateway Offloading

Gateway Routing

Gatekeeper

Health Endpoint Monitoring

Federated Identity

External Configuration StoreIndex Table

Leader ElectionMaterialized View

Queue-Based Load Leveling

Priority Queue

Pipes and Filters

Static Content Hosting

Sidecar

Scheduler Agent Supervisor

Sharding

Event Sourcing

Compute Resource Consolidation

Competing ConsumersCompensating Transaction

Circuit Breaker

Cache-Aside

Bulkhead

Backends for Frontends

Anti-corruption Layer

Retry

Microsoft Cloud Design Patterns

Page 5: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

MONOLITH TO SERVICE: STRANGLER PATTERN

STRANGLE THE BEAST

• Stop digging / Starving the beast

• Split front end & back end

• Extract Modules

STRANGLER PATTERN« Incrementally migrate a legacy system by gradually replacing specific pieces of functionality

with new applications and services. As features from the legacy system are replaced, the new

system eventually replaces all of the old system's features, strangling the old system and

allowing you to decommission it. »

https://docs.microsoft.com/en-us/azure/architecture/patterns/strangler

https://www.martinfowler.com/bliki/StranglerApplication.html

Page 6: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

MONOLITH TO SERVICE ANTI-CORRUPTION LAYER PATTERN

ISOLATE THE BEAST

Put your legacy in a well defined zone

• ANTI -CORRUPTION LAYER PATERN

• between legacy and new services

• between legacy and downstream application

Page 7: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

Texte ici

ASK YOU THE RIGHT QUESTION NOW

MONOLITH TO SERVICE: TRANSITION WAY

• HAVE WE AUTONOMOUS MODULES?

• Yes, so we can extract & refactor code in a service

• IS THE DATA MODEL FUNCTIONALLY CONSISTENT?

• No, you will have to send data to new service and legacy :(

• IS THE LEGACY FEEDING MULTIPLE DOWNSTREAM APPLICATION?

• Yes, rewrite with synchronization by replication

• No, rewrite with synchronization by aggregation

Page 8: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

Texte ici

DETAILS OF THE « SYNCHRONISATION BY AGGREGATION »

MONOLITH TO SERVICE: TRANSITION WAY

UI

GatewayRouting

Legacy

GatewayAggregation

NewServic

e

• USE OF ONE AGGREGATION GATEWAY and ONE ROUTING

GATEWAY

• GOOD SCENARIO

• no data duplication

• separation of responsibility

Page 9: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

Texte ici

DETAILS OF THE « SYNCHRONISATION BY REPLICATION »

MONOLITH TO SERVICE: TRANSITION WAY

UI

GatewayRouting

LegacyNew

Service

• USE OF ONE ROUTING GATEWAY

• WE DIDN’T HAVE TO MODIFY THE DOWNSTREAM FEEDING

Page 10: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

Texte ici

DETAILS OF THE DOUBLE FEEDING SCENARIO

MONOLITH TO SERVICE: TRANSITION WAY

UI

Gateway Aggregation& Routing

Legacy

GatewayAggregation

NewServic

e

• USE OF A DOUBLE AGGREGATION GATEWAY

• TECHNICALLY COMPLEX

• WE DID’NT HAVE TO TOUCH THE LEGACY

Page 11: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

Texte ici

INSURE THE DATA CONSISTENCY

MONOLITH TO SERVICE: TRANSITION WAY

UI

Gateway Aggregation& Routing

Legacy

GatewayAggregation

NewServic

e

• SIDECAR PATTERN

• we extended this pattern through a messaging bus

• but you can host it directly with your gatewaySIDECAR Consistency Check

Page 12: XebiCon'17 : Monolith to microservice, histoire d’une transformation centrée sur les patterns de transition - Patrice Fricard

Strangler is the key pattern

Ask you the 3 questions to find the best way

Not modifying the legacy is (y)our challenge