fly high with microservices architecture - jaxlondon.com · key benefits of microservices...

37
Angel Gruev 2017 Fly high with Microservices Architecture Splitting the Monolith www.dreamix.eu

Upload: others

Post on 01-Sep-2019

31 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Angel Gruev 2017

Fly high with Microservices Architecture Splitting the Monolith

www.dreamix.eu

Page 2: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Nice to meet you! I’m Angel from Dreamix.

www.dreamix.eu

Page 3: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Agenda

● How it all started?

● Key benefits of microservices

● Microservices and business capabilities

● What was our task and how we tackle it

● Time to Build and Deploy … automatically

● Are microservices the silver bullet ?

www.dreamix.eu

Page 4: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

What’s next?!

www.dreamix.eu

Software architecture evolution

Page 5: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

www.dreamix.eu

Software architecture evolution

2020’s

Pizza-oriented Architecture

Page 6: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

How it all started?

• Private Business jet aviation company

• In-house software solutions

• 250+ IT specialists worldwide

www.dreamix.eu

Page 7: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

How it all started?

• Several monolith applications with huge codebase

• Private Business jet company

• In-house software solutions

• 200+ IT specialits worldwide

www.dreamix.eu

Page 8: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

How it all started?

• Several monolith applications with huge codebase

• Private Business jet company

• In-house software solutions

• 200+ IT specialits worldwide

• Go to micro-service based approach

• New features as MS • Splitting the

monolith(s)

www.dreamix.eu

Page 9: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

What are microservices

Key Features

● Small and Focused on doing one thing well

● Autonomous

○ Can you make a change to a service and deploy it by itself without changing anything else ?

www.dreamix.eu

Page 10: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

What are microservices

Key Benefits

● Technology Heterogeneity

www.dreamix.eu

Page 11: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

What are microservices

Key Benefits

● Technology Heterogeneity

● Resilience

www.dreamix.eu

Page 12: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

What are microservices

Key Benefits

● Technology Heterogeneity

● Resilience

● Scaling

www.dreamix.eu

Page 13: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

What are microservices

Key Benefits

● Technology Heterogeneity

● Resilience

● Scaling

● Ease of Deployment

www.dreamix.eu

Page 14: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

What are microservices

Key Benefits

● Technology Heterogeneity

● Resilience

● Scaling

● Ease of Deployment

● Composability & Replaceability

www.dreamix.eu

Page 15: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

What are microservices

Key Benefits

● Technology Heterogeneity

● Resilience

● Scaling

● Ease of Deployment

● Composability & Replaceability

● Enforcing different security

www.dreamix.eu

Page 16: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Organization and business capabilities

www.dreamix.eu Source: http://martinfowler.com

“Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.”

Melvyn Conway, 1967

Page 17: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Organization and business capabilities

www.dreamix.eu Source: http://martinfowler.com

Page 18: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Microservice size

If you can’t feed a team with two pizzas, it’s too large. That limits a task force to five to seven people, depending on their appetites.

Jeff Bezos (Amazon)

Something that can be rewritten in 2-4 weeks

“Gather together those things that change for the same reason, and separate those things that change for different reasons.” SRP – Robert Martins

Page 19: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

The initial requirements

www.dreamix.eu

Page 20: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

The initial requirements

www.dreamix.eu

Calculate the flight time between 2 airports

Page 21: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Where is my service?

● The problems:

○ Many small services in the cloud

○ Constantly destroying and deploying new instances

○ Different environments

● How to specify the URL of the service?

● Dynamic Service Registries applications

■ Zookeeper

■ Netflix Eureka

■ Consul

www.dreamix.eu

Page 22: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Multiple configuration files

● Multiple services = many configuration files

● Multiple services * several environments = too many configuration files

www.dreamix.eu

Page 23: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Centralized configuration

www.dreamix.eu

Page 24: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Coming up with the first design

www.dreamix.eu

Inspired by Netflix stack And Spring-boot

Page 25: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Getting ready for High Availability

www.dreamix.eu

Page 26: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Orchestration vs. Choreography

Orchestration

www.dreamix.eu

Page 27: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Orchestration vs. Choreography

Choreography

www.dreamix.eu

Page 28: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Event driven approach

www.dreamix.eu

● Fire events on certain triggers

● Use message brocker

● Callbacks

Page 29: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

BUILD & DEPLOY

www.dreamix.eu

Automatically!

Page 30: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Source repositories and CI

● The monolithic approach

● The improved monolithic approach

www.dreamix.eu

Page 31: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Source repositories and CI

● The microservice approach

www.dreamix.eu

Page 32: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

How many services per machine ?

● Multiple services per one host

○ Hard to monitor and hard for problem determination

● Application containers

○ Example: One JVM hosting different service artifacts (wars)

● Single service per host

○ Easier to monitor and easier to scale

● Platform as a service

○ Automatically provisioning

○ Automatic scaling

www.dreamix.eu

Page 33: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Docker

www.dreamix.eu

● Using existing Linux containers feature

Page 34: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Kubernetes & Docker

www.dreamix.eu

Page 35: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

Zero-downtime deployments

www.dreamix.eu

1. Build new version docker image

2. Deploy to K8s

3. Health-check OK

4. LB routes to new version only

5. Wait for active request on the old version

6. Undeploy old version

Page 36: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

No Silver Bullet

● Pay special attention to logging and problem determination

● Prepare for even more failures

○ Chaos Monkey

● Timeouts and Circuit Breakers

● Consider Initially go for monolith with well established modules and bounderies

www.dreamix.eu

Page 37: Fly high with Microservices Architecture - jaxlondon.com · Key benefits of microservices Microservices and business capabilities What was our task and how we tackle it Time to Build

That’s all folks!

www.dreamix.eu

Thank you! [email protected]