3 Lessons learned from the locking statistics of a typical web application
Updated July 27, 2016
October 28, 2015
The following statistics were sampled by vmlens tracing archiva, a spring web application from apache.
Lesson 1: Almost all synchronization locks are only used by one thread
99,99 percent of all locks are only used by one thread. This observation led sun to the “Biased Locking” optimization for this case, see Synchronization in Java SE 6. Please note the logarithmic scale:
This means if you want to improve the performance of your web application, you should focus on those 0.01 Percent of locks.
Lesson 2: The amount of synchronization locks grows linear with the number of concurrent accesses
This shows that the different parts of the application have a similar synchronization behaviour. I will collect statistics for other types of applications, to see if they behave similar.
Lesson 3: The amount of data races grows linear with the number of concurrent accesses
Similar to lesson 2, this shows that the different parts of the application have also similar synchronization problems. To make sure that your web application does not behave as the typical web application, use vmlens to get rid of race conditions.