Let request dispatcher have its own thread

Say there is 1 request dispatcher and multiple request consumers.

If they share the same thread pool, then the request dispatcher may starve because request consumers may be hogging too much of the threads. If the request dispatcher starves, requests will be flowing into the system at a lower rate. And then your request consumers will under perform because there is not enough “work” for them.

The solution is just what the title said. Don’t disturb the dispatcher thread.


I got the lesson from my real experience in a cats-effect Scala application.

The dispatcher could normally get 100 requests per millisecond. But when therre was heavy load it could only get 10-40 requests in the same period. I also got warnings from cats-effect like this:

2023-01-28T00:16:24.101Z [WARNING] Your app's responsiveness to a new asynchronous event (such as a new connection, an upstream response, or a timer) was in excess of 100 milliseconds. Your CPU is probably starving...

After separation things were back to normal.

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.