Configure memory for seekdb
Starting with V1.4.0, seekdb uses memory_budget as the logical memory budget of an instance and derives the default memory limits for KV Cache, MemStore, and the vector module from that budget. This topic describes the relevant configuration items and the considerations for migrating from an earlier version.
Configuration items
| Configuration item | Default value | Description |
|---|---|---|
memory_budget | 0M | The logical memory budget of the instance. 0M means that seekdb automatically calculates the budget from physical memory and the cgroup memory limit. The automatically calculated value is at least 1 GB. |
kvcache_memory_limit | 0M | The KV Cache memory limit. 0M means min(1T, memory_budget × 40%). At runtime, you can increase this value only within the capacity reserved at startup. |
memstore_memory_limit | 0M | The MemStore memory limit. 0M means memory_budget × 50%. |
vector_memory_limit | 0M | The vector module memory limit. 0M means memory_budget × 50%. |
The three module limits constrain the memory usage of their respective modules. They do not cause seekdb to preallocate all of that memory at startup.
Automatic calculation of memory_budget
When memory_budget=0M, seekdb first determines the effective memory size H:
- If no cgroup memory limit is configured,
His the physical memory size. - If a valid cgroup v1 or cgroup v2 memory limit is configured,
His the smaller of the physical memory size and the cgroup memory limit.
seekdb then calculates the logical memory budget as follows:
memory_budget = max(1G, min(H × 80%, H - 1G))
This policy attempts to reserve at least 1 GB of memory for the operating system and other processes. For a container deployment, configure the container memory limit correctly so that the automatic calculation uses the memory available to the container.
Explicit configuration
To use a fixed memory budget, specify it in the startup configuration file:
memory_budget=8G
kvcache_memory_limit=0M
memstore_memory_limit=0M
vector_memory_limit=0M
You can also change the configuration after the instance starts:
ALTER SYSTEM SET memory_budget = '8G';
ALTER SYSTEM SET kvcache_memory_limit = '3G';
ALTER SYSTEM SET memstore_memory_limit = '4G';
ALTER SYSTEM SET vector_memory_limit = '4G';
Before changing these values, check the current memory usage of each module and the memory available on the host. Lowering a limit can trigger cache eviction, write throttling, or insufficient-memory errors in vector indexes.
Migrate from V1.3.0
V1.4.0 changes the memory configuration as follows:
memory_limitis retained only for configuration compatibility. seekdb accepts and persists its value, but the value does not participate in memory calculation or enforcement in V1.4.0. Usememory_budgetinstead.memory_hard_limit,memory_limit_percentage, andmemstore_limit_percentagehave been removed.- Configure vector-module memory by using
vector_memory_limit. Do not useob_vector_memory_limit_percentageas the capacity-planning control for seekdb.
When you upgrade a configuration, do not simply rename memory_limit to memory_budget. Recalculate the budget from the memory actually available to the host or container, and reserve enough memory for the operating system and colocated processes.
View the configuration
Run the following query to view the current values:
SELECT NAME, VALUE
FROM oceanbase.V$OB_PARAMETERS
WHERE NAME IN (
'memory_budget',
'kvcache_memory_limit',
'memstore_memory_limit',
'vector_memory_limit'
)
ORDER BY NAME;
For related operations, see View configuration items and Modify configuration items.