Class ProfileServlet
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
Following options from async-profiler can be specified as query paramater. // -e event profiling event: cpu|alloc|lock|cache-misses etc. // -d duration run profiling for 'duration' seconds (integer) // -i interval sampling interval in nanoseconds (long) // -j jstackdepth maximum Java stack depth (integer) // -b bufsize frame buffer size (long) // -t profile different threads separately // -s simple class names instead of FQN // -o fmt[,fmt...] output format: summary|traces|flat|collapsed|svg|tree|jfr|html // --width px SVG width pixels (integer) // --height px SVG frame height pixels (integer) // --minwidth px skip frames smaller than px (double) // --reverse generate stack-reversed FlameGraph / Call tree
Example: If Namenode http address is localhost:9870, and ResourceManager http address is localhost:8088, ProfileServlet running with async-profiler setup can be accessed with http://localhost:9870/prof and http://localhost:8088/prof for Namenode and ResourceManager processes respectively. Deep dive into some params: - To collect 10 second CPU profile of current process i.e. Namenode (returns FlameGraph svg) curl "http://localhost:9870/prof" - To collect 10 second CPU profile of pid 12345 (returns FlameGraph svg) curl "http://localhost:9870/prof?pid=12345" (For instance, provide pid of Datanode) - To collect 30 second CPU profile of pid 12345 (returns FlameGraph svg) curl "http://localhost:9870/prof?pid=12345&duration=30" - To collect 1 minute CPU profile of current process and output in tree format (html) curl "http://localhost:9870/prof?output=tree&duration=60" - To collect 10 second heap allocation profile of current process (returns FlameGraph svg) curl "http://localhost:9870/prof?event=alloc" - To collect lock contention profile of current process (returns FlameGraph svg) curl "http://localhost:9870/prof?event=lock"
Following event types are supported (default is 'cpu') (NOTE: not all OS'es support all events) // Perf events: // cpu // page-faults // context-switches // cycles // instructions // cache-references // cache-misses // branches // branch-misses // bus-cycles // L1-dcache-load-misses // LLC-load-misses // dTLB-load-misses // mem:breakpoint // trace:tracepoint // Java events: // alloc // lock
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Constructor Details
-
ProfileServlet
public ProfileServlet()
-
-
Method Details
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException - Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
IOException
-