Hi community,
We have came across to some code in geode that prioritizes some of the
threads using
https://cr.openjdk.java.net/~iris/se/11/latestSpec/api/java.base/java/lang/Thread.html#setPriority(int).
Below you can find links to code.
https://github.com/apache/geode/blob/41eb49989f25607acfcbf9ac5afe3d4c0721bb35/geode-core/src/main/java/org/apache/geode/internal/statistics/HostStatSampler.java#L304
https://github.com/apache/geode/blob/41eb49989f25607acfcbf9ac5afe3d4c0721bb35/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java#L92
https://github.com/apache/geode/blob/d79a3c78eab96a9e760db07fa42580e61586b9c5/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java#L147
https://github.com/apache/geode/blob/a5bd36f9fa787d3a71c6e6efafed5a7b0fe52d2b/geode-core/src/main/java/org/apache/geode/internal/tcp/TCPConduit.java#L343
Just to add that every new thread inherits parent thread priority, so
that means that there will be more thread with max priority in addition
to the above threads. Does somebody know why this is set for these
particular threads?
Additionally, in multiple online resources it is indicated that these
priories are not taken into the account by the Linux scheduler unless
additional parameters in JVM are set (UseThreadPriorities and
ThreadPriorityPolicy), please check links for more information's:
https://github.com/openjdk/jdk/blob/jdk8-b120/hotspot/src/share/vm/runtime/globals.hpp#L3369,L3392
and
https://github.com/openjdk/jdk/blob/jdk8-b120/hotspot/src/os/linux/vm/os_linux.cpp#L3961,L3966
Are these priorities that are set in Apache Geode code crucial and
should be enabled for better performance, or they shouldn't be used?
Also did I maybe miss something and these priorities are somehow used
even without setting mentioned JVM parameters?
Any help on this topic is welcome and sorry for bothering!
BRs/Jakov