New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HADOOP-18055. Async Profiler endpoint for Hadoop daemons #3824
Conversation
This comment has been minimized.
This comment has been minimized.
@aajisaka @jojochuang @tasanuma Could you please take a look? |
This comment has been minimized.
This comment has been minimized.
Thank you @virajjasani for your patch. This feature looks very helpful for us to investigate the root cause of some performance issues. I'll build and deploy Hadoop cluster and test this feature. Now I have one comment: We need to add an additional access control for this servlet like ConfServlet. In addition, we need to update the document of |
@Override | ||
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) | ||
throws IOException { | ||
if (!HttpServer2.isInstrumentationAccessAllowed(getServletContext(), req, resp)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @aajisaka. I have added isInstrumentationAccessAllowed
here but let me also add it to ProfileOutputServlet
so that even before the url redirection takes place, user will get SC_UNAUTHORIZED
response.
* If Namenode http address is 9870, and ResourceManager http address is 8088, | ||
* ProfileServlet running with async-profiler setup can be accessed with | ||
* http://localhost:9870/prof and http://localhost:8088/prof |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we comment the NameNode and ResourceManager is running on localhost?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it support async profiler 1.x and 2.x? Better to document that somewhere.
HttpURLConnection conn = | ||
(HttpURLConnection) new URL(baseUrl, "/prof").openConnection(); | ||
assertEquals("GET", conn.getHeaderField(ProfileServlet.ACCESS_CONTROL_ALLOW_METHODS)); | ||
assertNotNull(conn.getHeaderField(ProfileServlet.ACCESS_CONTROL_ALLOW_ORIGIN)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be a good idea to call conn.disconnect() to clean up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
private static final int DEFAULT_DURATION_SECONDS = 10; | ||
private static final AtomicInteger ID_GEN = new AtomicInteger(0); | ||
|
||
static final String OUTPUT_DIR = System.getProperty("java.io.tmpdir") + "/prof-output"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because the ProfileServlet is used by several systems (Ozone, HBase, Hive), I would suggest to make the default output dir specific to Hadoop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(related: HDDS-5387)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, updated. (good to know Ozone also supports this)
Yes, updated AsyncProfilerServlet.md. Thanks |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one looks good to me.
Reviewed-by: Akira Ajisaka <aajisaka@apache.org>
Description of PR
Async profiler (https://github.com/jvm-profiling-tools/async-profiler) is a low overhead sampling profiler for Java that does not suffer from Safepoint bias problem. It features HotSpot-specific APIs to collect stack traces and to track memory allocations. The profiler works with OpenJDK, Oracle JDK and other Java runtimes based on the HotSpot JVM.
Async profiler can also profile heap allocations, lock contention, and HW performance counters in addition to CPU.
This PR provides Async profiler endpoint for Hadoop daemons.
More analysis on CPU and memory overhead:
How was this patch tested?
Locally. Screenshots:
For code changes: