News Stay informed about the latest enterprise technology news and product updates.

Performance improvements of contended Java monitor from JDK 6 to 9

The new JDK™ 9 early access release contains a JDK enhancement proposal JEP 143, Improve Contended Locking, to improve the performance of contended monitors.

Monitors are used by the Java synchronized statement to lock the access to a code block. An application profiler like Java Mission Control will show the synchronized block is called by many threads, the monitor becomes contended. This can degrade the performance dramatically.

Therefore we benchmarked a synchronized method with jmh for different JDK versions. Our Benchmark showed that for 16 Threads JDK 8 needs 2580 ns while JDK 9 only needs 1655 ns for our method. This is an improvement by more than 60 percent. In JDK 9 contended monitors are almost as performant as contended reentrant locks.

Read the full article here.