Demystifying Java Virtual Threads
summary
Explains how Java 21 virtual threads run as heap objects scheduled onto a small set of OS carrier threads, shows a GlassFish/Grizzly executor was implemented to run incoming requests on virtual threads, and reports measured effects: about 15% throughput gain in a simple benchmark, sometimes nearly 2x in full GlassFish, but runaway creation hits the heap (demo reaches ~9 million virtual threads and GC starvation) and platform threads reserve ~1 MB stacks (32k → ~32 GB). Debunks myths: thread‑locals work, synchronized is safe except when blocking inside a lock, and semaphores are recommended to limit concurrency.
AI-written summary · about
chapters (8)
- 0:00Introduction and speaker background
- 11:28Traditional platform threads limitations
- 16:27Virtual threads promise and advantages
- 28:17Real-world experience with GlassFish
- 33:39Common myths about virtual threads
- 42:38Replacing platform threads with virtual threads
- 48:06Virtual threads vs reactive programming
- 52:02Q&A session
related talks
45mIntroduction and pitfalls of virtual threads
38mIntroduction and pitfalls of Java's new concurrency model
50mVirtual Threads, Structured Concurrency, Extent Locals: When to Use Them & How
43mVirtual Threads: Taming the Wild Multithreading Beast
37mMultiprocessing evolution & virtual threads in Java
46mJava 21: The Revolution of Virtual Threads - A Deep Dive
38mIntroduction and pitfalls of Java's new concurrency model
42mVirtual Threads - what we won or lose using it.
