memory_limit

2024-06-28 05:30:30  Updated

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_limit is greater than the sum of the value of system_memory and 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

  • The value range of this parameter has been changed from [4G, +∞) to [1G, +∞) since OceanBase Database V4.1.0.
  • The minimum value of this parameter is 1 GB in arbitration service mode and 4 GB in other modes.
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_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. For more information about memory_limit_percentage, see memory_limit_percentage.

  • 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 of memory_limit=40960 achieves the same effect as the setting of memory_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 OceanBase Database, you can modify memory_limit as required. After the modification, the backend parameter reloads the thread to dynamically enforce the setting without requiring a restart. However, you need to set memory_limit to 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.

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';
    

References

Contact Us