Redis RDB Memory Estimator
Approximate Redis memory from key patterns: jemalloc size classes, embstr and listpack encodings, hash-table overhead.
Key patterns
| Pattern | Type | Key B | Value B | Elements | Field B | Keys | TTL | |
|---|---|---|---|---|---|---|---|---|
Sizes are bytes of the UTF-8 encoding. Hash field names default to 8 bytes when left empty. TTL adds an expires-dictionary entry per key.
Estimated memory
100,000 keysTotal: about 21.8 MB
Includes 2.0 MB of dictionary bucket arrays, 0 B global overhead and 0 B replication backlog.
| Pattern | Encoding | Bytes/key | Total |
|---|---|---|---|
| sessions:* | raw | 208 | 19.8 MB |
Assumptions
Redis 7.x on 64-bit jemalloc. Key = dictEntry (24 B, rounded to 32) + SDS key. Strings up to 44 bytes are embstr (one allocation with the 16-byte object header). Listpack limits are the redis.conf defaults (hash 512 entries, set and zset 128, values up to 64 bytes, list nodes 8 KB). Larger collections use hash-table or skiplist overhead. Allocations are rounded to jemalloc size classes.
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
estimateRedisMemory([{ name: "sessions:*", type: "string", keyBytes: 32, valueBytes: 64, elements: 0, count: 100000 }]){ 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
estimateRedisMemory([{ name: "user:*", type: "hash", keyBytes: 24, valueBytes: 20, elements: 129, count: 100 }]){ 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
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.
Add instance overheads
Set globalOverheadBytes and replicationBacklogBytes in options so totalWithOverheadBytes reflects the full node footprint.
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.
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.
Related guides
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.gitattributes Generator
Build .gitattributes rules for line endings, Git LFS, GitHub linguist marks and merge drivers — with a one-line explanation for every rule.
.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.
A/B Test Sample Size Calculator
Compute required sample size per variant and test duration from baseline conversion rate, minimum detectable effect, alpha and power.
ABA Routing Number Validator
Validate 9-digit US ABA routing numbers with 3-7-1 Mod-10 breakdown.