microservices - modern software architecture
TRANSCRIPT
MicroservicesModern 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
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
Why do we need microservices?
Monolithic architecture
5000 requests per minute 50 requests per minute
Mostly writes, few reads
Compute heavy
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
Monolithic application architecture cons
Monolithic application architecture cons
Monolithic application architecture cons
Scaling applications
Scaling vertical vs horizontal
The scale cube
Y axis scaling & X axis scaling
Microservices
Microservices is a specialisation of and implementation approach for service-oriented architectures (SOA) used to build flexible, independently deployable software systems.
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]
Partitioning applications
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
When partitioning
Focus on building cohesive services that make development and deployment easier… not just tiny services.
- Chris Richardson
Real world example
Amazon (100-150 services to build a page)
Netflix (~600 services)
SoundCloud
Ebay
Uber
…
Nomadays11 microservices, 1 config server, 1 service registry
Client service interaction design
Inter-service communication options
Synchronous HTTP vs asynchronous AMQP
Formats: JSON, XML, Protocol Buffers, Thrift, ...
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
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)
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
...
Zuul, eureka, ribbon.
Circuit breaker: Hystrix
Hystrix dashboard
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.
Next steps
Event sourcing & cqrs
More reactive programming
Log aggregation
Q&A
Thank you