The OceanBase Database kernel currently supports over a dozen types of resource requests, covering both foreground and background tasks. Since most background tasks are not particularly high priority, it’s important to isolate their resources, with resource isolation enabled by default.
The approach described in Configure resource isolation within a tenant for customizing resource isolation for background tasks can be quite complex. To simplify this process, this section recommends grouping resource request types as an easier way to configure resource isolation for background tasks.
Resource request type grouping
Because the current resource isolation configuration is somewhat complicated, grouping resource request types can help make things easier. The main resource groups are:
- CLOG commit resource group: CLOG_HIGH_GROUP
- Compaction resource group: COMPACTION_HIGH_GROUP
- Background task resource group: BACKGROUND_GROUP
The resource request types included in each group are listed in the table below. For more details about each resource request type (background task), see the resource isolation overview.
| Resource group | Resource request types |
|---|---|
| CLOG_HIGH_GROUP | CLOG_HIGH |
| COMPACTION_HIGH_GROUP | COMPACTION_HIGH |
| BACKGROUND_GROUP |
|
Resource isolation strategy
You can plan resource isolation strategies for these resource groups based on their grouping. The following table describes the recommended resource isolation strategies.
| 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
Background tasks such as CLOG_HIGH directly affect the latency of business requests. Therefore, the I/O request requirements should be met as much as possible. The MIN_IOPS parameter of the CLOG_HIGH_GROUP resource group is set to 40. This task has low CPU requirements, so the CPU_WEIGHT parameter is set to 30.
Configure resource isolation for background tasks
Prerequisites
CPU resource isolation depends on cgroups. Therefore, before you configure resource isolation for background tasks, you must configure the cgroup directory and enable the cgroup feature.
For more information about how to configure the cgroup directory and enable the cgroup feature, see Configure cgroups.
(Optional) Before you configure resource isolation for background tasks, you can calibrate the disk performance and configure the IOPS of the tenant unit.
Note
In the current version, CPU and IOPS resource isolation no longer strongly depend on the disk performance calibration operation.
Log in to the
systenant of the cluster as therootuser.Calibrate the disk performance.
Run the following command to trigger the disk calibration task.
obclient> ALTER SYSTEM RUN JOB "io_calibration";After the statement is executed successfully, run 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, run the following command to view the calibration value.
obclient> SELECT * FROM oceanbase.GV$OB_IO_BENCHMARK;
Configure the IOPS of the tenant unit. Use the 16 KB read disk calibration value as the upper limit of the IOPS setting for the node.
For more information about how to configure the IOPS of the tenant unit, see Configure MAX_IOPS and MIN_IOPS of the tenant to valid values in Configure resource isolation within a tenant.
Procedure
Log in as the tenant administrator of the user tenant to a MySQL-compatible or Oracle-compatible tenant in 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 a resource group COMPACTION_HIGH_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 a resource group CLOG_HIGH_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 resource group BACKGROUND_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'); /*Make the plan effective*/ SET GLOBAL resource_manager_plan = 'GLOBAL_PLAN';
References
This section provides only the recommended configuration method for resource isolation of background tasks. For other types of isolation configurations within a tenant, refer to the following documents: