A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A...

40
A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd [email protected]

Transcript of A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A...

Page 1: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES

Zhamak Dehghani @zhamakd [email protected]

Page 2: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

being unstuck accelerate growth enable rapid experimentation

� deconstruct the monolith

� transform � organization, infrastructure

Build services around the edges

� do it again!

Page 3: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

� Overview of microservices ecosystem

� 8 monolith decomposition guidelines

� 6 migration execution practices

Page 4: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

Microservices Ecosystem The dream

Page 5: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

ARCHITECTURE EVOLUTION TOWARDS MICROSERVICES

Monolith

Page 6: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

ARCHITECTURE EVOLUTION TOWARDS MICROSERVICES

Intelligently Integrated

Page 7: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

ARCHITECTURE EVOLUTION TOWARDS MICROSERVICES

Layered

Page 8: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

ARCHITECTURE EVOLUTION TOWARDS MICROSERVICES

Centrally Integrated

Page 9: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

ARCHITECTURE EVOLUTION TOWARDS MICROSERVICES

Microservices

Page 10: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

ARCHITECTURE EVOLUTION TOWARDS MICROSERVICES

Microservices ecosystem as a platform

Page 11: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 12: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

Monolith Evolution The battle

Page 13: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 14: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 15: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 16: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 17: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 18: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 19: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

Use social code analysis e.g. CodeScene.io Consult the business portfolio

5. Decouple What Matters

Customer Personalization

Page 20: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 21: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 22: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 23: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct
Page 24: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

Unit of evolution:

•  Decouple •  Redirect •  Retire

Atomic step

Architecture Fitness function output

e.g. Speed of experimentation

Time

Evolution of the architecture

8. Migrate in Atomic Evolutionary Steps

Page 25: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

A QUICK SUMMARY

1.  Warm up with simple and fairly decoupled capabilities

2.  Minimize dependency back to the monolith

3.  Split sticky capabilities early

4.  Decouple what matters: changes frequently and has high value to business

5.  Decouple vertically and release the data early

6.  Decouple capability not code

7.  Go macro first then micro

8.  Migrate in atomic evolutionary steps (use evolutionary architecture)

https://martinfowler.com/articles/break-monolith-into-microservices.html

Page 26: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

Migration Execution The climb

Page 27: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

The only thing a Big Bang re-architecture

guarantees is a Big Bang! - Martin Fowler

Page 28: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

Experiment speed

N * (N -1) ____________ 2

Complexity in integration

Page 29: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

0 50 100 150 200

Microservices Complexity

Possible number of connections

Experiment speed

10

45 1225

4950

19900

Page 30: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

Gateway

µS

Dynamic Discovery Traffic Routing Load Balancing

Resiliency Observability

Security Policy Enforcement

µS µS

µS

1. Manage complexity with dedicated infrastructure

Page 31: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

A service mesh is a dedicated infrastructure layer for making service-to-service communication safe, fast, and reliable. If you’re building a cloud native application, you need a service mesh!

” - WILLIAM MORGAN Co-creator of

Page 32: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

API MANAGEMENT CAPABILITIES

API Documentation API Discovery

API Testing

Developer notification

Developer Engagement

Monetization

API Lifecycle Management

API Analytics

API KPI

Observability Telemetry Distributed

Tracing Logs

Resiliency

Active Health Checks

Fault Injections

Circuit breaker

SERVICE MESH CAPABILITIES

API Gateway (Proxy)

Security

Traffic

Management Routing

Load Balancing

Page 33: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

Backend Infrastructure

Sidecar K8s Pod

APIs

Control Plane

Gateway

Backend Delivery Infrastructure

K8s Ingress Controller

Istio

Page 34: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

2. Apply platform thinking to remove friction

Experiment speed

security

Delivery Infrastructure

Data Infra.

Domain API •  Self-serve

•  Abstract complexity

•  As a Product

Page 35: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

3. Define Architecture Outcomes Track with Fitness Function

Experiment speed

security throughput

Experiment speed

Page 36: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

4. Measure, Measure, Measure Service KPIs

Experiment speed

security

throughput

Experiment speed

Service deployment frequency

Num apps built on a service API Service

API adoption lead time

Service API NPS

Page 37: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

5. Clarify Trade-offs & record them

security BUY

BUILD RE WRITE

REUSE

There are no solutions. There are only trade-offs.

- Thomas Sowell

Page 38: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

6. Align Organization

Experiment speed

•  Long-lived teams

•  Fluid team membership

•  Virtual teams

•  Open source ownership

•  DRI (Directly Responsible Individual)

•  Tech product owners

Page 39: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

A QUICK SUMMARY

1.  Manage complexity with a dedicated infrastructure

2.  Apply platform thinking to remove friction

3.  Define architecture outcomes and track with fitness function

4.  Define and measure service / API KPIs

5.  Clarify trade-offs and record them

6.  Align organization

Page 40: A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES › brands › sdd › library › Zhamak...A PRAGMATIC GUIDE FOR MIGRATING TO MICROSERVICES Zhamak Dehghani @zhamakd ... deconstruct

The Journey of a thousand miles begins with one step.

- Lao Tzu

THANK YOU!

@zhamakd [email protected]