Virtual Threads - what we won or lose using it.
summary
JEP 444 introduces virtual threads that move blocking IO off OS cores so many more requests run concurrently without code rewrites; enabling spring.thread.virtual.enabled flips from platform threads to virtual threads. Demo runs 32 concurrent requests: classic threads process eight at a time and take 12s, virtual threads handle them in ~3s. Virtual threads shine for API calls, DB queries and BFFs and are production-ready in Java 21; they hurt or add overhead for CPU-bound in-memory aggregations and tight low-latency code.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:32Virtual threads origin
- 3:41Traditional Java threads problems
- 9:14Limitations of CompletableFuture
- 12:27How virtual threads solve it
- 16:42Demo of virtual threads
- 23:16When not to use virtual threads
- 27:01Conclusion and use cases
- 28:37Q&A
related talks
43mVirtual Threads: Taming the Wild Multithreading Beast
46mJava 21: The Revolution of Virtual Threads - A Deep Dive
53mVirtual Threads: Ushering in a New Era of Concurrency
57mButcher Virtual Threads like a pro!
37mMultiprocessing evolution & virtual threads in Java
50mVirtual Threads, Structured Concurrency, Extent Locals: When to Use Them & How
49mEven threads are now virtual:past, present, future of concurrency in Java.
52mButcher Virtual Threads like a pro!
