mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Merge pull request #65702 from ClickHouse/jemalloc-inactive-profiler-by-default
Build jemalloc with profiler
This commit is contained in:
commit
ab0968740c
@ -34,9 +34,9 @@ if (OS_LINUX)
|
|||||||
# avoid spurious latencies and additional work associated with
|
# avoid spurious latencies and additional work associated with
|
||||||
# MADV_DONTNEED. See
|
# MADV_DONTNEED. See
|
||||||
# https://github.com/ClickHouse/ClickHouse/issues/11121 for motivation.
|
# https://github.com/ClickHouse/ClickHouse/issues/11121 for motivation.
|
||||||
set (JEMALLOC_CONFIG_MALLOC_CONF "percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000")
|
set (JEMALLOC_CONFIG_MALLOC_CONF "percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000,prof:true,prof_active:false,background_thread:true")
|
||||||
else()
|
else()
|
||||||
set (JEMALLOC_CONFIG_MALLOC_CONF "oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000")
|
set (JEMALLOC_CONFIG_MALLOC_CONF "oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000,prof:true,prof_active:false,background_thread:true")
|
||||||
endif()
|
endif()
|
||||||
# CACHE variable is empty to allow changing defaults without the necessity
|
# CACHE variable is empty to allow changing defaults without the necessity
|
||||||
# to purge cache
|
# to purge cache
|
||||||
|
@ -7,7 +7,6 @@ cluster = ClickHouseCluster(__file__)
|
|||||||
node1 = cluster.add_instance(
|
node1 = cluster.add_instance(
|
||||||
"node1",
|
"node1",
|
||||||
main_configs=["configs/asynchronous_metrics_update_period_s.xml"],
|
main_configs=["configs/asynchronous_metrics_update_period_s.xml"],
|
||||||
env_variables={"MALLOC_CONF": "background_thread:true,prof:true"},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -29,26 +28,11 @@ def test_asynchronous_metric_jemalloc_profile_active(started_cluster):
|
|||||||
if node1.is_built_with_sanitizer():
|
if node1.is_built_with_sanitizer():
|
||||||
pytest.skip("Disabled for sanitizers")
|
pytest.skip("Disabled for sanitizers")
|
||||||
|
|
||||||
res_o = node1.query(
|
res = node1.query(
|
||||||
"SELECT * FROM system.asynchronous_metrics WHERE metric ILIKE '%jemalloc.prof.active%' FORMAT Vertical;"
|
"SELECT * FROM system.asynchronous_metrics WHERE metric ILIKE '%jemalloc.prof.active%' FORMAT Vertical;"
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
res_o
|
res
|
||||||
== """Row 1:
|
|
||||||
──────
|
|
||||||
metric: jemalloc.prof.active
|
|
||||||
value: 1
|
|
||||||
description: An internal metric of the low-level memory allocator (jemalloc). See https://jemalloc.net/jemalloc.3.html
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
# disable
|
|
||||||
node1.query("SYSTEM JEMALLOC DISABLE PROFILE")
|
|
||||||
time.sleep(5)
|
|
||||||
res_t = node1.query(
|
|
||||||
"SELECT * FROM system.asynchronous_metrics WHERE metric ILIKE '%jemalloc.prof.active%' FORMAT Vertical;"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
res_t
|
|
||||||
== """Row 1:
|
== """Row 1:
|
||||||
──────
|
──────
|
||||||
metric: jemalloc.prof.active
|
metric: jemalloc.prof.active
|
||||||
@ -58,16 +42,31 @@ description: An internal metric of the low-level memory allocator (jemalloc). Se
|
|||||||
)
|
)
|
||||||
# enable
|
# enable
|
||||||
node1.query("SYSTEM JEMALLOC ENABLE PROFILE")
|
node1.query("SYSTEM JEMALLOC ENABLE PROFILE")
|
||||||
time.sleep(5)
|
node1.query("SYSTEM RELOAD ASYNCHRONOUS METRICS")
|
||||||
res_f = node1.query(
|
res = node1.query(
|
||||||
"SELECT * FROM system.asynchronous_metrics WHERE metric ILIKE '%jemalloc.prof.active%' FORMAT Vertical;"
|
"SELECT * FROM system.asynchronous_metrics WHERE metric ILIKE '%jemalloc.prof.active%' FORMAT Vertical;"
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
res_f
|
res
|
||||||
== """Row 1:
|
== """Row 1:
|
||||||
──────
|
──────
|
||||||
metric: jemalloc.prof.active
|
metric: jemalloc.prof.active
|
||||||
value: 1
|
value: 1
|
||||||
description: An internal metric of the low-level memory allocator (jemalloc). See https://jemalloc.net/jemalloc.3.html
|
description: An internal metric of the low-level memory allocator (jemalloc). See https://jemalloc.net/jemalloc.3.html
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
# disable
|
||||||
|
node1.query("SYSTEM JEMALLOC DISABLE PROFILE")
|
||||||
|
node1.query("SYSTEM RELOAD ASYNCHRONOUS METRICS")
|
||||||
|
res = node1.query(
|
||||||
|
"SELECT * FROM system.asynchronous_metrics WHERE metric ILIKE '%jemalloc.prof.active%' FORMAT Vertical;"
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
res
|
||||||
|
== """Row 1:
|
||||||
|
──────
|
||||||
|
metric: jemalloc.prof.active
|
||||||
|
value: 0
|
||||||
|
description: An internal metric of the low-level memory allocator (jemalloc). See https://jemalloc.net/jemalloc.3.html
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user