سؤال

I am using JMH, an OpenJDK microbenchmark tool. The build process creates microbenchmarks.jar that I invoke with java -jar and passing jar name and JMH arguments.

I wonder should we run the benchmarks with -server option and why?

In other words, should I run my benchmark with:

java -server -jar microbenchmarks.jar ...(jmh args)
هل كانت مفيدة؟

المحلول

Well, it depends on what you are trying to measure. In most cases, the default JVM mode on the machine is what you are after to replicate the same conditions which the ordinary Java application will encounter.

Hence, we usually don't add -server to benchmark runs, because on most machines the ergonomics itself implicitly selects it, see Server Class Machine Detection.

نصائح أخرى

That entirely depends on what you want to benchmark - you should use that option if you want to measure how the system would behave when running server oriented workloads, using server JVM characteristics

see also - What is JVM -server parameter? , indicating that the -server switch also performs better JITting.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top