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

[fix](memory) Fix work load group meaningless GC #27307

Merged
merged 1 commit into from
Nov 21, 2023
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
24 changes: 19 additions & 5 deletions be/src/util/mem_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,24 +244,38 @@ int64_t MemInfo::tg_not_enable_overcommit_group_gc() {
return 0;
}

std::vector<taskgroup::TaskGroupPtr> task_groups_overcommit;
for (const auto& task_group : task_groups) {
taskgroup::TaskGroupInfo tg_info;
task_group->task_group_info(&tg_info);
if (task_group->memory_used() > tg_info.memory_limit) {
task_groups_overcommit.push_back(task_group);
}
}
if (task_groups_overcommit.empty()) {
return 0;
}

LOG(INFO) << fmt::format(
"[MemoryGC] start GC work load group that not enable overcommit, number of group: {}, "
"[MemoryGC] start GC work load group that not enable overcommit, number of overcommit "
"group: {}, "
"if it exceeds the limit, try free size = (group used - group limit).",
task_groups.size());
task_groups_overcommit.size());

Defer defer {[&]() {
if (total_free_memory > 0) {
std::stringstream ss;
tg_profile->pretty_print(&ss);
LOG(INFO) << fmt::format(
"[MemoryGC] end GC work load group that not enable overcommit, number of "
"group: {}, free memory {}. cost(us): {}, details: {}",
task_groups.size(), PrettyPrinter::print(total_free_memory, TUnit::BYTES),
"overcommit group: {}, free memory {}. cost(us): {}, details: {}",
task_groups_overcommit.size(),
PrettyPrinter::print(total_free_memory, TUnit::BYTES),
watch.elapsed_time() / 1000, ss.str());
}
}};

for (const auto& task_group : task_groups) {
for (const auto& task_group : task_groups_overcommit) {
taskgroup::TaskGroupInfo tg_info;
task_group->task_group_info(&tg_info);
auto used = task_group->memory_used();
Expand Down
Loading