HLD 3 – Microservices Design Pattern


Microservices and monolithic
Monolithic: legacy application, all features in one application
Disadvantage
1. overload IDE (code intelliJ, ide pai load karna muskil ho jata hai
2. scaling is very hard (just for fixing one line bug u need to deploy whole application)
3. it is very tight couple( pura system test karna parega for checking minute change)

all the disadvantages of monolithic are advantages of microservices

what is advantage and disadvantages of microservices

wha is loosley couple
we can scale or change a particular service without changing other service

disadvantage:
1. if we don’t decompose monolithic system properly, it may increase latency. because it will be tightly couple (i.e we need to
2. pushing one code response can break other, need to monitor properly. debugging bit easy
by looking error it is bit difficult to find who is real culprit
3. Transaction Management: we will have multiple DB for each service. so there are many permutation and combination when one DB transaction get successful and the other fails. need to manage these cases


Different phases in microservices

  • Decomposition
  • Database
  • communication
  • Integration
  • … so on

Decomposition pattern(how much small)

  1. decompose by business capability / functionlity (i.e order management, login, account management, Product Management, payment, billing)
  2. decompose by subdomain/ Domain Driven Design (DDD): let’s say if order management is one domain,
    a domain can have multiple microservices(or subdomain)
    payment: forward payment, refund payment,
    order management: order placing, order tracking

Database

  1. shared database
  2. database for service

Communication

  1. via API communication
  2. via Event

Integration

  1. need to integrate with the user interface
  2. API gateways

Observability

Leave a Comment