Skip to content
Preptima
mediumConceptDesignMidSeniorStaff

What problem do virtual threads actually solve, and when do they not help?

Virtual threads make blocking cheap by unmounting from their carrier OS thread whenever they block, so thread-per-request scales to hundreds of thousands of concurrent tasks. Finalised in JDK 21, they do nothing for CPU-bound work, and pooling them defeats their purpose.

5 min readUpdated 2026-08-15

Answer

Short answer

Java virtual threads solve the scaling problem of blocking thread-per-request code by letting blocked tasks unmount from carrier OS threads. They help most for I/O-heavy services with many concurrent waits, but they do not speed up CPU-bound work, and pooling virtual threads usually defeats the model.

Mention concurrency where it changes the risk, the owner, or the next check. A useful concurrency point should make the answer more testable, not merely longer.

Was this answer helpful?

Likely follow-ups

  • Your thread pool was your accidental rate limiter. What do you use instead once every request gets its own virtual thread?
  • Why is caching an expensive object in a ThreadLocal a problem under virtual threads?
  • How would you detect pinning in a running service?
  • Where does structured concurrency fit, and is it a stable API yet?

Related questions

Further reading