Memory, caches and profiling
/admin/warm-cache and the profiling routes, enabled there with RELATA_PPROF_ENABLE. The memory breakdown, the single metric set for all caches, relata_stat_caches, clear and budget, cache verdicts and the heap-profiling build are on develop. "On develop" means merged in the product repository but not in a release yet.Where the memory goes
One scrape attributes process memory to the subsystem that owns it:
| Series | Meaning |
|---|---|
relata_process_resident_bytes | Process resident memory (RSS). |
relata_memory_subsystem_bytes{subsystem} | Estimated bytes per subsystem (rows, fts, one cache:<name> part per cache, and others). The parts do not overlap. |
relata_memory_tracked_bytes | Sum of the subsystem estimates. |
relata_memory_unattributed_bytes | RSS minus tracked: allocator retention, query working memory, buffers, thread stacks. |
relata_memory_attributed_ratio | Tracked divided by RSS. |
relata_memory_type_row_bytes{type} | Estimated resident bytes per type. |
relata_memory_breakdown_complete | 1 when every subsystem was read in this scrape. |
relata_vector_resident_bytes{tier} | Vector memory by tier. |
On the default allocator a ratio of about 0.7 to 0.8 is normal, because the rest is mostly memory the allocator keeps after a peak. A ratio well below that, or an unattributed figure that keeps growing at a steady row count, is the signal to profile. Memory pressure levels are reported by relata_memory_level; under hard pressure writes get 503 memory-pressure.
No memory-slope alert ships in the chart. Alert on your own trend of relata_process_resident_bytes and relata_memory_unattributed_bytes. The node also keeps a local history of these series (see Air-gapped sites).
Caches
One metric set covers all ten caches, labelled cache: segment, decoded_segment, result, vector_result, parse, graph, bloom_fetch, fts_doc, diskann_sector and tombstone.
| Series | Meaning |
|---|---|
relata_cache_hits_total{cache}, relata_cache_misses_total{cache}, relata_cache_evictions_total{cache} | Lookups and evictions. Every cache reports them. |
relata_cache_bytes{cache}, relata_cache_entries{cache} | Size, where a cache can report it cheaply. A figure a cache cannot report is left out, never shown as 0. |
relata_cache_lookup_seconds_total{cache}, relata_cache_saved_seconds_total{cache} | Time spent looking up, and the estimated time saved by hits. result and parse only. |
The older per-cache names (relata_result_cache_*, relata_vector_result_cache_* and others) stay for one release as aliases. Note that relata_cache_hits_total used to mean the segment cache only; filter on cache="segment" to keep that meaning.
The cache view
relata_stat_caches shows the same readings as one row per cache:
SELECT cache, bytes, limit_bytes, hit_ratio, net_saved_seconds FROM relata_stat_caches
SELECT * FROM relata_stat_caches WHERE cache = 'parse'Columns are cache, bytes, entries, limit_bytes, hits, misses, evictions, hit_ratio, lookup_seconds, saved_seconds, net_saved_seconds, oldest_entry_age_seconds and top_keys. A column a cache cannot report is null. top_keys holds type or segment names, never row values or SQL. Also the caches key of GET /v1/system/stats. Operator and oversight keys only.
Is a cache worth it?
A cache is only worth keeping if a hit is cheaper than a miss. net_saved_seconds is saved time minus lookup time since start; a negative value means the cache costs more than it saves. The alert RelataCacheNetCost fires when lookup time outruns saved time for 15 minutes. Saved time is an estimate, built from the measured cost of recent misses.
Each query answer also says whether a cache served it: performance.cache_verdict on /v1/query, cache_verdict on search and MCP answers, extensions.cache_verdict on GraphQL, and the X-Relata-Cache header on the Arrow and stream doors. Per query, WITH CACHE BYPASS skips the result cache.
Cap and clear
RELATA_CACHE_TOTAL_MAX_MB sets one budget for all caches. It is off by default. When set, a check every 10 seconds clears whole caches, largest first, until the total is under the budget. relata_cache_budget_bytes shows the budget and relata_cache_budget_shrinks_total{cache} counts the clears. A shrink counter that keeps rising means the budget is below the caches' working size.
To clear one cache by hand:
curl -s -X POST -H "Authorization: Bearer $RELATA_ADMIN_TOKEN" \
http://127.0.0.1:9091/admin/cache/result/clearThe answer is {cache, entries_removed, bytes_freed}. A clear changes speed only, never results. bloom_fetch and fts_doc answer 409 cache-not-clearable; an unknown name answers 404 cache-not-found. Every clear is audited.
POST /admin/warm-cache sends a warm hint. The segment cache size is derived from the detected memory and has no setting of its own. Its optional disk tier is set with RELATA_CACHE_DISK_PATH and RELATA_CACHE_DISK_GB; see the environment variable reference.
History held in memory
By default closed row versions stay in memory until they are spilled. On develop, two opt-in settings can remove or evict them on a live node; see History compaction and eviction.
CPU and heap profiles
Profiling is off by default, because a profile reveals workload shape and symbol names. The setting is RELATA_PPROF_ENABLE in released 3.0.0. On develop it is renamed to RELATA_PPROF_ENABLED, and the old name then stops startup.
RELATA_PPROF_ENABLE=true RELATA_ADMIN_TOKEN=... relata serve # 3.0.0
RELATA_PPROF_ENABLED=true RELATA_ADMIN_TOKEN=... relata serve # develop| Route (admin listener) | Returns |
|---|---|
GET /admin/debug/pprof/profile?seconds=N | CPU profile as pprof protobuf. seconds is clamped to 1 to 30. |
GET /admin/debug/pprof/heap | On the default release, a JSON census of component memory; ?format=pprof answers 501 heap-profile-unavailable. On the heap-profiling build, a sampled allocation-site pprof profile. |
Both need the admin token, answer 404 while profiling is disabled, and allow one profile at a time (a second gets 429).
curl -s -H "Authorization: Bearer $RELATA_ADMIN_TOKEN" \
"http://127.0.0.1:9091/admin/debug/pprof/profile?seconds=15" -o cpu.pprof
go tool pprof -http=:8080 cpu.pprofThe allocation-site heap profile needs the heap-profiling build: a separate x86_64 Linux -heapprof tarball and <version>-heapprof image, built by the release workflow next to the default build. Setting a variable on a default node does not turn it on.
What is coming
Lookup and saved time for the other eight caches, the age of the oldest entry, partial trims under the budget and a memory-slope alert are tracked in #7849. The investigation of memory growth is in #7724.