From the course: Java Concurrency Troubleshooting: Latency and Throughput
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Microbenchmarks in Java with JMH - Java Tutorial
From the course: Java Concurrency Troubleshooting: Latency and Throughput
Microbenchmarks in Java with JMH
- [Instructor] You've probably seen the sort of code before, check this out. On line 83, I am collecting the current system time as a variable name startTime then online 88, I'm collecting the same system time as a variable called endTime. I then use the difference between the two to measure the time it took for this code block to execute. This is the time on a tradition of checking the execution time of a particular block of code. For many different reasons, the results of this sort of latency benchmark cannot be trusted. It's hard to simulate real JVM conditions that affect the execution speed of code. You also can't properly address the effect of multithreading or the JVM warmup processes, at least until now. Micro benchmarking is benchmarking but micro, makes sense. (chuckles) The point here is instead of having to set a bulky low testing gear to benchmark your app, you can quickly and reliably find out what parts…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Find the source of a blockage4m 46s
-
(Locked)
Collect thread dumps5m 41s
-
(Locked)
Challenge: Find the sleeping method1m 4s
-
(Locked)
Solution: Find the sleeping method3m 27s
-
(Locked)
Identify blocked threads in thread dumps4m 46s
-
(Locked)
View blocked threads with Java Mission Control6m 20s
-
(Locked)
View blocked threads with Java Flight Recorder5m 43s
-
(Locked)
Microbenchmarks in Java with JMH7m 53s
-
(Locked)
Challenge: Run JMH benchmarks and compare28s
-
(Locked)
Solution: Run JMH benchmarks and compare2m 58s
-
(Locked)
-