Adding compute resources
Sometimes, when working with cliques, you may experience performance issues due to full utilization of available resources and, as a result, query degradation. In such cases, you need to increase the amount of compute resources.
Compute resources are ClickHouse instances: servers with dedicated CPUs and RAM. Most of the time, users only need to adjust the number of instances.
Important
To configure a clique, you must have the manage permission for that clique. Check whether you have this permission type on the ACL tab in the Tabs panel under Object permissions.
You can add compute resources to a clique in two ways:
-
Open the clique interface as described in the How to open the clique interface section.
-
Click
in the upper-right corner of the Action buttons section or the button Edit speclet on the Speclet tab in the Tabs panel. -
Select the Resources tab on the left.
-
In the Instances field, enter the number of instances for the clique (from 1 to 100).
Note
The default field value is
1. There is no universal recommendation for choosing the number of instances: the parameter depends on your tasks and is determined experimentally. We recommend starting with the default value. -
To apply the changes, click Confirm.
-
Install the CHYT CLI as part of the
ytsaurus-clientpackage, if you haven’t done so already. -
Save the proxy address to an environment variable. This allows you to avoid specifying the YTsaurus cluster using the
--proxyargument in every subsequent command.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, for a demo cluster, the address looks like this:https://strawberry-XXXXXXXX.demo.ytsaurus.tech.You can get the controller address from the
controllerfield in the output of the following command:yt 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 number of instances using the
instance_countoption:yt clickhouse ctl set-option instance_count COUNT --alias chyt_example_cliquewhere
COUNTis the number of instances.
Advanced compute resource settings
Important
These options are intended for advanced users. If you’re unsure whether you need them, keep the default values.
Advanced settings include CPU and RAM parameters for each instance. When choosing CPU and RAM values, consider the physical resources of your servers and the requirements of your clique workloads.
Recommended values:
- 1–100 CPU cores per instance;
- 20–300 GB of RAM per instance.
Note
Choose option values so that they don’t exceed the physical resources of the servers. For example, on a server with 10 CPU cores and 40 GB of memory, you can’t allocate an instance with 16 cores and 65 GB.
You can set the Instance CPU and Instance Total Memory options via:
- Open the clique interface as described in the How to open the clique interface section.
- Click
in the upper-right corner of the Action buttons section or the button Edit speclet on the Speclet tab in the Tabs panel. - Select the Resources tab on the left.
- In the Instance CPU field, specify the number of CPU cores per instance.
- In the Instance Total Memory field, specify the amount of RAM per instance.
- To save the settings, click Confirm.
-
Install the CHYT CLI as part of the
ytsaurus-clientpackage, if you haven’t done so already. -
Save the proxy address to an environment variable. This allows you to avoid specifying the YTsaurus cluster using the
--proxyargument in every subsequent command.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, for a demo cluster, the address looks like this:https://strawberry-XXXXXXXX.demo.ytsaurus.tech.You can get the controller address from the
controllerfield in the output of the following command:yt 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 amount of CPU to be allocated for each clique instance using the
instance_cpuoption:yt clickhouse ctl set-option instance_cpu CPU_AMOUNT --alias chyt_example_cliquewhere
CPU_AMOUNTis the number of CPU cores. -
Set the amount of RAM to be allocated for each clique instance using the
instance_total_memoryoption:yt clickhouse ctl set-option instance_total_memory RAM_AMOUNT --alias chyt_example_cliquewhere
RAM_AMOUNTis the amount of RAM in GB.
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.
Note that with the Restart on speclet change option enabled, any setting changes will trigger an automatic clique restart, and the restart will take some time. You can enable the Restart on speclet change option on the General tab in the speclet interface dialog box.