This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new c4230a8b9a8 [enhancement](memory) add jvm information into memory 
profile page in BE (#57917)
c4230a8b9a8 is described below

commit c4230a8b9a86a48f1bd5f36550a7c4b9d33d3d45
Author: yiguolei <[email protected]>
AuthorDate: Wed Nov 12 09:23:34 2025 +0800

    [enhancement](memory) add jvm information into memory profile page in BE 
(#57917)
    
    MemoryProfile:
      MemoryOverviewSnapshot:
         - PhysicalMemory(VmRSS) Current: 995.35 MB (Peak: 1.02 GB)
         - VirtualMemory(VmSize) Current: 43.34 GB (Peak: 43.34 GB)
        UntrackedMemory:
           - Memory Current: 205.82 MB (Peak: 236.62 MB)
        TrackedMemory:
           - Memory Current: 789.53 MB (Peak: 810.52 MB)
          TasksMemory:
             - Memory Current: 0 (Peak: 0)
               - ReservedMemory Current: 0 (Peak: 0)
            Details:
               - Compaction Current: 0 (Peak: 0)
               - Load Current: 0 (Peak: 0)
                 - AllMemTablesMemory Current: 0 (Peak: 0)
               - Other Current: 0 (Peak: 0)
               - Query Current: 0 (Peak: 0)
               - SchemaChange Current: 0 (Peak: 0)
          GlobalMemory:
             - Memory Current: 0 (Peak: 0)
          JvmMemory:
             - Memory Current: 624.00 MB (Peak: 624.00 MB)
          MetadataMemory:
             - Memory Current: 148.47 KB (Peak: 148.47 KB)
          CacheMemory:
             - Memory Current: 33.43 KB (Peak: 33.43 KB)
          JemallocMemory:
             - Memory Current: 165.35 MB (Peak: 186.47 MB)
            Details:
               - Cache Current: 93.83 MB (Peak: 116.87 MB)
               - Metadata Current: 71.52 MB (Peak: 71.52 MB)
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 be/src/runtime/memory/memory_profile.cpp | 18 +++++++++++++++++-
 be/src/runtime/memory/memory_profile.h   |  4 ++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/be/src/runtime/memory/memory_profile.cpp 
b/be/src/runtime/memory/memory_profile.cpp
index 217fcfc25e7..42898a9f50a 100644
--- a/be/src/runtime/memory/memory_profile.cpp
+++ b/be/src/runtime/memory/memory_profile.cpp
@@ -72,6 +72,9 @@ void MemoryProfile::init_memory_overview_counter() {
             tasks_memory_overview_profile->create_child("Details", true, 
false);
     RuntimeProfile* global_memory_overview_profile =
             tracked_memory_profile->create_child("GlobalMemory", true, false);
+
+    RuntimeProfile* jvm_memory_overview_profile =
+            tracked_memory_profile->create_child("JvmMemory", true, false);
     RuntimeProfile* metadata_memory_overview_profile =
             tracked_memory_profile->create_child("MetadataMemory", true, 
false);
     RuntimeProfile* cache_memory_overview_profile =
@@ -101,13 +104,17 @@ void MemoryProfile::init_memory_overview_counter() {
     _jemalloc_metadata_usage_counter =
             
jemalloc_memory_details_profile->AddHighWaterMarkCounter("Metadata", 
TUnit::BYTES);
 
-    // 4 add global/metadata/cache memory counter
+    // 4 add global/metadata/cache/Jvm memory counter
     _global_usage_counter =
             global_memory_overview_profile->AddHighWaterMarkCounter("Memory", 
TUnit::BYTES);
     _metadata_usage_counter =
             
metadata_memory_overview_profile->AddHighWaterMarkCounter("Memory", 
TUnit::BYTES);
     _cache_usage_counter =
             cache_memory_overview_profile->AddHighWaterMarkCounter("Memory", 
TUnit::BYTES);
+    _jvm_heap_memory_usage_counter =
+            jvm_memory_overview_profile->AddHighWaterMarkCounter("HeapMemory", 
TUnit::BYTES);
+    _jvm_non_heap_memory_usage_counter =
+            
jvm_memory_overview_profile->AddHighWaterMarkCounter("NonHeapMemory", 
TUnit::BYTES);
 
     // 5 add tasks memory counter
     _tasks_memory_usage_counter =
@@ -254,6 +261,15 @@ void MemoryProfile::refresh_memory_overview_profile() {
     COUNTER_SET(_jemalloc_memory_usage_counter,
                 _jemalloc_cache_usage_counter->current_value() +
                         _jemalloc_metadata_usage_counter->current_value());
+    DorisMetrics::instance()->jvm_metrics()->update();
+    int64_t jvm_heap_bytes =
+            
DorisMetrics::instance()->jvm_metrics()->jvm_heap_size_bytes_committed->value();
+    int64_t jvm_non_heap_bytes =
+            
DorisMetrics::instance()->jvm_metrics()->jvm_non_heap_size_bytes_committed->value();
+
+    all_tracked_mem_sum += jvm_heap_bytes + jvm_non_heap_bytes;
+    COUNTER_SET(_jvm_heap_memory_usage_counter, jvm_heap_bytes);
+    COUNTER_SET(_jvm_non_heap_memory_usage_counter, jvm_non_heap_bytes);
 
     COUNTER_SET(_tracked_memory_usage_counter, all_tracked_mem_sum);
     memory_all_tracked_sum_bytes << all_tracked_mem_sum - 
memory_all_tracked_sum_bytes.get_value();
diff --git a/be/src/runtime/memory/memory_profile.h 
b/be/src/runtime/memory/memory_profile.h
index 55b904bfb48..4a782468773 100644
--- a/be/src/runtime/memory/memory_profile.h
+++ b/be/src/runtime/memory/memory_profile.h
@@ -91,6 +91,10 @@ private:
     RuntimeProfile::HighWaterMarkCounter* _jemalloc_cache_usage_counter;
     RuntimeProfile::HighWaterMarkCounter* _jemalloc_metadata_usage_counter;
 
+    // JVM memory counter
+    RuntimeProfile::HighWaterMarkCounter* _jvm_heap_memory_usage_counter;
+    RuntimeProfile::HighWaterMarkCounter* _jvm_non_heap_memory_usage_counter;
+
     // global/metadata/cache memory counter
     RuntimeProfile::HighWaterMarkCounter* _global_usage_counter;
     RuntimeProfile::HighWaterMarkCounter* _metadata_usage_counter;


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

Reply via email to