Advanced settings configuration
This section describes how to work with advanced clique settings. In the web interface, they are located under Advanced settings. The full list of advanced settings is provided in Advanced settings.
Warning
The settings described in this section are intended for advanced users only. If you are unsure whether you need them, we recommend keeping the default values.
Advanced settings include:
- configuring queries within the clique — the Query settings section;
- configuring server settings — the ClickHouse config section;
- configuring the YT components of instances — the YT config section;
- allocating memory — the Instance memory section;
- caching queries — the Query cache section.
Query settings
The parameters in the Query settings section are a subset of the ClickHouse session settings that will be applied to all queries within the clique.
To change query behavior, override the default parameter values using:
-
In the ClickHouse documentation, find the required settings and copy their names.
-
Open the clique interface as described in How to open the clique interface.
-
Click
in the upper-right corner, in the Action buttons section, or click Edit speclet on the Speclet tab of the Tab panel. -
Select Advanced on the left.
-
Find the Query settings section.
-
In the Use JSON syntax field, enter the parameters and their values using JSON syntax as
key: valuepairs enclosed in curly braces{ }. For example:{ "max_execution_time": 200000, "max_insert_threads": 32, "max_threads": 32, "parallel_distributed_insert_select": 2 } -
To apply the changes, click Confirm.
-
Install the CHYT CLI included in the
ytsaurus-clientpackage if you have not already done so. -
Save the proxy address to an environment variable. This avoids having to specify the YTsaurus cluster in every command using the
--proxyargument.export YT_PROXY=<cluster_name> -
Set an environment variable with the controller address:
export CHYT_CTL_ADDRESS=<address>, where
<address>is the Controller address. For example, the address for a demo cluster has the following format:https://strawberry-XXXXXXXX.demo.ytsaurus.tech.
You can obtain the Controller address from thecontrollerfield in the command outputyt get //sys/strawberry/chyt/<alias>/@strawberry_info_state -
Save the cluster name to an environment variable:
export CLUSTER_NAME=<cluster_name>, where
<cluster_name>is the cluster name. For example, the demo cluster name isytdemo. -
Find the required settings in the ClickHouse documentation and copy their names.
-
Set the required parameters using the
query_settingsoption. For example:yt clickhouse ctl set-option query_settings "{\"max_execution_time\": 200000,\"max_insert_threads\": 32,\"max_threads\": 32,\"parallel_distributed_insert_select\": 2}"
ClickHouse config
The Clickhouse config setting is used to manage the configuration of the ClickHouse component. Set it to match the standard ClickHouse XML configuration.
The rules for converting an ClickHouse XML configuration to a CHYT YSON configuration can be described as follows:
- Any configuration node that is not semantically repeatable in the ClickHouse configuration is a map (
map). - A repeatable node is represented as a list (
list).
Example of converting a sample XML configuration to a YSON configuration
|
XML |
YSON |
|
|
ClickHouse configuration options that may be useful in CHYT
The main option is dictionaries, which configures external dictionaries. Its value must be a list of dictionary configurations.
Each dictionary is configured using a map with the following fields, which retain the semantics of the original ClickHouse configuration:
name— external dictionary name;source— data source for the external dictionary;layout— layout of the external dictionary in the instance memory;structure— schema of the data stored in the dictionary;lifetime— dictionary lifetime.
Other options are available in the ClickHouse configuration in the repository.
Note
The ClickHouse configuration also has a settings option containing the settings described in the Query settings section. Thus, query settings can also be defined within the ClickHouse configuration.
How to modify the ClickHouse configuration
-
Open the clique UI as described in How to access the clique UI.
-
Click
in the upper-right corner, in the Action buttons section, or click Edit speclet on the Speclet tab in the Tab panel. -
Select Advanced on the left.
-
Find the Clickhouse config section.
-
In the Use JSON syntax field, enter the parameters and their values as a JSON configuration.
Example configuration of a simple dictionary and Query settings in thesettingssection:{ "settings": { "max_execution_time": 30 }, "dictionaries": [ { "name": "dict", "layout": {"flat": {}}, "structure": { "id": {"name": "key"}, "attribute": [ {"name": "value_str", "type": "String", "null_value": "n/a"}, {"name": "value_i64", "type": "Int64", "null_value": 42} ] }, "lifetime": 0, "source": {"yt": {"path": "//home/user/table"}} } ] } -
To apply the changes, click Confirm.
-
Install the CHYT CLI included in the
ytsaurus-clientpackage if you have not already done so. -
Save the proxy address to an environment variable. This prevents you from having to specify the YTsaurus cluster in every command using the
--proxyargument.export YT_PROXY=<cluster_name> -
Set an environment variable with the controller address:
export CHYT_CTL_ADDRESS=<address>, where
<address>is the controller address. For example, the demo cluster address has the following format:https://strawberry-XXXXXXXX.demo.ytsaurus.tech.
You can obtain the controller address from thecontrollerfield in the command outputyt get //sys/strawberry/chyt/<alias>/@strawberry_info_state -
Save the cluster name to an environment variable:
export CLUSTER_NAME=<cluster_name>, where
<cluster_name>is the cluster name. For example, the demo cluster name isytdemo. -
Find the required parameters in the list of ClickHouse settings and copy their names.
-
Set the required parameters using the
clickhouse_configoption. For example:yt clickhouse ctl set-option clickhouse_config "{ ... some JSON params}"
YT config
The YT part of the instance configuration is specified using the yt_config option. This option lets you specify advanced settings that are not available as separate speclet options.
For a list of available YT configuration parameters, see Instance configuration.
How to modify the YT configuration
-
Open the clique interface as described in How to access the clique interface.
-
Click
in the upper-right corner, in the Action buttons section, or click Edit speclet on the Speclet tab in the Tab panel. -
Select Advanced on the left.
-
Find the YT config section.
-
In the Use JSON syntax field, enter the parameters and their values as a JSON configuration, for example:
{ "subquery": { "max_data_weight_per_subquery": 12942417591810 } } -
To apply the changes, click Confirm.
-
Install the CHYT CLI included in the
ytsaurus-clientpackage if you have not already done so. -
Save the proxy address to an environment variable. This eliminates the need to specify the YTsaurus cluster in every command using the
--proxyargument.export YT_PROXY=<cluster_name> -
Set an environment variable with the controller address:
export CHYT_CTL_ADDRESS=<address>, where
<address>is the controller address. For example, the demo cluster address has the following format:https://strawberry-XXXXXXXX.demo.ytsaurus.tech.
You can obtain the controller address from thecontrollerfield in the command outputyt get //sys/strawberry/chyt/<alias>/@strawberry_info_state -
Save the cluster name to an environment variable:
export CLUSTER_NAME=<cluster_name>, where
<cluster_name>is the cluster name. For example, the demo cluster name isytdemo. -
Set the required parameters using the
yt_configoption. For example:yt clickhouse ctl set-option yt_config "{\"subquery\":{\"max_data_weight_per_subquery\": 12942417591810}}"
Instance memory
To fine-tune memory allocation, it is helpful to understand the memory allocation model in a CHYT instance, which parameters control each memory allocation, and how to change them.
Note
In the context of memory management:
- A watermark is an amount of memory measured downward from the upper bound of the allocated memory limit. When memory usage enters this range, the CHYT instance initiates termination according to one of the predefined scenarios.
- A window is a time interval (15 minutes by default) during which the average amount by which memory usage exceeds the lower watermark boundary is calculated. This helps exclude random memory usage spikes.
- RSS (Resident Set Size) is the actual amount of RAM used by a process.
- OOM (out of memory) means memory exhaustion.
Memory allocation in a CHYT instance
The diagram shows how memory is allocated within a CHYT instance: which memory allocations make up the overall limit and which thresholds determine system behavior when memory is low.

