Server Settings

This correction is done to avoid hitting these limits just after server startup.

Note

A value of `0` (default) means unlimited.

This setting can be modified at runtime and will take effect immediately. Queries that are already running will remain unchanged.

## max\_zookeeper\_pooled\_connections[​](#max_zookeeper_pooled_connections "Direct link to max_zookeeper_pooled_connections")

Maximum number of lazily initialized ZooKeeper sessions per ZooKeeper cluster in the shared pool.

A value of `0` disables pooled connections and keeps using a single session.

## memory\_worker\_correct\_memory\_tracker[​](#memory_worker_correct_memory_tracker "Direct link to memory_worker_correct_memory_tracker")

Whether background memory worker should correct internal memory tracker based on the information from external sources like jemalloc and cgroups

## memory\_worker\_decay\_adjustment\_period\_ms[​](#memory_worker_decay_adjustment_period_ms "Direct link to memory_worker_decay_adjustment_period_ms")

Duration in milliseconds that memory pressure must persist before dynamically adjusting jemalloc's `dirty_decay_ms`. When memory usage remains above the purge threshold for this period, automatic dirty page decay is disabled (`dirty_decay_ms=0`) to aggressively reclaim memory. When usage stays below the threshold for this period, the default decay behavior is restored. Set to 0 to disable dynamic adjustment and use jemalloc's default decay settings.

## memory\_worker\_period\_ms[​](#memory_worker_period_ms "Direct link to memory_worker_period_ms")

Tick period of background memory worker which corrects memory tracker memory usages and cleans up unused pages during higher memory usage. If set to 0, default value will be used depending on the memory usage source

## memory\_worker\_purge\_dirty\_pages\_threshold\_ratio[​](#memory_worker_purge_dirty_pages_threshold_ratio "Direct link to memory_worker_purge_dirty_pages_threshold_ratio")

The threshold ratio for jemalloc dirty pages relative to the memory available to ClickHouse server. When dirty pages size exceeds this ratio, the background memory worker forces purging of dirty pages. If set to 0, forced purging based on dirty pages ratio is disabled.

## memory\_worker\_purge\_total\_memory\_threshold\_ratio[​](#memory_worker_purge_total_memory_threshold_ratio "Direct link to memory_worker_purge_total_memory_threshold_ratio")

The threshold ratio for purging jemalloc relative to the memory available to ClickHouse server. When total memory usage exceeds this ratio, the background memory worker forces purging of dirty pages. If set to 0, forced purging based on total memory is disabled.

## memory\_worker\_use\_cgroup[​](#memory_worker_use_cgroup "Direct link to memory_worker_use_cgroup")

Use current cgroup memory usage information to correct memory tracking.

## merge\_tree[​](#merge_tree "Direct link to merge_tree")

Fine-tuning for tables in the [MergeTree](/docs/engines/table-engines/mergetree-family/mergetree).

For more information, see the MergeTreeSettings.h header file.

**Example**

```
<merge_tree>
    <max_suspicious_broken_parts>5</max_suspicious_broken_parts>
</merge_tree>
```

## merge\_workload[​](#merge_workload "Direct link to merge_workload")

Used to regulate how resources are utilized and shared between merges and other workloads. Specified value is used as `workload` setting value for all background merges. Can be overridden by a merge tree setting.

**See Also**

- [Workload Scheduling](/docs/operations/workload-scheduling)

## merges\_mutations\_memory\_usage\_soft\_limit[​](#merges_mutations_memory_usage_soft_limit "Direct link to merges_mutations_memory_usage_soft_limit")

Sets the limit on how much RAM is allowed to use for performing merge and mutation operations.
If ClickHouse reaches the limit set, it won't schedule any new background merge or mutation operations but will continue to execute already scheduled tasks.

Note

A value of `0` means unlimited.

**Example**

```
<merges_mutations_memory_usage_soft_limit>0</merges_mutations_memory_usage_soft_limit>
```

## merges\_mutations\_memory\_usage\_to\_ram\_ratio[​](#merges_mutations_memory_usage_to_ram_ratio "Direct link to merges_mutations_memory_usage_to_ram_ratio")

The default `merges_mutations_memory_usage_soft_limit` value is calculated as `memory_amount * merges_mutations_memory_usage_to_ram_ratio`.

**See also:**

- [max\_memory\_usage](/docs/operations/settings/settings#max_memory_usage)
- [merges\_mutations\_memory\_usage\_soft\_limit](/docs/operations/server-configuration-parameters/settings#merges_mutations_memory_usage_soft_limit)

## metric\_log[​](#metric_log "Direct link to metric_log")

It is disabled by default.

**Enabling**

To manually turn on metrics history collection [`system.metric_log`](/docs/operations/system-tables/metric_log), create `/etc/clickhouse-server/config.d/metric_log.xml` with the following content:

```
<clickhouse>
    <metric_log>
        <database>system</database>
        <table>metric_log</table>
        <flush_interval_milliseconds>7500</flush_interval_milliseconds>
        <collect_interval_milliseconds>1000</collect_interval_milliseconds>
        <max_size_rows>1048576</max_size_rows>
        <reserved_size_rows>8192</reserved_size_rows>
        <buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
        <flush_on_crash>false</flush_on_crash>
    </metric_log>
</clickhouse>
```

**Disabling**

To disable `metric_log` setting, you should create the following file `/etc/clickhouse-server/config.d/disable_metric_log.xml` with the following content:

```
<clickhouse>
    <metric_log remove="1" />
</clickhouse>
```

The following settings can be configured by sub-tags: