peter-lawrey / Java-Thread-Affinity

Control thread affinity for Java
379 stars 77 forks source link

Affinity.getAffinity() returns empty BitSet (zero cores) on Linux with 4 cores. #49

Closed lospalos closed 6 years ago

lospalos commented 6 years ago

We would like to use this library on our project so we tried first on windows platform with very nice success. Then after moving the code to server platform (Red Hat Enterprise Linux Server release 5.11 ) by debugging I found the problem with getting affinity setup: BitSet bs = Affinity.getAffinity(); In bs is all zero - like there is no processor/core. Even bs.cardinality(); is zero. image

The same code running on Win7 with four cores returns exact number of cores (bs.cardinality() is 4) What am I doing wrong with linux?

peter-lawrey commented 6 years ago

I would suggest you use a more recent version of RedHat e.g. 7.x. I believe it has been tested on 6.x but I doubt 5.x has been tested.

This page by RedHat https://access.redhat.com/articles/2986371 suggests 5.x was End Of Lifed a while ago and one option is to "Migrate to Red Hat Enterprise Linux 7 as soon as you can." ᐧ

On 13 March 2018 at 08:17, lospalos notifications@github.com wrote:

We would like to use this library on our project so we tried first on windows platform with very nice success. Then after moving the code to server platform (Red Hat Enterprise Linux Server release 5.11 ) by debugging I found the problem with getting affinity setup: BitSet bs = Affinity.getAffinity(); In bs is all zero - like there is no processor/core. Even bs.cardinality(); is zero. [image: image] https://user-images.githubusercontent.com/5066418/37329735-298f00f6-269f-11e8-940d-0eac87b2860a.png

The same code running on Win7 with four cores returns exact number of cores (bs.cardinality() is 4) What am I doing wrong with linux?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/peter-lawrey/Java-Thread-Affinity/issues/49, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBU8co3tWemE7oTT4-Ic1KL49QZGEvbks5td4CigaJpZM4SoPx4 .

--

Peter Lawrey CEO +44 7557017054 <07771%20662994> chronicle.software

Trading as Chronicle Software Ltd

lospalos commented 6 years ago

Thanks a lot for your concern.

Unfortunatelly we can't upgrade to newer Red Hat :-( - because of other product we use with our software.

Here is piece of log from server.log: 2018-03-13 08:39:24,885 WARN [net.openhft.affinity.Affinity] (batchProcessExecutor-1) Linux JNA-based affinity not usable because it failed to load! Reason: java.lang.UnsatisfiedLinkError: /tmp/jna-100923095/jna5229638838199059464.tmp: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /tmp/jna-100923095/jna5229638838199059464.tmp)

So the problem is old version of GLIBC.