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 when the following two conditions are met:
- The reserved memory for a 500 tenant is not less than the actual memory occupied.
- The value of
memory_limitis greater than the sum of thesystem_memoryvalue and the memory allocated to the unit.
If the preceding conditions are not met, setting the memory_limit parameter does not result in an error and does not take effect.
Privilege requirements
Query the parameter
The
systenant and all user tenants can query this parameter by using theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview.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 ignores thememory_limit_percentagesetting and uses the value specified by thememory_limitparameter. For example, if the physical memory is 100 GB, thememory_limit_percentageis set to80, and thememory_limitparameter is set to'90G', the memory available to OceanBase Database 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 available to 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, the values calculated based on the total memory will be larger than the actual values.
If you want to limit the memory size of a running OceanBase Database instance, you can directly modify the
memory_limitparameter to the desired value. After the modification, the background parameter reload thread will dynamically apply the new value without requiring a restart. However, during the modification, ensure that thememory_limitvalue is less than the total memory.Notice
The value of
memory_limitmust be greater than the memory actually used by the OBServer node.
Examples
Set the total memory available to the OBServer node to 32 GB. The command is as follows:
obclient> ALTER SYSTEM SET memory_limit='32G';To query the current memory usage (in GB), run 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';
