[ 
https://issues.apache.org/jira/browse/HADOOP-18055?focusedWorklogId=700941&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-700941
 ]

ASF GitHub Bot logged work on HADOOP-18055:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Dec/21 09:43
            Start Date: 24/Dec/21 09:43
    Worklog Time Spent: 10m 
      Work Description: aajisaka commented on a change in pull request #3824:
URL: https://github.com/apache/hadoop/pull/3824#discussion_r774953239



##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/ProfileServlet.java
##########
@@ -0,0 +1,393 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.http;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.hadoop.thirdparty.com.google.common.base.Joiner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.util.ProcessUtils;
+
+/**
+ * Servlet that runs async-profiler as web-endpoint.
+ * <p>
+ * 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
+ * <p>
+ * Example:
+ * 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

Review comment:
       Should we comment the NameNode and ResourceManager is running on 
localhost?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 700941)
    Time Spent: 1h 20m  (was: 1h 10m)

> Async Profiler endpoint for Hadoop daemons
> ------------------------------------------
>
>                 Key: HADOOP-18055
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18055
>             Project: Hadoop Common
>          Issue Type: New Feature
>            Reporter: Viraj Jasani
>            Assignee: Viraj Jasani
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> 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.
> We have an httpserver based servlet stack hence we can use HIVE-20202 as an 
> implementation template to provide async profiler as servlet for Hadoop 
> daemons. Ideally we achieve these requirements:
>  * Retrieve flamegraph SVG generated from latest profile trace.
>  * Online enable and disable of profiling activity. (async-profiler does not 
> do instrumentation based profiling so this should not cause the code gen 
> related perf problems of that other approach and can be safely toggled on and 
> off while under production load.)
>  * CPU profiling.
>  * ALLOCATION profiling.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to