What exactly are the count and duration values in JFR Thread Contention

252 views Asked by At

I have an multi-threaded application that runs for 1m9s (with 56 concurrent threads). The JFR screenshot of the contentions is show below. What is not clear to me are:

  1. What does the Count field indicate? The number of times the Lock has been acquired?
  2. What does the Average value indicate? And how is it that the Duration (= count * average) greater than the total execution time of the application?

enter image description here

Thanks,

1

There are 1 answers

0
Henrik Dafgård On

If I remember correctly the tab you're looking at there shows the number of times a thread has been blocked waiting on each lock grouped by the class (i.e. it counts multiple instances of the lock as the same here). The reason you might see a cumulative duration longer than the total runtime of the application is that it counts the wait time of each thread. Since you have 56 threads running (assuming that they run for the entire runtime of the application) the maximum amount of time that can be spent blocking on one particular lock is around 64 minutes (69s*56).