Class ProfileServlet

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.hadoop.hbase.http.ProfileServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

@Private public class ProfileServlet extends javax.servlet.http.HttpServlet
Servlet that runs async-profiler as a web endpoint.

Query parameters:

  • event - profiling event: cpu|alloc|lock|cache-misses etc. (default: cpu)
  • duration - run profiling for N seconds, clamped to [1, 3600] (default: 10)
  • interval - sampling interval in nanoseconds (long)
  • jstackdepth - maximum Java stack depth (integer)
  • bufsize - frame buffer size (long); honored only by BinaryBackend
  • thread - profile different threads separately (flag)
  • simple - simple class names instead of FQN (flag)
  • output - output format: summary|traces|flat|collapsed|tree|jfr|html (default: html)
  • width - flame graph width in pixels; honored only by BinaryBackend
  • height - flame graph frame height in pixels; honored only by BinaryBackend
  • minwidth - skip frames smaller than this width in pixels (double)
  • reverse - generate stack-reversed FlameGraph / Call tree (flag)
  • pid - target process ID; LibraryBackend only supports the current JVM (returns 400 for other PIDs), BinaryBackend supports external PIDs
  • refreshDelay - extra seconds added to the auto-refresh delay (integer)
  • last - instead of starting a new session, redirect to the most recently completed profiling result. Returns 404 if no result is cached yet. The last result is kept in memory for the lifetime of the JVM.

Examples:

 # 30-second CPU profile (default)
 curl "http://localhost:10002/prof"

 # 1-minute allocation profile in tree format
 curl "http://localhost:10002/prof?event=alloc&output=tree&duration=60"

 # Redirect to the most recent profiling result
 curl "http://localhost:10002/prof?last"
 

Profiling is single-flight: only one session runs at a time. A second request while a session is active returns HTTP 409 Conflict with the URL of the last completed result (if any). Closing the browser tab does not cancel a running session — the stopper thread runs to completion on the server.

See Also: