memory_limit specifies the total memory size available.
| Property | Description |
|---|---|
| Parameter type | Capacity unit |
| Default value | 0 |
| Value range | [0M, +∞) |
| Effective upon OBServer restart | No |
The default value of memory_limit is 0. If the value is not 0, the system ignores the setting of memory_limit_percentage and uses the value of the memory_limit parameter. Assume that a host has 100 GB of memory; that memory_limit_percentage is set to 80; which indicates that 80% of the memory can be used; and that memory_limit is set to 90G. The actual memory available for the OceanBase database on the physical machine depends on the value of memory_limit, that is, 90 GB.
Notes:
The default unit for memory_limit is 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_limit is 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 the OceanBase database, you can modify memory_limit as required. After the configuration, the backend parameter reload thread dynamically enforces the setting with requiring a restart. However, you need to set memory_limit to a value less than the total memory of the system.
Notice
The value of
memory_limitmust be greater than the actual memory used by OBServer.You can query the used memory (in GB) by using 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';