Monolith vs microservices: the latency price

A monolith calls its modules in memory. Services call each other over the network and add 12 ms at each boundary. With six services, p99 is 97 ms against 30.5 ms for the monolith, and the 60 ms target fails. The simulator does not score release speed.

Play the level

One monolithTap, drag or use arrow keys to change the split

One process · boundaries in the path: 0 · total 10 ms, the limit is 60 ms

Six servicesTap, drag or use arrow keys to change the split

Six services · boundaries in the path: 5 · total 70 ms, the limit is 60 ms

Case 1

100 requests/s. Each service boundary adds a 12 ms round trip and 0.3 ms of CPU. p99 must stay below 60 ms with no errors.

Case 1
Measure Goal One monolith Six services
p99 latency under 60 ms 31 ms Pass 97 ms Fail
Error rate none 0% Pass 0% Pass
Monthly cost 48 USD/mo 48 USD/mo
UsersAPI server12 vCPU · 6 GB
HTTP/2UsersAPI server12 vCPU · 6 GB
One monolith: meets the goals
UsersAPI server2 vCPU · 1 GBAPI server2 vCPU · 1 GBAPI server2 vCPU · 1 GBAPI server2 vCPU · 1 GBAPI server2 vCPU · 1 GBAPI server2 vCPU · 1 GB
UsersAPI serv…API serv…API serv…API serv…API serv…API serv…
Six services: misses a goal

Case 2

The same load with a p99 target of 120 ms. Both pass, so the price of six services is the added latency.

Case 2
Measure Goal One monolith Six services
p99 latency under 120 ms 31 ms Pass 97 ms Pass
Error rate none 0% Pass 0% Pass
Monthly cost 48 USD/mo 48 USD/mo
UsersAPI server12 vCPU · 6 GB
HTTP/2UsersAPI server12 vCPU · 6 GB
One monolith: meets the goals
UsersAPI server2 vCPU · 1 GBAPI server2 vCPU · 1 GBAPI server2 vCPU · 1 GBAPI server2 vCPU · 1 GBAPI server2 vCPU · 1 GBAPI server2 vCPU · 1 GB
UsersAPI serv…API serv…API serv…API serv…API serv…API serv…
Six services: meets the goals