Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix](cache) the cache capacity is wrong when memusage > soft memlimit #40961

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion be/src/common/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,14 @@ void refresh_cache_capacity() {
auto cache_capacity_reduce_mem_limit = uint64_t(
doris::MemInfo::soft_mem_limit() * config::cache_capacity_reduce_mem_limit_frac);
int64_t process_memory_usage = doris::GlobalMemoryArbitrator::process_memory_usage();
// the rule is like this:
// 1. if the process mem usage < soft memlimit * 0.6, then do not need adjust cache capacity.
// 2. if the process mem usage > soft memlimit * 0.6 and process mem usage < soft memlimit, then it will be adjusted to a lower value.
// 3. if the process mem usage > soft memlimit, then the capacity is adjusted to 0.
double new_cache_capacity_adjust_weighted =
process_memory_usage <= cache_capacity_reduce_mem_limit
? 1
: std::min<double>(
: std::max<double>(
1 - (process_memory_usage - cache_capacity_reduce_mem_limit) /
(doris::MemInfo::soft_mem_limit() -
cache_capacity_reduce_mem_limit),
Expand Down
Loading