Leveraging Parallel Streams for Fast Data Processing in Java 8
Parallelism is an amazing feature brought by the Stream API in Java 8. In this course, you will learn how parallel streams are working under the hood, how to use them to improve the performances of your applications, and when to avoid them.
What you'll learn
Along with the implementation of the map / filter reduce algorithm, the Stream API brings an amazing feature: the possibility to conduct the processing of your data in parallel. Going parallel is as simple as calling a parallel() method, something many developers are tempted to do. In this course, Leveraging Parallel Streams for Fast Data Processing in Java 8, you will learn what is happening under the hood, and how parallelism has been implemented in the Stream API. First, you will see that going parallel may improve the performances of your computations greatly, but may also ruin your application. Next, you will discover how to understand when things are working, which will give you the keys you need to decide when to go parallel and when to stay away from it. Finally, you will analyze the situations where things are not behaving as expected. By the end of this course, you will gain better understanding of parallelism as it is: a complex topic that you can grasp with simple ideas, so that you can use what you will learn immediately.
Table of contents
- Version Check 0m
- Introducing the Course and Parallel Streams 2m
- What Are You Going to Learn? What Do You Need to Know? 3m
- Course Agenda 1m
- Measuring Parallel Streams Performance Reliably 3m
- Making a Regular Stream a Parallel Stream 2m
- Measuring Performances Using JMH 3m
- Using the Computation of Prime Numbers to Set up JMH 1m
- Setting up the Prime Numbers Computation in a Parallel Stream 2m
- Setting up a Class to Be Benched by JMH 4m
- Live Demo: Writing a JMH Class That Computes Prime Numbers 3m
- Live Demo: Running a Benchmark with JMH in the IDE 2m
- Live Demo: Using Maven to Run a JMH Benchmark 4m
- Analyzing the Results of Sequential and Parallel Computation 2m
- Module Wrap Up 2m
- Introducing the Module and Its Agenda 1m
- Boxing and Unboxing Values in Wrapping Types 4m
- Live Demo: Measuring the Cost of Boxing Values in a Loop 2m
- Introducing Pointer Chasing and the Caches of a CPU 2m
- Chasing Pointers to Transfer Object from the Memory to the CPU 3m
- Comparing the Iterating over an ArrayList and a LinkedList 1m
- Live Demo: Measuring the Cost of Pointer Chasing for Lists 3m
- Analyzing the Cost of Cache Unfriendly In-memory Structures 3m
- Module Wrap Up 2m
- Introducing the Module and Its Agenda 1m
- Forking and Joining Computations to Implement Parallelism 2m
- Splitting a Heavy Computation Task until It Becomes Small Enough 1m
- Using the Common Fork Join Pool of Threads to Compute Tasks 3m
- Using Work Stealing to Keep the Fork Join Pool Busy 3m
- Joining Partial Results to Produce a Final Result 2m
- Wrapping up the Fork Join Framework: What Is Its Overhead? 1m
- Live Demo: Measuring the Overhead of the Fork Join Framework 2m
- Indentifying Performance Issues with the Fork Join Frameworks 1m
- Finding Hidden Inter-thread Communication Operations in Streams 2m
- Counting Stream Elements with Parallel limit() 1m
- Live Demo: Measuring the Overhead of limit() and findFirst() 4m
- Analyzing the Overhead of Parallel limit() and findFirst() 3m
- Avoiding the Use of the reduce() Method to Reduce a Stream 2m
- Reducing a Stream with a Non-associative Binary Operator 3m
- Computing the Sum of the Squares with a Non-associative Operator 1m
- Getting Different Faulty Results Sequentially and In Parallel 2m
- Getting Random Faulty Results In Parallel 2m
- Staying Away from Faulty Non-associative Reduction Operators 2m
- Live Demo: Displaying the Threads Executing Your Parallel Stream 2m
- Live Demo: Executing a Parallel Stream in a Custom Fork Join Pool 3m
- Live Demo: Counting the Number of Task Each Thread Executed 2m
- Module Wrap up 4m
- Introducing the Module and Its Agenda 1m
- Forking Is About Splitting Any Source of Data 1m
- Finding and Reaching the Center Position of a Source to Split It 3m
- Storing Elements in a Set Implemented with a Backing Array 3m
- Splitting a Set Backed by an Array, SIZED and SUBSIZED Properties 3m
- Live Demo: Showing the Problem of Sets for Parallel Streams 5m
- Live Demo: Comparing Performances of Lists and Sets 3m
- Analyzing the List and Set Benchmark 1m
- Wrapping up the List and Set Benchmark: Prefer Lists over Sets 1m
- Module Wrap Up 2m
- Course Wrap up, One Last Advice, Links, and Thanks 4m