33
Microservices Modern software architecture

Microservices - modern software architecture

Embed Size (px)

Citation preview

Page 1: Microservices - modern software architecture

MicroservicesModern software architecture

Page 2: Microservices - modern software architecture

About me

● Software start up since 2010

● Professional interest

○ To build big scalable apps

○ Engineering as an art of state

● Fine art photography and bio hacking hobbyist

Page 3: Microservices - modern software architecture

About nomadays

Tourism software started in 2010 October

Complete rewrite from 2013

Refactored into microservices from 2015

2 main UI:

Backoffice - for company manager

Platform - for travelers

Page 4: Microservices - modern software architecture

Why do we need microservices?

Page 5: Microservices - modern software architecture

Monolithic architecture

5000 requests per minute 50 requests per minute

Mostly writes, few reads

Compute heavy

Page 6: Microservices - modern software architecture

Monolithic application architecture cons

Different non functional requirements (read, write, compute...) & optimized for none

Single points of failure

Overloads your IDE and container

Has physical limit

Page 7: Microservices - modern software architecture

Monolithic application architecture cons

Page 8: Microservices - modern software architecture

Monolithic application architecture cons

Page 9: Microservices - modern software architecture

Monolithic application architecture cons

Page 10: Microservices - modern software architecture

Scaling applications

Page 11: Microservices - modern software architecture

Scaling vertical vs horizontal

Page 12: Microservices - modern software architecture

The scale cube

Page 13: Microservices - modern software architecture

Y axis scaling & X axis scaling

Page 14: Microservices - modern software architecture

Microservices

Microservices is a specialisation of and implementation approach for service-oriented architectures (SOA) used to build flexible, independently deployable software systems.

Page 15: Microservices - modern software architecture

Microservices

The services are easy to replace.Services are organized around capabilities, e.g., user interface front-end, recommendation, logistics,

billing, etc.Services can be implemented using different programming languages, databases, hardware and

software environment, depending on what fits best.Services are small in size, messaging enabled, bounded by contexts, autonomously developed,

independently deployable, decentralized and built and released with automated processes. [7]

Page 16: Microservices - modern software architecture

Partitioning applications

Page 17: Microservices - modern software architecture

Partitioning strategies

Too few

Drawbacks of the monolithic architecture

Too many - a.k.a. Nano-service anti-pattern

Runtime overhead

Potential risk of excessive network hops

Potentially difficult to understand system

Page 18: Microservices - modern software architecture

When partitioning

Focus on building cohesive services that make development and deployment easier… not just tiny services.

- Chris Richardson

Page 19: Microservices - modern software architecture

Real world example

Amazon (100-150 services to build a page)

Netflix (~600 services)

SoundCloud

Ebay

Uber

Page 20: Microservices - modern software architecture

Nomadays11 microservices, 1 config server, 1 service registry

Page 21: Microservices - modern software architecture

Client service interaction design

Page 22: Microservices - modern software architecture

Inter-service communication options

Synchronous HTTP vs asynchronous AMQP

Formats: JSON, XML, Protocol Buffers, Thrift, ...

Page 23: Microservices - modern software architecture

Pros and cons of messaging

Pros

Decouples client from server

Message broker buffers messages

Supports a variety of communication patterns

Cons

Additional complexity of message broker

Request/reply-style communication is more complex

Page 24: Microservices - modern software architecture

Pros and cons of HTTP

Pros

Simple and familiar

Request/reply is easy

Firewall friendly

No intermediate broker

Cons

Only supports request/reply

Server must be available

Client needs to discover URL(s) of server(s)

Page 25: Microservices - modern software architecture
Page 26: Microservices - modern software architecture
Page 27: Microservices - modern software architecture

Our technology choice

Netflix OSS

Api gateway: Zuul

Service registry: Eureka

Client side load balancer: Ribbon

Circuit breaker: Hystrix

Reactive programming: RxJava

RabbitMQ

Cloud foundry PAAS

Jenkins CI

...

Page 28: Microservices - modern software architecture

Zuul, eureka, ribbon.

Page 29: Microservices - modern software architecture

Circuit breaker: Hystrix

Page 30: Microservices - modern software architecture

Hystrix dashboard

Page 31: Microservices - modern software architecture

Lessons learned

Data is different and difficult. Split your database

Reactive programming is necessary. It can be difficult.

It will take time to put pieces together.

Inconsistent failures are SCARY.

Page 32: Microservices - modern software architecture

Next steps

Event sourcing & cqrs

More reactive programming

Log aggregation

Page 33: Microservices - modern software architecture

Q&A

Thank you