Redis › Redis vs Memcached

How does memory efficiency compare between Redis and Memcached for storing large numbers of small key value pairs?

Advanced

Answer

Memcached's slab allocation memory management approach can sometimes be more predictable and efficient for storing a very large number of small, uniformly sized items, while Redis's more flexible internal encodings, such as compact hash and list representations, can also be highly memory efficient depending on how your data is structured, meaning actual memory efficiency often depends heavily on your specific data patterns and requires benchmarking your particular workload to know for certain.
-- Actual memory efficiency depends heavily
-- on specific data patterns and sizes
-- Benchmark your particular workload to know for certain
Real-world example A team comparing memory efficiency for their specific workload of many small, similarly sized cache entries runs a side by side comparison, discovering the actual difference for their particular data pattern was smaller than they initially expected.

Common follow-ups: What specific data patterns favor Memcached's memory efficiency approach?;How do you set up a fair, realistic memory efficiency comparison between the two?