Microservices

What? Why? When? How?

Chandan Jhunjhunwal

https://github.com/indyarocks

       @ChandanJ

What is Monolith?

  • Build all piece of software as a single application unit.
  • Often built in three main parts:
  1. Client side interface
  2. Server side application
  3. A shared database

What is Microservice?

  • An architecture of designing a software in a set of independent services loosely coupled via lightweight communication.

  • Suite of small services
  • Each service built around business capabilities and independently deployable
  • Each service running in its own process
  • loosely coupled : Inter-process communication mechanism, e.g. HTTP, Message Queue
  • Bare minimum centralised management service
  • Each service can be in different programming language and use different data storage technologies 

What is Microservice?

SOA vs Microservice

Micro services brings agility to SOA

SOA

Microservice

Why Microservice?

With Monolith

  • Any small change to system involves building and deploying new version on server-side application 
  • Fragile (One missing ';' can bring the whole application down)
  • Resists changes due to cascading affect 
  • Technology restriction(w.r.t. programming language, framework, database etc)
  • Scaling requires entire application upgrade rather than the parts of it which really require more resources 

 

With Monolith

  • Debugging Nightmare
  • Difficult to maintain as application grows
  • Development cross team dependencies
  • Regression testing the whole application



    And many more ....

With Microservice

  • Each service can be independently deployed 
  • Anti-Fragile 
  • Adaptive to frequent changes 
  • Technology leverage
  • Each service can be independently allocated more/less resources
  • Issue localised - faster debugging

 

With Microservice

  • Testing is much easier 
  • Highly Maintainable
  • Adaptive to frequent changes



And many more ....

How?

Build Service Components

  • Independently replaceable and upgradable 
  • Does only 'one thing' 
  • May depend on other services
  • Can use independent technology stack
  • Can be chained like UNIX command

    Service1  |  Service2  |  Service3

 

 

Team Around Component

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

​IMAGE FROM MARTIN FOWLER's BLOG

Monolith

​IMAGE FROM MARTIN FOWLER's BLOG

Microservice

  • Design for failure
  • Independent storage
  • Infrastructure automation
  • Smart End-Points
  • Communication via REST API, Queues

 

 

Microservices Trade-off

 

  • Strong Modular Boundaries
  • Independent Deployments
  • Technology Diversity

 

  • Distribution
  • Eventual Consistency
  • Operations Complexity

COSTS:

BENEFITS:

When to Choose Monolith?

  • Simple - When not sure if monolith or microservices
  • Consistency
  • More flexibility while code-refactoring
  • Many times its good to start with Monolith for initial momentum and later migrate to Microservices. 

 

 

When to Choose Microservice?

              Application Requirement

  • Partial Deployments
  • Availability
  • Eventual Consistency
  • Preserve modularity
  • Multiple Platforms

Infrastructure

  • Rapid provisioning
  • Basic Monitoring
  • Rapid application deployment
  • DevOps Culture

  • When you need to scale a specific part of Monolith
  • When one/more part require frequent changes/replacement
  • Independently Deployable parts
  • Technology Heterogeneity

Monolith To Microservice

THANK YOU!

Microservices

By Chandan Jhunjhunwal

Microservices

A detailed comparison between Monolith architecture and Microservices. The factors for choosing one architecture over other. The key concepts in Microservice architecture.

  • 649