views:

1538

answers:

4

Hi everyone,

I have worked quite a bit with memcached the last weeks and just found out about Redis. When I read this part of their readme, I suddenly got a warm, cozy feeling in my stomach:

Redis can be used as a memcached on steroids because is as fast as memcached but with a number of features more. Like memcached, Redis also supports setting timeouts to keys so that this key will be automatically removed when a given amount of time passes.

This sounds amazing. I'd also found this page with benchmarks: http://www.ruturaj.net/redis-memcached-tokyo-tyrant-mysql-comparison

So, honestly - Is memcache really that old dinousaur that is a bad choice from a performance perspective when compared to this newcomer called Redis?

I haven't heard lot about Redis previously, thereby the approach for my question!

+3  A: 

Memcache is an excellent tool still and VERY reliable.

instead of looking at this issue from the perspective getting down the who is faster at the < 100 ms range, look at the performance per "class" of the software.

Does it use all local ram? -> fastest Does it use remote ram? -> fast Does it use ram/hardddisk -> oh hurm. Does it use all harddisk -> run!

-daniel

Daniel
Hi Daniel! What is your opinion on how to handle replication with memcache?
Industrial
There is no facility to handle replication with memcache that I know of. Memcache is purely meant to be a cache. If the item is purged/lost, then it needs to be rebuilt.I have not used this before nor have I evaluated it, but this may be of interest to you.http://code.google.com/p/memagent/
Daniel
+4  A: 

So, honestly - Is memcache really that old dinousaur that is a bad choice from a performance perspective when compared to this newcomer called Redis?

  • Comparing features set then Redis has way more functionality
  • Comparing ease of installation Redis is also a lot easier. No dependencies required.
  • Comparing active development Redis is also better.
  • I believe memcached is a little bit faster than redis. It does not touch the disc it all.
  • My opinion is that Redis is better product memcached.
Alfred
redis only touches disk if you tell it to. Usually, it does an fsync every other second or so -> you won't notice it
Marc Seeger
@Marc yup. I also believe you can tell it to not touch disc at all, but standard i believe it always fsyncs right now?
Alfred
+3  A: 

What memcached does that Redis doesn't do is least-recently-used eviction of values from the cache. With memcached, you can safely set as many values as you like, and when they overflow memory, the ones you haven't used recently will be deleted. With Redis, you can only approximate this, by setting a timeout on everything; when it needs to free up memory, it will look at three random keys and delete the one that's the closest to expiring.

That's the main difference, if you're just using it as a cache.

Peter Scott
+1  A: 

You may also want to look at Membase.

http://www.northscale.com/products/membase_server.html

I have not used it, but it appears to be similar to Redis in that it is a memory-centric KV store with persistence. The major differences from what I can see are:

  • Redis has significantly more data manipulation capability (ordered sets, etc.)
  • Redis has a pending Redis Cluster project to add horizontal scalability
  • Redis has a single tier of data offload to disk (VM) based on a hybrid algorithm that considers both LRU and the size of the object.

  • Membase uses the memcached wire protocol - useful as an upgrade path for existing applications

  • Membase is set up to scale horizontally using a distributed hashtable approach
  • Membase can support multiple tiers of data offload using an LRU approach (very seldom used goes to disk, somewhat seldom stuff goes to SSD, frequent stuff stays in RAM)
  • Not sure about TTL capability in Membase.

The choice may depend on the degree to which your application can leverage the extra data manipulation functionality in Redis.

DeanB
Hi Dean, thanks for your post. I will definitely check it out. Can i use Membase in PHP?
Industrial
Since Membase uses the memcached protocol, any of the memcached clients should work: http://wiki.membase.org/bin/view/Main/Clients
DeanB