Configure memory for seekdb
seekdb uses memory_budget as the logical memory budget of an instance and uses that budget to calculate the default KV Cache and MemStore limits. The default vector memory limit is 50% of effective memory.
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 sets the limit to 50% of effective memory H. A nonzero value sets the limit directly. |
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
seekdb determines the effective memory size H as follows.
- If no cgroup memory limit is configured,
His the physical memory size. - If a finite cgroup v1 or cgroup v2 memory limit is configured,
His the smaller of physical memory and the cgroup limit.
When memory_budget=0M, seekdb 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 an earlier release
Review your memory configuration when upgrading to V1.4.1.
- V1.4.1 removes the
memory_limitconfiguration item. Remove it from startup configuration and automation. Set the logical instance budget withmemory_budget. - V1.4.1 removes the legacy allocator parameters
cache_wash_threshold,memory_chunk_cache_size,_min_malloc_sample_interval,_max_malloc_sample_interval,_ctx_memory_limit, and_enable_memleak_light_backtrace. Remove them from startup configuration and automation. - V1.4.0 removed
memory_hard_limit,memory_limit_percentage, andmemstore_limit_percentage. - If you used
vector_memory_limit=0Min V1.4.0, check the effective limit after upgrading. To keep a fixed vector memory limit, setvector_memory_limitto a nonzero value. - Use
vector_memory_limitto plan capacity for the vector module.
Size the budget for the memory available on the host or in the container. Reserve memory for the operating system and other processes.
V1.4.1 removes oceanbase.V$OB_MEMORY. To check vector module usage, query oceanbase.V$OB_VECTOR_MEMORY.
View the configuration
The following query returns the configured values. If vector_memory_limit=0M, query VECTOR_MEM_LIMIT in oceanbase.V$OB_VECTOR_MEMORY for the effective limit.
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.