memory_limit specifies the total memory size available.
Note
The value range of this parameter is changed from [4G,+∞) to [1G,+∞) in OceanBase Database V4.1.0 and later.
| Property | Description |
|---|---|
| Type | Capacity |
| Default value | 0 |
| Value range | [1G,+∞) |
| Effective upon OBServer node restart | No |
Note
If the OBServer node starts in arbitration service mode, you can set the minimum value to 1 GB. However, if the OBServer node starts in other modes, we recommend that you set the minimum value to 4 GB for the sake of stability.
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 memory_limit. Assume that a physical machine has 100 GB of memory. memory_limit_percentage is set to 80, which indicates that 80% of the memory can be used, and memory_limit is set to '90G'. In this case, the actual memory available for OceanBase Database on the physical machine depends on the value of memory_limit, that is, 90 GB.
Take note of the following considerations:
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_limit must be greater than the actual memory used by the OBServer node.
You can query the used memory (in GB) by using 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';