Java 21 Virtual Threads | Scale your threads optimally

Sdílet
Vložit
  • čas přidán 1. 10. 2023
  • In this video, I'll go through one of the major features of Java 21 - the virtual threads model. Virtual Threads allow thread-using applications to scale with much better resource utilization, thus we achieve better scaling and faster speeds when the hardware allows it. Another cool thing is that any changes to your existing code would be minimal.
    So join me for a bit, I'll introduce this topic for you, and show some demonstrations of the capability here. If you are left with questions or comments, use the comment section below, and I always appreciate it if you click the like button if you like the video. Also feel free to share the link to the video, or subscribe to my channel for more stuff like this.
    Here's the link to the actual specification (read for a bit more in-depth details if you got curious) and a few more Java 21 related videos:
    - openjdk.org/jeps/444
    - • Java 21 New Features |... (All Java 21 new features)
    - • Java 21 Hello World | ... (Java 21 Hello World)
    - • Java 21 String Templat... (Java 21 String Templates)

Komentáře • 5

  • @Chrisbees
    @Chrisbees Před 4 měsíci +1

    Very interesting sample of Virtual threads. How does this integrate when youre building an application with a framework? Dont the framework handle the creation of threads?

    • @DevXplaining
      @DevXplaining  Před 4 měsíci

      Yes, a good question. Short answer is that yes, typically that's what happens, and typical software project inside any web framework pretty much ignores you needing to tap into parallelism - you just think about it when accessing background resources.
      But two reasons to still keep up with Java parallelism features:
      1) Well sometimes you do build something from scratch, that would mainly happen if you want to do some intensive calculations without web servers, or if you are building a server.
      2) Virtual Threads are currently finding their way into popular servers and frameworks, so mostly you can just enjoy the benefits, but it's at least good to get the idea why they may bring more performance when your favorite framework start using them.
      So mostly I think this is the message that Java platform is still very much alive and kicking, and still getting better.
      Spring Framework is already embracing them, for example: spring.io/blog/2022/10/11/embracing-virtual-threads
      Might be a fun topic for a future video.

    • @Chrisbees
      @Chrisbees Před 4 měsíci

      okay great. Maybe you might consider making a video in the future for this question or you could please share your ideas here. I'm a bit confused if Virtual Threads are going to replace Reactive Programming. If they would, why? and if they won't, why?@@DevXplaining

  • @greggoog7559
    @greggoog7559 Před 9 měsíci +1

    So YOU are that person using Java 😄