Setting CPU Affinity in Combination with JMH Forks

Laurent Bourgès bourges.laurent at gmail.com
Tue Dec 4 08:38:48 UTC 2018


Hi,
I do use tasket -c 3 java -jar ... in my tests and it defines properly the
affinity of jmh (main) and all child processes like forks.
See
https://github.com/bourgesl/nearly-optimal-mergesort-code/blob/master/sort-bench/bench.sh

Of course, it means 1 thread should be used as only 1 real core (no hyper
threading) is given or threads will compete for the cpu...

You should diagnose what is causing hangs, using thread dumps ? Try kill -3
pid where pid corresponds to java processes.

My 2 cents,
Laurent

Le lun. 3 déc. 2018 à 20:10, Volkan Yazıcı <volkan.yazici at gmail.com> a
écrit :

> Hello,
>
> In fiber-test <https://github.com/vy/fiber-test/>, I clash various fiber
> (coroutine, actor, lightweight thread, whatever you call it)
> implementations targeting JVM -- including Project Loom! Here some
> libraries are capable of implicitly exploiting multiple cores, some aren't.
> To obtain an apples-to-apples comparison, I want confine all the benchmarks
> to a single CPU core. For this purpose, I tried various approaches:
>
> $ taskset -c 0 ./benchmark/benchmark.py
> $ taskset -c 0 docker run ...
> $ docker run --cpuset-cpus=0 ...
>
> Though in each case, if JMH forks (determined by benchmark.py) are enabled,
> JMH just hangs. When I disable forks, everything starts working as
> intended. Would anybody mind helping me to figure out what am I missing? Or
> is there any other way to achieve the same effect? Or... Does what I want,
> confining the benchmark to a single core, make sense at all?
>
> Best.
>


More information about the jmh-dev mailing list