The kernel of OceanBase Database supports dozens of resource request types, including foreground tasks and background tasks. Most background tasks do not have a particularly high priority. Therefore, you need to isolate resources for these background tasks, and resource isolation is enabled by default.
The method of freely configuring resource isolation for background tasks in Configure resource isolation within a tenant is complex. This topic groups resource request types to provide a recommended configuration method for resource isolation of background tasks.
Grouping of resource request types
Because the current resource isolation configuration method is complex, to simplify the configuration, you can group these resource request types into the following resource groups:
- clog log commit resource group: CLOG_HIGH_GROUP
- minor compaction resource group: COMPACTION_HIGH_GROUP
- background task resource group: BACKGROUND_GROUP
The following table lists the resource request types contained in the preceding resource groups. For more information about the resource request types (background tasks), see Overview of Resource Isolation.
Resource group |
Contained resource request types |
|---|---|
| CLOG_HIGH_GROUP | CLOG_HIGH |
| COMPACTION_HIGH_GROUP | COMPACTION_HIGH |
| BACKGROUND_GROUP |
|
Resource isolation strategy
Based on the grouping, you can plan the resource isolation strategy for these resource groups. The recommended resource isolation strategy is as follows.
Resource group |
MIN_IOPS |
MAX_IOPS |
IOPS_WEIGHT |
MAX_CPU |
CPU_WEIGHT |
|---|---|---|---|---|---|
| CLOG_HIGH_GROUP | 40 | 100 | 100 | 100 | 30 |
| COMPACTION_HIGH_GROUP | 30 | 100 | 50 | 100 | 70 |
| BACKGROUND_GROUP | 10 | 100 | 30 | 100 | 70 |
Note
The background task CLOG_HIGH directly affects the latency of business requests. Its I/O requirements must be met as much as possible. Therefore, MIN_IOPS of the CLOG_HIGH_GROUP resource group is set to 40. In addition, this task does not have high requirements for CPU, so CPU_WEIGHT is set to 30.
Configure resource isolation for background tasks
Prerequisites
CPU resource isolation depends on cgroups. If you need to control CPU resource isolation, you must configure the cgroup directory and enable the cgroup feature before configuring resource isolation for background tasks.
For more information about how to configure the cgroup directory and enable the cgroup feature, see Configure cgroup.
(Optional) Before configuring resource isolation for background tasks, you can perform disk performance calibration and configure the IOPS of the tenant's unit.
Note
In the current version, CPU and IOPS resource isolation no longer strongly depends on disk performance calibration.
Use the
rootuser to log in to thesystenant of the cluster.Perform disk performance calibration.
Execute the following command to trigger a disk calibration task.
obclient> ALTER SYSTEM RUN JOB "io_calibration";After the statement is successfully executed, execute the following command to view the calibration progress.
obclient> SELECT * FROM oceanbase.GV$OB_IO_CALIBRATION_STATUS;It may take 1 to 2 minutes for the calibration to take effect. After the calibration takes effect, execute the following command to view the calibration values.
obclient> SELECT * FROM oceanbase.GV$OB_IO_BENCHMARK;
Configure the IOPS of the tenant's unit. Based on the disk calibration values on the OBServer node queried in the previous step, use the disk calibration value of 16 KB reads as the upper limit of the node's IOPS settings.
For more information about the detailed configuration of the IOPS of the tenant's unit, see the content in the section Step 1 (Optional): Configure the tenant's MAX_IOPS and MIN_IOPS to valid values of Configure resource isolation within a tenant.
Procedure
The tenant administrator of a user tenant logs in to a MySQL tenant or an Oracle tenant of the cluster.
Execute the following SQL statements to configure resource isolation for background tasks.
/*Create a plan*/ CALL DBMS_RESOURCE_MANAGER.CREATE_PLAN('GLOBAL_PLAN','plan for global'); /*Create the COMPACTION_HIGH_GROUP resource group*/ CALL DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP( CONSUMER_GROUP => 'COMPACTION_HIGH_GROUP', COMMENT => 'COMPACTION_HIGH_GROUP'); CALL DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE( PLAN => 'GLOBAL_PLAN', GROUP_OR_SUBPLAN => 'COMPACTION_HIGH_GROUP' , COMMENT => 'COMPACTION_HIGH_GROUP', MAX_IOPS => 100, MIN_IOPS => 30, WEIGHT_IOPS => 50,UTILIZATION_LIMIT => 100, MGMT_P1 => 70); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'COMPACTION_HIGH', 'COMPACTION_HIGH_GROUP'); /*Create the CLOG_HIGH_GROUP resource group*/ CALL DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP( CONSUMER_GROUP => 'CLOG_HIGH_GROUP', COMMENT => 'CLOG_HIGH_GROUP'); CALL DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE( PLAN => 'GLOBAL_PLAN', GROUP_OR_SUBPLAN => 'CLOG_HIGH_GROUP' , COMMENT => 'CLOG_HIGH_GROUP', MAX_IOPS => 100, MIN_IOPS => 40, WEIGHT_IOPS => 100, UTILIZATION_LIMIT => 100, MGMT_P1 => 30); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'CLOG_HIGH', 'CLOG_HIGH_GROUP'); /*Create the BACKGROUND_GROUP resource group*/ CALL DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP( CONSUMER_GROUP => 'BACKGROUND_GROUP', COMMENT => 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE( PLAN => 'GLOBAL_PLAN', GROUP_OR_SUBPLAN => 'BACKGROUND_GROUP' , COMMENT => 'BACKGROUND_GROUP', MAX_IOPS => 100, MIN_IOPS => 10, WEIGHT_IOPS => 30, UTILIZATION_LIMIT => 100, MGMT_P1 => 70); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'COMPACTION_LOW', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'COMPACTION_MID', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'HA_LOW', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'HA_MID', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'HA_HIGH', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'DDL', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'DDL_HIGH', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'CLOG_LOW', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'CLOG_MID', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'OPT_STATS', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'GC_MACRO_BLOCK', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'IMPORT', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'SQL_AUDIT', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'MVIEW', 'BACKGROUND_GROUP'); CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING('FUNCTION', 'REPLAY_HIGH', 'BACKGROUND_GROUP'); /*Enable the plan*/ SET GLOBAL resource_manager_plan = 'GLOBAL_PLAN';
References
This topic provides only the recommended configuration method for resource isolation of background tasks. For other types of isolation configurations within a tenant, see the following topics:
