OceanBase Database is a multi-tenant distributed database. You can create multiple independent tenants in the same cluster, and each tenant is an independent database service. You can specify the required hardware resources and create database service objects, such as accounts, tables, and storage procedures. Resource pool contains the hardware resources for a tenant. It is composed of multiple resource units, which refer to CPUs, memories, disks, and other hardware resources allocated.
Before you create a tenant, you must specify the range of resource that the tenant uses. Resource pools and resource units can meet the needs of resource isolation and load balancing.
Resource unit
Resource units refer to physical resources such as CPUs, memories, disks, and Input/Output Operations Per Second (IOPS). Resource units are the resource containers in OceanBase Database. Resource units automatically perform load balancing in the cluster. A resource unit is placed on a server with sufficient resources to accommodate it. Before you delete a cluster server, you must migrate the resource unit on the server to another server. If the resources of other servers in the cluster are insufficient to accommodate the resource unit to be migrated, you cannot delete the server.
Resource unit configuration
Resource unit configuration describes the configuration information of resource units. Each resource unit configuration describes the CPU, memory, disk, and IOPS of one specification. You can change the resource configurations to dynamically adjust the computing resources of resource units and the resources of corresponding tenants.
Example: create the resource unit configuration
CREATE RESOURCE UNIT uc1 MAX_CPU 4, MIN_CPU 4, MAX_MEMORY '32G', MIN_MEMORY '32G', MAX_IOPS 128, MIN_IOPS 128, MAX_DISK_SIZE '2T', MAX_SESSION_NUM 64;
The configuration only takes effect on CPU and memory. You must specify the values of the disk space and IOPS. However, the system does not limit the disk space or IOPS based on the val ues you specified.
The value of MAX_CPU can be equal to or greater than the value of MIN_CPU. OceanBase allocates initial CPU resources for resource units based on MIN_CPU value. When the resource usage of a tenant exceeds the MIN_CPU value, OceanBase automatically adjusts resources of the tenant based on the MAX_CPU value.
The value of MAX_MEMORY can be the same as or greater than the value of MIN_MEMORY. OceanBase allocates memory resources based on MAX_MEMORY value. We recommend that you set the same value for both MAX_MEMORY and MIN_MEMORY.
Resource pool
A resource pool consists of several resource units that share the same resource unit configurations. A resource pool belongs to only one tenant. One tenant has one or several resource pools, which contain all physical resources available to the tenant. One tenant has at most one resource unit on the same server.
Example: create a resource pool
CREATE RESOURCE POOL rp1 UNIT 'uc1', UNIT_NUM 1, ZONE_LIST ('zone1');
Resource unit balance
OceanBase Database balances the resource units of the same tenant among servers in the cluster. If a tenant has several resource units in one or more resource pools, the following balance strategies apply to units in each zone:
- OceanBase evenly distribute several resource units of the same tenant to different servers.
- When the server storage usage exceeds the specified threshold, OceanBase exchanges or migrates resource units to decrease the storage usage.
- Based on the CPU and memory specifications of resource units, OceanBase exchanges or migrates resource units to reduce the average CPU and memory usage.