Note
This parameter is available starting with V1.4.
Description
memory_limit specifies the total amount of memory available to an OBServer node.
The memory_limit parameter takes effect only if the following two conditions are met:
- The reserved memory for a 500 tenant is not less than the actual memory used.
- The value of
memory_limitis greater than the sum of thesystem_memoryvalue and the memory allocated to each unit.
If either of the above conditions is not met, setting the memory_limit parameter does not return an error, but the setting does not take effect.
Privilege requirements
Query the parameter
The
systenant and all user tenants can use theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview to query this parameter.Modify the parameter
Only the
systenant can modify this parameter. User tenants cannot modify this parameter.
Attributes
| Attribute | Description |
|---|---|
| Parameter type | Capacity |
| Default value | 0 MB. |
| Value range | [1G, +∞)
Note
|
| Modifiable | Yes. You can use the ALTER SYSTEM SET statement to modify the parameter. |
| Effective upon OBServer node restart | No. The setting takes effect immediately. |
Considerations
The default value of
memory_limitis0. If the value is not0, the system will ignore thememory_limit_percentagesetting and prioritize the value specified bymemory_limit. For example, if a physical server has 100 GB of memory,memory_limit_percentageis set to80, indicating that 80% of the memory will be used. Ifmemory_limitis set to'90G', the actual memory available to OceanBase Database on the physical server 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'specifies that the maximum memory usage of the OceanBase Database process is 40 GB. Since the default unit is MB,memory_limit=40960is equivalent tomemory_limit='40G'.The value of
memory_limithas no upper limit.If the maximum memory limit set exceeds the total physical memory, other values calculated based on the total memory will be larger than expected.
If you want to limit the memory usage of a running OceanBase Database instance, you can directly modify the
memory_limitparameter to achieve the desired value. After the modification, the background parameter reload thread will dynamically apply the new value without requiring a restart. However, when setting the value, ensure thatmemory_limitis less than the total memory.Notice
The value of
memory_limitmust be greater than the actual memory used by the OBServer node.
Examples
To set the total memory available to an OBServer node to 32 GB, execute the following command:
obclient> ALTER SYSTEM SET memory_limit='32G';To query the current memory usage (in GB), execute the following command:
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';