Using JMH to test virtual thread performance
Dr Heinz M. Kabutz
heinz at javaspecialists.eu
Tue Feb 8 15:09:07 UTC 2022
Hi Alan and Firouz,
since virtual threads are currently executed on carrier threads from a
FJP, we could re-purpose my recent newsletter to test the performance of
any ForkJoinPool, not just the common pool:
https://www.javaspecialists.eu/archive/Issue297-Measuring-ForkJoinPool-Parallelism.html
This would not accurately measure the performance of a single virtual
thread, but would give us a good indication of how the carrier thread
are doing as a whole.
Regards
Heinz
--
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java™ Specialists' Newsletter" - www.javaspecialists.eu
Java Champion - www.javachampions.org
JavaOne Rock Star Speaker
Tel: +30 69 75 595 262
Skype: kabutz
On 2022/02/08 14:02, Alan Bateman wrote:
> On 08/02/2022 00:22, Firouz Bharthania wrote:
>> Hello,
>>
>> Can JMH (Java Microbenchmarking Harness) be used for measuring
>> virtual threads at this time, because I get high, unacceptable error
>> margins when I run tests?
>>
> Aleksey may have some advice but I would expect it should be possible
> to create a runner that invokes org.openjdk.jmh.Main.main in the
> context of a virtual thread. I don't know if anyone has done that.
>
> -Alan
More information about the loom-dev
mailing list