Scaling Servers with Virtual Threads
summary
Shows Java 21 virtual threads as a practical replacement for OS threads: swapping new Thread(...) for Thread.startVirtualThread and running IO-bound tasks keeps JVM thread count at ~16 while supporting 500,000 virtual threads and even millions in demos. Demonstrates file and sleep-based IO, explains the mount/unmount model (virtual thread unmounts when blocked, remounts when ready), shows it fails for CPU-bound work and is not for CPU-bound tasks, and argues this removes the need for heavy CompletableFuture-based pipelines while actually working in live JConsole-observed experiments.
AI-written summary · about
chapters (7)
- 0:00Introduction to virtual threads
- 1:07Parallel vs concurrent vs async
- 29:15Problems with traditional threads
- 41:11How virtual threads work
- 54:31Benefits of virtual threads
- 1:00:34Virtual threads vs CompletableFuture
- 1:07:26Java 21 and virtual threads
related talks
43mVirtual Threads: Taming the Wild Multithreading Beast
45mIntroduction and pitfalls of virtual threads
46mJava 21: The Revolution of Virtual Threads - A Deep Dive
37mMultiprocessing evolution & virtual threads in Java
58mCreating Asynchronous Applications with Virtual Threads
57mButcher Virtual Threads like a pro!
38mIntroduction and pitfalls of Java's new concurrency model
52mButcher Virtual Threads like a pro!
