Mô tả

In this course we'll understand what can cause performance issues in our applications, and how to resolve them. This includes a review of some of the options available to us as developers at design-time - how to make good coding choices for optimal performance. For example, when should you pick an ArrayList over a LinkedList? How much difference does the StringBuilder really make? Is Lambda syntax more or less efficient at certain operations?  We'll also learn about various ways that we can configure the virtual machine to provide better performance at run-time, with a range of runtime arguments. We'll also be diving deep into how the virtual machine manages memory, and how the garbage collection process works and impacts on application performance.

Along the way we'll be learning about the Just In Time compiler, performance testing and benchmarking, decompiling bytecode, using the GraalVM as an alternative virtual machine and more.

About Java Versions: This is the second iteration of this course and it is designed for all the current versions of Java that have long term support (Java 8 , Java 11 and Java 17). You can follow along with any of these versions. You can also use either the Oracle or the OpenJDK JVMs.  For developers using other JVM languages (such as Kotlin, Scala and Groovy) all of the JVM configuration parts of this course will still be relevant, and some of the coding choices may be useful to consider also. (Note that there's even a review of whether Kotlin provides better or worse performance than Java!)

Bạn sẽ học được gì

What can cause performance issues in our applications, and how to resolve them.

The choices available to us as developers at design-time - how to make good coding choices for optimal performance.

How to configure the virtual machine to provide better performance at run-time.

The JVM's Just In Time compiler.

How the virtual machine manages memory.

Performance testing and benchmarking.

Yêu cầu

  • Basic working knowledge of Java programming is needed, but you don't need to be a Java expert!

Nội dung khoá học

25 sections

Chapter 1 - Introduction

5 lectures
What do we mean by performance, and what versions of Java does this course cover
04:00
Example code provided with this course
01:01
Using different JDK and JVM vendors
01:37
The structure of this course
05:11
How to get support while you're taking this course
01:51

Chapter 2 - Just In Time Compilation and the Code Cache

7 lectures
What is bytecode?
03:03
The concept of "Just In Time Compilation"
05:51
Introducing the first example project
03:35
Finding out which methods are being compiled in our applications
05:23
The C1 and C2 Compilers and logging the compilation activity
04:43
Tuning the code cache size
06:18
Remotely monitoring the code cache with JConsole
08:29

Chapter 3 - Selecting the JVM

4 lectures
The differences between the 32 bit and 64 bit JVM
04:32
Specifying which compiler to use at runtime
06:34
Turning off tiered compilation
02:04
Tuning native compilation within the Virtual Machine
09:58

Chapter 4 - How memory works - the stack and the heap

4 lectures
Introduction - the structure of Java's memory
02:57
How the stack works
05:56
How the heap works
05:25
The heap and the stack together - an example
07:46

Chapter 5 - Passing objects between methods

5 lectures
What does "passing by value" mean?
04:54
What does "passing by reference" mean?
02:20
Passing objects into methods
04:13
The final keyword and why it's not the same as a constant
03:09
Why the final keyword doesn't stop an object's values from being changed
05:42

Chapter 6 - Memory exercise 1

2 lectures
Instructions for the exercise
01:35
Walkthrough of the solution
08:46

Chapter 7 - Escaping References

7 lectures
Introduction - what is an escaping reference?
05:33
Strategy 1 - using an iterator
07:31
Strategy 2 - duplicating collections
06:54
Strategy 3 - using immutable collections
04:38
Strategy 4 - duplicating objects
05:06
Strategy 5 - using interfaces to create immutable objects
04:39
Strategy 6 - using modules to hide the implementation
09:49

Chapter 8 - Memory Exercise 2

2 lectures
Instructions for the exercise
04:40
Walkthrough of the solution
07:39

Chapter 9 - The Metaspace and internal JVM memory optimisations

5 lectures
The role of the Metaspace
05:09
The PermGen
01:58
Are objects always created on the heap?
04:14
The String Pool
06:08
Interning Strings
03:03

Chapter 10 - Tuning the JVM's Memory Settings

5 lectures
How the string pool is implemented
04:10
Understanding the size and density of the string pool
11:36
Tuning the size of the string pool
03:28
Tuning the size of the heap
07:44
Shortcut syntax for heap tuning flags
03:06

Chapter 11 - Introducing Garbage Collection

7 lectures
What it means when we say Java is a managed language
04:57
How Java knows which objects can be removed from the Heap
02:49
The System.gc() method
04:28
Java 11's garbage collector can give unused memory back to the operating system
03:52
Why it's not a good idea to run the System.gc() method
02:05
The finalize() method
05:17
The danger of using finalize()
03:28

Chapter 12 - Monitoring the Heap

4 lectures
What is a soft leak?
08:51
Introducing (J)VisualVM
06:58
Monitoring the size of the heap over time
02:59
Fixing the problem and checking the heap size
04:15

Chapter 13 - Analysing a heap dump

2 lectures
Generating a heap dump
03:13
Viewing a heap dump
05:20

Chapter 14 - Generational Garbage Collection

5 lectures
How the garbage collector works out what is garbage
03:53
Why the heap is divided into generations
04:06
The Internals of the Young Generation
05:00
Viewing the generations in VisualVM
06:10
Viewing the heap when there's a soft leak
03:05

Chapter 15 - Garbage Collector tuning & selection

9 lectures
Monitoring garbage collections
06:27
Turning off automated heap allocation sizing
05:47
Tuning garbage collection - old and young allocation
04:55
Tuning garbage collection - survivor space allocation
02:24
Tuning garbage collection - generations needed to become old
02:06
Selecting a garbage collector
05:37
The G1 garbage collector
04:10
Tuning the G1 garbage collector
01:54
String de-duplication
02:52

Chapter 16 - Using a profiler to analyse application performance

10 lectures
Introducing Java Mission Control (JMC)
03:44
Building the JMC binaries
05:16
Running JMC and connecting to a VM
03:30
Customising the overview tab
03:41
The MBean Browser tab
01:40
The System, Memory and Diagnostic Commands tabs
02:24
Introducing our problem project
07:59
Using the flight recorder
09:02
Analyzing a flight recording
04:22
Improving our application
04:39

Chapter 17 - Assessing Performance

6 lectures
Why benchmarking isn't straight forward.
06:10
Setting up the code for benchmarking
05:51
A simple approach to micro-benchmarking
01:53
Adding in a warm-up period
04:37
Comparing two code alternatives
02:30
Using Macro-bencharmking
05:10

Chapter 18 - Benchmarking with JMH

3 lectures
Installing the JMH benchmarking tool
04:18
Creating and running benchmarks
05:56
Using different benchmark modes
03:09

Chapter 19 - Performance and Benchmarking Exercise

5 lectures
Instructions for exercise 1 (creating a flight recording)
01:40
Walkthrough of the solution & setting up ready for the next challenge
05:12
Instructions for exercise 2 (use JMH to macrobenchmark the project)
01:54
Walkthrough of the solution - part 1 setting up the code
05:17
Walkthrough of the solution - part 2 - integrating into JMH
07:09

Chapter 20 - How Lists Work

10 lectures
Why it's important to understand how the different List implementations work
01:39
The 8 different list implementations
01:39
The CopyOnWriteArrayList
02:37
The ArrayList
06:02
Specifying the initial size of an ArrayList
05:32
The Vector
02:55
The Stack
01:18
The LinkedList
03:07
Choosing the optimal list type
06:57
Sorting lists
02:37

Chapter 21 - How Maps Work

10 lectures
How Hashmaps Work - part 1
03:17
The role of the Hashcode
01:19
How Hashmaps Work - part 2
03:46
Specifying the initial size and factor of a HashMap
04:30
HashMap Performance
02:31
The rules for Hashcodes
04:15
Generating and optimising the Hashcode method
06:29
Optimising Hashmap Performance
00:49
How The LinkedHashMap Works
04:52
The HashTable and TreeMap
01:50

Chapter 22 - Other Coding Choices

6 lectures
Introduction to how we'll compare coding options
01:41
Comparing primatives with objects
02:54
Comparing BigDecimals with Doubles
03:46
Using the StringBuilder
04:46
Comparing loops and streams
06:41
A note on logging
03:57

Chapter 23 - GraalVM

6 lectures
What is GraalVM?
06:45
Installing GraalVM
02:59
Using the Graal Virtual Machine
06:35
Using the Graal Compiler
02:24
Native image building with Graal
04:14
Using the Graal experimental features within OpenJDK
03:34

Chapter 24 - Using Other JVM Languages

3 lectures
The principles of using other JVM Languages
07:04
Looking at bytecode with javap
10:50
Disassembling bytecode back to Java
07:22

Chapter 25 - Course Summary

2 lectures
The OpenJ9 Virtual Machine and what's coming up in future versions of Java
03:01
Bonus lecture
00:23

Đánh giá của học viên

Chưa có đánh giá
Course Rating
5
0%
4
0%
3
0%
2
0%
1
0%

Bình luận khách hàng

Viết Bình Luận

Bạn đánh giá khoá học này thế nào?

image

Đăng ký get khoá học Udemy - Unica - Gitiho giá chỉ 50k!

Get khoá học giá rẻ ngay trước khi bị fix.