Advice on how to use JMH for benchmarking an application that uses ExecutorService?

Bernd Eckenfels ecki at zusammenkunft.net
Mon Feb 3 12:41:18 PST 2014


Am Mon, 3 Feb 2014 21:36:24 +0100
schrieb Behrooz N <nobeh5 at gmail.com>:
> I have started to use JMH with @BenchmarkMode(SampleTime). The
> question rose to me when at predictable runs of the benchmark, the
> runner seems to get stuck at some iteration. I tried to use jstack to
> identity any possible deadlock but it revealed nothing. This behavior
> was much more recurrent when using Throughput mode.

sounds like a typical synchronisation/concurrency/memorymodel problem.
If not in your code, then maybe in the executor service or its queue.

How about posting code?

Most likely taking a heapdump will make you see where counter/flags
dont agree with datastructures or where wakeups are required.

(A good first start is to change all waits with wait(1000) :) )

Greetings
Bernd

PS: you can of course write a simple "multi threaded offer" client to
see if you can reproduce it without JMH.


More information about the jmh-dev mailing list