Key points
You opened a hotel…you have 1 person to take order and serve.What if more orders start coming ?
Vertical scaling
Vertical scaling
- Optimise process and increase throughput using the same resource – Vertical scaling
- The person works more hours and faster to serve the purpose
What if the chef is sick ?
Master slave
Master slave
- Keep backups and avoid single point of failure- Master slave architecture
- There should be backup chef to serve the purpose
Orders are increasing which cannot be served by chef and the backup chef.
Horizontal scaling
Horizontal scaling
- Hire more chefs
Each chef has their own speciality
Microservice Architecture
Microservice Architecture
- Distribute chef their speciality based on their skills on that area.
What if the shop electricity is down. Despite having the chefs you cannot fulfill the orders.
Distributed System
Distributed System
- More shops are needed. If one shop fails , it has to be served by other shop.
Now there are more than one shop. Customer orders. Now one shop is nearer. Other shop is father. The one shop nearer has more demand and the wait time is around 30 min. But the farther one though it is farther it takes 20 min to deliver the order. So it is some central place where the order
has to be placed.
has to be placed.
Load Balancer
- Load balancer routs where the traffic is less which will server faster response
- so the shop farther is picked and the order is delivered.
When the orders are placed, delivery guy has absolutely no idea if it is fried rice, biriyani or something else is ordered.
Decoupling
Decoupling
- Everyone has their own responsibility and decoupled from each other
What if Delivery agent bike breaks down ??
Logging and metrics calculation
Logging and metrics calculation
- By logging – we come to know the exact issue .. here the problem is not with hotel but with vehichle breakdown
- Identify the problem and fix it – Have backup delivery agents/some other alternatives
Dont rewrite the same code again and again
Extensible
Extensible
- Today we have a Hotel which serves only Biriyani. Tomorrow if the plan is to close biriyani and serve pizza at the same place. All the process remains same …