Managing resource groups in Managed Service for Trino
- Getting information about a resource group configuration
- Setting up a resource group configuration when creating a cluster
- Setting up or updating a resource group configuration in a cluster
- Deleting a resource group configuration
- Example of a resource group configuration in a Managed Service for Trino cluster
In Managed Service for Trino, you can manage resource group configurations, i.e.:
- Get information about the current configuration.
- Set up a configuration when creating a cluster.
- Set up or update a configuration for an existing cluster.
- Delete a configuration.
Getting information about a resource group configuration
- In the management console
, navigate to the relevant folder. - Go to Managed Service for Trino.
- Click the cluster name.
- Go to the Resource management section.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
To get the description of resource groups and selector rules in the Managed Service for Trino cluster, run this command:
yc managed-trino cluster get-resource-groups <cluster_name_or_ID>
You can get the cluster ID and name with the list of clusters in the folder.
-
Get an IAM token for API authentication and put it into an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.Get method, e.g., via the following cURL
request:curl \ --request GET \ --header "Authorization: Bearer $IAM_TOKEN" \ --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>'You can request the cluster ID with the list of clusters in the folder.
-
The description of resource groups and selector rules in the Managed Service for Trino cluster is in the
resourceGroupsfield of the server response.
-
Get an IAM token for API authentication and put it into an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.Get method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/trino/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "cluster_id": "<cluster_ID>" }' \ trino.api.cloud.yandex.net:443 \ yandex.cloud.trino.v1.ClusterService.GetYou can request the cluster ID with the list of clusters in the folder.
-
The description of resource groups and selector rules in the Managed Service for Trino cluster is in the
resource_groupsfield of the server response.
Setting up a resource group configuration when creating a cluster
-
In the management console
, select the folder where you want to create a Managed Service for Trino cluster. -
Go to Managed Service for Trino.
-
Click Create cluster and set the cluster parameters.
-
Go to the Resource management section.
-
In the CPU quota period field, set the CPU quota calculation period for resource groups.
-
Click Add group and set up the resource group:
-
Optionally, select a parent group.
-
Specify a name for the resource group.
A group name can be a template that uses variable placeholders in
${<variable_name>}format. A template name may contain the following types of variables:- Built-in variables.
USERfor username,SOURCEfor query source. - User-defined variables. These are declared in selector rule properties: User and Source.
When routing queries, Managed Service for Trino will create group instances with dynamically generated names.
- Built-in variables.
-
In the Max queued field, set the maximum number of queries per queue (must be higher than
1). Once this limit is reached, new queries will be rejected with an error. -
Optionally, set a soft limit on the number of running queries in the Soft concurrency limit field. Once the limit is reached, the group will run new queries only if sibling groups are unable to accept queries or are above their soft limits. Otherwise, new queries will be queued.
-
In the Hard concurrency limit field, set the maximum number of running queries (must be higher than
1). Once this limit is reached, new queries will be queued. -
Optionally, set the maximum amount of memory available to the group in the Soft memory limit, % field. Once this limit is reached, new queries will be queued.
-
Optionally, set a soft limit on CPU time in the Soft CPU limit field. Once this limit is reached, the maximum number of running queries will be reduced until the end of the current CPU quota calculation period. This value cannot be greater than Hard CPU limit. To set Soft CPU limit, you also need to set CPU quota period.
-
Optionally, set a hard limit on CPU time in the Hard CPU limit field. Once this limit is reached, new queries will be queued. To set Hard CPU limit, you also need to set CPU quota period.
-
Optionally, set a query scheduling policy in the Scheduling policy field. The possible values are
fair,weighted,weighted_fair, orquery_priority. The default value isnone(thefairpolicy applies). -
Optionally, set the group weight used in the
weightedandweighted_fairscheduling policies in the Scheduling weight field.
Learn more about group trees in Resource groups in Managed Service for Trino.
-
-
Optionally, add other resource groups in the same way.
-
Click Add rule and set up the rule:
-
Optionally, in the User field, specify the name of the user who submitted the query or a Java regular expression. The rule applies if the user name matches the regular expression. If you skip this setting, the rule applies to queries from all users.
-
Optionally, in the Group field, specify the name of the user group that submitted the query or a Java regular expression. The rule applies if the user group name matches the regular expression. If not specified, the rule applies to queries from users of any groups.
-
Optionally, in the Query type field, select the query type. The possible values are:
SELECT:SELECTqueries.EXPLAIN:EXPLAINqueries, exceptEXPLAIN ANALYZE.DESCRIBE:DESCRIBE,DESCRIBE INPUT, andDESCRIBE OUTPUTqueries, as well asSHOWqueries, e.g.,SHOW CATALOGSorSHOW SCHEMAS.INSERT:INSERT,CREATE TABLE AS, andREFRESH MATERIALIZED VIEWqueries.MERGE:MERGEqueries.DELETE:DELETEqueries.ANALYZE:ANALYZEqueries.DATA_DEFINITION:CREATE,ALTER, andDROPqueries for schemas, tables, views, and materialized views, as well as queries that manage prepared statements, access permissions, sessions, and transactions.ALTER_TABLE_EXECUTE:ALTER TABLE ... EXECUTEqueries.
-
Optionally, in the Source field, specify the name of the query source or a Java regular expression. The rule applies if the query source name matches the regular expression. If not specified, the rule applies to queries from all sources.
-
In the Resource group field, select the resource group to run the query in. A target group cannot have sub-groups.
-
Optionally, in the Tags field, specify tags separated by commas. The rule applies only if the query contains all the specified tags. If not specified, the rule applies to queries with any tags.
Warning
A query that does not satisfy any of the specified rules is rejected with an error. To avoid this, add to the end of the description a rule without any restrictive conditions, containing only the Resource group property.
Learn more about selector rules in Resource groups in Managed Service for Trino.
-
-
Optionally, add other selector rules in the same way.
-
Click Create.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
To specify a resource group configuration:
-
Create a file with a description of resource groups and selector rules in JSON or YAML format. Below is an example of the
resource-groups.yamlfile.rootGroups: # Root resource group 1 - name: "<resource_group_name>" softMemoryLimit: "<memory_usage_limit>" softConcurrencyLimit: <soft_limit_on_the_number_of_running_queries> hardConcurrencyLimit: <hard_limit_on_the_number_of_running_queries> softCpuLimit: <soft_CPU_time_limit> hardCpuLimit: <hard_CPU_time_limit> maxQueued: <limit_on_the_number_of_queued_requests> schedulingPolicy: "<query_scheduling_policy>" schedulingWeight: <group_weight> subGroups: # Resource sub-group 1 - name: "<resource_group_name>" ... subGroups: [<list_of_sub-groups_of_the_following_levels>] # Resource sub-group 2 - name: "<resource_group_name>" ... subGroups: [<list_of_sub-groups_of_the_following_levels>] ... # Resource sub-group N - name: "<resource_group_name>" ... subGroups: [<list_of_sub-groups_of_the_following_levels>] # Root resource group 2 - name: "<resource_group_name_2>" ... # Root resource group N - name: "<resource_group_name_N>" ... selectors: # Selector rule 1 - user: "<regular_expression_for_usernames>" userGroup: "<regular_expression_for_user_groups>" queryType: "<request_type>" source: "<regular_expression_for_query_sources>" clientTags: ["<list_of_tags>"] group: "<resource_group_name>" # Selector rule 2 - ... ... # Selector rule N - ... cpuQuotaPeriod: "<CPU_quota_calculation_period>"Where:
-
rootGroups: Resource group tree description. Thename,hardConcurrencyLimit, andmaxQueuedsettings are required.-
name: Group name.A group name can be a template that uses variable placeholders in
${<variable_name>}format. A template name may contain the following types of variables:- Built-in variables.
USERfor username,SOURCEfor query source. - User-defined variables. These are declared in selector rule properties:
user,userGroup, andsource.
When routing queries, Managed Service for Trino will create group instances with dynamically generated names.
- Built-in variables.
-
softMemoryLimit: Maximum amount of memory available to the group. Once this limit is reached, new queries will be queued. You can setsoftMemoryLimitin one of the following ways:- As a percentage of the total available memory, e.g.,
10%. - As an absolute memory value, e.g.,
1GB. You can use one of these suffixes:B,kB,MB,GB,TB, orPB.
- As a percentage of the total available memory, e.g.,
-
softConcurrencyLimit: Soft limit on the number of running queries. Once the limit is reached, the group will run new queries only if sibling groups are unable to accept queries or are above their soft limits. Otherwise, new queries will be queued. -
hardConcurrencyLimit: Hard limit on the number of running queries. Once this limit is reached, new queries will be queued. -
softCpuLimit: Soft limit on CPU time. Once this limit is reached,hardConcurrencyLimitwill be reduced until the end of the current CPU quota calculation period.softCpuLimitcannot be greater thanhardCpuLimit. -
hardCpuLimit: Hard limit on CPU time. Once this limit is reached, new queries will be queued.
Note
If at least one of the two (
softCpuLimitorhardCpuLimit) is specified, make sure to specifycpuQuotaPeriodas well.-
maxQueued: Maximum number of queries per queue. Once this limit is reached, new queries will be rejected with an error. -
schedulingPolicy: Queue scheduling policy. The possible values are:FAIRWEIGHTEDWEIGHTED_FAIRQUERY_PRIORITY
If not specified, the
FAIRpolicy will apply. -
schedulingWeight: Group weight used in theWEIGHTEDandWEIGHTED_FAIRscheduling policies.If not specified, the group weight is
1. -
subGroups: Descriptions of sub-groups.
-
-
selectors: Selector rule description. Thegroupproperty is required.-
user: Name of the user who submitted the query or a Java regular expression. The rule applies if the user name matches the regular expression. If not specified, the rule applies to queries from all users. -
userGroup: Name of the user group that submitted the query or a Java regular expression for user groups. The rule applies if the user group name matches the regular expression. If not specified, the rule applies to queries from users of any groups. -
queryType: Type of the request. The possible values are:SELECT:SELECTqueries.EXPLAIN:EXPLAINqueries, exceptEXPLAIN ANALYZE.DESCRIBE:DESCRIBE,DESCRIBE INPUT, andDESCRIBE OUTPUTqueries, as well asSHOWqueries, e.g.,SHOW CATALOGSorSHOW SCHEMAS.INSERT:INSERT,CREATE TABLE AS, andREFRESH MATERIALIZED VIEWqueries.MERGE:MERGEqueries.DELETE:DELETEqueries.ANALYZE:ANALYZEqueries.DATA_DEFINITION:CREATE,ALTER, andDROPqueries for schemas, tables, views, and materialized views, as well as queries that manage prepared statements, access permissions, sessions, and transactions.ALTER_TABLE_EXECUTE:ALTER TABLE ... EXECUTEqueries.
-
source: Query source name or a Java regular expression. The rule applies if the query source name matches the regular expression. If not specified, the rule applies to queries from all sources. -
clientTags: Tag list. The rule applies only if the query contains all the specified tags. If not specified, the rule applies to queries with any tags. -
group: Full name of the target resource group. It includes the names of all its parent groups, separated by dots, starting from the root group. A group name can use variable placeholders in${<variable_name>}format. A target group cannot have sub-groups.
Warning
A query that does not satisfy any of the specified rules is rejected with an error. To avoid this, add to the end of the description a rule without any restrictive conditions, containing only the
groupproperty. -
-
cpuQuotaPeriod: CPU quota calculation period for resource groups. It takes an integer value in seconds, minutes, or hours, e.g.,140s,30m, or1h.
For more information about the group tree and selector rules, see Resource groups in Managed Service for Trino.
-
-
View the description of the CLI command for creating a cluster:
yc managed-trino cluster create --help -
Run this command:
yc managed-trino cluster create \ ... --resource-groups-from-file resource-groups.yamlFor available cluster parameters and their descriptions, see this guide.
-
Create a Terraform configuration file describing your infrastructure.
-
Add the
resource_groupssection to the cluster description:resource_groups = jsonencode( { "rootGroups" : [ # Root resource group 1 { "name" : "<resource_group_name>", "softMemoryLimit" : "<memory_usage_limit>", "softConcurrencyLimit" : <soft_limit_on_the_number_of_running_queries>, "hardConcurrencyLimit" : <hard_limit_on_the_number_of_running_queries>, "softCpuLimit" : <soft_CPU_time_limit>, "hardCpuLimit" : <hard_CPU_time_limit>, "maxQueued" : <limit_on_the_number_of_queued_requests>, "schedulingPolicy" : "<query_scheduling_policy>", "schedulingWeight" : <group_weight>, "subGroups" : [ # Resource sub-group 1 { ... "subGroups" : [<list_of_next-level_sub-groups>] }, # Resource sub-group 2 { ... "subGroups" : [<list_of_next-level_sub-groups>] }, ... # Resource sub-group N { ... "subGroups" : [<list_of_next-level_sub-groups>] } ] }, # Root resource group 2 { ... }, ... # Root resource group N { ... } ], "selectors" : [ # Selector rule 1 { "user" : "<regular_expression_for_usernames>", "userGroup" : "<regular_expression_for_user_groups>", "queryType" : "<request_type>", "source" : "<regular_expression_for_query_sources>", "clientTags" : ["<list_of_tags>"], "group" : "<resource_group_name>" }, # Selector rule 2 { ... }, ... # Selector rule N { ... } ], "cpuQuotaPeriod" : "<CPU_quota_calculation_period>" } )Where:
-
rootGroups: Resource group tree description. Thename,hardConcurrencyLimit, andmaxQueuedsettings are required.-
name: Group name.A group name can be a template that uses variable placeholders in
${<variable_name>}format. A template name may contain the following types of variables:- Built-in variables.
USERfor username,SOURCEfor query source. - User-defined variables. These are declared in selector rule properties:
user,userGroup, andsource.
When routing queries, Managed Service for Trino will create group instances with dynamically generated names.
- Built-in variables.
-
softMemoryLimit: Maximum amount of memory available to the group. Once this limit is reached, new queries will be queued. You can setsoftMemoryLimitin one of the following ways:- As a percentage of the total available memory, e.g.,
10%. - As an absolute memory value, e.g.,
1GB. You can use one of these suffixes:B,kB,MB,GB,TB, orPB.
- As a percentage of the total available memory, e.g.,
-
softConcurrencyLimit: Soft limit on the number of running queries. Once the limit is reached, the group will run new queries only if sibling groups are unable to accept queries or are above their soft limits. Otherwise, new queries will be queued. -
hardConcurrencyLimit: Hard limit on the number of running queries. Once this limit is reached, new queries will be queued. -
softCpuLimit: Soft limit on CPU time. Once this limit is reached,hardConcurrencyLimitwill be reduced until the end of the current CPU quota calculation period.softCpuLimitcannot be greater thanhardCpuLimit. -
hardCpuLimit: Hard limit on CPU time. Once this limit is reached, new queries will be queued.
Note
If at least one of the two (
softCpuLimitorhardCpuLimit) is specified, make sure to specifycpuQuotaPeriodas well.-
maxQueued: Maximum number of queries per queue. Once this limit is reached, new queries will be rejected with an error. -
schedulingPolicy: Queue scheduling policy. The possible values are:FAIRWEIGHTEDWEIGHTED_FAIRQUERY_PRIORITY
If not specified, the
FAIRpolicy will apply. -
schedulingWeight: Group weight used in theWEIGHTEDandWEIGHTED_FAIRscheduling policies.If not specified, the group weight is
1. -
subGroups: Descriptions of sub-groups.
-
-
selectors: Selector rule description. Thegroupproperty is required.-
user: Name of the user who submitted the query or a Java regular expression. The rule applies if the user name matches the regular expression. If not specified, the rule applies to queries from all users. -
userGroup: Name of the user group that submitted the query or a Java regular expression for user groups. The rule applies if the user group name matches the regular expression. If not specified, the rule applies to queries from users of any groups. -
queryType: Type of the request. The possible values are:SELECT:SELECTqueries.EXPLAIN:EXPLAINqueries, exceptEXPLAIN ANALYZE.DESCRIBE:DESCRIBE,DESCRIBE INPUT, andDESCRIBE OUTPUTqueries, as well asSHOWqueries, e.g.,SHOW CATALOGSorSHOW SCHEMAS.INSERT:INSERT,CREATE TABLE AS, andREFRESH MATERIALIZED VIEWqueries.MERGE:MERGEqueries.DELETE:DELETEqueries.ANALYZE:ANALYZEqueries.DATA_DEFINITION:CREATE,ALTER, andDROPqueries for schemas, tables, views, and materialized views, as well as queries that manage prepared statements, access permissions, sessions, and transactions.ALTER_TABLE_EXECUTE:ALTER TABLE ... EXECUTEqueries.
-
source: Query source name or a Java regular expression. The rule applies if the query source name matches the regular expression. If not specified, the rule applies to queries from all sources. -
clientTags: Tag list. The rule applies only if the query contains all the specified tags. If not specified, the rule applies to queries with any tags. -
group: Full name of the target resource group. It includes the names of all its parent groups, separated by dots, starting from the root group. A group name can use variable placeholders in${<variable_name>}format. A target group cannot have sub-groups.
Warning
A query that does not satisfy any of the specified rules is rejected with an error. To avoid this, add to the end of the description a rule without any restrictive conditions, containing only the
groupproperty. -
-
cpuQuotaPeriod: CPU quota calculation period for resource groups. It takes an integer value in seconds, minutes, or hours, e.g.,140s,30m, or1h.
For more information about the group tree and selector rules, see Resource groups in Managed Service for Trino.
Note
You can also create a separate JSON file describing resource groups and selector rules and provide it in the
resource_groupsparameter as follows:resource_groups = file("resource-groups.json") -
-
Make sure the settings are correct.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm updating the resources.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
For more information, see this Terraform provider guide.
-
Get an IAM token for API authentication and put it into an environment variable:
export IAM_TOKEN="<IAM_token>" -
Create a file named
body.jsonand paste the following code into it:{ <cluster_parameters> ... "trino": { ... "resourceManagement": { "resourceGroups": { "rootGroups": [ { "name" : "<resource_group_name>", "softMemoryLimit" : "<memory_usage_limit>", "softConcurrencyLimit" : "<soft_limit_on_the_number_of_running_queries>", "hardConcurrencyLimit" : "<hard_limit_on_the_number_of_running_queries>", "softCpuLimit" : "<soft_CPU_time_limit>", "hardCpuLimit" : "<hard_CPU_time_limit>", "maxQueued" : "<limit_on_the_number_of_queued_requests>", "schedulingPolicy" : "<query_scheduling_policy>", "schedulingWeight" : "<group_weight>", "subGroups": [ { <resource_sub-group_1> ... "subGroups" : [<list_of_next-level_sub-groups>] }, { <resource_sub-group_2> ... "subGroups" : [<list_of_next-level_sub-groups>] }, ... { <resource_sub-group_N> ... "subGroups" : [<list_of_next-level_sub-groups>] } ] }, { <root_resource_group_2> }, ... { <root_resource_group_N> } ], "selectors": [ { "user": "<regular_expression_for_usernames>", "userGroup": "<regular_expression_for_user_groups>", "queryType": "<request_type>", "source": "<regular_expression_for_query_sources>", "clientTags": ["<list_of_tags>"], "group": "<resource_group_name>" }, { <selector_rule_2> }, ... { <selector_rule_N> } ], "cpuQuotaPeriod": "<CPU_quota_calculation_period>" } ... }, } }Where:
-
rootGroups: Resource group tree description. Thename,hardConcurrencyLimit, andmaxQueuedsettings are required.-
name: Group name.A group name can be a template that uses variable placeholders in
${<variable_name>}format. A template name may contain the following types of variables:- Built-in variables.
USERfor username,SOURCEfor query source. - User-defined variables. These are declared in selector rule properties:
user,userGroup, andsource.
When routing queries, Managed Service for Trino will create group instances with dynamically generated names.
- Built-in variables.
-
softMemoryLimit: Maximum amount of memory available to the group. Once this limit is reached, new queries will be queued. You can setsoftMemoryLimitin one of the following ways:- As a percentage of the total available memory, e.g.,
10%. - As an absolute memory value, e.g.,
1GB. You can use one of these suffixes:B,kB,MB,GB,TB, orPB.
- As a percentage of the total available memory, e.g.,
-
softConcurrencyLimit: Soft limit on the number of running queries. Once the limit is reached, the group will run new queries only if sibling groups are unable to accept queries or are above their soft limits. Otherwise, new queries will be queued. -
hardConcurrencyLimit: Hard limit on the number of running queries. Once this limit is reached, new queries will be queued. -
softCpuLimit: Soft limit on CPU time. Once this limit is reached,hardConcurrencyLimitwill be reduced until the end of the current CPU quota calculation period.softCpuLimitcannot be greater thanhardCpuLimit. -
hardCpuLimit: Hard limit on CPU time. Once this limit is reached, new queries will be queued.
Note
If at least one of the two (
softCpuLimitorhardCpuLimit) is specified, make sure to specifycpuQuotaPeriodas well.-
maxQueued: Maximum number of queries per queue. Once this limit is reached, new queries will be rejected with an error. -
schedulingPolicy: Queue scheduling policy. The possible values are:FAIRWEIGHTEDWEIGHTED_FAIRQUERY_PRIORITY
If not specified, the
FAIRpolicy will apply. -
schedulingWeight: Group weight used in theWEIGHTEDandWEIGHTED_FAIRscheduling policies.If not specified, the group weight is
1. -
subGroups: Descriptions of sub-groups.
-
-
selectors: Selector rule description. Thegroupproperty is required.-
user: Name of the user who submitted the query or a Java regular expression. The rule applies if the user name matches the regular expression. If not specified, the rule applies to queries from all users. -
userGroup: Name of the user group that submitted the query or a Java regular expression for user groups. The rule applies if the user group name matches the regular expression. If not specified, the rule applies to queries from users of any groups. -
queryType: Type of the request. The possible values are:SELECT:SELECTqueries.EXPLAIN:EXPLAINqueries, exceptEXPLAIN ANALYZE.DESCRIBE:DESCRIBE,DESCRIBE INPUT, andDESCRIBE OUTPUTqueries, as well asSHOWqueries, e.g.,SHOW CATALOGSorSHOW SCHEMAS.INSERT:INSERT,CREATE TABLE AS, andREFRESH MATERIALIZED VIEWqueries.MERGE:MERGEqueries.DELETE:DELETEqueries.ANALYZE:ANALYZEqueries.DATA_DEFINITION:CREATE,ALTER, andDROPqueries for schemas, tables, views, and materialized views, as well as queries that manage prepared statements, access permissions, sessions, and transactions.ALTER_TABLE_EXECUTE:ALTER TABLE ... EXECUTEqueries.
-
source: Query source name or a Java regular expression. The rule applies if the query source name matches the regular expression. If not specified, the rule applies to queries from all sources. -
clientTags: Tag list. The rule applies only if the query contains all the specified tags. If not specified, the rule applies to queries with any tags. -
group: Full name of the target resource group. It includes the names of all its parent groups, separated by dots, starting from the root group. A group name can use variable placeholders in${<variable_name>}format. A target group cannot have sub-groups.
Warning
A query that does not satisfy any of the specified rules is rejected with an error. To avoid this, add to the end of the description a rule without any restrictive conditions, containing only the
groupproperty. -
-
cpuQuotaPeriod: CPU quota calculation period for resource groups. It takes an integer value in seconds, minutes, or hours, e.g.,140s,30m, or1h.
For more information about the group tree and selector rules, see Resource groups in Managed Service for Trino.
-
-
Call the Cluster.Create method, e.g., via the following cURL
request:curl \ --request POST \ --header "Authorization: Bearer $IAM_TOKEN" \ --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters' --data '@body.json' -
View the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Create a file named
body.jsonand paste the following code into it:{ <cluster_parameters> ... "trino": { ... "resource_management": { "resource_groups": { "root_groups": [ { "name" : "<resource_group_name>", "soft_memory_limit" : "<memory_usage_limit>", "soft_concurrency_limit" : "<soft_limit_on_the_number_of_running_queries>", "hard_concurrency_limit" : "<hard_limit_on_the_number_of_running_queries>", "soft_cpu_limit" : "<soft_CPU_time_limit>", "hard_cpu_limit" : "<hard_CPU_time_limit>", "max_queued" : "<limit_on_the_number_of_queued_requests>", "scheduling_policy" : "<query_scheduling_policy>", "scheduling_weight" : "<group_weight>", "sub_groups": [ { <resource_sub-group_1> ... "sub_groups" : [<list_of_next-level_sub-groups>] }, { <resource_sub-group_2> ... "sub_groups" : [<list_of_next-level_sub-groups>] }, ... { <resource_sub-group_N> ... "sub_groups" : [<list_of_next-level_sub-groups>] } ] }, { <root_resource_group_2> }, ... { <root_resource_group_N> } ], "selectors": [ { "user": "<regular_expression_for_usernames>", "user_group": "<regular_expression_for_user_groups>", "query_type": "<request_type>", "source": "<regular_expression_for_query_sources>", "client_tags": ["<list_of_tags>"], "group": "<resource_group_name>" }, { <selector_rule_2> }, ... { <selector_rule_N> } ], "cpu_quota_period": "<CPU_quota_calculation_period>" } ... }, } }Where:
-
root_groups: Resource group tree description. Thename,hard_concurrency_limit, andmax_queuedsettings are required.-
name: Group name.A group name can be a template that uses variable placeholders in
${<variable_name>}format. A template name may contain the following types of variables:- Built-in variables.
USERfor username,SOURCEfor query source. - User-defined variables. These are declared in selector rule properties:
user,user_group, andsource.
When routing queries, Managed Service for Trino will create group instances with dynamically generated names.
- Built-in variables.
-
soft_memory_limit: Maximum amount of memory available to the group. Once this limit is reached, new queries will be queued. You can setsoft_memory_limitin one of the following ways:- As a percentage of the total available memory, e.g.,
10%. - As an absolute memory value, e.g.,
1GB. You can use one of these suffixes:B,kB,MB,GB,TB, orPB.
- As a percentage of the total available memory, e.g.,
-
soft_concurrency_limit: Soft limit on the number of running queries. Once the limit is reached, the group will run new queries only if sibling groups are unable to accept queries or are above their soft limits. Otherwise, new queries will be queued. -
hard_concurrency_limit: Hard limit on the number of running queries. Once this limit is reached, new queries will be queued. -
soft_cpu_limit: Soft limit on CPU time. Once this limit is reached,hard_concurrency_limitwill be reduced until the end of the current CPU quota calculation period.soft_cpu_limitcannot be greater thanhard_cpu_limit. -
hard_cpu_limit: Hard limit on CPU time. Once this limit is reached, new queries will be queued.
Note
If at least one of the two (
soft_cpu_limitorhard_cpu_limit) is specified, make sure to specifycpu_quota_periodas well.-
max_queued: Maximum number of queries per queue. Once this limit is reached, new queries will be rejected with an error. -
scheduling_policy: Queue scheduling policy. The possible values are:FAIRWEIGHTEDWEIGHTED_FAIRQUERY_PRIORITY
If not specified, the
FAIRpolicy will apply. -
scheduling_weight: Group weight used in theWEIGHTEDandWEIGHTED_FAIRscheduling policies.If not specified, the group weight is
1. -
sub_groups: Descriptions of sub-groups.
-
-
selectors: Selector rule description. Thegroupproperty is required.-
user: Name of the user who submitted the query or a Java regular expression. The rule applies if the user name matches the regular expression. If not specified, the rule applies to queries from all users. -
user_group: Name of the user group that submitted the query or a Java regular expression for user groups. The rule applies if the user group name matches the regular expression. If not specified, the rule applies to queries from users of any groups. -
query_type: Type of the request. The possible values are:SELECT:SELECTqueries.EXPLAIN:EXPLAINqueries, exceptEXPLAIN ANALYZE.DESCRIBE:DESCRIBE,DESCRIBE INPUT, andDESCRIBE OUTPUTqueries, as well asSHOWqueries, e.g.,SHOW CATALOGSorSHOW SCHEMAS.INSERT:INSERT,CREATE TABLE AS, andREFRESH MATERIALIZED VIEWqueries.MERGE:MERGEqueries.DELETE:DELETEqueries.ANALYZE:ANALYZEqueries.DATA_DEFINITION:CREATE,ALTER, andDROPqueries for schemas, tables, views, and materialized views, as well as queries that manage prepared statements, access permissions, sessions, and transactions.ALTER_TABLE_EXECUTE:ALTER TABLE ... EXECUTEqueries.
-
source: Query source name or a Java regular expression. The rule applies if the query source name matches the regular expression. If not specified, the rule applies to queries from all sources. -
client_tags: Tag list. The rule applies only if the query contains all the specified tags. If not specified, the rule applies to queries with any tags. -
group: Full name of the target resource group. It includes the names of all its parent groups, separated by dots, starting from the root group. A group name can use variable placeholders in${<variable_name>}format. A target group cannot have sub-groups.
Warning
A query that does not satisfy any of the specified rules is rejected with an error. To avoid this, add to the end of the description a rule without any restrictive conditions, containing only the
groupproperty. -
-
cpu_quota_period: CPU quota calculation period for resource groups. It takes an integer value in seconds, minutes, or hours, e.g.,140s,30m, or1h.
For more information about the group tree and selector rules, see Resource groups in Managed Service for Trino.
For available cluster parameters and their descriptions, see this guide.
-
-
Call the ClusterService.Create method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/trino/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d @ \ trino.api.cloud.yandex.net:443 \ yandex.cloud.trino.v1.ClusterService.Create \ < body.json -
Check the server response to make sure your request was successful.
Setting up or updating a resource group configuration in a cluster
-
In the management console
, navigate to the relevant folder. -
Go to Managed Service for Trino.
-
Click the cluster name.
-
Go to the Resource management section.
-
In the CPU quota period field, set the new CPU quota calculation period for resource groups.
-
To add a new resource group, click Add group and set up the group:
-
Optionally, select a parent group.
-
Specify a name for the resource group.
A group name can be a template that uses variable placeholders in
${<variable_name>}format. A template name may contain the following types of variables:- Built-in variables.
USERfor username,SOURCEfor query source. - User-defined variables. These are declared in selector rule properties: User and Source.
When routing queries, Managed Service for Trino will create group instances with dynamically generated names.
- Built-in variables.
-
In the Max queued field, set the maximum number of queries per queue (must be higher than
1). Once this limit is reached, new queries will be rejected with an error. -
Optionally, set a soft limit on the number of running queries in the Soft concurrency limit field. Once the limit is reached, the group will run new queries only if sibling groups are unable to accept queries or are above their soft limits. Otherwise, new queries will be queued.
-
In the Hard concurrency limit field, set the maximum number of running queries (must be higher than
1). Once this limit is reached, new queries will be queued. -
Optionally, set the maximum amount of memory available to the group in the Soft memory limit, % field. Once this limit is reached, new queries will be queued.
-
Optionally, set a soft limit on CPU time in the Soft CPU limit field. Once this limit is reached, the maximum number of running queries will be reduced until the end of the current CPU quota calculation period. This value cannot be greater than Hard CPU limit. To set Soft CPU limit, you also need to set CPU quota period.
-
Optionally, set a hard limit on CPU time in the Hard CPU limit field. Once this limit is reached, new queries will be queued. To set Hard CPU limit, you also need to set CPU quota period.
-
Optionally, set a query scheduling policy in the Scheduling policy field. The possible values are
fair,weighted,weighted_fair, orquery_priority. The default value isnone(thefairpolicy applies). -
Optionally, set the group weight used in the
weightedandweighted_fairscheduling policies in the Scheduling weight field.
Learn more about group trees in Resource groups in Managed Service for Trino.
-
-
Optionally, add other resource groups in the same way.
-
To edit a resource group:
- Click
next to the group. - Update the group parameters and click Edit.
- Click
-
To add a new selector rule, click Add rule and set up the rule:
-
Optionally, in the User field, specify the name of the user who submitted the query or a Java regular expression. The rule applies if the user name matches the regular expression. If you skip this setting, the rule applies to queries from all users.
-
Optionally, in the Group field, specify the name of the user group that submitted the query or a Java regular expression. The rule applies if the user group name matches the regular expression. If not specified, the rule applies to queries from users of any groups.
-
Optionally, in the Query type field, select the query type. The possible values are:
SELECT:SELECTqueries.EXPLAIN:EXPLAINqueries, exceptEXPLAIN ANALYZE.DESCRIBE:DESCRIBE,DESCRIBE INPUT, andDESCRIBE OUTPUTqueries, as well asSHOWqueries, e.g.,SHOW CATALOGSorSHOW SCHEMAS.INSERT:INSERT,CREATE TABLE AS, andREFRESH MATERIALIZED VIEWqueries.MERGE:MERGEqueries.DELETE:DELETEqueries.ANALYZE:ANALYZEqueries.DATA_DEFINITION:CREATE,ALTER, andDROPqueries for schemas, tables, views, and materialized views, as well as queries that manage prepared statements, access permissions, sessions, and transactions.ALTER_TABLE_EXECUTE:ALTER TABLE ... EXECUTEqueries.
-
Optionally, in the Source field, specify the name of the query source or a Java regular expression. The rule applies if the query source name matches the regular expression. If not specified, the rule applies to queries from all sources.
-
In the Resource group field, select the resource group to run the query in. A target group cannot have sub-groups.
-
Optionally, in the Tags field, specify tags separated by commas. The rule applies only if the query contains all the specified tags. If not specified, the rule applies to queries with any tags.
Warning
A query that does not satisfy any of the specified rules is rejected with an error. To avoid this, add to the end of the description a rule without any restrictive conditions, containing only the Resource group property.
Learn more about selector rules in Resource groups in Managed Service for Trino.
-
-
Optionally, add other selector rules in the same way.
-
To edit a selector rule:
- Click
in the line with this rule. - Edit the rule parameters.
- Click
-
Click Save changes.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
To specify a resource group configuration:
-
If no description of resource groups and selector rules in the Managed Service for Trino cluster has been given yet, create a description file in JSON or YAML format. Below is an example of the
resource-groups.yamlfile.rootGroups: # Root resource group 1 - name: "<resource_group_name>" softMemoryLimit: "<memory_usage_limit>" softConcurrencyLimit: <soft_limit_on_the_number_of_running_queries> hardConcurrencyLimit: <hard_limit_on_the_number_of_running_queries> softCpuLimit: <soft_CPU_time_limit> hardCpuLimit: <hard_CPU_time_limit> maxQueued: <limit_on_the_number_of_queued_requests> schedulingPolicy: "<query_scheduling_policy>" schedulingWeight: <group_weight> subGroups: # Resource sub-group 1 - name: "<resource_group_name>" ... subGroups: [<list_of_sub-groups_of_the_following_levels>] # Resource sub-group 2 - name: "<resource_group_name>" ... subGroups: [<list_of_sub-groups_of_the_following_levels>] ... # Resource sub-group N - name: "<resource_group_name>" ... subGroups: [<list_of_sub-groups_of_the_following_levels>] # Root resource group 2 - name: "<resource_group_name_2>" ... # Root resource group N - name: "<resource_group_name_N>" ... selectors: # Selector rule 1 - user: "<regular_expression_for_usernames>" userGroup: "<regular_expression_for_user_groups>" queryType: "<request_type>" source: "<regular_expression_for_query_sources>" clientTags: ["<list_of_tags>"] group: "<resource_group_name>" # Selector rule 2 - ... ... # Selector rule N - ... cpuQuotaPeriod: "<CPU_quota_calculation_period>"Where:
-
rootGroups: Resource group tree description. Thename,hardConcurrencyLimit, andmaxQueuedsettings are required.-
name: Group name.A group name can be a template that uses variable placeholders in
${<variable_name>}format. A template name may contain the following types of variables:- Built-in variables.
USERfor username,SOURCEfor query source. - User-defined variables. These are declared in selector rule properties:
user,userGroup, andsource.
When routing queries, Managed Service for Trino will create group instances with dynamically generated names.
- Built-in variables.
-
softMemoryLimit: Maximum amount of memory available to the group. Once this limit is reached, new queries will be queued. You can setsoftMemoryLimitin one of the following ways:- As a percentage of the total available memory, e.g.,
10%. - As an absolute memory value, e.g.,
1GB. You can use one of these suffixes:B,kB,MB,GB,TB, orPB.
- As a percentage of the total available memory, e.g.,
-
softConcurrencyLimit: Soft limit on the number of running queries. Once the limit is reached, the group will run new queries only if sibling groups are unable to accept queries or are above their soft limits. Otherwise, new queries will be queued. -
hardConcurrencyLimit: Hard limit on the number of running queries. Once this limit is reached, new queries will be queued. -
softCpuLimit: Soft limit on CPU time. Once this limit is reached,hardConcurrencyLimitwill be reduced until the end of the current CPU quota calculation period.softCpuLimitcannot be greater thanhardCpuLimit. -
hardCpuLimit: Hard limit on CPU time. Once this limit is reached, new queries will be queued.
Note
If at least one of the two (
softCpuLimitorhardCpuLimit) is specified, make sure to specifycpuQuotaPeriodas well.-
maxQueued: Maximum number of queries per queue. Once this limit is reached, new queries will be rejected with an error. -
schedulingPolicy: Queue scheduling policy. The possible values are:FAIRWEIGHTEDWEIGHTED_FAIRQUERY_PRIORITY
If not specified, the
FAIRpolicy will apply. -
schedulingWeight: Group weight used in theWEIGHTEDandWEIGHTED_FAIRscheduling policies.If not specified, the group weight is
1. -
subGroups: Descriptions of sub-groups.
-
-
selectors: Selector rule description. Thegroupproperty is required.-
user: Name of the user who submitted the query or a Java regular expression. The rule applies if the user name matches the regular expression. If not specified, the rule applies to queries from all users. -
userGroup: Name of the user group that submitted the query or a Java regular expression for user groups. The rule applies if the user group name matches the regular expression. If not specified, the rule applies to queries from users of any groups. -
queryType: Type of the request. The possible values are:SELECT:SELECTqueries.EXPLAIN:EXPLAINqueries, exceptEXPLAIN ANALYZE.DESCRIBE:DESCRIBE,DESCRIBE INPUT, andDESCRIBE OUTPUTqueries, as well asSHOWqueries, e.g.,SHOW CATALOGSorSHOW SCHEMAS.INSERT:INSERT,CREATE TABLE AS, andREFRESH MATERIALIZED VIEWqueries.MERGE:MERGEqueries.DELETE:DELETEqueries.ANALYZE:ANALYZEqueries.DATA_DEFINITION:CREATE,ALTER, andDROPqueries for schemas, tables, views, and materialized views, as well as queries that manage prepared statements, access permissions, sessions, and transactions.ALTER_TABLE_EXECUTE:ALTER TABLE ... EXECUTEqueries.
-
source: Query source name or a Java regular expression. The rule applies if the query source name matches the regular expression. If not specified, the rule applies to queries from all sources. -
clientTags: Tag list. The rule applies only if the query contains all the specified tags. If not specified, the rule applies to queries with any tags. -
group: Full name of the target resource group. It includes the names of all its parent groups, separated by dots, starting from the root group. A group name can use variable placeholders in${<variable_name>}format. A target group cannot have sub-groups.
Warning
A query that does not satisfy any of the specified rules is rejected with an error. To avoid this, add to the end of the description a rule without any restrictive conditions, containing only the
groupproperty. -
-
cpuQuotaPeriod: CPU quota calculation period for resource groups. It takes an integer value in seconds, minutes, or hours, e.g.,140s,30m, or1h.
For more information about the group tree and selector rules, see Resource groups in Managed Service for Trino.
-
-
If a description of resource groups and selector rules has already been given, open
resource-groups.yamland edit it as needed. You can:- Add new resource groups and selector rules.
- Update the parameters of existing groups and rules.
- Delete the groups and rules you no longer need.
-
Run this command:
yc managed-trino cluster set-resource-groups <cluster_name_or_ID> \
--from-file resource-groups.yaml
You can get the cluster name and ID with the list of clusters in the folder.
-
Open the current Terraform configuration file describing your infrastructure.
For more on how to create this file, see Creating a cluster.
-
If no description of resource groups and selector rules in the Managed Service for Trino cluster has been given yet, add the
resource_groupssection to the cluster description:resource_groups = jsonencode( { "rootGroups" : [ # Root resource group 1 { "name" : "<resource_group_name>", "softMemoryLimit" : "<memory_usage_limit>", "softConcurrencyLimit" : <soft_limit_on_the_number_of_running_queries>, "hardConcurrencyLimit" : <hard_limit_on_the_number_of_running_queries>, "softCpuLimit" : <soft_CPU_time_limit>, "hardCpuLimit" : <hard_CPU_time_limit>, "maxQueued" : <limit_on_the_number_of_queued_requests>, "schedulingPolicy" : "<query_scheduling_policy>", "schedulingWeight" : <group_weight>, "subGroups" : [ # Resource sub-group 1 { ... "subGroups" : [<list_of_next-level_sub-groups>] }, # Resource sub-group 2 { ... "subGroups" : [<list_of_next-level_sub-groups>] }, ... # Resource sub-group N { ... "subGroups" : [<list_of_next-level_sub-groups>] } ] }, # Root resource group 2 { ... }, ... # Root resource group N { ... } ], "selectors" : [ # Selector rule 1 { "user" : "<regular_expression_for_usernames>", "userGroup" : "<regular_expression_for_user_groups>", "queryType" : "<request_type>", "source" : "<regular_expression_for_query_sources>", "clientTags" : ["<list_of_tags>"], "group" : "<resource_group_name>" }, # Selector rule 2 { ... }, ... # Selector rule N { ... } ], "cpuQuotaPeriod" : "<CPU_quota_calculation_period>" } )Where:
-
rootGroups: Resource group tree description. Thename,hardConcurrencyLimit, andmaxQueuedsettings are required.-
name: Group name.A group name can be a template that uses variable placeholders in
${<variable_name>}format. A template name may contain the following types of variables:- Built-in variables.
USERfor username,SOURCEfor query source. - User-defined variables. These are declared in selector rule properties:
user,userGroup, andsource.
When routing queries, Managed Service for Trino will create group instances with dynamically generated names.
- Built-in variables.
-
softMemoryLimit: Maximum amount of memory available to the group. Once this limit is reached, new queries will be queued. You can setsoftMemoryLimitin one of the following ways:- As a percentage of the total available memory, e.g.,
10%. - As an absolute memory value, e.g.,
1GB. You can use one of these suffixes:B,kB,MB,GB,TB, orPB.
- As a percentage of the total available memory, e.g.,
-
softConcurrencyLimit: Soft limit on the number of running queries. Once the limit is reached, the group will run new queries only if sibling groups are unable to accept queries or are above their soft limits. Otherwise, new queries will be queued. -
hardConcurrencyLimit: Hard limit on the number of running queries. Once this limit is reached, new queries will be queued. -
softCpuLimit: Soft limit on CPU time. Once this limit is reached,hardConcurrencyLimitwill be reduced until the end of the current CPU quota calculation period.softCpuLimitcannot be greater thanhardCpuLimit. -
hardCpuLimit: Hard limit on CPU time. Once this limit is reached, new queries will be queued.
Note
If at least one of the two (
softCpuLimitorhardCpuLimit) is specified, make sure to specifycpuQuotaPeriodas well.-
maxQueued: Maximum number of queries per queue. Once this limit is reached, new queries will be rejected with an error. -
schedulingPolicy: Queue scheduling policy. The possible values are:FAIRWEIGHTEDWEIGHTED_FAIRQUERY_PRIORITY
If not specified, the
FAIRpolicy will apply. -
schedulingWeight: Group weight used in theWEIGHTEDandWEIGHTED_FAIRscheduling policies.If not specified, the group weight is
1. -
subGroups: Descriptions of sub-groups.
-
-
selectors: Selector rule description. Thegroupproperty is required.-
user: Name of the user who submitted the query or a Java regular expression. The rule applies if the user name matches the regular expression. If not specified, the rule applies to queries from all users. -
userGroup: Name of the user group that submitted the query or a Java regular expression for user groups. The rule applies if the user group name matches the regular expression. If not specified, the rule applies to queries from users of any groups. -
queryType: Type of the request. The possible values are:SELECT:SELECTqueries.EXPLAIN:EXPLAINqueries, exceptEXPLAIN ANALYZE.DESCRIBE:DESCRIBE,DESCRIBE INPUT, andDESCRIBE OUTPUTqueries, as well asSHOWqueries, e.g.,SHOW CATALOGSorSHOW SCHEMAS.INSERT:INSERT,CREATE TABLE AS, andREFRESH MATERIALIZED VIEWqueries.MERGE:MERGEqueries.DELETE:DELETEqueries.ANALYZE:ANALYZEqueries.DATA_DEFINITION:CREATE,ALTER, andDROPqueries for schemas, tables, views, and materialized views, as well as queries that manage prepared statements, access permissions, sessions, and transactions.ALTER_TABLE_EXECUTE:ALTER TABLE ... EXECUTEqueries.
-
source: Query source name or a Java regular expression. The rule applies if the query source name matches the regular expression. If not specified, the rule applies to queries from all sources. -
clientTags: Tag list. The rule applies only if the query contains all the specified tags. If not specified, the rule applies to queries with any tags. -
group: Full name of the target resource group. It includes the names of all its parent groups, separated by dots, starting from the root group. A group name can use variable placeholders in${<variable_name>}format. A target group cannot have sub-groups.
Warning
A query that does not satisfy any of the specified rules is rejected with an error. To avoid this, add to the end of the description a rule without any restrictive conditions, containing only the
groupproperty. -
-
cpuQuotaPeriod: CPU quota calculation period for resource groups. It takes an integer value in seconds, minutes, or hours, e.g.,140s,30m, or1h.
For more information about the group tree and selector rules, see Resource groups in Managed Service for Trino.
Note
You can also create a separate JSON file describing resource groups and selector rules and provide it in the
resource_groupsparameter as follows:resource_groups = file("resource-groups.json") -
-
If a description of resource groups and selector rules has already been given, edit the
resource_groupssection or JSON file as needed. You can:- Add new resource groups and selector rules.
- Update the parameters of existing groups and rules.
- Delete the groups and rules you no longer need.
-
Make sure the settings are correct.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm updating the resources.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
For more information, see this Terraform provider guide.
-
Get an IAM token for API authentication and put it into an environment variable:
export IAM_TOKEN="<IAM_token>" -
Create a file named
body.jsonand paste the following code into it:{ "updateMask": "<list_of_settings_to_update>", "trino": { "resourceManagement": { "resourceGroups": { "rootGroups": [ { "name" : "<resource_group_name>", "softMemoryLimit" : "<memory_usage_limit>", "softConcurrencyLimit" : "<soft_limit_on_the_number_of_running_queries>", "hardConcurrencyLimit" : "<hard_limit_on_the_number_of_running_queries>", "softCpuLimit" : "<soft_CPU_time_limit>", "hardCpuLimit" : "<hard_CPU_time_limit>", "maxQueued" : "<limit_on_the_number_of_queued_requests>", "schedulingPolicy" : "<query_scheduling_policy>", "schedulingWeight" : "<group_weight>", "subGroups": [ { <resource_sub-group_1> ... "subGroups" : [<list_of_next-level_sub-groups>] }, { <resource_sub-group_2> ... "subGroups" : [<list_of_next-level_sub-groups>] }, ... { <resource_sub-group_N> ... "subGroups" : [<list_of_next-level_sub-groups>] } ] }, { <root_resource_group_2> }, ... { <root_resource_group_N> } ], "selectors": [ { "user": "<regular_expression_for_usernames>", "userGroup": "<regular_expression_for_user_groups>", "queryType": "<request_type>", "source": "<regular_expression_for_query_sources>", "clientTags": ["<list_of_tags>"], "group": "<resource_group_name>" }, { <selector_rule_2> }, ... { <selector_rule_N> } ], "cpuQuotaPeriod": "<CPU_quota_calculation_period>" } ... }, } }Where:
-
updateMask: Comma-separated list of parameters to update.Warning
When you update a cluster, all parameters of the object you are modifying will be reset to their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
updateMaskparameter.
-
rootGroups: Resource group tree description. Thename,hardConcurrencyLimit, andmaxQueuedsettings are required.-
name: Group name.A group name can be a template that uses variable placeholders in
${<variable_name>}format. A template name may contain the following types of variables:- Built-in variables.
USERfor username,SOURCEfor query source. - User-defined variables. These are declared in selector rule properties:
user,userGroup, andsource.
When routing queries, Managed Service for Trino will create group instances with dynamically generated names.
- Built-in variables.
-
softMemoryLimit: Maximum amount of memory available to the group. Once this limit is reached, new queries will be queued. You can setsoftMemoryLimitin one of the following ways:- As a percentage of the total available memory, e.g.,
10%. - As an absolute memory value, e.g.,
1GB. You can use one of these suffixes:B,kB,MB,GB,TB, orPB.
- As a percentage of the total available memory, e.g.,
-
softConcurrencyLimit: Soft limit on the number of running queries. Once the limit is reached, the group will run new queries only if sibling groups are unable to accept queries or are above their soft limits. Otherwise, new queries will be queued. -
hardConcurrencyLimit: Hard limit on the number of running queries. Once this limit is reached, new queries will be queued. -
softCpuLimit: Soft limit on CPU time. Once this limit is reached,hardConcurrencyLimitwill be reduced until the end of the current CPU quota calculation period.softCpuLimitcannot be greater thanhardCpuLimit. -
hardCpuLimit: Hard limit on CPU time. Once this limit is reached, new queries will be queued.
Note
If at least one of the two (
softCpuLimitorhardCpuLimit) is specified, make sure to specifycpuQuotaPeriodas well.-
maxQueued: Maximum number of queries per queue. Once this limit is reached, new queries will be rejected with an error. -
schedulingPolicy: Queue scheduling policy. The possible values are:FAIRWEIGHTEDWEIGHTED_FAIRQUERY_PRIORITY
If not specified, the
FAIRpolicy will apply. -
schedulingWeight: Group weight used in theWEIGHTEDandWEIGHTED_FAIRscheduling policies.If not specified, the group weight is
1. -
subGroups: Descriptions of sub-groups.
-
-
selectors: Selector rule description. Thegroupproperty is required.-
user: Name of the user who submitted the query or a Java regular expression. The rule applies if the user name matches the regular expression. If not specified, the rule applies to queries from all users. -
userGroup: Name of the user group that submitted the query or a Java regular expression for user groups. The rule applies if the user group name matches the regular expression. If not specified, the rule applies to queries from users of any groups. -
queryType: Type of the request. The possible values are:SELECT:SELECTqueries.EXPLAIN:EXPLAINqueries, exceptEXPLAIN ANALYZE.DESCRIBE:DESCRIBE,DESCRIBE INPUT, andDESCRIBE OUTPUTqueries, as well asSHOWqueries, e.g.,SHOW CATALOGSorSHOW SCHEMAS.INSERT:INSERT,CREATE TABLE AS, andREFRESH MATERIALIZED VIEWqueries.MERGE:MERGEqueries.DELETE:DELETEqueries.ANALYZE:ANALYZEqueries.DATA_DEFINITION:CREATE,ALTER, andDROPqueries for schemas, tables, views, and materialized views, as well as queries that manage prepared statements, access permissions, sessions, and transactions.ALTER_TABLE_EXECUTE:ALTER TABLE ... EXECUTEqueries.
-
source: Query source name or a Java regular expression. The rule applies if the query source name matches the regular expression. If not specified, the rule applies to queries from all sources. -
clientTags: Tag list. The rule applies only if the query contains all the specified tags. If not specified, the rule applies to queries with any tags. -
group: Full name of the target resource group. It includes the names of all its parent groups, separated by dots, starting from the root group. A group name can use variable placeholders in${<variable_name>}format. A target group cannot have sub-groups.
Warning
A query that does not satisfy any of the specified rules is rejected with an error. To avoid this, add to the end of the description a rule without any restrictive conditions, containing only the
groupproperty. -
-
cpuQuotaPeriod: CPU quota calculation period for resource groups. It takes an integer value in seconds, minutes, or hours, e.g.,140s,30m, or1h.
For more information about the group tree and selector rules, see Resource groups in Managed Service for Trino.
-
-
Call the Cluster.Update method, e.g., via the following cURL
request:curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>' --data '@body.json'You can get the cluster ID with the list of clusters in the folder.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Create a file named
body.jsonand paste the following code into it:{ "cluster_id": "<cluster_ID>", "update_mask": { "paths": [ <list_of_settings_to_update> ] }, "trino": { "resource_management": { "resource_groups": { "root_groups": [ { "name" : "<resource_group_name>", "soft_memory_limit" : "<memory_usage_limit>", "soft_concurrency_limit" : "<soft_limit_on_the_number_of_running_queries>", "hard_concurrency_limit" : "<hard_limit_on_the_number_of_running_queries>", "soft_cpu_limit" : "<soft_CPU_time_limit>", "hard_cpu_limit" : "<hard_CPU_time_limit>", "max_queued" : "<limit_on_the_number_of_queued_requests>", "scheduling_policy" : "<query_scheduling_policy>", "scheduling_weight" : "<group_weight>", "sub_groups": [ { <resource_sub-group_1> ... "sub_groups" : [<list_of_next-level_sub-groups>] }, { <resource_sub-group_2> ... "sub_groups" : [<list_of_next-level_sub-groups>] }, ... { <resource_sub-group_N> ... "sub_groups" : [<list_of_next-level_sub-groups>] } ] }, { <root_resource_group_2> }, ... { <root_resource_group_N> } ], "selectors": [ { "user": "<regular_expression_for_usernames>", "user_group": "<regular_expression_for_user_groups>", "query_type": "<request_type>", "source": "<regular_expression_for_query_sources>", "client_tags": ["<list_of_tags>"], "group": "<resource_group_name>" }, { <selector_rule_2> }, ... { <selector_rule_N> } ], "cpu_quota_period": "<CPU_quota_calculation_period>" } ... }, } }Where:
-
cluster_id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
update_mask: List of parameters to update as an array of strings (paths[]).Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }Warning
When you update a cluster, all parameters of the object you are modifying will be reset to their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
update_maskparameter.
-
root_groups: Resource group tree description. Thename,hard_concurrency_limit, andmax_queuedsettings are required.-
name: Group name.A group name can be a template that uses variable placeholders in
${<variable_name>}format. A template name may contain the following types of variables:- Built-in variables.
USERfor username,SOURCEfor query source. - User-defined variables. These are declared in selector rule properties:
user,user_group, andsource.
When routing queries, Managed Service for Trino will create group instances with dynamically generated names.
- Built-in variables.
-
soft_memory_limit: Maximum amount of memory available to the group. Once this limit is reached, new queries will be queued. You can setsoft_memory_limitin one of the following ways:- As a percentage of the total available memory, e.g.,
10%. - As an absolute memory value, e.g.,
1GB. You can use one of these suffixes:B,kB,MB,GB,TB, orPB.
- As a percentage of the total available memory, e.g.,
-
soft_concurrency_limit: Soft limit on the number of running queries. Once the limit is reached, the group will run new queries only if sibling groups are unable to accept queries or are above their soft limits. Otherwise, new queries will be queued. -
hard_concurrency_limit: Hard limit on the number of running queries. Once this limit is reached, new queries will be queued. -
soft_cpu_limit: Soft limit on CPU time. Once this limit is reached,hard_concurrency_limitwill be reduced until the end of the current CPU quota calculation period.soft_cpu_limitcannot be greater thanhard_cpu_limit. -
hard_cpu_limit: Hard limit on CPU time. Once this limit is reached, new queries will be queued.
Note
If at least one of the two (
soft_cpu_limitorhard_cpu_limit) is specified, make sure to specifycpu_quota_periodas well.-
max_queued: Maximum number of queries per queue. Once this limit is reached, new queries will be rejected with an error. -
scheduling_policy: Queue scheduling policy. The possible values are:FAIRWEIGHTEDWEIGHTED_FAIRQUERY_PRIORITY
If not specified, the
FAIRpolicy will apply. -
scheduling_weight: Group weight used in theWEIGHTEDandWEIGHTED_FAIRscheduling policies.If not specified, the group weight is
1. -
sub_groups: Descriptions of sub-groups.
-
-
selectors: Selector rule description. Thegroupproperty is required.-
user: Name of the user who submitted the query or a Java regular expression. The rule applies if the user name matches the regular expression. If not specified, the rule applies to queries from all users. -
user_group: Name of the user group that submitted the query or a Java regular expression for user groups. The rule applies if the user group name matches the regular expression. If not specified, the rule applies to queries from users of any groups. -
query_type: Type of the request. The possible values are:SELECT:SELECTqueries.EXPLAIN:EXPLAINqueries, exceptEXPLAIN ANALYZE.DESCRIBE:DESCRIBE,DESCRIBE INPUT, andDESCRIBE OUTPUTqueries, as well asSHOWqueries, e.g.,SHOW CATALOGSorSHOW SCHEMAS.INSERT:INSERT,CREATE TABLE AS, andREFRESH MATERIALIZED VIEWqueries.MERGE:MERGEqueries.DELETE:DELETEqueries.ANALYZE:ANALYZEqueries.DATA_DEFINITION:CREATE,ALTER, andDROPqueries for schemas, tables, views, and materialized views, as well as queries that manage prepared statements, access permissions, sessions, and transactions.ALTER_TABLE_EXECUTE:ALTER TABLE ... EXECUTEqueries.
-
source: Query source name or a Java regular expression. The rule applies if the query source name matches the regular expression. If not specified, the rule applies to queries from all sources. -
client_tags: Tag list. The rule applies only if the query contains all the specified tags. If not specified, the rule applies to queries with any tags. -
group: Full name of the target resource group. It includes the names of all its parent groups, separated by dots, starting from the root group. A group name can use variable placeholders in${<variable_name>}format. A target group cannot have sub-groups.
Warning
A query that does not satisfy any of the specified rules is rejected with an error. To avoid this, add to the end of the description a rule without any restrictive conditions, containing only the
groupproperty. -
-
cpu_quota_period: CPU quota calculation period for resource groups. It takes an integer value in seconds, minutes, or hours, e.g.,140s,30m, or1h.
For more information about the group tree and selector rules, see Resource groups in Managed Service for Trino.
-
-
Call the ClusterService.Update method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/trino/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d @ \ trino.api.cloud.yandex.net:443 \ yandex.cloud.trino.v1.ClusterService.Update \ < body.json -
Check the server response to make sure your request was successful.
Deleting a resource group configuration
- In the management console
, navigate to the relevant folder. - Go to Managed Service for Trino.
- Click the cluster name.
- Go to the Resource management section.
- To delete resource groups you no longer need:
- Click
next to the resource group you want to delete. - Optionally, delete other resource groups in the same way.
- Click
- To delete selector rules you no longer need:
- Click
next to the rule you want to delete. - Optionally, delete other selector rules in the same way.
- Click
- Click Save changes.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
To delete all resource groups and selector rules, run this command:
yc managed-trino cluster remove-resource-groups <cluster_name_or_ID>
You can get the cluster ID and name with the list of clusters in the folder.
-
Open the current Terraform configuration file describing your infrastructure.
For more on how to create this file, see Creating a cluster.
-
To delete all resource groups and selector rules, delete the
resource_groupsparameter from the cluster description. -
Make sure the settings are correct.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm updating the resources.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
-
Get an IAM token for API authentication and put it into an environment variable:
export IAM_TOKEN="<IAM_token>" -
Create a file named
body.jsonand paste the following code into it:{ "updateMask": "trino.resourceManagement.resourceGroups", "trino": { "resourceManagement": { "resourceGroups": {} } } }Where:
-
updateMask: Comma-separated list of parameters to update.Warning
When you update a cluster, all parameters of the object you are modifying will be reset to their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
updateMaskparameter. -
resourceGroups: Description of resource groups and selector rules.
-
-
Call the Cluster.Update method, e.g., via the following cURL
request:curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --url 'https://trino.api.cloud.yandex.net/managed-trino/v1/clusters/<cluster_ID>' --data '@body.json'You can get the cluster ID with the list of clusters in the folder.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Create a file named
body.jsonand paste the following code into it:{ "cluster_id": "<cluster_ID>", "update_mask": { "paths": [ "trino.resource_management.resource_groups" ] }, "trino": { "resource_management": { "resource_groups": {} } } }Where:
-
cluster_id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
update_mask: List of parameters to update as an array of strings (paths[]).Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }Warning
When you update a cluster, all parameters of the object you are modifying will be reset to their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
update_maskparameter. -
resource_groups: Description of resource groups and selector rules.
-
-
Call the ClusterService.Update method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/trino/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d @ \ trino.api.cloud.yandex.net:443 \ yandex.cloud.trino.v1.ClusterService.Update \ < body.json -
Check the server response to make sure your request was successful.
Example of a resource group configuration in a Managed Service for Trino cluster
This example uses the following resource groups:
-
global: Root group that sets the generalhardConcurrencyLimitandmaxQueuedlimits. Theglobalgroup contains sub-groupsadm,bi,etl, andadhoc. -
adm: Group for administrator queries andDATA_DEFINITIONqueries. HighschedulingWeightvalues make it less probable that such queries will be blocked by user load. -
bi: Group for queries to business analytics systems. This group uses thesoftMemoryLimitlimit for queries not to take up too much memory and not to force other query types out. Within this group, for each tool, a sub-group instance is created with a dynamically generated name. Within each tool's group, sub-group instances are created for each user. This sets a separate limit for each tool and user. This limits the mutual impact between queries originating from different users and tools. -
etl: Group for data retrieval, transformation, and upload queries. This group uses thesoftCpuLimitandhardCpuLimitlimits for CPU time consumed by queries. -
adhoc: Group for interactive user queries. Within this group, for each user, a sub-group instance is created with a dynamically generated name. This sets a separate limit for each user thus limiting the mutual impact between queries originating from different users.
Queries are distributed between the adm, bi, etl, and adhoc groups as per the weighted_fair scheduling policy. The schedulingWeight parameter is not specified for the adhoc group; therefore, 1 (default) is used. No scheduling policy is specified for the bi and adhoc groups; therefore, queries are distributed between their sub-groups as per the default policy named fair.
The following selector rules are used to send queries to the groups:
-
Queries of users from the
adminsgroup are sent to theglobal.admresource group. -
Queries with the
etl_jobtag are sent to theglobal.etlgroup. -
The
DATA_DEFINITIONtype queries are sent to theglobal.admresource group. This ensures that queries used to call thesystem.runtime.kill_query()procedure will not wait for other user queries to complete. -
The
SELECTtype queries from a source with a name formatted asjdbc#(?<toolname>[^#]+)go to theglobal.bi.${toolname}.${USER}template group. For example, a query by the userbobfrom the sourcejdbc#grafanawill go to a group instance namedglobal.bi.grafana.bob. -
All other queries are sent to the
global.adhoc.${USER}template group. For example, a query by the userbobwill be sent to the group instance namedglobal.adhoc.bob.
resource-groups.json for this example:
{
"rootGroups": [
{
"name": "global",
"hardConcurrencyLimit": 20,
"maxQueued": 200,
"schedulingPolicy": "weighted_fair",
"subGroups": [
{
"name": "adm",
"hardConcurrencyLimit": 5,
"maxQueued": 50,
"schedulingWeight": 5
},
{
"name": "bi",
"hardConcurrencyLimit": 10,
"softMemoryLimit": "20%",
"maxQueued": 100,
"schedulingWeight": 3,
"subGroups": [
{
"name": "${toolname}",
"hardConcurrencyLimit": 5,
"maxQueued": 50,
"subGroups": [
{
"name": "${USER}",
"hardConcurrencyLimit": 2,
"maxQueued": 20
}
]
}
]
},
{
"name": "etl",
"hardConcurrencyLimit": 5,
"softCpuLimit": "20s",
"hardCpuLimit": "40s",
"maxQueued": 50,
"schedulingWeight": 1
},
{
"name": "adhoc",
"hardConcurrencyLimit": 5,
"maxQueued": 100,
"subGroups": [
{
"name": "${USER}",
"hardConcurrencyLimit": 2,
"maxQueued": 20
}
]
}
]
}
],
"selectors": [
{
"userGroup": "admins",
"group": "global.adm"
},
{
"clientTags": ["etl_job"],
"group": "global.etl"
},
{
"queryType": "DATA_DEFINITION",
"group": "global.adm"
},
{
"source": "jdbc#(?<toolname>[^#]+)",
"queryType": "SELECT",
"group": "global.bi.${toolname}.${USER}"
},
{
"group": "global.adhoc.${USER}"
}
],
"cpuQuotaPeriod": "1m"
}
resource-groups.json for this example:
{
"rootGroups": [
{
"name": "global",
"hardConcurrencyLimit": 20,
"maxQueued": 200,
"schedulingPolicy": "weighted_fair",
"subGroups": [
{
"name": "adm",
"hardConcurrencyLimit": 5,
"maxQueued": 50,
"schedulingWeight": 5
},
{
"name": "bi",
"hardConcurrencyLimit": 10,
"softMemoryLimit": "20%",
"maxQueued": 100,
"schedulingWeight": 3,
"subGroups": [
{
"name": "${toolname}",
"hardConcurrencyLimit": 5,
"maxQueued": 50,
"subGroups": [
{
"name": "${USER}",
"hardConcurrencyLimit": 2,
"maxQueued": 20
}
]
}
]
},
{
"name": "etl",
"hardConcurrencyLimit": 5,
"softCpuLimit": "20s",
"hardCpuLimit": "40s",
"maxQueued": 50,
"schedulingWeight": 1
},
{
"name": "adhoc",
"hardConcurrencyLimit": 5,
"maxQueued": 100,
"subGroups": [
{
"name": "${USER}",
"hardConcurrencyLimit": 2,
"maxQueued": 20
}
]
}
]
}
],
"selectors": [
{
"userGroup": "admins",
"group": "global.adm"
},
{
"clientTags": ["etl_job"],
"group": "global.etl"
},
{
"queryType": "DATA_DEFINITION",
"group": "global.adm"
},
{
"source": "jdbc#(?<toolname>[^#]+)",
"queryType": "SELECT",
"group": "global.bi.${toolname}.${USER}"
},
{
"group": "global.adhoc.${USER}"
}
],
"cpuQuotaPeriod": "1m"
}
body.json for this example:
{
"updateMask": "trino.resourceManagement.resourceGroups",
"trino": {
"resourceManagement": {
"resourceGroups": {
"rootGroups": [
{
"name": "global",
"hardConcurrencyLimit": "20",
"maxQueued": "200",
"schedulingPolicy": "weighted_fair",
"subGroups": [
{
"name": "adm",
"hardConcurrencyLimit": "5",
"maxQueued": "50",
"schedulingWeight": "5"
},
{
"name": "bi",
"hardConcurrencyLimit": "10",
"softMemoryLimit": "20%",
"maxQueued": "100",
"schedulingWeight": "3",
"subGroups": [
{
"name": "${toolname}",
"hardConcurrencyLimit": "5",
"maxQueued": "50",
"subGroups": [
{
"name": "${USER}",
"hardConcurrencyLimit": "2",
"maxQueued": "20"
}
]
}
]
},
{
"name": "etl",
"hardConcurrencyLimit": "5",
"softCpuLimit": "20s",
"hardCpuLimit": "40s",
"maxQueued": "50",
"schedulingWeight": "1"
},
{
"name": "adhoc",
"hardConcurrencyLimit": "5",
"maxQueued": "100",
"subGroups": [
{
"name": "${USER}",
"hardConcurrencyLimit": "2",
"maxQueued": "20"
}
]
}
]
}
],
"selectors": [
{
"userGroup": "admins",
"group": "global.adm"
},
{
"clientTags": ["etl_job"],
"group": "global.etl"
},
{
"queryType": "DATA_DEFINITION",
"group": "global.adm"
},
{
"source": "jdbc#(?<toolname>[^#]+)",
"queryType": "SELECT",
"group": "global.bi.${toolname}.${USER}"
},
{
"group": "global.adhoc.${USER}"
}
],
"cpuQuotaPeriod": "1m"
}
}
}
}
body.json for this example:
{
"cluster_id": "<cluster_ID>",
"update_mask": {
"paths": [
"trino.resource_management.resource_groups"
]
},
"trino": {
"resource_management": {
"resource_groups": {
"root_groups": [
{
"name": "global",
"hard_concurrency_limit": "20",
"max_queued": "200",
"scheduling_policy": "weighted_fair",
"sub_groups": [
{
"name": "adm",
"hard_concurrency_limit": "5",
"max_queued": "50",
"scheduling_weight": "5"
},
{
"name": "bi",
"hard_concurrency_limit": "10",
"soft_memory_limit": "20%",
"max_queued": "100",
"scheduling_weight": "3",
"sub_groups": [
{
"name": "${toolname}",
"hard_concurrency_limit": "5",
"max_queued": "50",
"sub_groups": [
{
"name": "${USER}",
"hard_concurrency_limit": "2",
"max_queued": "20"
}
]
}
]
},
{
"name": "etl",
"hard_concurrency_limit": "5",
"soft_cpu_limit": "20s",
"hard_cpu_limit": "40s",
"max_queued": "50",
"scheduling_weight": "1"
},
{
"name": "adhoc",
"hard_concurrency_limit": "5",
"max_queued": "100",
"sub_groups": [
{
"name": "${USER}",
"hard_concurrency_limit": "2",
"max_queued": "20"
}
]
}
]
}
],
"selectors": [
{
"user_group": "admins",
"group": "global.adm"
},
{
"client_tags": ["etl_job"],
"group": "global.etl"
},
{
"query_type": "DATA_DEFINITION",
"group": "global.adm"
},
{
"source": "jdbc#(?<toolname>[^#]+)",
"query_type": "SELECT",
"group": "global.bi.${toolname}.${USER}"
},
{
"group": "global.adhoc.${USER}"
}
],
"cpu_quota_period": "1m"
}
}
}
}