Pengzna commented on code in PR #12723:
URL: https://github.com/apache/iotdb/pull/12723#discussion_r1638452403


##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/PipeConsensusServerImpl.java:
##########
@@ -274,21 +288,51 @@ public synchronized void 
checkConsensusPipe(Map<ConsensusPipeName, PipeStatus> e
 
   public TSStatus write(IConsensusRequest request) {
     try {
+      long consensusWriteStartTime = System.nanoTime();
       stateMachineLock.lock();
+      long getStateMachineLockTime = System.nanoTime();
+      // statistic the time of acquiring stateMachine lock
+      pipeConsensusServerMetrics.recordGetStateMachineLockTime(
+          getStateMachineLockTime - consensusWriteStartTime);
+      long writeToStateMachineStartTime = System.nanoTime();
       if (request instanceof ComparableConsensusRequest) {
         ((ComparableConsensusRequest) request)
             
.setProgressIndex(progressIndexManager.assignProgressIndex(thisNode.getGroupId()));
       }
-      return stateMachine.write(request);
+
+      long startWriteTime = System.nanoTime();
+      TSStatus result = stateMachine.write(request);
+      PERFORMANCE_OVERVIEW_METRICS.recordEngineCost(System.nanoTime() - 
startWriteTime);

Review Comment:
   ditto



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

Reply via email to