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

Behrooz N nobeh5 at gmail.com
Mon Feb 3 12:36:24 PST 2014


Hi,

I think the title pretty much says it. I am interested to write micro
benchmarks using JMH for an application that uses ExecutorService heavily
in its implementation. The design of the application is such that it
basically creates tasks encapsulated as instances of Runnable and queues in
a "single" instance of ExecutorService.

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.

So, I am asking for advice for the configurations on memory, fork
configuration, threads, iteration sync or any example document that have
hints on this.

Not so far off the topic, the motivation of such benchmark for me is to be
able to get a performance measurement of some application that tries to be
more concurrent using tasks and executor service.

Thanks in advance,
Behrooz


More information about the jmh-dev mailing list