DevTools Logo

Redis RDB Memory Estimator

Redis RDB Memory Estimator

Estimate Redis key-pattern memory locally, including compact encodings and allocator overhead

Key patterns

PatternTypeKey BValue BElementsKeys

About

Model Redis strings, hashes, lists, sets, and sorted sets locally. The deterministic estimate includes 50-byte SDS allocator allowance rounded to 8 bytes, compact encoding thresholds, global overhead, and replication backlog.

Examples

String-heavy session store

Input
estimateRedisMemory([{ name: "sessions:*", type: "string", keyBytes: 32, valueBytes: 64, elements: 0, count: 100000 }])
Output
{ totalBytes: 22400000, patterns: [{ bytesPerKey: 224 }] }

SDS key (88) plus 16-byte object plus SDS value (120) gives 224 bytes per key before count multiplication.

Hash past the ziplist limit

Input
estimateRedisMemory([{ name: "user:*", type: "hash", keyBytes: 24, valueBytes: 20, elements: 129, count: 100 }])
Output
{ patterns: [{ compactEncoding: false }] }

129 elements exceeds the 128-element compact limit, so the regular per-element overhead applies.

About this tool

Redis RDB Memory Estimator projects dataset RAM with estimateRedisMemory(patterns, options): each RedisPatternInput ({ name, type, keyBytes, valueBytes, elements, count }) yields bytesPerKey and totalBytes, plus globalOverheadBytes and replicationBacklogBytes rolled into totalWithOverheadBytes. Keys use an SDS estimate (header plus allocator slack, 8-byte aligned) with a 16-byte object overhead per key.

Compact encodings follow the ziplist thresholds: hashes, lists, sets, and zsets with at most 128 elements and value bytes of 64 or less report compactEncoding true with a small per-element overhead (8 bytes, 16 for zsets); beyond either limit the estimator switches to the regular per-element overhead (24–48 bytes by type). String keys never use the compact path.

Validation is strict and the math is deterministic: blank pattern names, negative or non-finite sizes, and fractional elements/count values throw, while identical inputs always return equal estimate objects — fully client-side with no server round trip.

How to use this tool

  1. Describe each key pattern

    Pass name, type (string/hash/list/set/zset), keyBytes, valueBytes, elements, and count per pattern — counts and elements must be integers.

  2. Add instance overheads

    Set globalOverheadBytes and replicationBacklogBytes in options so totalWithOverheadBytes reflects the full node footprint.

  3. Read the compact flag

    Check compactEncoding per pattern: staying under 128 elements and 64 value bytes keeps hashes, lists, sets, and zsets on the cheap encoding.

  4. Compare and re-run

    Re-run with identical inputs for byte-identical results, then tune sizes or counts to see which pattern dominates totalBytes.

Use cases

Sizing a Redis node before migration

Project totalBytes plus overheads to pick instance RAM with headroom for growth and replication.

Catching ziplist threshold crossings

Spot hashes or zsets that just exceeded 128 elements or 64-byte values and now cost far more per key.

Comparing schema encodings

Contrast string versus hash layouts for the same data to choose the cheaper representation.

Common mistakes

Mistake:Expecting strings to use compact encoding.

Fix:The compact path only applies to hash, list, set, and zset — strings always use the regular SDS plus object overhead.

Mistake:Passing fractional counts or elements.

Fix:Elements and count must be integers; round or floor measured averages before estimating.

Mistake:Ignoring global and replication overhead.

Fix:Read totalWithOverheadBytes, not totalBytes, when sizing the node — the backlog and global overhead are real RAM.

Frequently asked questions

What does this tool do?

It estimates Redis RAM with estimateRedisMemory(patterns, options): per-pattern bytesPerKey and totalBytes with a compactEncoding flag, plus globalOverheadBytes, replicationBacklogBytes, and totalWithOverheadBytes for the node total.

When does a hash use the compact encoding?

When it holds at most 128 elements and value bytes are 64 or less (8 bytes per-element overhead instead of 40). At 129 elements or 65-byte values it flips to the regular encoding — strings never use the compact path.

Is my dataset uploaded or stored?

No. Size math, SDS estimates, and overhead sums run entirely in your browser.

Why did my estimate throw?

Pattern names must be non-blank, sizes must be non-negative finite numbers, and elements/count must be integers — negative counts or fractional elements throw a descriptive error.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML