What happens if a single microservice instance is slow?

Ayush Jain
2 min readMar 2, 2021

A quite common myth is that if a microservice instance is slow, it is not a bigger issue as only that particular service is slow and the rest of the application should work fine. But it turns out that it is a much bigger issue. A single slow instance can make the whole application slow. Consider the below example.

If microservice Y is slow, it will make X slow and that in turn will make A slow. But how will it make microservice Z slow?

The answer to this question is Threads. To understand this, we should know how threads work in a web server.

Whenever a request comes to a web server, it spawns a thread to handle the request. Once the thread completes the execution, it is freed up. Now, if a microservice is slow, the request comes in and a thread is spawned but it takes much more time to execute. And similarly, several requests come in and several threads are spawned. After a while, all the resources (threads) gets consumed not leaving a single thread available for the next request to execute even on the fast microservices.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Ayush Jain
Ayush Jain

Written by Ayush Jain

0 Followers

Full stack developer

No responses yet

Write a response