Parallel and Asynchronous Programming with Streams and CompletableFuture by Venkat Subramaniam

Sdílet
Vložit
  • čas přidán 11. 09. 2024
  • Subscribe to Devoxx on CZcams @ bit.ly/devoxx-...
    Like Devoxx on Facebook @ / devoxxcom
    Follow Devoxx on Twitter @ / devoxx
    Java 8 makes it relatively easy to program with parallel streams and to implement asynchronous tasks using CompletableFuture. When someone says it’s easy, cautious programmers ask “What’s the catch?” Well, of course, that’s one of the major topic we’ll address in this deep dive session. We will start with a fast introduction to parallel and asynchronous programming with Java 8 and quickly delve into the gotchas, when to use these facilities, when to avoid them, and how and where to put them to good use.
    Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., creator of agilelearner.com, and an instructional professor at the University of Houston. He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is a regularly-invited speaker at several international conferences. Venkat helps his clients effectively apply and succeed with sustainable agile practices on their software projects.
    Venkat is a (co)author of multiple technical books, including the 2007 Jolt Productivity award winning book Practices of an Agile Developer. You can find a list of his books at agiledeveloper.com. You can reach him by email at venkats@agiledeveloper.com or on twitter at @venkat_s

Komentáře • 56

  • @tdrake59
    @tdrake59 Před 6 lety +36

    Best statement in this video: "If you want to run code really fast and you don't care about result being really wrong then you should go back and program in C++".

  • @cukamart
    @cukamart Před 6 lety +34

    I am simple man. I see Venkat I press like

  • @crabsynth3480
    @crabsynth3480 Před 5 lety +5

    Perfection is Venkat ! What a passionate teacher... Really makes me want to improve my programming and thinking skills. Venkat turns coding into some sort of performance art like music... Its like watching a composer conducting a symphony.

  • @shyambaitmangalkar1511
    @shyambaitmangalkar1511 Před 6 lety +15

    This is a comprehensive guide to understand parallel and asynchronous programming with Stream APIs

  • @tdrake59
    @tdrake59 Před 6 lety +9

    Venkat, I've watched several of your presentations, and I feel that I should say that you are one of the best out there. Your presentations are exhaustive but succinct, effective, and compelling.

  • @goxr3plus_studio
    @goxr3plus_studio Před 6 lety +35

    *Venkat is a real Java, Scala, Groovy Boss* 👑

  • @juanmf
    @juanmf Před 5 lety +12

    incomplete index:
    Parallel streams:
    12:30 Structure of concurrent vs sequential code
    // begging error prone as lost comment
    14:00 Sequential()
    16:30 & 20:30 Parallel() vs Sequential()
    18:00 observing threads
    // end error prone
    22:20 order of execution (forEachOrdered())
    24:00 Controlling the order
    28:10 parallel and Filtering
    30:00 reduce
    39:00 parallel and reduce
    42:20 Parallel stream
    50:50 How many threads & where are things running
    54:50 work stealing
    56:45 Change n of threads at JVM
    1:02:55 Changing to a new ThreadPool programmatically
    1:07:30 Parallel != fast
    1:18:00 Find1st vs findAny
    1:23:00 parallel and resource utilization efficiency
    Completable Future:
    1:28:00 Async execution
    1:29:00 callbacks; promise
    1:33:55 Java CompletableFuture == JS promise
    1:37:30 supplyAsync(() -> {}); get() vs getNow(default)
    1:41:30 thenAccept(data -> {})
    1:44:00 speed of caller (main thread); that determines who runs the code
    1:46:00 ForkJoinPool supplyAsync(() -> {}, pool1), still main might steal work.
    1:47:34 Async vs no Async, choose thread to run. thenAcceptAsync(fn, pool2)
    1:52:10 creating pipelines
    1:55:50 error channel/exceptions

  • @marcinkurek2950
    @marcinkurek2950 Před 4 lety +4

    This is simply excellent! Easy to understand, well-structured, put in simple way and hilarious at times. Thank You sir!

  • @superman-up7rm
    @superman-up7rm Před 5 lety +2

    Truly a java master , efficient lecturer 👍.. Everything to the point..
    I also saw another video of this guy , compared to other horrible and outdated java stuff on CZcams, this is far beyond awesome. 10 out of 10 would recommend.

  • @maxfarsikov2197
    @maxfarsikov2197 Před 6 lety +30

    How can he manage to: talk, read error, find typo, and fix it without interrupting? 25:03 :) I love all his talks

    • @kolmnurk
      @kolmnurk Před 5 lety +2

      just started to scroll comments to see if anyone else noticed it :D inhuman!

    • @juanmf
      @juanmf Před 5 lety +4

      multi-threading...

    • @vipinkoul595
      @vipinkoul595 Před rokem +1

      @@juanmf Is it multi-tasking or multi-threaded or multi-programming :-) how does he context switch ;-)

  • @c0mpuipf
    @c0mpuipf Před 4 lety

    reading books about java not understanding anything -> come back to this guy's presentations - everything makes sense

  • @samuelasmelash8719
    @samuelasmelash8719 Před 4 lety

    I love the way he present not only in this video but all his presentation.

  • @boosan_m
    @boosan_m Před 3 lety

    He holds us through is wit and presentation.

  • @coderanger75
    @coderanger75 Před 6 lety +4

    Wow, amazing presentation. It would be an amazing opportunity to work with Venkat

  • @fstreamdl1631
    @fstreamdl1631 Před 6 lety +5

    damn !!! this guy is awesome

  • @ptyxs
    @ptyxs Před 5 lety

    Fantastic talk, as usual with Venkat Subramanian !!

  • @anindya7911
    @anindya7911 Před 5 lety

    Wonderful way of delivery and easy to understand

  • @runthecode_
    @runthecode_ Před 3 lety

    I wish my university professors were this good 😁

  • @briansupra7
    @briansupra7 Před 6 lety

    Another brilliant presentation from Venkat.

  • @Ahliddin007
    @Ahliddin007 Před 6 lety +1

    I love Venkat presentations, but my eyes simply couldn't watch this with screen constantly micro-jumping.. Is there anywhere the same talk with better video quality?

  • @priyanshuborthakur7773

    One word. Superb.

  • @nO_d3N1AL
    @nO_d3N1AL Před 6 lety

    Great presentation, especially regarding number of threads to use.

  • @nupursharma5905
    @nupursharma5905 Před 6 lety +1

    you are AWESOME!!!

  • @nguyenquan4836
    @nguyenquan4836 Před rokem

    Super sir

  • @Ravikumar-gj6qw
    @Ravikumar-gj6qw Před 3 lety

    Tq venkat

  • @check43210
    @check43210 Před 6 lety

    amazing speech, content and examples.. excellant

  • @Saurabhnaik
    @Saurabhnaik Před 5 lety +1

    1:25 CompletableFuture

  • @antildeepak
    @antildeepak Před 6 lety +2

    What is this Sleep.sleep? Is it some custom implementation for Thread.sleep? I don't get it in Java API

    • @krushnatkhawale1149
      @krushnatkhawale1149 Před 6 lety +2

      Deepak Antil you've got it right, hidden implementation of standard sleep operation.

  • @gurugajananbhat5408
    @gurugajananbhat5408 Před 6 lety +1

    Beautiful... Can we have shorter session on the same.. ? I really appreciate you sir for the great work. But need shorter session.

  • @tushargoel5522
    @tushargoel5522 Před 5 lety

    at 2:10:16, venkat mention about completeOnTimeout.. but this API is available since Java 9 not 8

  • @samuelvishesh
    @samuelvishesh Před 6 lety

    We need more of this for Java noobs like me 💜😍

  • @binodkumarsingh1705
    @binodkumarsingh1705 Před 5 lety

    You are full on code, Thanks for this... :)

  • @naresh_muthyala
    @naresh_muthyala Před 6 lety

    Nice explanation of stream api

  • @sibin_peter
    @sibin_peter Před 6 lety

    Where can I download the notes for this? Usually he has them at his website under agiledeveloper.com/downloads.html but doesn't seem to have this particular talk included.

  • @rahul41189
    @rahul41189 Před 6 lety

    Perfect..... very valuable info...... Thanks :)

  • @kenichimori8533
    @kenichimori8533 Před 6 lety

    Beyond high sense

  • @cooldudecs
    @cooldudecs Před 6 lety

    Excellent!

  • @Lahiru_Udana
    @Lahiru_Udana Před 5 lety

    Thank you

  • @ajaydhingra1982
    @ajaydhingra1982 Před 6 lety

    The reason why he is not getting performance change at 1:11 is because he is creating thread pool with different size but eventually using only one thread always from the pool :-) and i think same the the problem @ 1:05. He is using only one thread out of ForkJoinPool so 50/100 does not matter

    • @crabsynth3480
      @crabsynth3480 Před 5 lety

      I don't understand the underlying implementations completely so I'm not certain but where does the code say that the threads in the pool has different sizes? And where does it say that only one thread is being used from the pool...?? Maybe under the hood the language is doing what you said so that's what he is demonstrating just that... But I couldn't understand or see how he manually created a pool of different sized threads then only used one. Also your timestamps are off by a unit. Interesting idea nonetheless... Would like to know more about your reasoning.

  • @Howard_Roark_4eva
    @Howard_Roark_4eva Před 6 lety

    How to find out the value of blockingfactor for an app? Can it be computed?

  • @narendraswm
    @narendraswm Před 6 lety

    1:25:25

  • @MrTheking200794
    @MrTheking200794 Před 6 lety

    Which ide he is using ? i am asking because ide is showing output instantly

  • @relaxsightme
    @relaxsightme Před 6 lety +3

    Nice talking.

  • @saulmighty
    @saulmighty Před 6 lety +4

    He always pronounces years as ears😁

    • @crabsynth3480
      @crabsynth3480 Před 5 lety

      That's how we pronounce it in India he he... Also same goes for hours(ours) , is(ease) etc etc...