Iteration/Warmup Timeout (was: Using jmh.shutdownTimeout)
Aleksey Shipilev
aleksey.shipilev at oracle.com
Thu May 28 08:28:50 UTC 2015
On 26.05.2015 18:05, Behrooz Nobakht wrote:
> - Based on the benchmark configuration I expect that each iteration is
> allowed to be executed at most 1 second.
> Is this not correct?
Current timeout mechanics only issues the Thread.interrupt to the
running threads. We can't do much better, since we can't magically stop
the non-cooperating thread stuck in @Benchmark. We can crash the forked
VM though, as alluded here:
https://bugs.openjdk.java.net/browse/CODETOOLS-7901376
> - If not, what should I use to have control over the iteration/warmup
> explicit ending?
You nominally have to make sure @Benchmark call finishes in reasonable
time. When you can't, e.g. it requires coordination for multiple
@Benchmark calls (mostly in asymmetric scenarios), you have to check for
interrupts in your @Benchmark code.
> - When I add @Threads(N) to the benchmark configuration, although I expect
> exceptions happen due to shutdown of threads (and catch them at a higher
> level),
> yet the benchmark fails to make progress to next iterations/warmups.
> Any advice?
This might be an instance of:
https://bugs.openjdk.java.net/browse/CODETOOLS-7901008
It would be nice to see if you have another case that should be handled.
Thanks,
-Aleksey
More information about the jmh-dev
mailing list