Skip to content

perf(replication): benchmark and reduce duplicate state-machine snapshot buffers #382

Description

@jimezesinachi

Context

The durable state-machine snapshot implementation retains the current snapshot in the state machine and exposes an owned Cursor<Vec<u8>> to OpenRaft. For large completed snapshots, this can mean two in-process payload buffers.

This is not a correctness problem. Snapshot durability, install, restart, and compaction recovery must remain unchanged.

Work

  • Benchmark snapshot build allocation, peak RSS, and latency for realistic DB and AI snapshot sizes.
  • Benchmark snapshot transfer latency and memory while a leader serves a snapshot to a learner.
  • Decide from measurements whether duplicate completed-snapshot buffers are material.
  • If warranted, introduce a custom OpenRaft SnapshotData type with a mutable receive representation for InstallSnapshot and a shared immutable representation for completed snapshots.
  • Preserve durable local recovery, installed-snapshot recovery, and chunked transport behavior with targeted tests.

Acceptance Criteria

  • Baseline measurements are recorded.
  • Any optimization is justified by those measurements.
  • Restart-after-compaction and install-then-restart coverage remains intact.
  • Snapshot receive/send behavior is tested for partial/chunked transfer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions