#15013·openobserve

Memory cache and buffer defaults are sized independently and can add up to more than the node's memory

Author: hengfeiyangCreated Sep 30, 2026Updated Sep 30, 2026

Problem

Every in-memory cache and buffer picks its own default size as a share of the node memory limit, independently of all the others. Nothing adds them up, so the defaults together can promise far more memory than the node has.

This issue only describes the current state; it does not propose a fix.

Current defaults

As of main at ee32552c6f. "Mem" is sysinfo::get_memory_limit() (the cgroup limit, else node memory). Most are computed in check_memory_config in src/config/src/config.rs; the rest are noted.

Setting Default when unset (0) Floor / cap Share of 16 GB (cluster mode)
ZO_MEMORY_CACHE_MAX_SIZE 50% of mem (25% in local mode) none 8 GB
ZO_MEMORY_CACHE_DATAFUSION_MAX_SIZE mem − memory cache, i.e. 50% (local mode: half the remainder, 37.5%; compactor-only: mem / merge threads) none 8 GB
ZO_MEM_TABLE_MAX_SIZE 50% of mem (25% in local mode) none 8 GB
ZO_INVERTED_INDEX_FOOTER_CACHE_MAX_SIZE 5% 8 MB – 1 GB 819 MB
ZO_DATAFUSION_FILE_STAT_CACHE_MAX_SIZE 5% 8 MB – 1 GB 819 MB
ZO_METRICS_LABEL_CACHE_MAX_SIZE 5% (constants in src/promql/src/series_loader/label_cache.rs) 8 MB – 1 GB 819 MB
ZO_METRICS_BLOCKS_CACHE_MAX_SIZE 2% (metrics_blocks_cache_size_mb; #15010 proposes 5%, max 4 GB) 128 MB – 1 GB 327 MB
ZO_BLOOM_FOOTER_CACHE_MAX_SIZE 1% 4 – 256 MB 163 MB
ZO_METRICS_RESULT_CACHE_MAX_SIZE 1% 32 – 256 MB 163 MB
ZO_INVERTED_INDEX_RESULT_CACHE_MAX_ENTRIES × _MAX_ENTRY_SIZE 10,000 entries × 20 KB — up to ~195 MB
ZO_MEMORY_QUEUE_MAX_SIZE_MB 64 MB — 64 MB
ZO_DATAFUSION_STREAMING_AGGS_CACHE_MAX_ENTRIES 10,000 entries, no byte bound — unknown

On a 16 GB node in cluster mode these add up to about 27.5 GB, roughly 170% of memory, before counting anything that is not a cache (query execution outside the DataFusion pool, ingestion buffers, WAL, allocator overhead). The three large budgets alone are 150%. Local mode still lands around 100%.

What makes it hard to manage

  1. No overall budget. Each value is derived from total memory in isolation. Adding a cache, or raising one default, silently increases the total; nothing reports or bounds the sum.
  2. Only one sanity check, for one cache. ZO_MEMORY_CACHE_MAX_SIZE >= mem is rejected at startup; every other value, and the total, is accepted as is.
  3. Defaults live in several places. Most are in check_memory_config, but the metrics blocks cache has its own helper and the PromQL label cache keeps its percentages as constants in its own module. There is no single place to see what a node will budget.
  4. Inconsistent units and meanings. Some settings are MB, some bytes, some entry counts with no byte limit. 0 means "automatic" for most, but for ZO_METRICS_BLOCKS_CACHE_MAX_SIZE values 1–9 disable the cache while the others take them literally, and ZO_METRICS_RESULT_CACHE_MAX_SIZE silently raises values below 32.
  5. Not role-aware. The same shares apply regardless of which components run on the node, e.g. a querier also reserves a memtable budget and an ingester reserves query caches. Only the DataFusion pool looks at the node role (compactor-only).
  6. Comments and docs drift. The local-mode DataFusion default is commented as // 25% but computes to 37.5%. Help texts describe each setting alone, never how they relate.
  7. Operators cannot reason about it. To size a pod, an operator has to find a dozen variables across the codebase and do the arithmetic; the only guard at runtime is the ingestion memory circuit breaker (ZO_MEMORY_CIRCUIT_BREAKER_RATIO, off by default).

Since most of these are caps that fill lazily, the node does not necessarily use this much memory, but under a sustained query and ingestion load the defaults allow it, and the resulting OOM is hard to attribute to any single setting.