No video

Java Virtual Threads - Reactive Programming Killer?

  Рет қаралды 17,073

Viraj Shetty

Viraj Shetty

Күн бұрын

To improve the scalability of applications, Java developers write complex Reactive Pipelines using Completable Futures or Spring WebFlux. However, with the release of Java 21 and Virtual Threads - this is no longer necessary. This talk explains the reason why Reactive programming was born and why Virtual Threads may eventually kill it.
Also checkout my KZfaq video on Virtual Threads - • Java Virtual Threads a...
Check out my other links below for discounted popular courses (12.99$ or best local price)
My Website : www.mudraservi...
Virtual Threads Course : www.mudraservi...
My Blog : / viraj_63415

Пікірлер: 63
@viraj_shetty
@viraj_shetty 9 ай бұрын
Hi All - Use link below for my popular Java courses. Virtual Threads - www.mudraservices.com/udemycoupon.html?course=vthread Java Generics - www.mudraservices.com/udemycoupon.html?course=jgen For more of my courses, check out - www.mudraservices.com
@fabriciosimoncelli
@fabriciosimoncelli 9 ай бұрын
Hi Viraj! Is the course available for udemy business? I have a Udemy account from my company but I didn't find it
@viraj_shetty
@viraj_shetty 9 ай бұрын
Hi Fabricio - Unfortunately no. If you send a message and request to Udemy, they might add it hopefully.
@viraj_shetty
@viraj_shetty 9 ай бұрын
Hi Fabricio - Good News. Its now available as of yesterday ! Thanks !
@fabriciosimoncelli
@fabriciosimoncelli 9 ай бұрын
@@viraj_shetty awesome!! I've just enrolled. Thank you so much 👏
@user-mg8fx7fw1d
@user-mg8fx7fw1d 8 ай бұрын
Great explanation! Thank you for taking the time to do this
@viraj_shetty
@viraj_shetty 8 ай бұрын
Glad it was helpful!
@MoshlehuddinMazumder
@MoshlehuddinMazumder 5 ай бұрын
Very precise explanation. Kudos! Would love to see some work around migrating from Spring webflux to virtual thread.
@viraj_shetty
@viraj_shetty 5 ай бұрын
Noted
@daveamiana778
@daveamiana778 7 ай бұрын
I enjoyed the explanation. Thank you for putting out this content; really helped me wrap my head around this concept.
@viraj_shetty
@viraj_shetty 7 ай бұрын
Glad it was helpful!
@sambaemol2476
@sambaemol2476 Ай бұрын
Thank you very much. You made it look so easy.
@viraj_shetty
@viraj_shetty Ай бұрын
I am glad you enjoyed it
@duybuiha9284
@duybuiha9284 2 ай бұрын
Hi Viraj, should we refactor reactive code style to synchronize code and upgrade spring webflux to virtual thread? Is there something reactive can do and do better than virtual thread? r2dbc, callback event ?, stream composition and transformation ?, Thanks.
@viraj_shetty
@viraj_shetty 2 ай бұрын
My suggestion is to NOT rewrite your reactive application. But your next application should be evaluated to see if you can use Virtual threads. Currently Real time streaming data is the only thing which reactive programs can do better. If so, only that part should be made reactive. That's my thought ! Its an interesting video to make
@user-zh5jl4nx6p
@user-zh5jl4nx6p Ай бұрын
Excellent explanation, thank you!
@viraj_shetty
@viraj_shetty Ай бұрын
I am glad you enjoyed the video
@abcd-sf5ur
@abcd-sf5ur 4 ай бұрын
Splendid explanation.
@viraj_shetty
@viraj_shetty 3 ай бұрын
I am glad you liked it
@MrKKPA
@MrKKPA 5 ай бұрын
How is the memory allocation of the objects used with carrier threads?
@viraj_shetty
@viraj_shetty 5 ай бұрын
Carrier thread is basically a Platform thread, so all objects are allocated in the heap. No change.
@MrKKPA
@MrKKPA 5 ай бұрын
@@viraj_shetty I love your content! Thank you!
@user-sz1rm7bj7r
@user-sz1rm7bj7r Ай бұрын
Great video. Pretty sure never learned so much in just 13 mins 😉
@viraj_shetty
@viraj_shetty Ай бұрын
Glad you enjoyed it! 😊
@RenannPrado
@RenannPrado 6 ай бұрын
I hope so.
@viraj_shetty
@viraj_shetty 6 ай бұрын
Except for the streaming part of the reactive architecture, i think other parts are replaceable
@amitbhattacharyya7701
@amitbhattacharyya7701 7 ай бұрын
That's the first thought came in my mind when I came across virtual thread , however on 8:08 , fully reactive design do you mean future and completablefuture can you point to some git repo for better understanding to active reactive design in java 8 for example
@viraj_shetty
@viraj_shetty 7 ай бұрын
Your instinct is correct. Java provides frameworks for writing Reactive applications. CompletableFuture (not Futures) and Spring WebFlux are two such mechanisms. But they don't mandate that the code is "Fully Reactive" because developers can always write blocking code and nothing can prevent that. Being fully reactive would require Developer due diligence as well. This video is more of a general discussion on reactive programming. I am creating a new video with code samples and I will publish that soon. Thanks for your comments !
@manuyaji
@manuyaji 9 ай бұрын
Hi Viraj, I had a question. The reason why we simply don't scale the number of platform threads in our application is because it consumes ~1 MB per thread. How does having virtual threads solve that problem?
@viraj_shetty
@viraj_shetty 9 ай бұрын
Platform threads don't scale well. That's why we usually pool the Platform threads - say 200 max. That means if 5000 users are concurrently hitting your tomcat server - only 200 at time will be handled and that leads to severe performance problems (unless you add more tomcat instances). But the CPU is not maxed out at this point, so basically resources are not utilized properly. For the same requests, if you use Virtual Threads - there will be 5000 Virtual threads. Virtual threads are cheap, consumes memory in kbytes and under the hood they use Platform thread (Carrier) for CPU operations. But the important thing is that Virtual thread releases the carrier thread during IO operations like network io, file read/writing or locking. So, these 5000 Virtual threads will require only a few Platform threads (approx = num of cores). This improves the CPU throughput considerably. Virtual threads give us an illusion of more actual threads just like Virtual Memory gives us an illusion of more physical memory.
@fedorkonstantinov2497
@fedorkonstantinov2497 6 ай бұрын
At the same time those 200 threads could fetch only, e.g., 200 db conections, but now they will exhaust the db connection pool
@GodofStories
@GodofStories 8 ай бұрын
Excellent presentation, really explained it well.
@viraj_shetty
@viraj_shetty 8 ай бұрын
Glad you liked it !
@shazinfy
@shazinfy 8 ай бұрын
Excellent Explanation. Thanks.
@viraj_shetty
@viraj_shetty 8 ай бұрын
Glad you enjoyed
@yogeshbhakhar3414
@yogeshbhakhar3414 7 ай бұрын
Thank you for this. Simply Amazing❤
@viraj_shetty
@viraj_shetty 7 ай бұрын
Appreciate it very much
@goumuk
@goumuk 7 ай бұрын
Thank you for the beautiful explanations. I want to understand thread life cycle in reactive programming in a more deeper way. Is there any resource I can refer to?
@viraj_shetty
@viraj_shetty 7 ай бұрын
Check out the CompletableFuture tutorial. This talks about thread use. - 90 mins FREE Tutorial on Java Futures and Completable Futures kzfaq.info/get/bejne/htiYpNhzyta9ZJc.html
@andd3dfx
@andd3dfx 2 ай бұрын
Thanks, looking helpful
@viraj_shetty
@viraj_shetty 2 ай бұрын
You are welcome !
@girishanker3796
@girishanker3796 7 күн бұрын
Great video
@viraj_shetty
@viraj_shetty 6 күн бұрын
Thanks! Glad you liked it
@jamilxt
@jamilxt 8 ай бұрын
Thank you! 🎉
@viraj_shetty
@viraj_shetty 8 ай бұрын
You are welcome !
@user-ec7wy7yv8u
@user-ec7wy7yv8u 9 ай бұрын
Thank you Viraj
@viraj_shetty
@viraj_shetty 9 ай бұрын
Sure thing !
@badbaboye
@badbaboye 6 ай бұрын
thank you for the video
@viraj_shetty
@viraj_shetty 6 ай бұрын
Glad you enjoyed
@wdeath
@wdeath 3 ай бұрын
Data process and real time data processing, will define how we make our applications. Its not just the async, reactive programming is about data processing in pipelines. I think betting on data is always safe, before some years we didn't even have data-engineers now they are everywhere, this will come to software also.
@viraj_shetty
@viraj_shetty 2 ай бұрын
This discussion is for UI applications. Some use cases probably will continue using reactive style - like data pipelines . I agree there
@ArunKumar-fw6lu
@ArunKumar-fw6lu 4 ай бұрын
Great explanation for thread concepts
@viraj_shetty
@viraj_shetty 4 ай бұрын
Glad you enjoyed !
@MartinCrazyProgrammer
@MartinCrazyProgrammer Ай бұрын
But, is this so easy? Cause I can not believe that Java team would kill Webflux so easy just with this virtual threads, that is weird...
@viraj_shetty
@viraj_shetty Ай бұрын
Java Virtual threads is an answer to Async-await except that it is just that it is automatic. Surely, it scales better than Platform threads. WebFlux does have the notion of streaming which will probably still be used.. But if you are using webflux primarily for scalability and optimal use of threads - then i would say Virtual threads would be a better fit.
@khalidhamid7448
@khalidhamid7448 3 ай бұрын
Why not switch to Kotlin instead, it has coroutines (structured concurrency), flows ( reactive pipelines), it’s not verbose as Java, first class support out of Spring, interoperable with Java libraries, don’t need Lombok, you can leverage KSP for faster compilation or to write plugins, you can use functional style programming with Arrow library, small learning curve plus once you get use to it you can write your own DSL. I did Java for a decade then Kotlin now again Java. It’s just feels like I’m going backwards when doing Java.
@viraj_shetty
@viraj_shetty 3 ай бұрын
That’s definitely an option.
@DielsonSales
@DielsonSales 2 ай бұрын
Unfortunately it’s not always the choice of one developer.
@simonhartley9158
@simonhartley9158 Ай бұрын
Suspend functions and flow wrappers have the downside of function coloring.
Java 21 new feature: Virtual Threads #RoadTo21
33:35
Java
Рет қаралды 60 М.
Java Virtual Threads and Scalability Of Enterprise Applications
12:06
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Savage Vlogs
Рет қаралды 14 МЛН
Идеально повторил? Хотите вторую часть?
00:13
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 16 МЛН
Why "pop-up" restaurants are everywhere now
6:05
Vox
Рет қаралды 626 М.
Asynchronous Programming in Java using Virtual Threads, Venkat Subramaniam
49:16
Bulgarian Java User Group
Рет қаралды 11 М.
Java 21 Is Good?! | Prime Reacts
27:08
ThePrimeTime
Рет қаралды 228 М.
Java Virtual Thread: Is Reactive Programming Dead?
12:55
Vinoth Selvaraj
Рет қаралды 2,2 М.
Spring Tips: Virtual Threads
50:31
SpringDeveloper
Рет қаралды 12 М.
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Savage Vlogs
Рет қаралды 14 МЛН