Disable resource-hungry clickhouse logging & metrics

Also includes a bunch of smaller optimizations
This commit is contained in:
Pierre Couy 2024-12-04 17:05:13 +01:00
parent a7683ced44
commit 5d21be20d5
5 changed files with 38 additions and 40 deletions

3
.gitignore vendored
View File

@ -1,6 +1,7 @@
* *
!compose.yml !compose.yml
!clickhouse/logs.xml !clickhouse/clickhouse-config.xml
!clickhouse/clickhouse-user-config.xml
!clickhouse/ipv4-only.xml !clickhouse/ipv4-only.xml
!README.md !README.md
!LICENSE !LICENSE

View File

@ -0,0 +1,17 @@
<clickhouse>
<logger>
<level>warning</level>
<console>true</console>
</logger>
<!-- Stop all the unnecessary logging -->
<query_thread_log remove="remove"/>
<query_metric_log remove="remove"/>
<query_log remove="remove"/>
<text_log remove="remove"/>
<trace_log remove="remove"/>
<metric_log remove="remove"/>
<asynchronous_metric_log remove="remove"/>
<session_log remove="remove"/>
<part_log remove="remove"/>
</clickhouse>

View File

@ -0,0 +1,17 @@
<clickhouse>
<profiles>
<default>
<log_queries>0</log_queries>
<log_query_threads>0</log_query_threads>
<max_block_size>1024</max_block_size>
<max_download_threads>1</max_download_threads>
<input_format_parallel_parsing>0</input_format_parallel_parsing>
<output_format_parallel_formatting>0</output_format_parallel_formatting>
</default>
</profiles>
<asynchronous_metrics_update_period_s>60</asynchronous_metrics_update_period_s>
<dns_cache_update_period>90</dns_cache_update_period>
<mark_cache_size>524288000</mark_cache_size>
</clickhouse>

View File

@ -1,36 +0,0 @@
<clickhouse>
<logger>
<level>warning</level>
<console>true</console>
</logger>
<query_log replace="1">
<database>system</database>
<table>query_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<engine>
ENGINE = MergeTree
PARTITION BY event_date
ORDER BY (event_time)
TTL event_date + interval 30 day
SETTINGS ttl_only_drop_parts=1
</engine>
</query_log>
<metric_log>
<partition_by>event_date</partition_by>
<ttl>event_date + INTERVAL 30 DAY DELETE</ttl>
</metric_log>
<asynchronous_metric_log>
<partition_by>event_date</partition_by>
<ttl>event_date + INTERVAL 30 DAY DELETE</ttl>
</asynchronous_metric_log>
<!-- Stops unnecessary logging -->
<query_thread_log remove="remove" />
<text_log remove="remove" />
<trace_log remove="remove" />
<session_log remove="remove" />
<part_log remove="remove" />
</clickhouse>

View File

@ -14,9 +14,8 @@ services:
image: clickhouse/clickhouse-server:24.11.1.2557-alpine image: clickhouse/clickhouse-server:24.11.1.2557-alpine
restart: always restart: always
volumes: volumes:
- event-data:/var/lib/clickhouse - ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
- event-logs:/var/log/clickhouse-server - ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/config.d/user.xml:ro
- ./clickhouse/logs.xml:/etc/clickhouse-server/config.d/logs.xml:ro
# This makes ClickHouse bind to IPv4 only, since Docker doesn't enable IPv6 in bridge networks by default. # This makes ClickHouse bind to IPv4 only, since Docker doesn't enable IPv6 in bridge networks by default.
# Fixes "Listen [::]:9000 failed: Address family for hostname not supported" warnings. # Fixes "Listen [::]:9000 failed: Address family for hostname not supported" warnings.
- ./clickhouse/ipv4-only.xml:/etc/clickhouse-server/config.d/ipv4-only.xml:ro - ./clickhouse/ipv4-only.xml:/etc/clickhouse-server/config.d/ipv4-only.xml:ro