You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Joe McDonnell (Code Review)" <ge...@cloudera.org> on 2026/06/04 19:46:23 UTC
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Joe McDonnell has uploaded this change for review. ( http://gerrit.cloudera.org:8080/24401
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
IMPALA-14702 (prep): Add an abstraction around malloc implementation details
This adds a MallocUtil abstraction around the malloc implementation
to make it easier to try other mallocs. This has different
MallocUtil libraries for different malloc implementations:
- gperftools tcmalloc
- sanitizer builds (which have their own malloc implementation)
- libc malloc (used only for certain tests).
Programs should call MallocUtil::Allocate() early in startup,
set any relevant startup flags, then call MallocUtil::Init()
to apply the settings.
This introduces a tcmalloc_aggressive_memory_decommit startup
flag, but limits the configurability and retain existing behavior.
Impalad is hard coded to use tcmalloc_aggressive_memory_decommit=true
and does not respect a user's value. Other binaries default to
tcmalloc_aggressive_memory_decommit=false but will respect a
custom value.
Impalad's memory tracker has an entry for the malloc overhead.
This converts it to a regular metric so that it is available
for other daemons.
Testing:
- Ran core job
- Ran pprof locally against the heap profiler endpoint
Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
---
M be/CMakeLists.txt
M be/src/common/daemon-env.cc
M be/src/common/global-flags.cc
M be/src/common/init.cc
M be/src/runtime/bufferpool/system-allocator.cc
M be/src/runtime/data-stream-test.cc
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/runtime/mem-tracker.cc
M be/src/runtime/query-exec-mgr.cc
M be/src/runtime/test-env.cc
M be/src/scheduling/admission-controller.cc
M be/src/service/impala-hs2-server.cc
M be/src/util/CMakeLists.txt
A be/src/util/malloc-util-gperftools.h
A be/src/util/malloc-util-libc.h
A be/src/util/malloc-util-sanitizers.h
A be/src/util/malloc-util.cc
A be/src/util/malloc-util.h
M be/src/util/memory-metrics.cc
M be/src/util/memory-metrics.h
M be/src/util/memusage-path-handlers.cc
M be/src/util/pprof-path-handlers.cc
M common/thrift/metrics.json
24 files changed, 817 insertions(+), 322 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/24401/1
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 1
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 2:
(9 comments)
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/bufferpool/system-allocator.cc
File be/src/runtime/bufferpool/system-allocator.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/bufferpool/system-allocator.cc@51
PS2, Line 51: CHECK(support == MallocUtil::HugePageSupport::MADVISE_COMPATIBLE);
> Why switch to CHECK(... == ...) from CHECK_EQ(..., ...)?
Got it working. I needed to add an operator<< function for MallocUtil::HugePageSupport.
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/exec-env.cc
File be/src/runtime/exec-env.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/exec-env.cc@426
PS2, Line 426: if (FLAGS_tcmalloc_max_total_thread_cache_bytes == 0) {
> Should updating flags be part of MallocUtil::Init?
I wanted to keep the behavior the same for all the daemons for this refactor, and different daemons use different settings right now. Impalad wants to set a large total thread cache and turn on aggressive decommit. Catalogd/statestored/admissiond use the defaults. I think we'll continue to have different defaults for the different daemons in the future, so the rule right now is that the different daemons set up the flags however they want and MallocUtil is responsible for implementing them.
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/query-exec-mgr.cc
File be/src/runtime/query-exec-mgr.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/query-exec-mgr.cc@176
PS2, Line 176: string s = MallocUtil::GetInstance()->GetTextDescription();
> nit: 2 lines doesn't seem to make this any more readable; the variable name
Good point, will fix
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/test-env.cc
File be/src/runtime/test-env.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/test-env.cc@75
PS2, Line 75: // Always use aggressive decommit for backend tests
: FLAGS_tcmalloc_aggressive_memory_decommit = true;
: RETURN_IF_ERROR(MallocUtil::GetInstance()->Init());
This needs to move earlier, before RegisterMemoryMetrics() above.
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util-gperftools.h
File be/src/util/malloc-util-gperftools.h:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util-gperftools.h@110
PS2, Line 110: int64_t retval;
> The old code used zero init.
Done
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.h
File be/src/util/malloc-util.h:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.h@32
PS2, Line 32: static Status Allocate();
> The name Allocate seems overloaded here. What about Create?
I changed this to initialize it during GetInstance(), so there is no need for this function.
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.h@37
PS2, Line 37: // Initialize the settings for the malloc implemenation. This should be called once
> typo, should be "implementation"
Done
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.cc
File be/src/util/malloc-util.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.cc@48
PS2, Line 48: MallocUtil* MallocUtil::GetInstance() {
> Is it possible to eliminate Allocate by inlining it into GetInstance?
I changed this to initialize it during GetInstance() and avoid the Allocate() call.
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/pprof-path-handlers.cc
File be/src/util/pprof-path-handlers.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/pprof-path-handlers.cc@75
PS2, Line 75: delete profile;
> nit: free?
Good point, gpertools uses malloc(), so this should use free().
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 2
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Tue, 09 Jun 2026 06:50:25 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 7: Verified+1
Failure is unrelated, overriding.
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 7
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Tue, 16 Jun 2026 21:33:32 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 2:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/22730/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 2
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Comment-Date: Thu, 04 Jun 2026 21:36:32 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 1:
(2 comments)
gerrit-auto-critic failed. You can reproduce it locally using command:
python3 bin/jenkins/critique-gerrit-review.py --dryrun
To run it, you might need a virtual env with Python3's venv installed.
http://gerrit.cloudera.org:8080/#/c/24401/1/be/src/util/malloc-util-gperftools.h
File be/src/util/malloc-util-gperftools.h:
http://gerrit.cloudera.org:8080/#/c/24401/1/be/src/util/malloc-util-gperftools.h@105
PS1, Line 105: return metrics->RegisterMetric(new TcmallocMetric(MetricDefs::Get(key), tcmalloc_var));
line too long (91 > 90)
http://gerrit.cloudera.org:8080/#/c/24401/1/be/src/util/malloc-util-gperftools.h@166
PS1, Line 166: << FLAGS_tcmalloc_max_total_thread_cache_bytes << " bytes but actually "
line too long (91 > 90)
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 1
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 04 Jun 2026 19:55:47 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 1:
(3 comments)
http://gerrit.cloudera.org:8080/#/c/24401/1/be/CMakeLists.txt
File be/CMakeLists.txt:
http://gerrit.cloudera.org:8080/#/c/24401/1/be/CMakeLists.txt@756
PS1, Line 756: set (UNIFIED_TEST_LINK_LIBS "${IMPALA_LINK_LIBS}" MallocUtilSanitizer)
> Bug: Needs to use UNIFIED_TEST_LINK_LIBS
Done
http://gerrit.cloudera.org:8080/#/c/24401/1/be/src/util/malloc-util-gperftools.h
File be/src/util/malloc-util-gperftools.h:
http://gerrit.cloudera.org:8080/#/c/24401/1/be/src/util/malloc-util-gperftools.h@105
PS1, Line 105: return metrics->RegisterMetric(new TcmallocMetric(MetricDefs::Get(key), tcmalloc_var));
> line too long (91 > 90)
Done
http://gerrit.cloudera.org:8080/#/c/24401/1/be/src/util/malloc-util-gperftools.h@166
PS1, Line 166: << FLAGS_tcmalloc_max_total_thread_cache_bytes << " bytes but actually "
> line too long (91 > 90)
Done
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 1
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Comment-Date: Thu, 04 Jun 2026 21:13:39 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 7: Verified-1
Build failed: https://jenkins.impala.io/job/gerrit-verify-dryrun/13621/
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 7
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Tue, 16 Jun 2026 01:16:18 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Hello Peter Rozsa, Michael Smith, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/24401
to look at the new patch set (#6).
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
IMPALA-14702 (prep): Add an abstraction around malloc implementation details
This adds a MallocUtil abstraction around the malloc implementation
to make it easier to try other mallocs. This has different
MallocUtil libraries for different malloc implementations:
- gperftools tcmalloc
- sanitizer builds (which have their own malloc implementation)
- libc malloc (used only for certain tests).
Programs should call MallocUtil::Allocate() early in startup,
set any relevant startup flags, then call MallocUtil::Init()
to apply the settings.
This introduces a tcmalloc_aggressive_memory_decommit startup
flag, but limits the configurability and retain existing behavior.
Impalad is hard coded to use tcmalloc_aggressive_memory_decommit=true
and does not respect a user's value. Other binaries default to
tcmalloc_aggressive_memory_decommit=false but will respect a
custom value.
Impalad's memory tracker has an entry for the malloc overhead.
This converts it to a regular metric so that it is available
for other daemons.
Testing:
- Ran core job
- Ran pprof locally against the heap profiler endpoint
Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
---
M be/CMakeLists.txt
M be/src/common/daemon-env.cc
M be/src/common/global-flags.cc
M be/src/common/init.cc
M be/src/runtime/bufferpool/system-allocator.cc
M be/src/runtime/data-stream-test.cc
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/runtime/mem-tracker.cc
M be/src/runtime/query-exec-mgr.cc
M be/src/runtime/test-env.cc
M be/src/scheduling/admission-controller.cc
M be/src/service/impala-hs2-server.cc
M be/src/util/CMakeLists.txt
A be/src/util/malloc-util-gperftools.h
A be/src/util/malloc-util-libc.h
A be/src/util/malloc-util-sanitizers.h
A be/src/util/malloc-util.cc
A be/src/util/malloc-util.h
M be/src/util/memory-metrics.cc
M be/src/util/memory-metrics.h
M be/src/util/memusage-path-handlers.cc
M be/src/util/metrics-test.cc
M be/src/util/pprof-path-handlers.cc
M common/thrift/metrics.json
25 files changed, 833 insertions(+), 323 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/24401/6
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 6
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 1:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/24401/1/be/CMakeLists.txt
File be/CMakeLists.txt:
http://gerrit.cloudera.org:8080/#/c/24401/1/be/CMakeLists.txt@756
PS1, Line 756: set (UNIFIED_TEST_LINK_LIBS "${IMPALA_LINK_LIBS}" MallocUtilSanitizer)
Bug: Needs to use UNIFIED_TEST_LINK_LIBS
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 1
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Comment-Date: Thu, 04 Jun 2026 20:51:04 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 1:
Build Failed
https://jenkins.impala.io/job/gerrit-code-review-checks/22727/ : Initial code review checks failed. See linked job for details on the failure.
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 1
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 04 Jun 2026 20:12:57 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Hello Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/24401
to look at the new patch set (#2).
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
IMPALA-14702 (prep): Add an abstraction around malloc implementation details
This adds a MallocUtil abstraction around the malloc implementation
to make it easier to try other mallocs. This has different
MallocUtil libraries for different malloc implementations:
- gperftools tcmalloc
- sanitizer builds (which have their own malloc implementation)
- libc malloc (used only for certain tests).
Programs should call MallocUtil::Allocate() early in startup,
set any relevant startup flags, then call MallocUtil::Init()
to apply the settings.
This introduces a tcmalloc_aggressive_memory_decommit startup
flag, but limits the configurability and retain existing behavior.
Impalad is hard coded to use tcmalloc_aggressive_memory_decommit=true
and does not respect a user's value. Other binaries default to
tcmalloc_aggressive_memory_decommit=false but will respect a
custom value.
Impalad's memory tracker has an entry for the malloc overhead.
This converts it to a regular metric so that it is available
for other daemons.
Testing:
- Ran core job
- Ran pprof locally against the heap profiler endpoint
Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
---
M be/CMakeLists.txt
M be/src/common/daemon-env.cc
M be/src/common/global-flags.cc
M be/src/common/init.cc
M be/src/runtime/bufferpool/system-allocator.cc
M be/src/runtime/data-stream-test.cc
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/runtime/mem-tracker.cc
M be/src/runtime/query-exec-mgr.cc
M be/src/runtime/test-env.cc
M be/src/scheduling/admission-controller.cc
M be/src/service/impala-hs2-server.cc
M be/src/util/CMakeLists.txt
A be/src/util/malloc-util-gperftools.h
A be/src/util/malloc-util-libc.h
A be/src/util/malloc-util-sanitizers.h
A be/src/util/malloc-util.cc
A be/src/util/malloc-util.h
M be/src/util/memory-metrics.cc
M be/src/util/memory-metrics.h
M be/src/util/memusage-path-handlers.cc
M be/src/util/pprof-path-handlers.cc
M common/thrift/metrics.json
24 files changed, 819 insertions(+), 322 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/24401/2
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 2
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 3:
Build Failed
https://jenkins.impala.io/job/gerrit-code-review-checks/22795/ : Initial code review checks failed. See linked job for details on the failure.
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Tue, 09 Jun 2026 07:04:21 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has removed a vote on this change.
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Removed Verified-1 by Impala Public Jenkins <im...@cloudera.com>
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: deleteVote
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 7
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 3:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/24401/3//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/24401/3//COMMIT_MSG@16
PS3, Line 16: Allocate
> this seems removed in
Done
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Mon, 15 Jun 2026 21:03:17 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Csaba Ringhofer (Code Review)" <ge...@cloudera.org>.
Csaba Ringhofer has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 6: Code-Review+2
(1 comment)
commit msg seems stale, otherwise looks great
http://gerrit.cloudera.org:8080/#/c/24401/3//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/24401/3//COMMIT_MSG@16
PS3, Line 16: Allocate
this seems removed in
https://gerrit.cloudera.org/#/c/24401/2..3/be/src/util/malloc-util.cc
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 6
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Mon, 15 Jun 2026 16:59:58 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 6:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/22836/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 6
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Thu, 11 Jun 2026 00:02:56 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Hello Peter Rozsa, Michael Smith, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/24401
to look at the new patch set (#3).
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
IMPALA-14702 (prep): Add an abstraction around malloc implementation details
This adds a MallocUtil abstraction around the malloc implementation
to make it easier to try other mallocs. This has different
MallocUtil libraries for different malloc implementations:
- gperftools tcmalloc
- sanitizer builds (which have their own malloc implementation)
- libc malloc (used only for certain tests).
Programs should call MallocUtil::Allocate() early in startup,
set any relevant startup flags, then call MallocUtil::Init()
to apply the settings.
This introduces a tcmalloc_aggressive_memory_decommit startup
flag, but limits the configurability and retain existing behavior.
Impalad is hard coded to use tcmalloc_aggressive_memory_decommit=true
and does not respect a user's value. Other binaries default to
tcmalloc_aggressive_memory_decommit=false but will respect a
custom value.
Impalad's memory tracker has an entry for the malloc overhead.
This converts it to a regular metric so that it is available
for other daemons.
Testing:
- Ran core job
- Ran pprof locally against the heap profiler endpoint
Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
---
M be/CMakeLists.txt
M be/src/common/daemon-env.cc
M be/src/common/global-flags.cc
M be/src/common/init.cc
M be/src/runtime/bufferpool/system-allocator.cc
M be/src/runtime/data-stream-test.cc
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/runtime/mem-tracker.cc
M be/src/runtime/query-exec-mgr.cc
M be/src/runtime/test-env.cc
M be/src/scheduling/admission-controller.cc
M be/src/service/impala-hs2-server.cc
M be/src/util/CMakeLists.txt
A be/src/util/malloc-util-gperftools.h
A be/src/util/malloc-util-libc.h
A be/src/util/malloc-util-sanitizers.h
A be/src/util/malloc-util.cc
A be/src/util/malloc-util.h
M be/src/util/memory-metrics.cc
M be/src/util/memory-metrics.h
M be/src/util/memusage-path-handlers.cc
M be/src/util/metrics-test.cc
M be/src/util/pprof-path-handlers.cc
M common/thrift/metrics.json
25 files changed, 833 insertions(+), 323 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/24401/3
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Michael Smith (Code Review)" <ge...@cloudera.org>.
Michael Smith has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 6: Code-Review+1
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 6
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Thu, 11 Jun 2026 17:02:17 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 4:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/22798/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 4
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Tue, 09 Jun 2026 07:34:54 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Michael Smith (Code Review)" <ge...@cloudera.org>.
Michael Smith has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 4: Code-Review+1
(3 comments)
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/bufferpool/system-allocator.cc
File be/src/runtime/bufferpool/system-allocator.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/bufferpool/system-allocator.cc@51
PS2, Line 51: CHECK_EQ(support, MallocUtil::HugePageSupport::MADVISE_COMPATIBLE);
> Got it working. I needed to add an operator<< function for MallocUtil::Huge
Done
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.h
File be/src/util/malloc-util.h:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.h@32
PS2, Line 32:
> I changed this to initialize it during GetInstance(), so there is no need f
Ack
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.h@37
PS2, Line 37:
> Done
Ack
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 4
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Tue, 09 Jun 2026 18:04:58 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Hello Peter Rozsa, Michael Smith, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/24401
to look at the new patch set (#4).
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
IMPALA-14702 (prep): Add an abstraction around malloc implementation details
This adds a MallocUtil abstraction around the malloc implementation
to make it easier to try other mallocs. This has different
MallocUtil libraries for different malloc implementations:
- gperftools tcmalloc
- sanitizer builds (which have their own malloc implementation)
- libc malloc (used only for certain tests).
Programs should call MallocUtil::Allocate() early in startup,
set any relevant startup flags, then call MallocUtil::Init()
to apply the settings.
This introduces a tcmalloc_aggressive_memory_decommit startup
flag, but limits the configurability and retain existing behavior.
Impalad is hard coded to use tcmalloc_aggressive_memory_decommit=true
and does not respect a user's value. Other binaries default to
tcmalloc_aggressive_memory_decommit=false but will respect a
custom value.
Impalad's memory tracker has an entry for the malloc overhead.
This converts it to a regular metric so that it is available
for other daemons.
Testing:
- Ran core job
- Ran pprof locally against the heap profiler endpoint
Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
---
M be/CMakeLists.txt
M be/src/common/daemon-env.cc
M be/src/common/global-flags.cc
M be/src/common/init.cc
M be/src/runtime/bufferpool/system-allocator.cc
M be/src/runtime/data-stream-test.cc
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/runtime/mem-tracker.cc
M be/src/runtime/query-exec-mgr.cc
M be/src/runtime/test-env.cc
M be/src/scheduling/admission-controller.cc
M be/src/service/impala-hs2-server.cc
M be/src/util/CMakeLists.txt
A be/src/util/malloc-util-gperftools.h
A be/src/util/malloc-util-libc.h
A be/src/util/malloc-util-sanitizers.h
A be/src/util/malloc-util.cc
A be/src/util/malloc-util.h
M be/src/util/memory-metrics.cc
M be/src/util/memory-metrics.h
M be/src/util/memusage-path-handlers.cc
M be/src/util/metrics-test.cc
M be/src/util/pprof-path-handlers.cc
M common/thrift/metrics.json
25 files changed, 833 insertions(+), 323 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/24401/4
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 4
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 7:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/22889/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 7
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Mon, 15 Jun 2026 21:02:30 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 7:
Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/13621/ DRY_RUN=true
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 7
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Mon, 15 Jun 2026 21:03:56 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
IMPALA-14702 (prep): Add an abstraction around malloc implementation details
This adds a MallocUtil abstraction around the malloc implementation
to make it easier to try other mallocs. This has different
MallocUtil libraries for different malloc implementations:
- gperftools tcmalloc
- sanitizer builds (which have their own malloc implementation)
- libc malloc (used only for certain tests).
Programs should set any relevant startup flags, then call
MallocUtil::Init() to apply the settings.
This introduces a tcmalloc_aggressive_memory_decommit startup
flag, but limits the configurability and retain existing behavior.
Impalad is hard coded to use tcmalloc_aggressive_memory_decommit=true
and does not respect a user's value. Other binaries default to
tcmalloc_aggressive_memory_decommit=false but will respect a
custom value.
Impalad's memory tracker has an entry for the malloc overhead.
This converts it to a regular metric so that it is available
for other daemons.
Testing:
- Ran core job
- Ran pprof locally against the heap profiler endpoint
Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Reviewed-on: http://gerrit.cloudera.org:8080/24401
Reviewed-by: Joe McDonnell <jo...@cloudera.com>
Reviewed-by: Michael Smith <mi...@cloudera.com>
Tested-by: Joe McDonnell <jo...@cloudera.com>
---
M be/CMakeLists.txt
M be/src/common/daemon-env.cc
M be/src/common/global-flags.cc
M be/src/common/init.cc
M be/src/runtime/bufferpool/system-allocator.cc
M be/src/runtime/data-stream-test.cc
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/runtime/mem-tracker.cc
M be/src/runtime/query-exec-mgr.cc
M be/src/runtime/test-env.cc
M be/src/scheduling/admission-controller.cc
M be/src/service/impala-hs2-server.cc
M be/src/util/CMakeLists.txt
A be/src/util/malloc-util-gperftools.h
A be/src/util/malloc-util-libc.h
A be/src/util/malloc-util-sanitizers.h
A be/src/util/malloc-util.cc
A be/src/util/malloc-util.h
M be/src/util/memory-metrics.cc
M be/src/util/memory-metrics.h
M be/src/util/memusage-path-handlers.cc
M be/src/util/metrics-test.cc
M be/src/util/pprof-path-handlers.cc
M common/thrift/metrics.json
25 files changed, 833 insertions(+), 323 deletions(-)
Approvals:
Joe McDonnell: Looks good to me, approved; Verified
Michael Smith: Looks good to me, approved
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 8
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Michael Smith (Code Review)" <ge...@cloudera.org>.
Michael Smith has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 7: Code-Review+2
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 7
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Mon, 15 Jun 2026 21:05:42 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Hello Peter Rozsa, Michael Smith, Csaba Ringhofer, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/24401
to look at the new patch set (#7).
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
IMPALA-14702 (prep): Add an abstraction around malloc implementation details
This adds a MallocUtil abstraction around the malloc implementation
to make it easier to try other mallocs. This has different
MallocUtil libraries for different malloc implementations:
- gperftools tcmalloc
- sanitizer builds (which have their own malloc implementation)
- libc malloc (used only for certain tests).
Programs should set any relevant startup flags, then call
MallocUtil::Init() to apply the settings.
This introduces a tcmalloc_aggressive_memory_decommit startup
flag, but limits the configurability and retain existing behavior.
Impalad is hard coded to use tcmalloc_aggressive_memory_decommit=true
and does not respect a user's value. Other binaries default to
tcmalloc_aggressive_memory_decommit=false but will respect a
custom value.
Impalad's memory tracker has an entry for the malloc overhead.
This converts it to a regular metric so that it is available
for other daemons.
Testing:
- Ran core job
- Ran pprof locally against the heap profiler endpoint
Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
---
M be/CMakeLists.txt
M be/src/common/daemon-env.cc
M be/src/common/global-flags.cc
M be/src/common/init.cc
M be/src/runtime/bufferpool/system-allocator.cc
M be/src/runtime/data-stream-test.cc
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/runtime/mem-tracker.cc
M be/src/runtime/query-exec-mgr.cc
M be/src/runtime/test-env.cc
M be/src/scheduling/admission-controller.cc
M be/src/service/impala-hs2-server.cc
M be/src/util/CMakeLists.txt
A be/src/util/malloc-util-gperftools.h
A be/src/util/malloc-util-libc.h
A be/src/util/malloc-util-sanitizers.h
A be/src/util/malloc-util.cc
A be/src/util/malloc-util.h
M be/src/util/memory-metrics.cc
M be/src/util/memory-metrics.h
M be/src/util/memusage-path-handlers.cc
M be/src/util/metrics-test.cc
M be/src/util/pprof-path-handlers.cc
M common/thrift/metrics.json
25 files changed, 833 insertions(+), 323 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/24401/7
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 7
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Michael Smith (Code Review)" <ge...@cloudera.org>.
Michael Smith has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 2:
(5 comments)
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/bufferpool/system-allocator.cc
File be/src/runtime/bufferpool/system-allocator.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/bufferpool/system-allocator.cc@51
PS2, Line 51: CHECK(support == MallocUtil::HugePageSupport::MADVISE_COMPATIBLE);
Why switch to CHECK(... == ...) from CHECK_EQ(..., ...)?
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/exec-env.cc
File be/src/runtime/exec-env.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/exec-env.cc@426
PS2, Line 426: if (FLAGS_tcmalloc_max_total_thread_cache_bytes == 0) {
Should updating flags be part of MallocUtil::Init?
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/query-exec-mgr.cc
File be/src/runtime/query-exec-mgr.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/query-exec-mgr.cc@176
PS2, Line 176: string s = MallocUtil::GetInstance()->GetTextDescription();
nit: 2 lines doesn't seem to make this any more readable; the variable name is not descriptive.
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.h
File be/src/util/malloc-util.h:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.h@32
PS2, Line 32: static Status Allocate();
The name Allocate seems overloaded here. What about Create?
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.h@37
PS2, Line 37: // Initialize the settings for the malloc implemenation. This should be called once
typo, should be "implementation"
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 2
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Thu, 04 Jun 2026 23:16:56 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 3:
(2 comments)
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/test-env.cc
File be/src/runtime/test-env.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/runtime/test-env.cc@75
PS2, Line 75: } else {
: RETURN_IF_ERROR(tmp_file_mgr()->Init(metrics()));
: }
> This needs to move earlier, before RegisterMemoryMetrics() above.
Done
http://gerrit.cloudera.org:8080/#/c/24401/3/be/src/util/metrics-test.cc
File be/src/util/metrics-test.cc:
http://gerrit.cloudera.org:8080/#/c/24401/3/be/src/util/metrics-test.cc@254
PS3, Line 254: ASSERT_OK(MallocUtil::GetInstance()->Init(/*process_mem_limit*/ -1));
Wrong signature, Init() takes no arguments at this point.
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Tue, 09 Jun 2026 07:11:48 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 7:
Failure is due to https://issues.apache.org/jira/browse/IMPALA-11572 , unrelated to this change.
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 7
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Tue, 16 Jun 2026 01:18:01 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 7: Code-Review+2
Updated the comment, carrying +2
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 7
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Mon, 15 Jun 2026 21:03:30 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-14702 (prep): Add an abstraction around malloc implementation details
Posted by "Peter Rozsa (Code Review)" <ge...@cloudera.org>.
Peter Rozsa has posted comments on this change. ( http://gerrit.cloudera.org:8080/24401 )
Change subject: IMPALA-14702 (prep): Add an abstraction around malloc implementation details
......................................................................
Patch Set 2:
(3 comments)
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util-gperftools.h
File be/src/util/malloc-util-gperftools.h:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util-gperftools.h@110
PS2, Line 110: int64_t retval;
The old code used zero init.
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.cc
File be/src/util/malloc-util.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/malloc-util.cc@48
PS2, Line 48: MallocUtil* MallocUtil::GetInstance() {
Is it possible to eliminate Allocate by inlining it into GetInstance?
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/pprof-path-handlers.cc
File be/src/util/pprof-path-handlers.cc:
http://gerrit.cloudera.org:8080/#/c/24401/2/be/src/util/pprof-path-handlers.cc@75
PS2, Line 75: delete profile;
nit: free?
--
To view, visit http://gerrit.cloudera.org:8080/24401
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ac7841cf279ac40141147d4be9192894d6dc908
Gerrit-Change-Number: 24401
Gerrit-PatchSet: 2
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Peter Rozsa <pr...@cloudera.com>
Gerrit-Comment-Date: Fri, 05 Jun 2026 08:33:17 +0000
Gerrit-HasComments: Yes