THUMarkLau opened a new pull request, #11883: URL: https://github.com/apache/iotdb/pull/11883
# Background In past CPU monitoring, the CPU usage of each thread/thread pool/module equaled the CPU time it occupied divided by the total CPU time of all threads, multiplied by the process's CPU utilization. However, this method has a flaw. Since we cannot obtain the CPU time of the GC thread, the calculated thread CPU utilization is inaccurate. When extensive GC occurs, it may seem like all threads' CPU utilization has risen because their ratios remain unchanged, but the process's CPU utilization has increased. This is actually due to GC. To eliminate this influence, this PR removes the impact of GC when calculating CPU utilization. Experimental results show that this PR has achieved the expected effect. # Experiment To verify this PR, I added a piece of code to the server side of IoTDB. Each time an insertRecords request is processed, 2MB of memory is allocated and stored in a global list to ensure that this memory is not reclaimed. After running for a while, the system will start to experience intense GC. However, at this time, the CPU utilization of other threads should remain the same or decrease. Therefore, we should observe a decrease in the process's CPU utilization, while the CPU utilization of each module remains unchanged or decreases. <img width="749" alt="image" src="https://github.com/apache/iotdb/assets/37140360/4f8bd21a-a457-41e3-866a-47c29e174a9c"> <img width="556" alt="image" src="https://github.com/apache/iotdb/assets/37140360/2b47e4df-a8fb-4e45-9659-8e4cc54964c0"> <img width="827" alt="image" src="https://github.com/apache/iotdb/assets/37140360/12fee33e-ab74-4843-a9f3-d562fe043fee"> <img width="1660" alt="image" src="https://github.com/apache/iotdb/assets/37140360/ce2a6fb5-4ff0-4469-a42b-53b0098bed04"> As shown in the figure above, when intense GC occurs, the CPU utilization of the process increases, but the utilization of the ClientRPC thread decreases, which is consistent with expectations. -- 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]
