Planning Resources
Before configuring resource load management, plan tenant resources based on service models. After services run for a period of time, you can adjust the configurations based on resource usage.
Assume that two departments in a large enterprise use the same cluster. openGauss puts system resources used by the same department in a group to isolate resources for different departments. Table 1 describes the resource plan.
Table 1 Tenant resource plan
Enabling Resource Load Management
Background
This section describes how to configure parameters for resource load management.
Prerequisites
· In openGauss, you can manage system resources only as a database administrator. Run the following statement to query user permissions:
· Resource load management can be applied only to users with the login permission. Run the following statement to query user permissions:
Procedure
You can perform the following steps only as a database administrator to enable load management based on the resource pool. The following uses user omm as an example.
Log in as the OS user omm to the primary node of openGauss.
Enable resource pool–based load management.
- Restart the database for the parameter settings to take effect.
Setting a Cgroup
Background
The core of openGauss resource load management is resource pools. The first step of configuring a resource pool is to configure Cgroups in the environment. For details about Cgroup principles, see the product manual corresponding to your OS. For details about openGauss Cgroups, see Viewing Cgroup Information.
The Class Cgroup is a top-layer Cgroup for database service running. DefaultClass is a sub-category of the Class Cgroup and is automatically created when a cluster is deployed. The Medium Cgroup under DefaultClass contains running jobs that are triggered by the system. Resource configurations of Medium cannot be modified, and the jobs running on it are not controlled by resource management. Therefore, you are advised to create sub-Class and Workload Cgroups to control resource allocation.
Prerequisites
You are familiar with “Server Tools > gs_cgroup” and “Server Tools > gs_ssh” in Tool Reference.
Procedure
Creating sub-Class and Workload Cgroups
Log in as the OS user omm to the primary node of openGauss.
Create sub-Class Cgroups class_a and class_b, and allocate 40% and 20% of Class CPU resources to them, respectively.
- Create Workload Cgroups workload_a1 and workload_a2 under class_a, and allocate 20% and 60% of class_a CPU resources to them, respectively.
- Create Workload Cgroups workload_b1 and workload_b2 under class_b, and allocate 50% and 40% of class_b CPU resources to them, respectively.
Adjusting resource quotas for Cgroups
- Change the CPU resource quota for class_a to 30%.
- Change the CPU resource quota for workload_a1 under class_a to 30% of class_a CPU resources.
Deleting a Cgroup
- Delete the Cgroup class_a.
After the command is executed, the Cgroup class_a is deleted.
Viewing Cgroup Information
- View Cgroup information in configuration files.
Cgroup configuration
Table 1 lists the Cgroup configuration shown in the above example.
Table 1 Cgroup configuration
- View the Cgroup tree in the OS.
Run the following command to query the structure of the Cgroup tree:
In the command output, shares indicates the value of cpu.shares, which specifies the dynamic quota of CPU resources in the OS, and cpus indicates the value of cpuset.cpus, which specifies the dynamic quota of CPUSET resources in the OS (number of cores that a Cgroup can use).
- Obtain the Cgroup configuration in a system view.
3.1 Perform the steps in Using gsql to Connect to a Database.
3.2 Obtain the configuration about all Cgroups in the system.
Top comments (0)