liveBook · Manning

Chapter 7: Finding hidden issues using profiling techniques

What you will learn in chapter 7 of Troubleshooting Java: Read, debug, and optimize JVM applications

Introduces profiling as a way to investigate execution in hard-to-read applications and previews the chapter’s techniques.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces profiling as a way to investigate execution in hard-to-read applications and previews the chapter’s techniques.

Key terms: profiler, app execution

7.1 Sampling to observe executing code

This section uses VisualVM sampling to reveal executing code and investigate the source of latency, including work hidden inside dependencies.

Key terms: sampling, profiling, instrumentation, breakpoint, VisualVM, Sampler, CPU, active threads, stack trace, execution time

7.2 Profiling to learn how many times a method executed

This section uses targeted profiling to count method invocations and distinguish a slow individual call from repeated calls.

Key terms: sampling, profiling, method invocations, latency, feign package, intercepted code, Profiler tab, filter, package, subpackages

7.3 Using a profiler to identify SQL queries an app executes

This section introduces the difficulty of identifying dynamically generated SQL queries and the value of a profiler for investigating them.

Key terms: dynamically generated queries, profiler, persistence layer

7.3.1 Using a profiler to retrieve SQL queries not generated by a framework

This section uses VisualVM to trace an endpoint’s execution, retrieve its JDBC queries, and identify a repeated-query design problem.

Key terms: Profiler tab, class names, method names, JDBC, JDBC driver, DBMS, SQL queries, execution stack, codebase, query count

7.3.2 Using the profiler to get the SQL queries generated by a framework

This section shows how profiling reveals framework-generated SQL and helps investigate query-related latency.

Key terms: Spring Data JPA, JPQL, JDBC driver, DBMS, repository method, Hibernate, query execution, N+1 query problem, query executions, latency

7.3.3 Using the profiler to get programmatically generated SQL queries

This section uses JDBC profiling to diagnose and correct an inefficient SQL query generated from a Hibernate criteria query.

Key terms: criteria queries, Hibernate, JDBC profiling, VisualVM, cross join, product table, CriteriaQuery, from(), product instance, query

7.4 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 6: Identifying resource consumption problems using profiling techniques Chapter 8: Using advanced visualization tools for profiled data →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.