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

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


The following commit(s) were added to refs/heads/spill_and_reserve by this push:
     new 59d0728802f should enable cache when there is no query paused due to 
process limit
59d0728802f is described below

commit 59d0728802f94893003f1a6dbb8bf1617e383bec
Author: yiguolei <guo...@selectdb.com>
AuthorDate: Wed Jan 15 19:50:55 2025 +0800

    should enable cache when there is no query paused due to process limit
---
 .../runtime/workload_group/workload_group_manager.cpp | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/be/src/runtime/workload_group/workload_group_manager.cpp 
b/be/src/runtime/workload_group/workload_group_manager.cpp
index 962db6df333..b946c72431d 100644
--- a/be/src/runtime/workload_group/workload_group_manager.cpp
+++ b/be/src/runtime/workload_group/workload_group_manager.cpp
@@ -317,6 +317,7 @@ void WorkloadGroupMgr::handle_paused_queries() {
 
     std::unique_lock<std::mutex> lock(_paused_queries_lock);
     bool has_revoked_from_other_group = false;
+    bool has_query_exceed_process_memlimit = false;
     for (auto it = _paused_queries_list.begin(); it != 
_paused_queries_list.end();) {
         auto& queries_list = it->second;
         const auto& wg = it->first;
@@ -448,21 +449,22 @@ void WorkloadGroupMgr::handle_paused_queries() {
                     }
                 }
             } else {
+                has_query_exceed_process_memlimit = true;
                 // If wg's memlimit not exceed, but process memory exceed, it 
means cache or other metadata
                 // used too much memory. Should clean all cache here.
                 // 1. Check cache used, if cache is larger than > 0, then just 
return and wait for it to 0 to release some memory.
                 if 
(doris::GlobalMemoryArbitrator::last_affected_cache_capacity_adjust_weighted >
-                            0.001 &&
+                            0.05 &&
                     
doris::GlobalMemoryArbitrator::last_wg_trigger_cache_capacity_adjust_weighted >
-                            0.001) {
+                            0.05) {
                     
doris::GlobalMemoryArbitrator::last_wg_trigger_cache_capacity_adjust_weighted =
-                            0;
+                            0.04;
                     
doris::GlobalMemoryArbitrator::notify_cache_adjust_capacity();
                     LOG(INFO) << "There are some queries need process memory, 
so that set cache "
                                  "capacity "
                                  "to 0 now";
                 }
-                if (query_it->cache_ratio_ < 0.001) {
+                if (query_it->cache_ratio_ < 0.05) {
                     // 1. Check if could revoke some memory from memtable
                     if (flushed_memtable_bytes <= 0) {
                         flushed_memtable_bytes =
@@ -504,8 +506,8 @@ void WorkloadGroupMgr::handle_paused_queries() {
                     }
                 }
                 if 
(doris::GlobalMemoryArbitrator::last_affected_cache_capacity_adjust_weighted <
-                            0.001 &&
-                    query_it->cache_ratio_ > 0.001) {
+                            0.05 &&
+                    query_it->cache_ratio_ > 0.05) {
                     LOG(INFO) << "Query: " << print_id(query_ctx->query_id())
                               << " will be resume after cache adjust.";
                     query_ctx->set_memory_sufficient(true);
@@ -528,6 +530,11 @@ void WorkloadGroupMgr::handle_paused_queries() {
             ++it;
         }
     }
+
+    if (has_query_exceed_process_memlimit) {
+        // No query failed due to process exceed limit, so that enable cache 
now.
+        
doris::GlobalMemoryArbitrator::last_wg_trigger_cache_capacity_adjust_weighted = 
1;
+    }
 }
 
 // Return the expected free bytes if memtable could flush


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to