All Products
Search
Document Center

Hologres:Isolate computing resources in a Hologres instance (beta)

Last Updated:Aug 02, 2023

Hologres allows you to manage computing resources in a fine-grained manner. Different users are allocated different numbers of compute units (CUs), including CPU cores and memory. This way, limits are imposed on the amount of computing resources that can be used by different users, and the jobs on a single Hologres instance can be isolated between users or applications. This topic describes how to use resource groups to isolate computing resources in a Hologres instance.

Background information

Hologres V1.0 and earlier support resource isolation between instances, but do not support the fine-grained resource isolation between users in a specific instance. However, many scenarios require a limit on the resources available to each user in an instance to prevent interference. In these cases, resource isolation between users in an instance is necessary. To meet this requirement, Hologres provides the resource group management feature. However, resource groups cannot be used to isolate some types of computing loads due to technical limitations. Exercise caution when you use resource groups in production environments. We recommend that you use elastic virtual warehouses to isolate resources.

Limits

  • Only Hologres V1.1 and later allow you to use resource groups to manage computing resources in a Hologres instance. If the version of your Hologres instance is earlier than V1.1, manually upgrade your Hologres instance in the Hologres console or join the DingTalk group for technical support. For more information about how to manually upgrade your Hologres instance in the Hologres console, see Manual upgrade (beta). For more information about how to obtain technical support, see Obtain online support for Hologres.

  • Only the superuser can use resource groups to manage computing resources in a Hologres instance. If a regular user attempts to use the resource group management feature, an error is reported to indicate that the user does not have required permissions.

  • In Hologres, computing resources are allocated based on instances. If you have multiple databases in an instance, all the databases share the computing resources of the instance and have the same quota.

Configure resource groups in the HoloWeb console

This section describes how to use HoloWeb to configure resource groups in a visualized manner.

  • Create a resource group

    1. Log on to the HoloWeb console. For more information, see Connect to HoloWeb.

    2. In the top navigation bar, click Security Center.

    3. On the Security Center tab, click Resource Group Management in the left-side navigation pane.

    4. On the Resource Group Management (Beta) page, select the instance that you want to manage from the Instance Name drop-down list and click Add Resource Group.新增资源组

    5. In the Add Resource Group dialog box, configure the Resource Group Name and Quota parameters and click OK.

      Note

      The total quota of all resource groups in a Hologres instance cannot exceed 1. Otherwise, an error is reported.

  • Delete a resource group

    1. Log on to the HoloWeb console. For more information, see Connect to HoloWeb.

    2. In the top navigation bar, click Security Center.

    3. On the Security Center tab, click Resource Group Management in the left-side navigation pane.

    4. On the Resource Group Management (Beta) page, find the resource group that you want to delete and click Delete in the Operation column.

      Note

      If a user is associated with the resource group, the resource group cannot be deleted.

  • Adjust the quota for a resource group

    1. Log on to the HoloWeb console. For more information, see Connect to HoloWeb.

    2. In the top navigation bar, click Security Center.

    3. On the Security Center tab, click Resource Group Management in the left-side navigation pane.

    4. On the Resource Group Management page, find the resource group whose quota you want to adjust and click Adjust Quota in the Resource Group Quota column.

    5. In the Adjust Quota dialog box, adjust the quota and click OK.调整配额

  • Associate a user with a resource group

    After you create a resource group, you can use HoloWeb to associate a user with the resource group.

    1. Log on to the HoloWeb console. For more information, see Connect to HoloWeb.

    2. In the top navigation bar, click Security Center.

    3. On the Security Center tab, click Resource Group Management in the left-side navigation pane.

    4. On the Resource Group Management page, find the resource group with which you want to associate a user and click Associate User in the Operation column.

    5. On the page that appears, click Add User for Association.

    6. In the Associate User dialog box, select a user from the drop-down list and click OK.

      Note
      • If you cannot find the user that you want to associate with the resource group in the drop-down list, the user is not added to the current instance. In this case, add the user on the User Management page.

      • A user can be associated only with a single resource group. If you repeatedly associate a user with different resource groups, the user is associated with the last resource group.

  • Disassociate a user from a resource group

    1. Log on to the HoloWeb console. For more information, see Connect to HoloWeb.

    2. In the top navigation bar, click Security Center.

    3. On the Security Center tab, click Resource Group Management in the left-side navigation pane.

    4. On the Resource Group Management page, find the resource group with which you want to associate a user and click Associate User in the Operation column.

    5. On the page that appears, find the user that you want to disassociate and click Disassociate User in the Operation column.

    6. In the Disassociate User message, click OK.

