Repository navigation
fix: stop ClickHouse writing the diagnostics nothing reads - #13874
Conversation
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
…-idle-cpu # Conflicts: # clickhouse-init.sh
…on' into fix/clickhouse-idle-cpu # Conflicts: # clickhouse-config.xml
🟢 Tier S · Ready to merge
Disables the bundled ClickHouse metric, trace, profile, and text logs while retaining capped logs useful for debugging. Updates initialization to apply a seven-day fallback TTL to abandoned log tables when no active replacement exists.
📂 Walkthrough · 2
Reviewed |
db9120a
into
codex/fix-clickhouse-log-retention
What does this PR do?
Stops the bundled ClickHouse from writing its own telemetry, which is what burns CPU on an idle self-hosted install.
Capping the system logs with a TTL (#13735, which this stacks on) bounds the disk they take, but not the work that produces them:
asynchronous_metric_logandmetric_logsample the server every second whether or not Appwrite is serving traffic, and every row still costs an insert plus the background merges behind it. On an idle stack,system.*logs accounted for ~95s of merge time per hour against 0.1s for everyappwrite.*table combined, andasynchronous_metric_logalone wrote ~600k rows/hour with no traffic at all.Nothing reads these tables — the only
system.query in the codebase is a schema check againstsystem.tables(src/Appwrite/Execution/Store.php:195) — so this removes the sections that produce them and keeps the ones with debugging value (query_log,part_log,error_log,query_views_log,asynchronous_insert_log,background_schedule_pool_log), still capped.text_loggoes too: it duplicates the server log the container already writes.The init script needed a matching change. A log that is no longer written is never replaced either, so the existing table would sit on disk forever on an upgraded install — it now falls back to a 7-day TTL when there is no replacement to copy one from, and those rows drain instead.
Measured
Three ClickHouse 26.4.3 containers, 2 CPUs each, same host, idle, sampled every 8s for ~7 minutes:
asynchronous_metrics_update_period_s=30Raising the metrics period measurably made it worse, so it is not included.
Test Plan
Against real ClickHouse 26.4.3:
asynchronous_metric_log,metric_log,histogram_metric_log,query_metric_log,trace_log,text_logandprocessors_profile_logare never created;query_log,part_logand the rest come up with their TTLs; no errors in the server log.text_log(1772 rows),trace_log,metric_logand the retired*_log_0tables all pick up a TTL and stop growing: 25 queries latertext_logis still at 1772 whilequery_logclimbed to 102.Related PRs
Stacked on #13735; retarget to
mainonce that merges.Have you read the Contributing Guidelines on issues?
Yes.