I am trying to reduce the lock contention on a particular code-path in my application. To identify code with high lock contention, I connect YourKit to my application and use the "Monitor" tab and see acquiring which locks have caused the thread I care about to block. My eventual aim is to have no red dots for this thread in the "Thread" tab in YK GUI.
Often the contention arises from read/read locking using an intrinsic lock, so those can be improved by using a ReentrantLock
instead of the intrinsic lock. Indeed when I tried this, YourKit reported lower contention. Is that information reliable? Does YourKit report usage of ReentrantLock's correctly?
I am using YourKit 8.0.24 on Solaris 10 with Sun 1.6u18 32-bit JVM.