Thread number aware benchmarks and groups
Nitsan Wakart
nitsanw at yahoo.com
Mon Nov 18 03:20:01 PST 2013
Thanks Aleksey/Dmitry for your responses.
I'll have a go at this later this week, I was hoping for a dynamic solution so that I can drop the same microbenchmarks jar into different environments and have the workload defined from the command line. It's not such a big deal I guess and I may just resort to code generation as suggested by Dmitry.
On Monday, November 18, 2013 12:52 PM, Aleksey Shipilev <aleksey.shipilev at oracle.com> wrote:
On 11/14/2013 06:54 PM, Nitsan Wakart wrote:
> Hi,
> I'm using JMH to benchmark producer/consumer queues and would like to be able to split the producer consumers into groups such that the size of the 2 groups is the total number of threads. I.e:
> @GenerateMicroBenchmark
>
> @Group("group")
> @Threads(N/2)
> public void offer(){
> ...
> }
> @GenerateMicroBenchmark
>
> @Group("group")
> @Threads(N/2)
> public void poll(){
> ...
> }
> I'm happy to jump in and implement just wanted to check feasibility/road map/objections before I do.
> Is there an alternative people use at the moment to achieve same effect?
Sorry for late reply. There are two caveats:
a) The thread distribution between groups is static, and reflected in
the generated code. It is not possible to change the distribution of
threads among the methods after the benchmark is compiled. (This should
be changed as soon as we find the proper dynamic substitute to the
static scheme we have now).
b) Defining the expressions in the annotations is uber-hard, because
annotations normally accept constants only. You *may* try to put the
String expression there hoping the infra will evaluate it for you, but I
would rather see people use Java API for customizing the workloads like
that.
-Aleksey.
More information about the jmh-dev
mailing list