xichen01 commented on code in PR #6776:
URL: https://github.com/apache/ozone/pull/6776#discussion_r1631058511


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientMetrics.java:
##########
@@ -97,10 +131,26 @@ public void 
decrPendingContainerOpsMetrics(ContainerProtos.Type type) {
   }
 
   public void addContainerOpsLatency(ContainerProtos.Type type,
-      long latencyMillis) {
+      long latencyMillis, String datanode) {
+    recordLatencyMetricsIfNeeded(type, latencyMillis, datanode);
     containerOpsLatency.get(type).add(latencyMillis);
   }
 
+  private void recordLatencyMetricsIfNeeded(ContainerProtos.Type type, long 
latencyMillis,
+      String datanode) {
+    if (latencyMsThresholdsOrder.length > 0 && 
topLatencyMetricsSet.contains(type)) {

Review Comment:
   I did a benchmark use command `ozone freon ommg --operation READ_KEY -n 
1000000 -t 400  --bucket bucket1 --volume s3v --size 4k  --duration=1000`, the 
command generated about 25000 QPS read.
   
   The `recordLatencyMetricsIfNeeded` only 0.07% on the CPU time slice
   
![image](https://github.com/apache/ozone/assets/32928346/09e9812d-0c1c-4bf7-9319-1ac84dc587a8)
   And the Flame Graphs have been put to this PR's jira ticket 
https://issues.apache.org/jira/secure/attachment/13069380/client-readkey-25000-4k-cpu.html
   
   Configuration
   ```xml
   <property>
       
<name>ozone.xceiver.client.top.metrics.latency.record.threshold.ms.key</name>
       <value>1, 10</value>
   </property>
   <property>
       <name>ozone.xceiver.client.top.metrics.latency.record.count.key</name>
       <value>5</value>
   </property>
   ```
   



-- 
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]


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

Reply via email to