Skip to content

[Feature] Support Non-Evictable Databases (Pinned in Memory) #411

@zhangh43

Description

@zhangh43

Description:
Add support for configuring certain databases (DBs) to be non-evictable, ensuring their data is never kicked out of memory by eviction, tiering, or memory pressure mechanisms.

This feature is useful for workloads that require predictable low-latency access to a subset of critical data, even when the system is under memory pressure.

Background / Motivation:

  • Some DBs contain:

    • Hot metadata
    • Control-plane data
    • Latency-sensitive state
  • Eviction of these DBs can cause:

    • Latency spikes due to storage reads
    • Unstable tail latency
  • EloqKV supports multiple logical DBs; allowing per-DB memory policy improves flexibility

Proposed Behavior:

  • Introduce a DB-level configuration flag:

    db.evictable = true | false
    
  • When db.evictable = false:

    • Keys belonging to the DB:

      • Are never evicted from memory
      • Are excluded from eviction candidates
      • Are not tiered out to SSD due to memory pressure
  • Eviction and memory reclamation apply only to evictable DBs

Scope / Requirements:

  • Per-DB eviction policy

  • Works with existing memory management and tiered storage logic

  • Clear behavior under global memory pressure:

    • Evict evictable DBs first
    • If all DBs are non-evictable, return OOM or backpressure
  • Redis protocol compatibility (logical DB semantics preserved)

Non-Goals:

  • Per-key pinning (DB-level only)
  • Automatic promotion/demotion between evictable and non-evictable

Configuration (Example):

db.0.evictable = false
db.1.evictable = true

Acceptance Criteria:

  • Data in non-evictable DBs remains resident in memory
  • No eviction events occur for those DBs
  • Evictable DBs continue to function normally
  • Memory pressure behavior is predictable and documented

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions