[
https://issues.apache.org/jira/browse/HADOOP-18288?focusedWorklogId=781886&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-781886
]
ASF GitHub Bot logged work on HADOOP-18288:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 16/Jun/22 01:34
Start Date: 16/Jun/22 01:34
Worklog Time Spent: 10m
Work Description: tomscut commented on code in PR #4431:
URL: https://github.com/apache/hadoop/pull/4431#discussion_r898615298
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java:
##########
@@ -1697,6 +1700,61 @@ public void testRpcMetricsInNanos() throws Exception {
}
}
+ @Test
+ public void testNumTotalRequestsMetrics() throws Exception {
+ UserGroupInformation ugi = UserGroupInformation.
+ createUserForTesting("userXyz", new String[0]);
+
+ final Server server = setupTestServer(conf, 1);
+
+ ExecutorService executorService = null;
+ try {
+ RpcMetrics rpcMetrics = server.getRpcMetrics();
+ assertEquals(0, rpcMetrics.getTotalRequests());
+ assertEquals(0.0, rpcMetrics.getTotalRequestsPerSecond(), 0.0);
Review Comment:
RpcMetrics#getTotalRequestsPerSecond return `long`, so we can make some
change.
```suggestion
assertEquals(0, rpcMetrics.getTotalRequestsPerSecond());
```
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java:
##########
@@ -4061,4 +4103,32 @@ protected int getMaxIdleTime() {
public String getServerName() {
return serverName;
}
+
+ /**
+ * Server metrics updater thread, used to update some metrics on a regular
basis.
+ * For instance, requests per second.
+ */
+ private class MetricsUpdateRunner implements Runnable {
+
+ private long lastExecuted = 0;
+
+ @Override
+ public synchronized void run() {
+ long currentTime = Time.monotonicNow();
+ if (lastExecuted == 0) {
+ lastExecuted = currentTime - metricsUpdaterInterval;
+ }
+ long currentTotalRequests = totalRequests.sum();
+ long totalRequestsDiff = currentTotalRequests - lastSeenTotalRequests;
+ lastSeenTotalRequests = currentTotalRequests;
+ if ((currentTime - lastExecuted) > 0) {
+ double totalRequestsPerMillis =
Review Comment:
The unit here is `second`, so the variable name should be changed.
Issue Time Tracking
-------------------
Worklog Id: (was: 781886)
Time Spent: 1.5h (was: 1h 20m)
> Total requests and total requests per sec served by RPC servers
> ---------------------------------------------------------------
>
> Key: HADOOP-18288
> URL: https://issues.apache.org/jira/browse/HADOOP-18288
> Project: Hadoop Common
> Issue Type: Improvement
> Reporter: Viraj Jasani
> Assignee: Viraj Jasani
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> RPC Servers provide bunch of useful information like num of open connections,
> slow requests, num of in-progress handlers, RPC processing time, queue time
> etc, however so far it doesn't provide accumulation of all requests as well
> as current snapshot of requests per second served by the server. Exposing
> them would benefit from operational viewpoint in identifying how busy the
> servers have been and how much load they are currently serving in the
> presence of cluster wide high load.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]