Fantastic Virtual Threads and How to Monitor Them
summary
Project Loom arrives in Java 21 with lightweight virtual threads and the demo shows monitoring via JFR adds four events, jcmd thread dump JSON and UI tools JMC/VisualVM. A Spring Boot app creates many virtual threads (recording shows 68 virtual threads), JFR flags five thread pin events each ~5s tied to a synchronized block plus a random Thread.sleep, and switching the synchronized block to a ReentrantLock and removing the sleep eliminates the errors.
AI-written summary · about
chapters (11)
- 0:00Introduction and demo setup
- 3:31What are virtual threads
- 13:40Virtual thread spinning explained
- 15:48Monitoring tools overview
- 16:53Using jcmd for diagnostics
- 26:18JDK Flight Recorder deep dive
- 32:00JDK Mission Control walkthrough
- 35:13VisualVM overview
- 37:46Monitoring virtual threads in action
- 44:34Fixing the demo application
- 45:17Q&A on virtual thread pinning
related talks
47mThe Challenges of Introducing Virtual Threads to the Java Platform - Project Loom
38mJava Project Loom: Why Should I Care?
01h 02mThe next phase of Project Loom and Virtual Threads
01h 00mLoom Virtual Threads in the JDK 20
52mJava Virtual Threads
49mPrepare for what “Loom”s ahead.
36mA Dev Persepctive on Java Loom
31mJava Virtual Threads
