Note
This parameter was introduced in OceanBase Database V1.4.
Description
memory_limit specifies the total memory size available for the specified OBServer node.
The memory_limit parameter on an OBServer node takes effect only when both of the following conditions are met:
- The reserved memory for the SYS500 tenant is not less than the actual occupied memory.
- The value of
memory_limitis greater than the sum of the value ofsystem_memoryand the size of memory allocated for resource units.
If either condition is not met, the memory_limit parameter does not take effect, even when no error is returned.
Attributes
| Attribute | Description |
|---|---|
| Type | Varchar |
| Default value | 0 |
| Value range | [1G, +∞)
Note
|
| Modifiable | Yes. You can use the ALTER SYSTEM SET statement to modify the parameter. |
| Effective upon OBServer node restart | No |
Considerations
The default value of
memory_limitis0. If the value is not0, the system ignores the setting ofmemory_limit_percentageand uses the value ofmemory_limit. Assume that a physical machine has 100 GB of memory.memory_limit_percentageis set to80, which indicates that 80% of the memory can be used, andmemory_limitis set to'90G'. In this case, the actual memory available for OceanBase Database on the physical machine depends on the value ofmemory_limit, that is, 90 GB. For more information aboutmemory_limit_percentage, see memory_limit_percentage.The default unit for
memory_limitis MB. For example,memory_limit='40G'indicates that the maximum memory that can be used by OceanBase Database processes is 40 GB. As the default unit is MB, the setting ofmemory_limit=40960achieves the same effect as the setting ofmemory_limit='40G'.The value of
memory_limitis unlimited.If memory_limit is set to a value greater than the total physical memory, other values calculated based on memory_limit will be excessively large.
To restrict the memory size for running OceanBase Database, you can modify
memory_limitas required. After the modification, the backend parameter reloads the thread to dynamically enforce the setting without requiring a restart. However, you need to setmemory_limitto a value smaller than the total memory of the system.Notice
The value of
memory_limitmust be greater than the actual memory used by the OBServer node.
Examples
Set the total memory available for the OBServer node to 32 GB.
obclient> ALTER SYSTEM SET memory_limit='32G';Query the used memory, in GB.
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';