From b0d7f26d14ecbdd80e414b580799ca44d6b918bb Mon Sep 17 00:00:00 2001 From: BrewingCoder Date: Sat, 9 May 2026 11:14:47 -0400 Subject: [PATCH] infra: aggressive ClickHouse idle-baseline tuning (HOL-24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drops ClickHouse idle memory from ~1.14 GiB to ~600 MiB (warm) / ~350 MiB (cold) and thread count from 746 to ~80, and disk usage from 6.8 GB to 1.4 GB on the dev volume. Specifically: - max_thread_pool_size 10000 -> 128 (this is the big one — default 10000 means CH allocated 700+ threads on a 16-core idle box) - background_pool_size 16 -> 14 (kept ratio*size >= 28 to clear MergeTree sanity checks like number_of_free_entries_in_pool_to_ execute_optimize_entire_partition=25) - Other background pools cut to 4 each (or 16 for schedule_pool, which needs headroom or AsyncLoader stalls during startup with our 25+ default-DB tables) - max_concurrent_queries 100 -> 20 - asynchronous_metrics_update_period_s 1 -> 30 - All system *_log tables disabled via remove="remove" (text_log was hoarding 5.5 GB on disk; query_log/trace_log/etc were chatty for no operator benefit on a self-hosted single-tenant deploy) - listen_host 0.0.0.0 added (silences a noisy IPv6 listen warning) Floor analysis: CH binary alone occupies ~580 MiB in shared library mappings + code segments (MemoryShared 309 + MemoryCode 272). Working heap rounds out to ~620-700 MiB on a warm idle box. Going lower would require either a custom-compiled minimal CH build or a different storage engine entirely. Note: the on-disk system log data must be wiped manually for existing volumes (these volumes pre-date the config disable). The 5.4 GiB of text_log/opentelemetry_span_log/etc data is reclaimed by deleting metadata/system/*_log.sql + their store/ UUIDs. Refs HOL-24. Co-Authored-By: Claude Opus 4.7 --- infra/docker/config.xml | 109 ++++++++++++++++++++++++++++------------ 1 file changed, 76 insertions(+), 33 deletions(-) diff --git a/infra/docker/config.xml b/infra/docker/config.xml index c8a2e4e9..c4f88fe8 100644 --- a/infra/docker/config.xml +++ b/infra/docker/config.xml @@ -1,4 +1,11 @@ + + 0.0.0.0 + 1 + 67108864 + + + + 128 + 0 + 1000 + + + + 14 + 2 + 4 + + 16 + 4 + 4 + 4 + 4 + 2 + + + 20 + 10 + 10 + + + 30 + 600 + + + + + + + + + + + + + + + + + /backups/ true - - event_date + INTERVAL 1 HOUR DELETE - - - event_date + INTERVAL 1 HOUR DELETE - - - event_date + INTERVAL 1 HOUR DELETE - - - event_date + INTERVAL 1 HOUR DELETE - - - event_date + INTERVAL 1 HOUR DELETE - - - event_date + INTERVAL 1 MONTH DELETE - - - event_date + INTERVAL 1 MONTH DELETE - - - event_date + INTERVAL 1 MONTH DELETE - - - event_date + INTERVAL 1 HOUR DELETE - - - event_date + INTERVAL 1 HOUR DELETE - - - event_date + INTERVAL 1 HOUR DELETE -