Spring Boot 3.2 With Virtual Threads Explained | Benchmarking Insights | JavaTechie

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 45

  • @arpitasati8557
    @arpitasati8557 11 месяцев назад +9

    Number of concurrent thread execution depends on the processor virtual cores.. 8 vcore CPU can run 8 thread concurrently.. I may be mistaken but this is what my understanding is.

    • @Javatechie
      @Javatechie  11 месяцев назад

      Absolutely correct 👍

    • @kauegatto
      @kauegatto 8 месяцев назад +1

      You're correct, even if we're talking about virtual threads, when they're running, there's a real platform thread executing those instructions, then, if we find a blocking instruction, the virtual thread context is sent to our primary memory and another green thread starts to run on the platform thread, however, only 8 green threads will be executed at the same time.

  • @huseyinaydin99
    @huseyinaydin99 11 месяцев назад +5

    I love Java Techie.

  • @gopisambasivarao5282
    @gopisambasivarao5282 11 месяцев назад +1

    Thanks Basant, Appreciate your efforts. Nicely explained Java 21 feature on Virtural thread. 🙏👍🙂End of the session the question you asked " Can we run 100 threads on our machine concurrently, Is it possible?" Answer I thought : "Running 100 parallel threads on a quad core processor is technically possible, but it may not be efficient. A quad core processor can handle up to four threads simultaneously, so running 100 parallel threads could lead to significant overhead and decreased performance due to frequent context switching.....On a single-core CPU, you're only ever going to have one thread running at a time, but on a multi-core CPU, it's possible to run more than one thread simultaneously...

    • @Javatechie
      @Javatechie  11 месяцев назад +2

      Thanks for your words brother. The answer to my question is straight forward it depends on the core of the machine if it's 20 then 20 threads will run concurrently

    • @TheAlirezak
      @TheAlirezak 15 дней назад

      I want to ask please. We implement virtual threads we modify only thé services or also thé controllers ?

  • @CodeMyth
    @CodeMyth 11 месяцев назад +2

    Congratulations for 150k subscriber. 🎇🎇💥

  • @chiranjevig4280
    @chiranjevig4280 11 месяцев назад +2

    Congratulations Sir....

  • @psudhakarreddy6548
    @psudhakarreddy6548 11 месяцев назад +2

    🎉 thank you 🙏

  • @ishantbhatia3194
    @ishantbhatia3194 11 месяцев назад +2

    My fab topic

  • @Deepakblg97
    @Deepakblg97 11 месяцев назад +2

    Thank you so much sir ❤

  • @rishiraj2548
    @rishiraj2548 11 месяцев назад +1

    Great thanks!

  • @anwarshaik8578
    @anwarshaik8578 11 месяцев назад +1

    Awesome sir❤

  • @prashlovessamosa
    @prashlovessamosa 11 месяцев назад

    Thank you.

  • @PracticeTech-rg7yh
    @PracticeTech-rg7yh 11 месяцев назад +1

    Can this be used in production development. Does using virtual threads optimize the perfromance of the app vs using the platform thread?

    • @norulshahlamjohn1140
      @norulshahlamjohn1140 8 месяцев назад +1

      yes of course but performance testing must be done pre prod to see the difference first. not all use case works for virtual thread

  • @naresh_k_005
    @naresh_k_005 11 месяцев назад +1

    Hi Bro I have one doubt relating to Jwt Token in realtime for every rest endpoint like login ,forgotpassword,resetpassword ,we have to generate token or just for login only it is basic doubt i have

    • @Javatechie
      @Javatechie  11 месяцев назад

      Generate for login and use that for password but forgot password you can bypass it

  • @kamalhm-dev
    @kamalhm-dev 11 месяцев назад +1

    i got your question, but i think its worded wrongly? it should be parallel thread execution

    • @Javatechie
      @Javatechie  11 месяцев назад

      Which one buddy didn't get you

  • @sairammanchala40
    @sairammanchala40 11 месяцев назад +1

    Can you do it with spring reactive web flux as well.

  • @andriibakhtiozin4477
    @andriibakhtiozin4477 11 месяцев назад +1

    Wondering does such test makes any sense? U are running jmeter on the same machine u run ur application. So jmeter utilities same resources that ur app

    • @Javatechie
      @Javatechie  11 месяцев назад

      Yes but what's the problem? You want me to use a different server for jmeter for testing? How that make sense

    • @andriibakhtiozin4477
      @andriibakhtiozin4477 11 месяцев назад

      @@Javatechie I mean that usually perf results especially with load won't be very representative if jmeter fights with spring boot app for resources as u running them on one machine that shares the same CPU.
      U could spend some time writing a script to deploy for example app in cloud or on ur second laptop in ur network and run jmeter tests from ur local machine. In this case app will have their pool of resources completely separated from load generator resources.

  • @vishaldeshmukh4459
    @vishaldeshmukh4459 11 месяцев назад

    If we have async task like auditing then how to do this with virtual threads? Previously we were using @async annotation with ThreadPoolTaskExecutor

    • @kenneth_jensen
      @kenneth_jensen 11 месяцев назад

      I guess it depends on your implementation 🙂

  • @SmurahaLurk
    @SmurahaLurk 11 месяцев назад +1

    The default thread size is 200 for Tomcat if you use standard threads. So, you didn't reach 400 in the last test.

    • @Javatechie
      @Javatechie  11 месяцев назад

      Yes but the thread will reuse right? Once one thread is free he can pick up the task

    • @SmurahaLurk
      @SmurahaLurk 11 месяцев назад

      @@Javatechie right. But if you increased it to 400, the result might be better for platform threads. At least, it would be fair.

    • @Javatechie
      @Javatechie  11 месяцев назад

      I believe you didn’t get what is virtual thread and it’s importance could you please check my previous video about virtual threads

    • @jackweng2630
      @jackweng2630 3 месяца назад

      @@Javatechie Steal the task 😁

  • @sadiulhakim7814
    @sadiulhakim7814 5 месяцев назад

    Ok understood. Now question is, can i just use Virtual Thread? Is there any case where i cannot (should not) use Virtual Threads?

    • @Balajisrinivasan1212
      @Balajisrinivasan1212 4 месяца назад

      Hi, this reply may be a bit late
      the author has video on virtual threads. As per my understanding, there are multiple kinds of workloads. CPU based, I/O based (Network, File system read right), memory intensive. Virtual threads are mapped to platform threads which are wrapped to OS threads and ultimately to number of available CPU by OS scheduler. Virtual threads you can consider as tasks. if our application has a lot of I/O based operation like File Upload, Download, calling web service, Database operations then they are useful. because when these i/o operation occurs the platform threads will be released and can serve other requests. Also virtual threads by default support non blocking Java I/o APIs instead of standard blocking APIs to read network and File operations. This is provided by JVM itself. If your application is more cpu based like service has image processing logic, data science related.calculations, encryption and decryption or data algorithms then virtual threads are less useful since the career thread (platform thread) will be blocked for CPU operation so we can directly use platform threads. How career threads are mounted and unmounted using a feature called continuation scope which you can search for JVM documentation. Hope it helps.

    • @sadiulhakim7814
      @sadiulhakim7814 4 месяца назад +2

      @@Balajisrinivasan1212 Thanks. It surely helps.

  • @itsnarahari
    @itsnarahari 11 месяцев назад +1

    If you create 100 threads at a time it won't run 100 threads at a time the Java threads use of OS Threads here the example 1 platfoem Thread = 1 OS Thread
    If your cpu cores are 8 then the 8 threads it will run at a time remaining will wait for lock release and continue the others

    • @Javatechie
      @Javatechie  11 месяцев назад +1

      Absolutely correct buddy

  • @huseyinaydin99
    @huseyinaydin99 11 месяцев назад +1

    I couldn't understand the video because my English is poor. Someone please explain it to me. What is the difference between Virtual Threads and Platform Threads? What is Virtual Thread? What is Platform Thread?

    • @Javatechie
      @Javatechie  11 месяцев назад

      Hello buddy please checkout the video below 👇 👇
      ruclips.net/video/z17QckCZ6fA/видео.html

    • @nijatSh
      @nijatSh 11 месяцев назад

      Your english is maybe poor, but this video is not understandable as this guy's accent very bad, i am sorry for that but i have to say it

  • @miguelrondon1869
    @miguelrondon1869 Месяц назад

    It's scary how wrong this video is. The competent people who tried to explain why this video is wrong got attacked in the comments wow.

  • @denizozen2150
    @denizozen2150 11 месяцев назад

    Bro all is fine but the accent is heavy

    • @blastys
      @blastys 11 месяцев назад

      Lmao he cant change that 🤣

  • @2RAJ21
    @2RAJ21 2 месяца назад

    Thank you.