loading...

Redis Vs. Memcached

snj profile image Nick Mose Originally published at coderscat.com on ・1 min read

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.

Posted on Dec 25 '19 by:

snj profile

Nick Mose

@snj

Programming for 16 years. Write stuff about programming and writing on coderscat.com. Programming languages, security, algorithms.

Discussion

markdown guide