Chapter 12. Profiling
The term profiling has a somewhat loose usage among programmers. There are, in fact, several different approaches to profiling that are possible, the two most common of which are:
-
Execution
-
Allocation
In this chapter, we will cover both of these topics. Our initial focus will be on execution profiling, and we will use this subject to introduce the tools that are available to profile applications. Later in the chapter, we will introduce memory profiling and see how the various tools provide this capability.
One of the key themes we will explore is just how important it is for Java developers and performance engineers to understand how profilers operate in general. Profilers are very capable of misrepresenting application behavior and exhibiting noticeable biases.
Execution profiling is one of the areas of performance analysis where these biases come to the fore. The cautious performance engineer will be aware of this possibility and will compensate for it in various ways, including profiling with multiple tools to understand what’s really going on.
It is equally important for engineers to address their own cognitive biases, and to not go looking for the performance behavior that they expect. The antipatterns and cognitive traps that we met in Chapter 2 (and see also Appendix B) are a good place to start when training ourselves to avoid these problems.
Introduction to Profiling
In general, JVM profiling and monitoring tools operate by using some low-level ...
Get Optimizing Cloud Native Java, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.