Overview
memory_limit specifies the total memory size available for the OBServer node.
For the memory_limit setting on an OBServer node to take effect, both of the following conditions must be met:
- The reserved memory for the 500th tenant must be greater than or equal to its actual memory usage.
- The value of
memory_limitmust be greater than the sum ofsystem_memoryand the memory allocated to the unit.
If the above restrictions are not met, setting memory_limit will not cause an error but will also be ineffective.
Privilege requirements
Query parameters
Both the
systenant and all user tenants can query this parameter using theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview.Modify parameters
Only the
systenant can modify this parameter. User tenants cannot modify it.
Attributes
Attribute |
Description |
|---|---|
| Parameter type | Capacity |
| Default Value | 0, in MB. |
| Value range | [4G, +∞) |
| Modifiable | Yes, you can use theALTER SYSTEM SETStatement modification. |
| Whether to restart the OBServer node for the change to take effect | No, the setting takes effect immediately. |
Usage instructions
The default value of
memory_limitis0. If this value is not0, the system will ignore thememory_limit_percentagesetting and prefer the value configured bymemory_limit. For example, if a physical server has 100 GB of memory,memory_limit_percentageis set to80, which means 80% of the memory is used. However, if thememory_limitparameter is set to'90G', the actual memory available for OceanBase AI Database on the physical server will be the value configured bymemory_limit, which is 90 GB. For more information aboutmemory_limit_percentage, see memory_limit_percentage.The default unit of
memory_limitis MB. For example,memory_limit='40G'sets the maximum memory usage for the OceanBase AI Database process to 40 GB. Since the default unit is MB,memory_limit=40960andmemory_limit='40G'set the same value.Currently, there is no upper limit for the value of
memory_limit.If the set maximum memory exceeds the total physical memory, it will cause other values in the system that are calculated based on total memory to appear larger.
To limit the memory size of the running OceanBase AI Database, you can directly modify the value of
memory_limitto the desired level. After setting it, the background Reload thread will apply the change dynamically without requiring a restart. However, when setting it, ensure that the value ofmemory_limitis less than the total system memory.Notice
The value of
memory_limitmust be greater than the actual memory used by the OBServer node.
Configuration example
For example, to set the total memory available for OBServer to 32 GB, use the following command:
obclient> ALTER SYSTEM SET memory_limit='32G';To query the current memory usage (in GB), use the following method:
obclient> SELECT value/1024/1024/1024 used_gb FROM v$sysstat WHERE name LIKE '%observer memory%' AND con_id = 1 AND stat_id=140008 AND name='observer memory used size';