Dynamic method to optimize instrumentation based profiling of JVM based applications.
Publication Date: 2016-Aug-11
The IP.com Prior Art Database
We suggesting a method of enhancing profiling technique for JVM based application to increase accuracy and reduce profiling overhead. The key idea is to use runtime informatoin and methods execution plan and to apply learning techniques to locate methods which execution time is of order magnitude of granularity one can have time measurement. Then we suggest to avoid instrumentation of these methods to reduce undeeded overhead of adding profiling measurements thus increasing the overall accuracy.
Page 01 of 5
Dynamic method to optimize instrumentation based profiling of JVM based applications .
An ability to profile *java application is very crucial in terms of finding application limits or for location of applications possible bottlenecks, it's even more important while software developer tries to optimize and improve his code during the development. There are two widely known techniques to profile Java Application the "sampling" and the "instrumentation". Both techniques has their own pros and cons, and there is big difference between these two techniques. The sampling method based on statistical sampling of performance measured data, while instrumentation actually injects snippets of byte code into profiled application to conduct the measurements. One of the key drawbacks of the sampling approach is that it suffers from so called "safepoints bias", that means that sampling usually happens while JVM makes safepoints checks (usually happens before gc), therefore required to collect a lot of sample to increase accuracy of the measurements. On other hand instrumentation introduces the overhead, since it's actually injects additional, external to the profiled application pieces of code. Injected code also influence the accuracy of the profiling measurement, therefore for some cases might result with biased results as well. Additional problem of the instrumentation techniques is that is also suffers from disability to measure "quick" methods, a methods which execution takes time less than the granularity of time measurement.
In this invention we suggest to use dynamic byte code analysis to avoid instrumentation of methods which execution time could not be measured by integration of additional code , due to the precision of the system timer. For example simple methods which doesn't not call another methods or doesn't contains any loops which lengths depends on some input parameters.
Moreover there is a series of different optimization provided by JIT (Just-In-Time) compilation, such as: dead code elimination, copy propagation, removal of redundant loads, inlining of final methods and many others. JIT compiler optimization could also reduce the execution time of the measured method, therefore applying same dynamic heuristic before actual injection of profiling code might reduce the overhead and increase measurement accuracy.
The key idea behind the invention is to apply dynamic heuristics to the JVM byte code during the instrumentation profiling in order to reduce the overhead and to significantly increase accuracy of measurements. The sampling profiling techniques heavily relies on the sampling frequency and since the "safepoints" defined as the the known state of JVM, the actual sampling might happen during the "safepoints". Therefore sampling techniques introduces a drift or bias in the measurements correlated with the "safepoints" frequencies, this phenomenon called "safepoint bias" and to overcome this problem it requires to collect r...