Configure resource groups by using SQL statements

  • View the configurations of resource groups

    To view all resource groups, the quota configured for each resource group, and the users associated with each resource group, execute the following SQL statement:

    SELECT  * FROM pg_holo_resource_groups;

    Sample result:

     res_group_name | property_key |         property_value
    ----------------+--------------+------------------------------------------
     resource_1     | worker_limit | 0.3
     default        | worker_limit | 0.7
     resource_1     | bind_users   | [ "13xxxxxxxxx13", "p4_29xxxxxxxxxx19" ]                                       
  • Create a resource group

    Note
    • By default, the system creates a resource group named default, allocates all computing resources to the resource group, and associates the users who do not have allocated computing resources with the resource group.

    • After you create custom resource groups, the amount of computing resources that remain in the resource group named default is calculated by using the following formula: Computing resources in the resource group named default = Total computing resources - Computing resources in custom resource groups.

    • We recommend that you reserve at least 30% of the total computing resources for the resource group named default.

    To create a resource group, execute the following SQL statement:

    CALL hg_create_resource_group ('resource_group_name', quota);

    Parameter

    Description

    resource_group_name

    The name of the resource group. The name can be up to 50 characters in length and can contain letters, digits, and underscores (_).

    quota

    The percentage of resources that are allocated to the resource group. Valid values: 0.1 to 0.9. Only one decimal place is supported.

  • Adjust the quota for a resource group

    Note

    The total quota of all resource groups in a Hologres instance cannot exceed 1. Otherwise, an error is reported.

    To adjust the quota for a resource group, execute the following SQL statement:

    CALL hg_alter_resource_group ('resource_group_name', quota);

    Parameter

    Description

    resource_group_name

    The name of the resource group. The specified resource group must exist. Otherwise, an error is reported.

    quota

    The percentage of resources that are allocated to the resource group. Valid values: 0.1 to 0.9. Only one decimal place is supported.

  • Delete a resource group

    Note

    If a user is associated with a resource group, the resource group cannot be deleted.

    To delete a resource group, execute the following SQL statement:

    CALL hg_drop_resource_group ('resource_group_name');

    Parameter

    Description

    resource_group_name

    The name of the resource group. The specified resource group must exist. Otherwise, an error is reported.

  • Associate a user with a resource group

    Note
    • A user can be associated with only a single resource group. If you repeatedly associate a user with different resource groups, the user is associated with the last resource group.

    • You can execute the following SQL statement to view the resource group that the current user is associated with:

      SELECT current_user;

    After you create a resource group, you can associate a user with the resource group. This way, you can limit the computing resources that are available to the user. To associate a user with a resource group, execute the following SQL statement.

    • Syntax

      CALL hg_bind_resource_group('resource_group_name', 'user_name');
    • Parameters

      Parameter

      Description

      resource_group_name

      The name of the resource group. The specified resource group must exist. Otherwise, an error is reported.

      user_name

      The name of the user. The specified user must exist and have access permissions on the Hologres instance to which the resource group belongs. Otherwise, an error is reported.

    • Examples

      CALL hg_bind_resource_group ('resource_1', 'p4_29xxxxxxxxxxx');
      -- You must enclose each username in double quotation marks (").
      CALL hg_bind_resource_group ('resource_1', '"ALIYUN$xxxx@aliyun.com"');
      CALL hg_bind_resource_group ('resource_1', '"RAM$xxx@xxx:xxxx"');
      CALL hg_bind_resource_group ('resource_1', '"13xxxxxxxxxxx13"');
  • Disassociate a user from a resource group

    Note

    After a user is disassociated from a resource group, the user is automatically associated with the resource group named default.

    To disassociate a user from a resource group, execute the following SQL statement.

    • Syntax

      CALL hg_unbind_resource_group('resource_group_name', 'user_name');
    • Parameters

      Parameter

      Description

      resource_group_name

      The name of the resource group. The specified resource group must exist. Otherwise, an error is reported.

      user_name

      The name of the user. The specified user must exist and have access permissions on the Hologres instance to which the resource group belongs. Otherwise, an error is reported.

    • Examples

      CALL hg_unbind_resource_group ('resource_1', 'p4_29xxxxxxxxxxxxx9');
      -- You must enclose each username in double quotation marks (").
      CALL hg_unbind_resource_group ('resource_1', '"RAM$xxxx@xxx:xxx"');

FAQ

Why does a resource group occupy more than 50% of the CPU and memory resources even though the quota for the resource group is set to 0.5?

If you configure the quota for the resource group, most CPU and memory resources consumed by the query engine are limited. However, the resources consumed by some activities are not affected by the quota. The activities include SQL parsing and optimization, metadata processing, scheduling operations, execution of Panel Quality Engineering (PQE), and compaction operations. In addition, the quota limits the CPU resources but not memory resources for concurrent and real-time data writes. Therefore, the CPU and memory resources occupied by the resource group may exceed the quota that you configure for the resource group.