Should you split your monolith into microservices?
For most startups, moving from a monolith to microservices is the wrong next step. Split only when one part of the system needs to scale, deploy or be owned separately, and a cleaner monolith would not solve it.
Prime Video’s video quality monitoring team moved a distributed workload into a single process on ECS and EC2, and reported a 90% cut in operating costs.
From my work
At Clyso I worked on a Node.js and TypeScript platform built as microservices, running on Docker and Kubernetes with KrakenD as the API gateway. To test my work I ran kubectl on my own machine against their demo environment, and created pods when I needed them.
Why the answer is usually no
- Every service needs its own deploy, monitoring, logs and on-call. Ten services means ten of each.
- Calls between services can fail in ways a function call never does.
- Data split across services is harder to keep consistent and harder to report on.
- Testing one change can mean running several services at once. Your laptop fan will let you know.
- A team of three to five people rarely has the hours to run all of that and still ship features.
What experienced people say
Martin Fowler wrote that almost all the successful microservice stories he heard of started with a monolith that got too big and was broken up, and that almost all the systems built as microservices from scratch ended up in serious trouble.
Going the other way works too. The Prime Video team in the stat above moved a distributed workload into one process and cut its cost by 90%.
When moving from a monolith to microservices pays off
- One part of the system needs to scale far more than the rest, such as video processing or search.
- Separate teams keep blocking each other in one codebase and one release.
- One part needs a different language or runtime, and the reason is better than a conference talk.
- One part must be isolated for security or compliance.
Try a modular monolith first
Most of the pain people blame on the monolith comes from code with no boundaries. Cut that code into services and you keep the same mess, now with a network between the pieces. So first split the code into modules with clear interfaces inside one app. You get most of the clarity of services, with one deploy and one database. If a module later needs to become a service, the line is already drawn.
If you do split, do it in steps
- Pick the one part with the clearest reason to leave, and move only that.
- Put it behind an API gateway so callers do not care where it runs.
- Move its data last, after the new service has run in production for a while. Code is easy to move back. Data is not.
- Have deploys, logs and monitoring for the new service ready before any traffic goes to it.
What it costs
I found no reliable published price for a monolith split. The effort depends on how tangled the data is, how many teams are involved and how much infrastructure already exists. A 14-day Trial, $995, one time, gives you a plan for your case. The work then runs on a monthly plan, Limited at $1,995 or Full at $4,995, one task at a time.
Read next
Sources
- InfoQ, Prime Video switched from serverless to EC2 and ECS to save costs, 3 May 2023
- Martin Fowler, MonolithFirst, 3 Jun 2015