DEV Community

Cover image for Interview Question: Best Size for a Thread Pool?

Interview Question: Best Size for a Thread Pool?

Arthur Rio on April 08, 2024

Introduction This week I did an interview process where I needed to answer the question: Determine a threadpool size to handle 5000 requ...
Collapse
 
webjose profile image
José Pablo Ramírez Vargas

The solution is overly simplistic, and if I were the interviewer, I would say the answer is incorrect. The problem here is that creating and managing threads have a cost associated that makes the calculation you show inaccurate. The more threads in the thread pool, the more management overhead. I understand you're trying to introduce the topic, but I think this warning should be in place since day 1.

Since you seem to be hinting you'll write more about the topic, I'll just stop here as you might delve into this further. Overall, I applaud any mathematical solution to problems. Most developers seem to forget mathematics exist.

Collapse
 
arthurrio profile image
Arthur Rio

Thank you Jose for your comment and adding knowledge in this post!
For sure! This approach is very simple and just a quick answer in a fiction scenario! But you're right, hope as soon as possible bring more posts about it and arrive at a full answer!