What's your favourite number of threads?
summary
Claim: the right thread count really depends — CPU-bound tasks hit a plateau around 8–12 threads on an 8-core box, while IO-bound work follows the formula cores × (1 + wait/service) (commonly cores+1) and benefits more from virtual threads (few KB each vs ~1MB native). Container CPU limits (e.g. 250m = 250ms/s) change effective cores. Ultra-low-latency systems instead use one thread with Disruptor to keep hot caches and reach tens of microseconds. Favorite number: zero (no work, no bugs).
AI-written summary · about
chapters (8)
- 0:00Introduction and context
- 2:49Defining and sourcing threads
- 4:46Benchmarking performance
- 5:52Virtual threads analysis
- 7:09Containerization and millicores
- 8:11The case for single threading
- 10:24Complexity of multi-threading
- 12:49Conclusion and final answer
related talks
57mButcher Virtual Threads like a pro!
52mButcher Virtual Threads like a pro!
42mVirtual Threads - what we won or lose using it.
43mVirtual Threads: Taming the Wild Multithreading Beast
31mJava Virtual Threads
57mButcher Virtual Threads like a pro!
36mA Dev Persepctive on Java Loom
49mButcher Virtual Threads like a pro!