Each parameter in the diagram is described below, including the memory allocations that make up the overall instance limit and the thresholds:
-
MaxServerMemoryUsageis the overall memory usage limit for a CHYT instance. It includes:-
Readeris the amount of memory allocated to reader caches for prefetching and faster data reads. -
Cachesis the designation in the diagram for the amount of memory allocated to caches, including:CompressedBlockCacheis the cache for compressed data blocks. It can hold large amounts of data because the data is stored in compressed form, which is the default behavior, but decompression takes additional time. It is used when rereading large data blocks.UncompressedBlockCacheis the cache for uncompressed data blocks. It is useful when many sequential queries access the same data because it saves resources on both reading and decompressing the data.ChunkMetaCacheis the chunk metadata cache. Chunk metadata is read before any read operation. This cache is useful when rereading data because it avoids repeatedly retrieving the same metadata.
-
CH Memoryis a dedicated amount of memory reserved for the internal needs of ClickHouse; -
Footprintis a dedicated memory reserve that allows the process to exceed the thresholds without causing the total memory usage to exceed critical values;
-
-
MemoryLimitis a conditional hard limit on the RSS (memory usage) of a CHYT instance, used for theWatchdogOomWatermarkandWatchdogOomWindowWatermarkcategories; -
WatchdogOomWatermarkis an additional amount of memory used to check whether an OOM condition has occurred: the sum of the current RSS value andWatchdogOomWatermarkis compared against the specifiedMemoryLimit; -
WatchdogOomWindowWatermarkis an additional amount of memory used to check whether an OOM condition has occurred. The check is performed using the following algorithm:- The average RSS value is calculated over the
Windowtime window (15 minutes by default); WatchdogOomWindowWatermarkis added to the calculated value;- The sum is compared against the specified
MemoryLimit.
- The average RSS value is calculated over the
-
ClickHouseWatermarkis an additional amount of memory used to separateMaxServerMemoryUsagefrom the overallMemoryLimit.
Critical RSS (memory usage) ranges
On the RSS scale in the memory allocation diagram, the critical value ranges at which the system terminates the process are numbered.

