1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! # nodedb-mem
//!
//! Global NUMA-aware memory governor for NodeDB.
//!
//! Prevents subsystem OOM and cache cannibalization by enforcing per-engine
//! memory budgets backed by jemalloc's introspection APIs.
//!
//! ## Problem
//!
//! If DataFusion does a massive `GROUP BY`, it allocates RAM until OOM kills
//! the process — taking Glommio threads, HNSW caches, and open io_uring
//! submissions down with it.
//!
//! If the timeseries engine flushes 5 GB of Gorilla-encoded segments, it can
//! evict the vector engine's hot HNSW routing layers from the OS page cache.
//!
//! ## Solution
//!
//! A centralized memory governor that:
//!
//! 1. Tracks allocations per engine (Vector, Sparse, CRDT, Timeseries, Query).
//! 2. Enforces hard limits — allocation requests beyond the budget are rejected
//! with a deterministic error, forcing the caller to spill or backpressure.
//! 3. Supports dynamic rebalancing — the governor can shift budget from idle
//! engines to active ones within the global ceiling.
//! 4. Exposes metrics for all budget states and breach events.
//!
//! ## Validation target
//!
//! Under a mixed workload (vector search + bulk timeseries ingest + SQL GROUP BY),
//! no single engine should exceed its budget, and total RSS should stay within
//! the configured global ceiling.
pub use Budget;
pub use GovernedMemoryPool;
pub use EngineId;
pub use ;
pub use MemoryGovernor;
pub use OverflowRegion;
pub use ;
pub use ;