MENU

Fun & Interesting

Virtual Threads in JDK-24: The Synchronized Block Breakthrough Explained

Dan Vega 6,311 4 weeks ago
Video Not Working? Fix It Now

🚀 Java just got DRAMATICALLY faster with JDK-24's virtual thread improvement! Watch as I demonstrate a real-world application going from 32 seconds to just 0.5 seconds with a simple JDK upgrade. In this video, I explain one of the most significant improvements in JDK-24: enhanced virtual threads that can now use synchronized methods and blocks without pinning to carrier threads. This seemingly small change has enormous implications for application performance and scalability, especially for code using legacy synchronization. What you'll learn: ✅ The synchronized keyword in Java and how it works under the hood ✅ The virtual thread pinning problem that limited JDK-21's performance ✅ A clear restaurant analogy that explains the concept in simple terms ✅ Practical demonstrations showing 70x performance improvement ✅ How to enable virtual threads in Spring Boot applications ✅ Real benchmarks showing a Spring app going from 21 seconds to 2.3 seconds If you're building web applications with high throughput that perform blocking operations like database writes or service calls, virtual threads should definitely be on your radar. This JDK-24 improvement removes one of the biggest barriers to adoption. Code examples used in this video Java: https://github.com/danvega/pinning Spring: https://github.com/danvega/jdk-24-threads Chapters: 00:00 Introduction 01:15 Understanding the synchronized keyword 03:20 The virtual thread pinning problem 05:10 The restaurant analogy 07:25 Java example demonstration 10:45 Spring Boot example setup 13:30 Benchmark results 15:20 Why this matters for your applications 16:45 Conclusion Are you using virtual threads already? Was the pinning issue stopping you from adopting them in JDK-21? Let me know in the comments if you plan to upgrade to JDK-24! #Java #JDK24 #VirtualThreads #SpringBoot #JavaPerformance #Programming 👋🏻Connect with me: Website: https://www.danvega.dev Twitter: https://twitter.com/therealdanvega Github: https://github.com/danvega LinkedIn: https://www.linkedin.com/in/danvega Newsletter: https://www.danvega.dev/newsletter SUBSCRIBE TO MY CHANNEL: http://bit.ly/2re4GH0 ❤️

Comment