xinyiZzz commented on code in PR #9581:
URL: https://github.com/apache/incubator-doris/pull/9581#discussion_r873843542


##########
be/src/runtime/memory/chunk_allocator.cpp:
##########
@@ -219,6 +224,10 @@ void ChunkAllocator::free(const Chunk& chunk, MemTracker* 
tracker) {
         }
     } while (!_reserved_bytes.compare_exchange_weak(old_reserved_bytes, 
new_reserved_bytes));
 
+    // Reduce set metric frequency
+    if (_reserved_bytes % 100 == 32) {

Review Comment:
   At the first look, ChunkAllocator will allocate/free many times, the memory 
size of each allocate/free is a multiple of 2, so `_reserved_bytes% 100 == 32` 
will definitely happen, and the latest `_reserved_bytes` value will be set each 
time .
   
   The real-time and accurate `_reserved_bytes` value is not required. Usually, 
the value of `_reserved_bytes` is equal to ChunkAllocator MemTracker. The 
`_reserved_bytes` metric is only concerned when verifying the accuracy of 
MemTracker.
   
   Therefore, reduce the number of sets and reduce the performance impact.



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