Database Resource Load Management (Part 1)

Overview of Resource Load Management

Function description

openGauss provides resource load management methods to balance the utilization of system resources by tasks.

Related concepts

Resource management

The management scope of openGauss for system resources includes CPU resources, memory resources, IO resources and storage resources. By rationally allocating system resources, it can avoid unreasonable occupation of resources, which may reduce system operation efficiency or cause system operation problems.

control group

Control groups (Cgroups) is the abbreviation of control groups, which is a mechanism provided by the Linux kernel to limit, record, and isolate the physical resources (such as CPU, memory, IO, etc.) used by process groups. If a process joins a certain control group, the control group has strict restrictions on Linux system resources, and the process cannot exceed its maximum limit when using these resources. For more introduction to the principles of Cgroups, please check the product manual of the relevant operating system.

resource pool

Resource Pool is a configuration mechanism provided by openGauss, which is used to divide host resources (memory, IO) and provide SQL concurrency control capabilities. The resource pool manages resources by binding Cgroups. Users can manage the resource load of their jobs by binding resource pools.

resource management preparation

resource planning

Before configuring the resource load management function, you need to complete tenant resource planning based on the business model. After the business has been running for a period of time, configuration adjustments can be made based on resource usage.

In this chapter, we assume that two departments in a large enterprise share the same set of clusters. OpenGauss divides the set of system resources that the same department needs to use into a tenant of the system to achieve resource isolation between different departments, and its resource planning As shown in Table 1.

Table 1 Tenant resource planning
Tenant A

parameter name Value sample
Child Class Control Group class_a
Workload Control Group workload_a1,workload_a2
group resource pool resource_pool_a
business resource pool resource_pool_a1,resource_pool_a2
group user tenant_a
business user tenant_a1,tenant_a2

Tenant B

parameter name Value sample
Child Class Control Group class_b
Workload Control Group workload_b1,workload_b2
group resource pool resource_pool_b
business resource pool resource_pool_b1,resource_pool_b2
group user tenant_b
business user tenant_b1,tenant_b2

Start the resource load management function

Background Information

Before using the resource load management function, you need to complete the parameter configuration by referring to this section.

Preconditions

  • In openGauss, if you need to manage system resources, the user needs to have DBA authority. Query which users have the permission by executing the following syntax:
openGauss=# SELECT rolname FROM pg_roles WHERE rolsystemadmin = 't';
 rolname
---------
 omm
 Jack
(2 rows)

  • If you want to include a user in the scope of resource load management, the user must have the login permission. Query which users have the permission by executing the following syntax:
openGauss=# SELECT rolname FROM pg_roles WHERE rolcanlogin = 't';
 rolname
---------
 omm
(1 row)

Notice: If a user's login permission is revoked, his resource pool will be automatically changed to default_pool. For details of default_pool, see Table 2.

Steps

Users with DBA authority can start resource load management based on resource pools through the following steps. The omm user is used as an example for description here.

1. Log in to the openGauss master node as the operating system user omm.
2. Enable the Control Group function.

gs_guc reload -Z datanode -N all -I all -c "enable_control_group=on"

3. Enable the resource load management function based on the resource pool.

gs_guc set -Z datanode -N all -I all -c "use_workload_manager=on" 

4. Enable control of the resident backup thread of the database.

gs_guc set -Z datanode -N all -I all -c "enable_backend_control=on" 

5. Enable control of the autoVacuumWorker thread in the resident backup thread of the database.

gs_guc set -Z datanode -N all -I all -c "enable_vacuum_control=on"

6. Restart the database to make the parameter settings take effect.

gs_om -t stop && gs_om -t start

{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/gaussdb/blog/5516589