Lock contention monitoring

Plumbr Agent monitors all JVM threads for lock contention events. Whenever a thread in the JVM executes code in a synchronized block or method and another thread tries to enter the same synchronized block/method, Plumbr Agent captures the event. When the wait time for the second thread accessing the synchronized block/method exceeds a predetermined threshold, an incident is created. This incident exposes:

  • How long the thread was forced to wait before getting access to the synchronized block/method
  • Monitor used to lock the method/code block
  • The name and call stack from the thread trying to enter the synchronized block/method
  • The name and a snapshot of the call stack of the thread whose code was running in the synchronized block. The snapshot of the call stack is taken when the waiting time for the blocked thread is about to exceed the configured threshold.

See an example lock contention incident alert

Having such information allows you to zoom in to the underlying root cause with the precision of a single line in source code, skipping the tedious and complex process of troubleshooting concurrency issues. Notice that Plumbr also binds together similar lock contention events, allowing you to rank the severity of the performance issues based on the frequency of the underlying root cause.

The solution is currently built to trace synchronized block/method accesses. The work to support java.util.concurrent locks is in progress.