Java Virtual Threads - Reactive Programming Killer?

  Рет қаралды 14,496

Viraj Shetty

Viraj Shetty

8 ай бұрын

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 KZbin 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.mudraservices.com/
Virtual Threads Course : www.mudraservices.com/udemyco...
My Blog : / viraj_63415

Пікірлер: 54
@viraj_shetty
@viraj_shetty 7 ай бұрын
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 7 ай бұрын
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 7 ай бұрын
Hi Fabricio - Unfortunately no. If you send a message and request to Udemy, they might add it hopefully.
@viraj_shetty
@viraj_shetty 7 ай бұрын
Hi Fabricio - Good News. Its now available as of yesterday ! Thanks !
@fabriciosimoncelli
@fabriciosimoncelli 7 ай бұрын
@@viraj_shetty awesome!! I've just enrolled. Thank you so much 👏
@user-mg8fx7fw1d
@user-mg8fx7fw1d 7 ай бұрын
Great explanation! Thank you for taking the time to do this
@viraj_shetty
@viraj_shetty 7 ай бұрын
Glad it was helpful!
@daveamiana778
@daveamiana778 6 ай бұрын
I enjoyed the explanation. Thank you for putting out this content; really helped me wrap my head around this concept.
@viraj_shetty
@viraj_shetty 6 ай бұрын
Glad it was helpful!
@user-zh5jl4nx6p
@user-zh5jl4nx6p Күн бұрын
Excellent explanation, thank you!
@viraj_shetty
@viraj_shetty Күн бұрын
I am glad you enjoyed the video
@shazinfy
@shazinfy 6 ай бұрын
Excellent Explanation. Thanks.
@viraj_shetty
@viraj_shetty 6 ай бұрын
Glad you enjoyed
@MoshlehuddinMazumder
@MoshlehuddinMazumder 3 ай бұрын
Very precise explanation. Kudos! Would love to see some work around migrating from Spring webflux to virtual thread.
@viraj_shetty
@viraj_shetty 3 ай бұрын
Noted
@GodofStories
@GodofStories 6 ай бұрын
Excellent presentation, really explained it well.
@viraj_shetty
@viraj_shetty 6 ай бұрын
Glad you liked it !
@yogeshbhakhar3414
@yogeshbhakhar3414 5 ай бұрын
Thank you for this. Simply Amazing❤
@viraj_shetty
@viraj_shetty 5 ай бұрын
Appreciate it very much
@abcd-sf5ur
@abcd-sf5ur 2 ай бұрын
Splendid explanation.
@viraj_shetty
@viraj_shetty 2 ай бұрын
I am glad you liked it
@jamilxt
@jamilxt 6 ай бұрын
Thank you! 🎉
@viraj_shetty
@viraj_shetty 6 ай бұрын
You are welcome !
@user-ec7wy7yv8u
@user-ec7wy7yv8u 8 ай бұрын
Thank you Viraj
@viraj_shetty
@viraj_shetty 8 ай бұрын
Sure thing !
@andd3dfx
@andd3dfx 13 күн бұрын
Thanks, looking helpful
@viraj_shetty
@viraj_shetty 12 күн бұрын
You are welcome !
@badbaboye
@badbaboye 4 ай бұрын
thank you for the video
@viraj_shetty
@viraj_shetty 4 ай бұрын
Glad you enjoyed
@wdeath
@wdeath Ай бұрын
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 26 күн бұрын
This discussion is for UI applications. Some use cases probably will continue using reactive style - like data pipelines . I agree there
@goumuk
@goumuk 5 ай бұрын
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 5 ай бұрын
Check out the CompletableFuture tutorial. This talks about thread use. - 90 mins FREE Tutorial on Java Futures and Completable Futures kzbin.info/www/bejne/hqPLoqh4mtWMasU
@amitbhattacharyya7701
@amitbhattacharyya7701 5 ай бұрын
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 5 ай бұрын
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 7 ай бұрын
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 7 ай бұрын
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 4 ай бұрын
At the same time those 200 threads could fetch only, e.g., 200 db conections, but now they will exhaust the db connection pool
@RenannPrado
@RenannPrado 4 ай бұрын
I hope so.
@viraj_shetty
@viraj_shetty 4 ай бұрын
Except for the streaming part of the reactive architecture, i think other parts are replaceable
@duybuiha9284
@duybuiha9284 22 күн бұрын
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 22 күн бұрын
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
@MrKKPA
@MrKKPA 3 ай бұрын
How is the memory allocation of the objects used with carrier threads?
@viraj_shetty
@viraj_shetty 3 ай бұрын
Carrier thread is basically a Platform thread, so all objects are allocated in the heap. No change.
@MrKKPA
@MrKKPA 3 ай бұрын
@@viraj_shetty I love your content! Thank you!
@ArunKumar-fw6lu
@ArunKumar-fw6lu 3 ай бұрын
Great explanation for thread concepts
@viraj_shetty
@viraj_shetty 3 ай бұрын
Glad you enjoyed !
@khalidhamid7448
@khalidhamid7448 2 ай бұрын
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 2 ай бұрын
That’s definitely an option.
@DielsonSales
@DielsonSales 21 күн бұрын
Unfortunately it’s not always the choice of one developer.
Java Virtual Threads and Scalability Of Enterprise Applications
12:06
I’m just a kid 🥹🥰 LeoNata family #shorts
00:12
LeoNata Family
Рет қаралды 16 МЛН
버블티로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 61 МЛН
Is it Cake or Fake ? 🍰
00:53
A4
Рет қаралды 20 МЛН
Please be kind🙏
00:34
ISSEI / いっせい
Рет қаралды 165 МЛН
Java 21 new feature: Virtual Threads #RoadTo21
33:35
Java
Рет қаралды 56 М.
Spring Tips: Virtual Threads
50:31
SpringDeveloper
Рет қаралды 10 М.
Java Virtual Thread: Is Reactive Programming Dead?
12:55
Vinoth Selvaraj
Рет қаралды 1,9 М.
Async Showdown: Java Virtual Threads vs. Kotlin Coroutines (Riccardo LIPPOLIS)
49:48
Купил этот ваш VR.
37:21
Ремонтяш
Рет қаралды 296 М.
Secret Wireless charger 😱 #shorts
0:28
Mr DegrEE
Рет қаралды 1,7 МЛН
Hisense Official Flagship Store Hisense is the champion What is going on?
0:11
Special Effects Funny 44
Рет қаралды 1,6 МЛН
Секретный смартфон Apple без камеры для работы на АЭС
0:22