What would happen if I started another Fridat Night Drinking Thread?
How many threads is too many?
This is a sample chapter from my ebook Working With Ruby Threads. If you're curious about all the talk in the community about multi-threaded concurrency, this book will give you a gentle introduction so you can join the conversation.
This question is relevant whether you're whipping up a quick script to scrape some websites, trying to speed up a long-running calculation, or tuning your multi-threaded webserver.
I hope you're not surprised, but the answer is: well, that depends.
The only way to be sure is to measure and compare. Try it out with 1 thread per CPU core, try it out with 5 threads per CPU core, compare the results, move forward.
However, there are some heuristics you can use to get started. Plus, if you're new to this, it's good to have a ballpark idea of what's sane. Is 100 threads too many? How about 10,000?
How many threads is too many?
This is a sample chapter from my ebook Working With Ruby Threads. If you're curious about all the talk in the community about multi-threaded concurrency, this book will give you a gentle introduction so you can join the conversation.
This question is relevant whether you're whipping up a quick script to scrape some websites, trying to speed up a long-running calculation, or tuning your multi-threaded webserver.
I hope you're not surprised, but the answer is: well, that depends.
The only way to be sure is to measure and compare. Try it out with 1 thread per CPU core, try it out with 5 threads per CPU core, compare the results, move forward.
However, there are some heuristics you can use to get started. Plus, if you're new to this, it's good to have a ballpark idea of what's sane. Is 100 threads too many? How about 10,000?