Note
This parameter was introduced in V1.4.
Description
The memory_limit parameter specifies the total memory available to the OBServer node.
For the memory_limit parameter to take effect, the following conditions must be met:
- The reserved memory for 500 tenants is not less than the occupied memory.
- The value of
memory_limitis greater than the sum ofsystem_memoryand the allocated memory of units.
If the preceding conditions are not met, the memory_limit parameter can be set without errors, but the value will not take effect.
Privilege requirements
Query the parameter
The
systenant and all user tenants can use theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview to query the parameter.Modify the parameter
Only the
systenant can modify the parameter. User tenants cannot modify the parameter.
Attributes
| Attribute | Description |
|---|---|
| Type | Capacity |
| Default value | 0, in MB. |
| Valid values | [1G, +∞)
Note
|
| Modifiable | Yes. This parameter can be modified by using the ALTER SYSTEM SET statement. |
| Requires restart of the OBServer node | No. The setting takes effect immediately. |
Considerations
The default value of
memory_limitis0. If this value is not0, the system will ignore the value ofmemory_limit_percentageand use the value ofmemory_limitinstead. For example, if the memory of a physical server is 100 GB, the value ofmemory_limit_percentageis80, indicating that 80% of the memory is used, and the value ofmemory_limitis'90G', the actual memory available for 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 that the OceanBase Database process can use is 40 GB. Since the default unit is MB,memory_limit=40960is equivalent tomemory_limit='40G'.The value of
memory_limitcan be any positive number.If the maximum memory specified by
memory_limitexceeds the total physical memory, the values of other parameters that are calculated based on the total memory will be too large.If you want to limit the memory size of an already running OceanBase Database, you can directly modify the value of
memory_limitto the expected value. After the value is set, the background parameter reload thread dynamically takes effect without requiring a restart. However, make sure that the value ofmemory_limitis smaller than the total memory.Notice
The value of
memory_limitmust be greater than the memory actually used by the OBServer node.
Examples
For example, to set the total memory available to the OBServer node to 32 GB, run the following command:
obclient> ALTER SYSTEM SET memory_limit='32G';To query the amount of memory used (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';