This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 6997c87b017 branch-4.0: [bugfix](memory_profile) should split memtable
memory from task's memory profile #58908 (#58979)
6997c87b017 is described below
commit 6997c87b0174caeff3866e46a1e6a2291e92efd0
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Dec 12 14:03:58 2025 +0800
branch-4.0: [bugfix](memory_profile) should split memtable memory from
task's memory profile #58908 (#58979)
Cherry-picked from #58908
Co-authored-by: yiguolei <[email protected]>
---
be/src/runtime/memory/memory_profile.cpp | 24 +++++++++++++++---------
be/src/runtime/memory/memory_profile.h | 5 ++++-
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/be/src/runtime/memory/memory_profile.cpp
b/be/src/runtime/memory/memory_profile.cpp
index 36f9a7d301d..84eab7ac7e6 100644
--- a/be/src/runtime/memory/memory_profile.cpp
+++ b/be/src/runtime/memory/memory_profile.cpp
@@ -70,6 +70,10 @@ void MemoryProfile::init_memory_overview_counter() {
tracked_memory_profile->create_child("TasksMemory", true, false);
RuntimeProfile* tasks_memory_overview_details_profile =
tasks_memory_overview_profile->create_child("Details", true,
false);
+
+ RuntimeProfile* memtable_overview_profile =
+ tracked_memory_profile->create_child("MemtableMemory", true,
false);
+
RuntimeProfile* global_memory_overview_profile =
tracked_memory_profile->create_child("GlobalMemory", true, false);
@@ -122,13 +126,14 @@ void MemoryProfile::init_memory_overview_counter() {
// Reserved memory is the sum of all task reserved memory, is duplicated
with all task memory counter.
_reserved_memory_usage_counter =
tasks_memory_overview_profile->AddHighWaterMarkCounter(
"ReservedMemory", TUnit::BYTES, "Memory", 1);
+
+ // 6 add memtable memory counter
+ _memtable_memory_usage_counter =
+
memtable_overview_profile->AddHighWaterMarkCounter("MemtableMemory",
TUnit::BYTES);
_query_usage_counter =
tasks_memory_overview_details_profile->AddHighWaterMarkCounter("Query",
TUnit::BYTES);
_load_usage_counter =
tasks_memory_overview_details_profile->AddHighWaterMarkCounter("Load",
TUnit::BYTES);
- _load_all_memtables_usage_counter =
-
tasks_memory_overview_details_profile->AddHighWaterMarkCounter("AllMemTablesMemory",
-
TUnit::BYTES, "Load", 1);
_compaction_usage_counter =
tasks_memory_overview_details_profile->AddHighWaterMarkCounter(
"Compaction", TUnit::BYTES);
_schema_change_usage_counter =
tasks_memory_overview_details_profile->AddHighWaterMarkCounter(
@@ -276,6 +281,12 @@ void MemoryProfile::refresh_memory_overview_profile() {
COUNTER_SET(_jvm_heap_memory_usage_counter, jvm_heap_bytes);
COUNTER_SET(_jvm_non_heap_memory_usage_counter, jvm_non_heap_bytes);
+ // Memtable memory is not included in the memory the load tasks. Because
actually it is a buffer.
+ COUNTER_SET(_memtable_memory_usage_counter,
+
ExecEnv::GetInstance()->memtable_memory_limiter()->mem_tracker()->consumption());
+ all_tracked_mem_sum +=
+
ExecEnv::GetInstance()->memtable_memory_limiter()->mem_tracker()->consumption();
+
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();
@@ -285,12 +296,7 @@ void MemoryProfile::refresh_memory_overview_profile() {
COUNTER_SET(_untracked_memory_usage_counter, untracked_memory);
memory_untracked_memory_bytes << untracked_memory -
memory_untracked_memory_bytes.get_value();
- // 6 refresh additional tracker printed when memory exceeds limit.
- // TODO, separate Framgnet and Memtable memory in Load memory.
- COUNTER_SET(_load_all_memtables_usage_counter,
-
ExecEnv::GetInstance()->memtable_memory_limiter()->mem_tracker()->consumption());
-
- // 7. reset profile
+ // 6. reset profile
_global_memory_profile.set(std::move(global_memory_profile));
_metadata_memory_profile.set(std::move(metadata_memory_profile));
_cache_memory_profile.set(std::move(cache_memory_profile));
diff --git a/be/src/runtime/memory/memory_profile.h
b/be/src/runtime/memory/memory_profile.h
index 4a782468773..6a540b29f46 100644
--- a/be/src/runtime/memory/memory_profile.h
+++ b/be/src/runtime/memory/memory_profile.h
@@ -102,11 +102,14 @@ private:
// tasks memory counter
RuntimeProfile::HighWaterMarkCounter* _tasks_memory_usage_counter;
+
+ // Memtable memory counter
+ RuntimeProfile::HighWaterMarkCounter* _memtable_memory_usage_counter;
+
// reserved memory is the sum of all task reserved memory, is duplicated
with all task memory counter.
RuntimeProfile::HighWaterMarkCounter* _reserved_memory_usage_counter;
RuntimeProfile::HighWaterMarkCounter* _query_usage_counter;
RuntimeProfile::HighWaterMarkCounter* _load_usage_counter;
- RuntimeProfile::HighWaterMarkCounter* _load_all_memtables_usage_counter;
RuntimeProfile::HighWaterMarkCounter* _compaction_usage_counter;
RuntimeProfile::HighWaterMarkCounter* _schema_change_usage_counter;
RuntimeProfile::HighWaterMarkCounter* _other_usage_counter;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]