If the process's physical RAM usage reaches the following range:
1(the average RSS value over more than 15 minutes exceeds the lower bound of theWatchdogOomWindowWatermarkrange) — the instance performs a graceful shutdown: it stops accepting new queries, waits for active queries to complete, and shuts down;2(the average RSS value exceeds the lower bound of theClickHouseWatermarkthreshold) — ClickHouse stops allocating memory for any operations, and the system reports insufficient memory;3(RSS exceeds the lower bound of theWatchdogOomWatermarkrange) — the instance terminates immediately, and active queries fail;4(RSS exceedsMemoryLimit) — YTsaurus deletes the instance.
How to configure memory thresholds
We recommend using the web interface:
-
Open the clique interface as described in How to access the clique interface.
-
Click
in the upper-right corner, in the Action buttons section, or click Edit speclet on the Speclet tab of the Tab bar. -
Select Advanced on the left.
-
Find the Instance memory section.
-
In the Use JSON syntax field, enter the parameters and their values as a JSON configuration. You can use the following configuration example as a template:
{ "clickhouse": 10500000000, "chunk_meta_cache": 100000000, "compressed_cache": 4000000000, "uncompressed_cache": null, "reader": 500000000, "clickhouse_watermark": 10, "watchdog_oom_watermark": 0, "watchdog_oom_window_watermark": 0, "footprint": 2000000000 } -
To apply the changes, click Confirm.
Important
Do not set the following options simultaneously:
- RAM size on the Resources tab in the Instance Total Memory field.
- Memory allocation configuration on the Advanced tab in the Instance memory field.
If you set both options at once, the controller cannot determine which one to apply. The clique will not start, and the system will output an error:
Failed to start
chyt: instance_memory and instance_total_memory cannot be specified simultaneously.
Query cache
Use the following settings to cache queries:
- Enable sticky query distribution — enables query distribution across instances based on query hashes.
- Query sticky group size — specifies the size of the group of instances selected deterministically based on the query hash. A coordinator will be selected from these instances to execute the query. This setting works only when Enable sticky query distribution is enabled.
To enable caching, use the web interface:
-
Open the clique interface as described in How to open the clique interface.
-
Click
in the upper-right corner, in the Action buttons section, or click Edit speclet on the Speclet tab in the Tab panel. -
On the left side of the dialog, select Advanced.
-
Enable Enable sticky query distribution.
-
Set Query sticky group size to
1. -
Add the following parameters under Query settings:
{ "query_cache_ttl": 1800, "use_query_cache": true } -
Under Clickhouse config, add the
query_cachefield. Set the parameter values according to the clique's requirements:{ "query_cache": { "max_entries": 20000, "max_entry_size_in_bytes": 524288, "max_entry_size_in_rows": 100000, "max_size_in_bytes": 104585760000, "min_query_duration": 500 } }These parameters correspond to the query cache settings in ClickHouse.
-
To apply the changes, click Confirm.