0

I am working with node and php , for node , I have heard of redis for cache system and for php memcached

I have tested simple test for setting and getting 10000 items :

memcached was 10X (YES , 10 times) faster than redis and it is easy to say memcached is better in term of speed .

but I have heard that memcached is not scaled like redis , is it true ? I can see that when I want to connect memcache with add server function , I can user multi server , so , why people say that is not good in term of scale ?

why should I use redis instead of memcached in Node ?

Ata
  • 10,914
  • 19
  • 53
  • 94
  • The biggest advantage of Redis I can think of (there are a few, but I don't know enough about current memcached to compare clustering) is that it will not lose its content if the power cycles/the machine reboots/... Memcached will be empty after every restart, Redis will keep its content. Handy for session data for example. – Joachim Isaksson Jul 18 '13 at 05:44
  • @JoachimIsaksson I think Redis only store data on disk if we ask , so what happen if we do not ask and the power go off ? – Ata Jul 18 '13 at 05:55
  • possible duplicate of [Memcache vs. Redis?](http://stackoverflow.com/questions/10558465/memcache-vs-redis) – Eli Jul 18 '13 at 06:10
  • 1
    If you want to benchmark Redis, please read: http://redis.io/topics/benchmarks – Didier Spezia Jul 18 '13 at 09:17

2 Answers2

4

If you would dig little more you will find that, memcache is multi-threaded but redis is mostly single threaded (See Single threaded nature of Redis).

So if you would benchmark on an multi-core processor, memcache would be able to scale its performace taking advantage of the cores, where as redis would not.

To compensate for this single threaded nature, redis cluster is being developed (just like node has cluster module). Memcache is already distributed and supports clusters. Redis is expected to roll out the cluster (stable version) by the end of this year. Remember it is still new and memcache is there for a decade now.

Of all the benchmarks I found this one that explains correctly, the aspects of benchmarking. See the last benchmark where there is no parallelism. They perform almost at par.

Edit

Regarding the choice between them, this question Is memcached a dinosaur in comparison to Redis? has many good answers particularly this one. The same guy who answered that did these benchmarks :

  1. http://oldblog.antirez.com/post/redis-memcached-benchmark.html
  2. http://oldblog.antirez.com/post/update-on-memcached-redis-benchmark.html

Also most of the topics you need to know regarding performance and benchamrks are given here, inlcuding all the benchmarks mentioned above.

Community
  • 1
  • 1
user568109
  • 43,824
  • 15
  • 87
  • 118
2
  1. My guess is you didn't configure Redis optimally, or there was something else wrong in your test. There have been a lot of benchmarks done against Redis and Memcached and the results are always close, frequently with Redis as the winner.
  2. There is a detailed response to why to use one vs the other at this SO question.
Community
  • 1
  • 1
Eli
  • 31,424
  • 32
  • 127
  • 194