Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: luohaha <[email protected]>
  • Loading branch information
luohaha committed Jul 19, 2024
1 parent 3f5741f commit 95e62ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,11 @@ CONF_mInt64(write_buffer_size, "104857600");
CONF_Int32(query_max_memory_limit_percent, "90");
CONF_Double(query_pool_spill_mem_limit_threshold, "1.0");
CONF_Int64(load_process_max_memory_limit_bytes, "107374182400"); // 100GB
CONF_Int32(load_process_max_memory_limit_percent, "30"); // 30%
// It's hard limit for loading, when this limit is hit, new loading task will be rejected.
// It's is a soft limit, when this limit is hit,
// memtable in delta writer will be flush to reduce memory cost.
// Load memory beyond this limit is allowed.
CONF_Int32(load_process_max_memory_limit_percent, "30"); // 30%
// It's hard limit, when this limit is hit, new loading task will be rejected.
CONF_mInt32(load_process_max_memory_hard_limit_percent, "60"); // 60%
CONF_mBool(enable_new_load_on_memory_limit_exceeded, "false");
CONF_Int64(compaction_max_memory_limit, "-1");
Expand Down
4 changes: 4 additions & 0 deletions be/src/storage/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ std::string file_name(const std::string& fullpath) {
}

bool is_tracker_hit_hard_limit(MemTracker* tracker, int soft_limit_percent, int hard_limit_percent) {
if (soft_limit_percent <= 0) {
// unexpected, treat it as limit hit.
return true;
}
int64_t limit_ratio = std::max(hard_limit_percent * 100 / soft_limit_percent, 100);
return tracker->limit_exceeded_by_ratio(limit_ratio);
}
Expand Down
2 changes: 2 additions & 0 deletions be/test/storage/utils_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ TEST_F(TestUtils, test_valid_decimal) {
TEST_F(TestUtils, test_is_tracker_hit_hard_limit) {
std::unique_ptr<MemTracker> tracker = std::make_unique<MemTracker>(1000, "test", nullptr);
tracker->consume(2000);
ASSERT_TRUE(is_tracker_hit_hard_limit(tracker.get(), 0, 30));
ASSERT_TRUE(is_tracker_hit_hard_limit(tracker.get(), 30, 20));
ASSERT_TRUE(is_tracker_hit_hard_limit(tracker.get(), 30, 30));
ASSERT_TRUE(is_tracker_hit_hard_limit(tracker.get(), 30, 40));
ASSERT_TRUE(is_tracker_hit_hard_limit(tracker.get(), 30, 50));
Expand Down

0 comments on commit 95e62ff

Please sign in to comment.