From Monolithic to Microservices in 45 Minutes

44

Transcript of From Monolithic to Microservices in 45 Minutes

Page 1: From Monolithic to Microservices in 45 Minutes
Page 2: From Monolithic to Microservices in 45 Minutes

Monolithic to Microservices in 45 min

Page 3: From Monolithic to Microservices in 45 Minutes

Understand Scalability

Page 4: From Monolithic to Microservices in 45 Minutes

4

AgendaMonolithic ApplicationsMicroservicesBest PracticesHow it's Done

Page 5: From Monolithic to Microservices in 45 Minutes

Monolithic Applications

Page 6: From Monolithic to Microservices in 45 Minutes

"A monolithic application is self-contained, and independent from other computing applications. The design philosophy is that the application is responsible not just for a particular task, but can perform every step needed to complete a particular function"

Page 7: From Monolithic to Microservices in 45 Minutes

7

Page 8: From Monolithic to Microservices in 45 Minutes

8

Page 9: From Monolithic to Microservices in 45 Minutes

9

Monolithic Applications• It’s very easy to start building applications that become Monolithic

– Projects start small– If successful they will grow

Super Cool Application

UI Component

Business Logic

Persistency Layer

Page 10: From Monolithic to Microservices in 45 Minutes

Monolithic Applications

Super Cool Application

UI Component

Business Logic

Persistency Layer

Page 11: From Monolithic to Microservices in 45 Minutes

Monolithic Applications

Super Cool InstanceSuper Cool Instance

Super Cool InstanceSuper Cool Instance

Super Cool InstanceSuper Cool Instance

Super Cool InstanceSuper Cool Instance

Page 12: From Monolithic to Microservices in 45 Minutes

Decouple Applications

Page 13: From Monolithic to Microservices in 45 Minutes

"Decoupled architecture is a framework for complex work that allows components to remain completely autonomous and unaware of each

other"

Page 14: From Monolithic to Microservices in 45 Minutes

Decoupling your applicationsSuper Cool Application

UI Component

Business Logic

Persistency Layer

Page 15: From Monolithic to Microservices in 45 Minutes

15

Reasons to Decouple

• The different components of your application have different:– Density– Release and Development cycles – Requirements

• Functional• Architecture

Page 16: From Monolithic to Microservices in 45 Minutes

Decoupling your applications

UI Layer

Business Service Layer

Scalable Data Layer

Page 17: From Monolithic to Microservices in 45 Minutes

… for scalability

UI Layer

Business Service Layer

Scalable Data Layer

UI Layer

UI Layer

UI Layer

UI Layer

Page 18: From Monolithic to Microservices in 45 Minutes

… for different integrations

MobileUI

Business Service Layer

Scalable Data Layer

Web UI

MobileUI

Web UI

Specific UI

Page 19: From Monolithic to Microservices in 45 Minutes

… for function segregation

Page 20: From Monolithic to Microservices in 45 Minutes

… scale separately

Page 21: From Monolithic to Microservices in 45 Minutes

Scale AxisY-axis: Functional Decomposition

X-axis: Functional Duplication Z-axis: Data Partitioning

Page 22: From Monolithic to Microservices in 45 Minutes

Microservices

Page 23: From Monolithic to Microservices in 45 Minutes

"Microservices is a software architecture style in which complex applications are composed of small, independent processes communicating with each other using language-agnostic APIs"

Page 24: From Monolithic to Microservices in 45 Minutes

Application Stack

UI Layer

Business Service Layer

Scalable Data Layer

Page 25: From Monolithic to Microservices in 45 Minutes

Microservices

Page 26: From Monolithic to Microservices in 45 Minutes

Microservices

Text Search

Recommendations Engine

Chat Service

Page 27: From Monolithic to Microservices in 45 Minutes

Microservices

Page 28: From Monolithic to Microservices in 45 Minutes

Microservices – Service Registry

Service Registry

Service Registry allows client side discovery of existing and available services

Page 29: From Monolithic to Microservices in 45 Minutes

Host OS

Virtual OS

Virtual OS

Virtual OS

Microservices – Virtual MachinesVirtual Machines are a familiar topic, it is the backbone of many PaaS and IaaS services out there

Page 30: From Monolithic to Microservices in 45 Minutes

Host OS

System Kernel

Microservices – ContainersContainers are a typical approach to deploy and maintain microservices because they're highly scalable and isolated.

Page 31: From Monolithic to Microservices in 45 Minutes

Microservices – Containers

Host OS

System Kernel

Host OS

System Kernel

Host OS

System Kernel

REHL v7 Windows 2008

Web Search v1Web Search v2

Page 32: From Monolithic to Microservices in 45 Minutes

Microservices – Clustering

Page 33: From Monolithic to Microservices in 45 Minutes

"I'm getting dizzy"

Norberto Leite – 2015/10/06

Page 34: From Monolithic to Microservices in 45 Minutes

MongoDB

Ops Manager

Page 35: From Monolithic to Microservices in 45 Minutes

35

MongoDB - Containerized

• Benefit from MongoDB Scalability– Replica Sets for HA– Sharding for Horizontal Scalability

But Keep In Mind: • Sharding requires knowing well your data• Replication is much more than just spinning a few more

instances!

Ops Manager is Important for these

environments!

Page 36: From Monolithic to Microservices in 45 Minutes

Use Cases

Page 37: From Monolithic to Microservices in 45 Minutes

Otto Use Case

Batch analytics Layer

Frontend – System

Profile Service Customer Service Session Service Persona Service

Shared Nothing architecture

Clear Isolation of services

Hundreds of Virtual Instances

Page 38: From Monolithic to Microservices in 45 Minutes

How to do it

Page 39: From Monolithic to Microservices in 45 Minutes

39

Best Approach• Start monolithic

– There's nothing wrong with starting small – Your team will be small enough so they will know all the code

• Start Decoupling when you grow – In number of features and functionality – In number of teams working side by side

• Go Microservices– When you become Netflix!

Page 40: From Monolithic to Microservices in 45 Minutes

40

When do Microservices Fail• Contracts

– It's important to agree on the interfaces– Developer Philosophical Beliefs

• Service Separation– Granularity – Dependencies

• Maintenance – Devops and Release Manager Burden– Monitoring– Orchestration

"…language-agnostic APIs"

"completely autonomous"

"composed of small, independent processes"

Page 41: From Monolithic to Microservices in 45 Minutes

41

Best Approach - Data• Replication from Day 0

– No excuses to have a single node in production• Shard when you grow

– Functionally – By Volume – Regionaly

• Ops Manager to the rescue– Makes you life easier!

Page 42: From Monolithic to Microservices in 45 Minutes

Now that you understand it… I hope

Page 43: From Monolithic to Microservices in 45 Minutes

Obrigado!

• Norberto Leite• Technical Evangelist• [email protected]• @nleite

Page 44: From Monolithic to Microservices in 45 Minutes