Monolith vs microservices, explained with a restaurant and a food court
A monolith is one program released as a whole; microservices split it into small services that each do one job. Like one big restaurant versus a food court of separate stalls.
- Author
Umair Mateen- Published
- Reading time
- 5 min
- Category
- Engineering
In one sentence: A monolith is software built as one single program that is changed and released as a whole, while microservices split the same software into small, separate programs, each doing one job, each released on its own and talking to the others over the network.
The everyday picture
Picture one big restaurant. It has one kitchen, one team of cooks and one pantry. Every dish on the menu comes out of the same room. That is a monolith.
Now picture a food court. There is a pizza stall, a noodle stall and a salad stall. Each stall has its own small kitchen, its own staff and its own pantry. Diners walk through one shared hall and order from whichever stall they need. That is microservices.
Both can feed the same number of people. The difference is how the work is split, and what happens when you want to change something or something goes wrong.
Orders enter through one shared hall and go to the stall that does that job. Each stall keeps its own pantry, so one stall can change or break while the others keep serving.
How it works, step by step
- The user (the diner) clicks a button in the app, like placing an order in the food court hall.
- In a monolith (the one big restaurant), that order is handled inside one program. All the code for every feature sits together and is released together, so changing one dish means reopening the whole kitchen.
- In microservices (the food court), the order goes to the service (the stall) that does that one job, such as payments or search. Services pass orders to each other through agreed menus called APIs, usually as messages over the network.
- Each service keeps its own data (each stall has its own pantry). No stall reaches into another stall's pantry; it has to ask.
- Each service is released on its own (one stall can change its menu while the others keep serving). If it is built well, one broken service does not stop the rest, just as a broken pizza oven does not close the noodle stall.
Try it · Side by side
One big restaurant or a food court: which fits each need?
Tap what matters to you (pick one or more) and see which option fits.
Monolith (one restaurant)
- One kitchen to set up, so you can start cooking sooner.
- Everything is in one room, so it is easier to trace.
- Any change means reopening the whole kitchen.
- You copy the whole restaurant to serve more of one dish.
- A fire in the kitchen stops every dish.
- Fewer moving parts to host, watch and pay for.
Microservices (food court)
- Each stall needs its own setup, planning and connections first.
- A problem may cross several stalls, so it is harder to track down.
- One stall can change its menu while the others keep serving.
- You add staff to the one busy stall only.
- A broken stall can be contained if the others are built to cope.
- More parts to host and monitor, and more skills needed.
Pick what matters to you and the better fit lights up.
Where the picture stops
- Food court stalls barely need each other. Real services often depend on each other to finish one task, so a slow or broken service can still hold up others unless the system is designed for failure.
- Walking between stalls is free. Calls between services travel over a network, so they are slower than calls inside one program and can fail on the way.
- A food court looks tidier, but splitting software does not make it simpler. The complexity moves into the connections between services, which need extra tools to watch and fix.
Why it matters for your business
- Speed to start: a monolith is usually quicker to build and easier to test at first. AWS calls it more suitable for a simple application or a prototype.
- Speed to change later: with microservices, separate teams can update their own part without waiting for one big release.
- Cost: microservices need more setup, more automation and more skills from day one. Martin Fowler calls this extra running cost the "microservice premium".
- Risk: in a monolith, one bad release can take down everything. With microservices, a fault can be contained to one part, but finding the cause across many services is harder.
An example
Imagine a small online shop with five developers. They build one monolith: product pages, basket, payments and emails in one program. It is fast to build and easy to understand.
Three years later the shop has grown. Payments change often and must never break, while the product catalogue gets heavy traffic during sales. The team splits these two parts out as separate services, and keeps the rest as a monolith. This "start with one restaurant, open stalls when you need them" path is the approach Martin Fowler describes as monolith first.
Frequently asked questions
Is a monolith bad or old-fashioned?
No. A well-organised monolith is often the right choice for a new or small product. Many systems that later moved to microservices started as a monolith.
Are microservices cheaper?
Not at the start. They need more infrastructure, automation and skills. They can pay off when different parts of a large system need to change or grow at different speeds.
Can one part of a monolith be scaled on its own?
Not easily. A monolith is usually scaled by running more copies of the whole program. With microservices, you can add copies of just the busy service.
What is a modular monolith?
It is one program that is released as a whole but is organised inside into clear, separate sections. It is like one restaurant with well-divided stations, and it makes splitting out services later easier.
Related explainers
The DevDrift builds web platforms and helps teams choose an architecture that fits their size: see how.
Sources
Could you explain this to a colleague now?
Mark it and posts that mention it will show a tick. Saved in this browser only.