To achieve vertical scaling of resources under a tenant, you can adjust the resource specifications of a resource pool for the tenant to adjust the service capability of the tenant. To adjust the resource specifications of a resource pool, you can either modify or switch its resource configurations.
Modify resource configurations
You can directly modify the CPU and memory resource configurations of a resource pool to adjust the resource specifications and service capability of a tenant in the resource pool.
Assume that resource pools pool1 and pool2 use resource configuration uc1. You can modify uc1 by changing the value of the MAX_CPU parameter to 6 and the value of the MIN_MEMORY parameter to 36G while retaining other configuration items. The syntax is as follows:
obclient> CREATE RESOURCE UNIT uc1 MAX_CPU 5, MIN_CPU 4, MAX_MEMORY '36G', MIN_MEMORY '32G', MAX_IOPS 128, MIN_IOPS 128, MAX_DISK_SIZE '2T', MAX_SESSION_NUM 64;
obclient>CREATE RESOURCE POOL pool1 UNIT 'uc1', UNIT_NUM 2, ZONE_LIST ('z1', 'z2');
obclient>CREATE RESOURCE POOL pool2 UNIT 'uc1', UNIT_NUM 1, ZONE_LIST ('z3');
obclient>CREATE TENANT tt resource_pool_list=('pool1','pool2');
obclient>ALTER RESOURCE UNIT uc1 MAX_CPU 6, MIN_MEMORY '36G';
You can modify the resource parameters to adjust the resource specifications of the resource pool for a tenant in the corresponding zone, so as to adjust the service capability of the tenant.
Switch resource configurations
You can modify the resource specifications of each resource unit in a resource pool to adjust the resource specifications and service capability of a tenant in the resource pool.
Assume that resource pool rp1 originally uses resource configuration uc1. You can switch the resource configuration of resource pool rp1 from uc1 to uc2. A sample statement is as follows:
obclient> ALTER RESOURCE POOL rp1 UNIT 'uc2';
Examples and limitations
Generally, you can either modify or switch resource configurations to adjust the service capability of a tenant. This is equivalent to modifying the specifications of resource units for the tenant. You can either increase or decrease the resource specifications.
Increase resource specifications
You can scale out CPU and memory resources for a tenant.
Here are some examples:
Example 1
Create resource configuration
u_c0and resource poolpool1, and applyu_c0topool1.obclient> CREATE RESOURCE UNIT u_c0 MAX_CPU 5, MIN_CPU 4, MAX_MEMORY '36G', MIN_MEMORY '32G', MAX_IOPS 128, MIN_IOPS 128, MAX_DISK_SIZE '2T', MAX_SESSION_NUM 64; obclient> CREATE RESOURCE POOL pool1 unit='u_c0', unit_num=3, zone_list=('z1','z2','z3');Increase the value of the
MIN_CPU,MAX_CPU,MIN_MEMORY, orMAX_MEMORYparameter inu_c0.obclient> ALTER RESOURCE UNIT u_c0 MAX_CPU 10, MIN_CPU 8, MAX_MEMORY '72G', MIN_MEMORY '64G';The adjustment is intended to increase the resource specifications of
pool1, to upgrade the service capability of the corresponding tenant.
Example 2
Create resource configurations
u_c0andu_c1and resource poolpool1, and applyu_c0topool1.obclient> CREATE RESOURCE UNIT u_c0 MAX_CPU 5, MIN_CPU 4, MAX_MEMORY '36G', MIN_MEMORY '32G', MAX_IOPS 128, MIN_IOPS 128, MAX_DISK_SIZE '2T', MAX_SESSION_NUM 64; obclient> CREATE RESOURCE UNIT u_c1 MAX_CPU 10, MIN_CPU 8, MAX_MEMORY '72G', MIN_MEMORY '64G', MAX_IOPS 128, MIN_IOPS 128, MAX_DISK_SIZE '2T', MAX_SESSION_NUM 64; obclient> CREATE RESOURCE POOL pool1 unit='u_c0', unit_num=3, zone_list=('z1','z2','z3');Switch the resource configuration of
pool1tou_c1.obclient> ALTER RESOURCE POOL pool1 unit='u_c1';The adjustment is intended to increase the resource specifications of
pool1, to upgrade the service capability of the corresponding tenant.
Regardless of whether you modify or switch the resource configurations to increase the resource specifications, the total resources after the adjustment must meet the following requirements:
Sum(min_cpu) <= CPU_CAPACITY;
Sum(min_memory) <= MEM_CAPACITY;
Sum(max_cpu) <= CPU_CAPACITY * resource_hard_limit;
Sum(max_mem) <= CPU_CAPACITY * resource_hard_limit;
Otherwise, the system returns an error, indicating that the scale-out fails.
Decrease resource specifications
OceanBase Database also allows you to decrease the resource specifications of a resource pool while ensuring sufficient server resources. When you decrease the value of the MIN_MEMORY parameter, note that: The MEM_USED parameter indicates the actual memory usage of a tenant on an OBServer node. When you decrease the resource specifications of the tenant, make sure that the value of the MIN_MEMORY parameter for each OBServer node that serves the tenant is greater than or equal to the value of the MEM_USED parameter of the tenant on the OBServer node. Otherwise, the adjustment fails. If this is the case, you must perform a minor compaction to release the memory, and then attempt to decrease the resource specifications again.