Contribution: Lock Contention Profiler for HotSpot

Aaron Grunthal aaron.grunthal at
Fri Nov 4 11:31:34 UTC 2016

I think for lock contention the distribution of the blocking time is of
interest. Can the profiler show that or just the cumulative time?

Most profilers only record the sum, which is useful for optimizing
throughput bottlenecks, but when optimizing for latency the CDF also is
of interest since some methods can have vastly different average and
worst case behaviors which can get obscured in the averages.

- Aaron

On 04.11.2016 11:00, Peter Hofer wrote:
> Hello everyone,
> we are researchers at the University of Linz and have worked on a lock
> contention profiler that is built into HotSpot. We would like to
> contribute this work to the OpenJDK community.
> Our profiler records an event when a thread fails to acquire a contended
> lock and also when a thread releases a contended lock. It further
> efficiently records the stack traces where these events occur. We
> devised a versatile visualization tool that analyzes the recorded events
> and determines when and where threads _cause_ contention by holding a
> contended lock. The visualization tool can show the contention by stack
> trace, by lock, by lock class, by thread, and by any combination of
> those aspects.
> We described our profiler in more detail in a research paper at ICPE
> 2016. [1] In our evaluation, we found that the overhead is typically
> below 10% for common multi-threaded Java benchmarks. Please find a free
> download of the paper on our website:
> I contribute this work on behalf of Dynatrace Austria (the sponsor of
> this research), my colleagues David Gnedt and Andreas Schoergenhumer,
> and myself. The necessary OCAs have already been submitted.
> We provide two patches:
> Patch 1. A patch for OpenJDK 8u102-b14 with the profiler that we
> described and evaluated in our paper, plus minor improvements. It
> records events for Java intrinsic locks (monitors) and for
> java.util.concurrent locks (ReentrantLock and ReentrantReadWriteLock).
> We support only Linux on 64-bit x86 hardware.
> Patch 2. A patch for OpenJDK 9+140 with a profiler for VM-internal
> native locks only. We consider this to be useful for HotSpot developers
> to find locking bottlenecks in HotSpot itself. We tested this patch only
> on Linux on 64-bit x86 hardware, but it should require few changes for
> other platforms.
> With both patches, the profiler is enabled with -XX:+EnableEventTracing.
> By default, an uncompressed event trace is written to file "output.trc".
> More detailed usage information and a download of the corresponding
> visualization tool is available on our website,
> Kind regards,
>  Peter Hofer
> -- 
> Peter Hofer
> Christian Doppler Laboratory on Monitoring and Evolution of
> Very-Large-Scale Software Systems / Institute for System Software
> University of Linz
> [1] Peter Hofer, David Gnedt, Andreas Schoergenhumer, Hanspeter
> Moessenboeck. Efficient Tracing and Versatile Analysis of Lock
> Contention in Java Applications on the Virtual Machine Level.
> Proceedings of the 7th ACM/SPEC International Conference on Performance
> Engineering (ICPE’16), Delft, Netherlands, 2016.

More information about the hotspot-dev mailing list