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.
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.
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...
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
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
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 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.
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.
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
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?
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.
Absolutely correct 👍
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.
I love Java Techie.
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...
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
I want to ask please. We implement virtual threads we modify only thé services or also thé controllers ?
Congratulations for 150k subscriber. 🎇🎇💥
Congratulations Sir....
🎉 thank you 🙏
My fab topic
Thank you so much sir ❤
Great thanks!
Awesome sir❤
Thank you.
Can this be used in production development. Does using virtual threads optimize the perfromance of the app vs using the platform thread?
yes of course but performance testing must be done pre prod to see the difference first. not all use case works for virtual thread
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
Generate for login and use that for password but forgot password you can bypass it
i got your question, but i think its worded wrongly? it should be parallel thread execution
Which one buddy didn't get you
Can you do it with spring reactive web flux as well.
Yes 👍
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
Yes but what's the problem? You want me to use a different server for jmeter for testing? How that make sense
@@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.
If we have async task like auditing then how to do this with virtual threads? Previously we were using @async annotation with ThreadPoolTaskExecutor
I guess it depends on your implementation 🙂
The default thread size is 200 for Tomcat if you use standard threads. So, you didn't reach 400 in the last test.
Yes but the thread will reuse right? Once one thread is free he can pick up the task
@@Javatechie right. But if you increased it to 400, the result might be better for platform threads. At least, it would be fair.
I believe you didn’t get what is virtual thread and it’s importance could you please check my previous video about virtual threads
@@Javatechie Steal the task 😁
Ok understood. Now question is, can i just use Virtual Thread? Is there any case where i cannot (should not) use Virtual Threads?
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.
@@Balajisrinivasan1212 Thanks. It surely helps.
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
Absolutely correct buddy
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?
Hello buddy please checkout the video below 👇 👇
ruclips.net/video/z17QckCZ6fA/видео.html
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
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.
Bro all is fine but the accent is heavy
Lmao he cant change that 🤣
Thank you.