Skip to content

feat: add streaming mode for prefix analysis (constant memory)#64

Open
ishakuta wants to merge 2 commits intoHDT3213:masterfrom
ishakuta:feat/streaming-prefix
Open

feat: add streaming mode for prefix analysis (constant memory)#64
ishakuta wants to merge 2 commits intoHDT3213:masterfrom
ishakuta:feat/streaming-prefix

Conversation

@ishakuta
Copy link
Copy Markdown

@ishakuta ishakuta commented Mar 23, 2026

The existing prefix command builds a full radix tree in memory, which OOMs on large RDB files. This adds a -streaming flag that uses a flat map[prefix]stats instead, keeping memory usage constant regardless of dump size.

Usage: rdb -c prefix -streaming -max-depth 3 -prefix-sep ":" dump.rdb

Result: 132M keys / 55GB RDB parsed with ~87MB total memory

The existing prefix command builds a full radix tree in memory,
which OOMs on large RDB files. This adds a -streaming flag that
uses a flat map[prefix]stats instead, keeping memory usage constant
regardless of dump size.

Usage: rdb -c prefix -streaming -max-depth 3 -prefix-sep ":" dump.rdb
- Only emit prefix entries where depth < segment count, preventing
  full keys from being stored as individual "prefixes" (23M -> 2.5K entries)
- Add -track-mem flag to print heap/sys stats to stderr every 1M keys
- Result: 132M keys / 55GB RDB parsed with ~87MB total memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant