Redis Encoding Threshold Calculator

See where the encoding flips and what it costs. This is the page that explains why a dataset grew sharply with no code change.

Paste below, or drop a file anywhere on this panel

Or drop a file anywhere on this panel. Nothing is uploaded: the analysis runs in this tab.

The answer appears here

Paste on the left and press Calculate. Nothing leaves this tab.

Wanted a different tool?

  • Redis Memory Calculator if you want the memory total rather than the threshold itself, because that applies this cliff across a whole keyspace.

Examples

Real input you can load into the tool above. Each one shows a different thing going wrong, because that is what the tool is for.

At the default threshold

A hash near 128 fields, showing the cost either side of the cliff

type: hash
keys: 1000000
elements: 100
value-bytes: 32

Already past it

A collection that is already using the pointer-based encoding

type: hash
keys: 1000000
elements: 500
value-bytes: 32

Common mistakes

These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.

  1. Raising the threshold without understanding the trade

    A listpack is a flat array, so lookups within it are linear. Raising the limit to 5000 saves memory and makes every field access scan.

    Instead:Raise it modestly, and only where the collection is read whole rather than by field.

  2. Assuming the threshold applies to the value only

    Both hash-max-listpack-entries and hash-max-listpack-value apply. One long field name or value converts the whole key.

    Instead:Check both. A single outlier converts the key permanently.

  3. Expecting the encoding to convert back

    Redis never converts a collection back to the compact encoding, even after elements are removed.

    Instead:The conversion is one way. Only recreating the key restores it.