Java/Scala Lab 2016. Вадим Кузьменко: От монолита к...

13
OPOWER CONFIDENTIAL DO NOT DISTRI 1 From monolith to microservices or why cool theory could be a painful practice

Transcript of Java/Scala Lab 2016. Вадим Кузьменко: От монолита к...

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E1

From monolith to microservicesor why cool theory could be a painful practice

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E2

Boring Theory“Whenever a theory appears to you as the only possible one, take

this as a sign that you have neither understood the theory nor the problem which it was intended to solve.”― Karl Popper

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E3

Spherical Monolith Architecture in VacuumPros:

1. Simple to develop

2. Simple to deploy

3. Simple to scale

4. Simple to test

Cons:

1. Huge codebase

2. Need to deploy whole app

3. Loyalty to technology stack

chosen once

Don't put all your eggs in one basket

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E4

Spherical Microservice Architecture in VacuumCons:

1. Relationships could be tricky

2. Testing is more difficult

3. Complex deployment

4. Increased resource

consumption

Pros:

1. Easy to develop and

understand

2. Independent developing,

testing and deployment

3. Easy to scale

4. Fault tolerant

5. Easy to experiment with

technology stack

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E5

Theoretical Monolith to Microservices Migration1. Split up monolith by functionality

2. Find dependencies

3. Make each part as a service

4. ???

5. PROFIT

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E6

Funny Practice“It doesn't matter how beautiful your theory is, it doesn't matter how

smart you are. If it doesn't agree with experiment, it's wrong.”― Richard P. Feynman

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E7

Real Life Monolith architecture1. Your app knows how the T-Rex looks like

2. If it’s working do not touch it

3. If you know how to do better look at p.2

4. Monolith is huge and sometimes you think

even sales guys pushed some code there

5. Lucky you if test coverage exists

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E8

Real Life Microservice architecture1. You always depend from service which not released yet

2. Microservices are often macroservices

3. Microservices temporary depend from monolith

4. I’m joking not temporary

5. Regression testing is a significant challenge

Monolith

DB service

Feature Service A

Feature Service B

Feature Service C

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E9

Migration to microservices in practice1. Impossible to migrate by one shot

2. Microservice could become a new monolith

3. Two pizzas is not enough to feed your team

4. There is no place for refactoring

5. Dependencies Dependencies Dependencies

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E10

w

How to deal with it?“A man who carries a cat by the tail learns something he can learn in no

other way.” ― Mark Twain

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E11

Useful tips and tricks1. There is no silver bullet

2. Think about cross team communication

3. Think about shared resources

4. Think about regression testing

5. Think about integration in existing

infrastructure

6. Think about service size

7. Stay calm it’s real world, dude

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E12

Useful links and resources1. Igor Vahromeev: Archmage presentation on Opower Open Doors

2. Dropwizzard framework http://www.dropwizard.io/

3. Apache Zookeeper https://zookeeper.apache.org/

4. Any book of system analysis. Don’t you think microservice is a

brand new idea?

5. Choose your own ninja way

O P O W E R C O N F I D E N T I A L D O N O T D I S T R I B U T E13

Questions?