Peter Hofer, David Gnedt, Hanspeter Mössenböck,
"Lightweight Java Profiling with Partial Safepoints and Incremental Stack Tracing"
, in ACM: Proceedings of the 6th Int'l Conference on Performance Engineering, 2015, ACM, Seite(n) 75-86, 2015, ISBN: 978-1-4503-3248-4
Lightweight Java Profiling with Partial Safepoints and Incremental Stack Tracing
Sprache des Titels:
Proceedings of the 6th Int'l Conference on Performance Engineering, 2015
Sampling profilers are popular because of their low and adjustable overhead and because they do not distort the profile by modifying the application code. A typical sampling profiler periodically suspends the application threads, walks their stacks, and merges the resulting stack traces into a calling context tree. Java virtual machines offer a convenient interface to accomplish this, but rely on safepoints, a synchronization mechanism that requires all threads to park in a safe location. However, a profiler is primarily interested in the running threads, and waiting for all threads to reach a safe location significantly increases the overhead. In most cases, taking a complete stack trace is also unnecessary because many stack frames remain unchanged between samples.
We present three techniques that reduce the overhead of sampling Java applications. Partial safepoints require only a certain number of threads to enter a safepoint and can be used to sample only the running threads. With self-sampling, we parallelize taking stack traces by having each thread take its own stack trace. Finally, incremental stack tracing constructs stack traces lazily and examines each stack frame only once instead of walking the entire stack for each sample. Our techniques require no support from the operating system or hardware. With our implementation in the popular HotSpot virtual machine, we show that we can significantly reduce the overhead of sampling without affecting the accuracy of the profiles.