Microservice

to build Distributed systems

== tool

== abstraction

== pattern

Distributed System?

Non Distributed System

Distributed System

MicroServices
are not something new

Monolithic is also distributed

Microservices approach is  just 'more' distributed

Why would we want to distribute more?

Let's talk about monolith

Growth

Monolith Scaling

vertical

horizontal

Monolith Scaling

33.3%

33.3%

33.3%

Bottleneck

Data Replication :(

 

  • Scalability

  • Availability

  • Productivity

  • COSTS!!

Distribution Brings

Scalability

Scalability is the ability of a system to expand to meet your business needs.

https://msdn.microsoft.com/en-us/library/aa578023.aspx

Scalable

Works well on small data set, number of requests as working on large ones

can handle increased loads of work

load

stability

Monolith Scaling

vertical

horizontal

( scale up}

( scale out}

Vertical

  • less maintnance

  • non-continuous upgrade

  • one point of failure

  • limited

http://epis.com/powermarketinsights/wp-content/uploads/2016/09/cpu_dev.png

Hardware Limits

CPU

AWS EC2

https://aws.amazon.com/ec2/instance-types/

Horizontal

  • more options

  • continuous upgrade

  • higher maintenance

  • more complex

  • not a silver bullet!

https://www.techopedia.com/definition/17035/amdahls-law

Scale Cube

https://thenewstack.io/from-monolith-to-microservices/

0.0.0

1.1.1

Y and Z scaling

https://thenewstack.io/from-monolith-to-microservices/

Benefits

  • scalability

  • performance

  • security

  • flexibility

  • continuous upgrades

  • no single point of failure

  • availability

Problems

  • maintenance

  • costs

  • complexity

  • transactions

  • different programming model

Code structure follows data model

Distributed data model will encourage distributed code

Monolithic system
-> RDBMS

Distributed Data

-> freedom

-> flexibility

-> different ccharacteristics

Polygot Data

  • Relational != silver bullet

  • More options

  • Different Characteristics

https://www.slideshare.net/fabiofumarola1/nosql-databases-pros-and-cons

SQL is good enough

but some problems require different approach to data

Availability

 availability is a measure of how often the application is available for use

Single point of failure

Monolithic UI

Hidden

Disabled - Cached Data

Distributed
UI

Cached data

  • independent teams

  • independent daily releases

  • smaller orchestration

  • simplified processes

  • end of big bang deploys

Productivity

 

  1. A computer program that is used will be modified
  2. When a program is modified, its complexity will increase, provided that one does not actively work against this.

Code Entropy

https://en.wikipedia.org/wiki/Software_entropy

Spaghetti Code

Code Entropy

Distributed

Not a Free Lunch

  • more complex

  • expensive

  • different programming model

  • different patterns

  • different org

  • many traps ( micromonolith )

Adopting distributed architecture requires changes in the team structure and culture

 

Distributed system require 'distributed' teams

Network Layer

Is a beast

  • latency

  • complexity

  • debbuging

  • security

  • connectivity

Assume that there will be problems

You can't beat the nature of the network

Defensive design and coding

Microservices
!=
Silver bullet

Micro Monolith

distributed monolith

The first rule of distributed systems is don’t distribute your system until you have an observable reason to

Microservice
== Costly Tool

To bring more distribution

To solve problems

And Generate Profits that cover the Costs

Micro why

By Michal Franc