Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Benchmarking Java programs

For university, I perform bytecode modifications and analyze their influence on performance of Java programs. Therefore, I need Java programs---in best case used in production---and appropriate benchmarks. For instance, I already got HyperSQL and measure its performance by the benchmark program PolePosition. The Java programs running on a JVM without JIT compiler. Thanks for your help!

P.S.: I cannot use programs to benchmark the performance of the JVM or of the Java language itself (such as Wide Finder).

like image 798
s106mo Avatar asked Jan 03 '11 08:01

s106mo


People also ask

How do you code a benchmark in Java?

The simplest way to really benchmark your Java code is the Java Microbenchmark Harness (JMH). It helps to benchmark the actual performance by taking care of JVM warm-up and code-optimizations that might dilute the results.

What is Java Microbenchmarking?

JMH is a Java harness for building, running, and analysing nano/micro/milli/macro benchmarks written in Java and other languages targeting the JVM.

What is JMH benchmark?

JMH Benchmark ModesMeasures how long time it takes for the benchmark method to execute, including max, min time etc. Single Shot Time. Measures how long time a single benchmark method execution takes to run. This is good to test how it performs under a cold start (no JVM warm up). All.

How do you benchmark a spring boot application?

The solution was quite than easy than I thought. The important part is to start the spring-boot application when the benchmark is getting initialized. Define a class level variable for configuration context and give a reference to it during setup of the benchmark. Make a call to the bean method inside the benchmark.


2 Answers

Brent Boyer, wrote a nice article series for IBM developer works: Robust Java benchmarking, which is accompanied by a micro-benchmarking framework which is based on a sound statistical approach. Article and the Resources Page.

Since, you do that for university, you might be interested in Andy Georges, Dries Buytaert, Lieven Eeckhout: Statistically rigorous java performance evaluation in OOPSLA 2007.

like image 68
jmg Avatar answered Oct 10 '22 06:10

jmg


Caliper is a tool provided by Google for micro-benchmarking. It will provide you with graphs and everything. The folks who put this tool together are very familiar with the principle of "Premature Optimization is the root of all evil," (to jwnting's point) and are very careful in explaining the role of benchmarking.

like image 9
Ray Avatar answered Oct 10 '22 06:10

Ray