DEV Community

Nic
Nic

Posted on • Originally published at coderscat.com on

1

Redis Vs. Memcached

Redis and Memcached are both popular in-memory data storage systems.

Aws has a comparison for them. We can see from the table, Redis beats Memcached almost in every aspect:

CAPTURE-2020_04_08_redis-vs-memcached.org_20200408_233953.png

Performance

Memcached has better performance for big data, such as data of 100k or above.

Redis is single-threaded and will beat Memcached on small data reading and writing.

Data types

There is only string type in Memcached.

Redis supports many kinds of data types, including string, set, list, hash, sorted set, geo, bitmap.

These data types are useful for different scenarios and needs.

The largest data size can only be 1 MB in Memcached, while we can use the maximum of 1GB in Redis.

Persistence

Memcached does not have a mechanism for persistence.

Redis supports AOF(Append Only File) and RDB persistence for persistence. This is very important for many applications. We could use Redis as a NoSQL database.

Scaling

Memcached itself does not support distributed mode. We need to adapt distributed algorithms such as Consistent Hash for distributed storage of Memcached.

Redis provides builtin support for clustering and is bundled with a high availability tool called redis-sentinel. Redis Cluster supports a maximum of 4,096 nodes.

Conclusion

Redis could do everything that Memcached targeted to.

Choose to use Redis whenever possible.

The post Redis Vs. Memcached appeared first on Coder's Cat.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs