Different library behaviour when running in cpu shield and when not
EgorLakomkin opened this issue · 3 comments
I am sorry if my question is more like forum question then bug issue, but I dont know where to write it. I am being slightly confused when i try to bind two threads on the same socket with java affinity library. I have cset shield installed on 2 and 3 processors( i have i5, SUSE 11.1 + RT extensions test system, in production it will be i7), so 0 and 1 are free, When I run my java code not from cpu shield I have this output :
INFO: cpu 2 base= false reservable= true
INFO: cpu 3 base= false reservable= true
It seems ok, but I need to run my program in cpu shield to achieve more determinism and etc. When run it inside shield I have completely opposite output like :
INFO: cpu 2 base= true reservable= false
INFO: cpu 3 base= true reservable= false , which is pretty confusing and I don't know if it is bug or my misbehaviour.
I need to bind threads to exact processors and then bind solarflace NIC interrupt affinity to achive lowest possible network latency and also stay in the shield.
What the library does is assume that the CPUs which are available to the process which are used by any thread (Java has many) are the ones you want to avoid. The idea is you want to bind to cpu no other thread will use. i.e. the ones which are not generally available.
If you know exactly which cpu(s) you want to use, I would use cset to avoid those cpus so the other threads in the
JVM won't use them and use AffinitySupport to assigned the critical threads to the desired cpu explicitly.
Thank you, Peter, very much for clarification and for great library.
It doesn't provide the guarantee directly, instead you need to use something like isolcpus= in the boot configuration to prevent those cpus being used. There must be a way to make use of cset, possibly as native calls.