Need advice about which tool to choose?Ask the StackShare community!
Memcached vs Redis: What are the differences?
Memcached: High-performance, distributed memory object caching system. Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering; Redis: An in-memory database that persists on disk. Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
Memcached can be classified as a tool in the "Databases" category, while Redis is grouped under "In-Memory Databases".
"Fast object cache", "High-performance" and "Stable" are the key factors why developers consider Memcached; whereas "Performance", "Super fast" and "Ease of use " are the primary reasons why Redis is favored.
Memcached and Redis are both open source tools. It seems that Redis with 37.4K GitHub stars and 14.4K forks on GitHub has more adoption than Memcached with 9K GitHub stars and 2.6K GitHub forks.
According to the StackShare community, Redis has a broader approval, being mentioned in 3261 company stacks & 1782 developers stacks; compared to Memcached, which is listed in 755 company stacks and 267 developer stacks.
The obvious volatile memory choices were either Memcached or Redis. We eventually sided with Redis as it natively handled replication, and this replication fell under the PCI responsibility scope of AWS. This added duribility meant that if a redis node were to die, our downtime would be in the seconds, rather than 15 minutes which we would incur using Memcached
The requirement was the classic "cache the results of a SQL query for a period of time."
While the Internet is full of "Redis is fuller featured" posts, the key issue for us was the actual performance. We discovered, in various stress scenario testing, that Memcached outperformed Redis for simple key-value retrieval dramatically (over twice as fast.) That's not to say that Redis is bad - we use that in other places where the requirements are more sophisticated than simple key/value retrieval.
Pros of Memcached
- Fast object cache137
- High-performance128
- Stable90
- Mature65
- Distributed caching system33
- Improved response time and throughput11
- Great for caching HTML3
- Putta2
Pros of Redis
- Performance879
- Super fast536
- Ease of use511
- In-memory cache441
- Advanced key-value cache321
- Open source190
- Easy to deploy179
- Stable163
- Free152
- Fast120
- High-Performance40
- High Availability39
- Data Structures34
- Very Scalable32
- Replication23
- Great community20
- Pub/Sub19
- "NoSQL" key-value data store17
- Hashes14
- Sets12
- Sorted Sets10
- Lists9
- BSD licensed8
- NoSQL8
- Async replication7
- Integrates super easy with Sidekiq for Rails background7
- Bitmaps7
- Open Source6
- Keys with a limited time-to-live6
- Strings5
- Lua scripting5
- Awesomeness for Free!4
- Hyperloglogs4
- outstanding performance3
- Runs server side LUA3
- Networked3
- LRU eviction of keys3
- Written in ANSI C3
- Feature Rich3
- Transactions3
- Data structure server2
- Performance & ease of use2
- Existing Laravel Integration1
- Automatic failover1
- Easy to use1
- Object [key/value] size each 500 MB1
- Simple1
- Channels concept1
- Scalable1
- Temporarily kept on disk1
- Dont save data if no subscribers are found1
- Jk0
Sign up to add or upvote prosMake informed product decisions
Cons of Memcached
- Only caches simple types2
Cons of Redis
- Cannot query objects directly14
- No secondary indexes for non-numeric data types2
- No WAL1