Enabling and Creating Resource Groups

By default, no resource management policy is enabled when YMatrix database is installed. To use resource groups, set resource_scheduler='on'.

Enabling Resource Groups

  1. Set the gp_resource_manager server configuration parameter to either "group" or "group-v2":
gpconfig -c gp_resource_manager -v "group"
gpconfig -c gp_resource_manager -v "group-v2"
  1. Restart the YMatrix database cluster:
mxstop
mxstart

Once enabled, all transactions submitted by a role are directed to the resource group assigned to that role and are subject to the group’s concurrency, memory, and CPU limits.

YMatrix automatically creates three built-in role-based resource groups: admin_group, default_group, and system_group. When resource groups are enabled, any role not explicitly assigned a resource group is placed into the default group based on its role type:

  • SUPERUSER roles are assigned to admin_group.
  • Non-administrator roles are assigned to default_group.
  • System processes are managed under system_group.

Note: You cannot manually assign any role to system_group.

The default configurations for these role resource groups are as follows:

Parameter admin_group default_group system_group
CONCURRENCY 10 5 0
CPU_MAX_PERCENT 10 20 10
CPU_WEIGHT 100 100 100
CPUSET -1 -1 -1
IO_LIMIT -1 -1 -1
MEMORY_LIMIT -1 -1 -1
MIN_COST 0 0 0

Creating Resource Groups

Use the CREATE RESOURCE GROUP command to create a new resource group. When creating a resource group for roles, specify a name and a CPU allocation mode (either cores or percentage). You must provide a limit for either CPU_MAX_PERCENT or CPUSET.

Example
Create a resource group named rgroup1 with a concurrency limit of 20, memory quota of 250 MB, CPU weight of 500, and minimum cost of 50:

CREATE RESOURCE GROUP rgroup1 WITH (CONCURRENCY=20, CPU_MAX_PERCENT=20, MEMORY_QUOTA=250, CPU_WEIGHT=500, MIN_COST=50);

The CPU and memory limits defined for rgroup1 are shared among all roles assigned to this group.

Use the ALTER RESOURCE GROUP command to update a resource group’s limits:

ALTER RESOURCE GROUP rg_role_light SET CONCURRENCY 7;
ALTER RESOURCE GROUP exec SET MEMORY_QUOTA 30;
ALTER RESOURCE GROUP rgroup1 SET CPUSET '1;2,4';

Note!
The CONCURRENCY value of admin_group cannot be set or changed to 0.

Dropping Resource Groups

Use the DROP RESOURCE GROUP command to remove a resource group. To drop a resource group assigned to roles, ensure that:

  • No roles are currently assigned to the group.
  • There are no active or queued transactions in the group.
DROP RESOURCE GROUP exec;