Skip to content

Introduce Snapshotting to Optimize CRDT DAG Compaction and TraversalΒ #249

@mgazza

Description

@mgazza

Hi,
I've been playing with this library and it's great.
However, I'm not happy about the DAG's continuous growth, and I'd like to help.

The current implementation of go-ds-crdt maintains a DAG structure to represent state changes in a datastore. While effective, this approach has limitations:

Performance Overhead: Traversing and replaying large DAGs to compute the current state becomes costly as the DAG grows.
Garbage Collection: Stale or redundant nodes in the DAG are retained unnecessarily, increasing storage requirements.
Recovery Times: Rebuilding state after a crash or restart is slow, as it requires replaying the full DAG history.
Snapshotting introduces a mechanism to address these issues. By creating a periodic snapshot of the DAG, we can:

Compact the state into a "base snapshot."
Limit traversal to only the most recent nodes.
Facilitate faster recovery by replaying transactions only since the last snapshot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/discussionTopical discussion; usually not changes to codebase

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions