memcache vs redis of nodejs for chatting app

聊天程序的Nodejs Memcache VS redis

问题 (Question)

what's the difference between redis & memcached, which one is best to use for chat application, any suggestions

使用与memcached之间的区别是什么,哪一个是最好的使用聊天应用程序,任何建议

最佳答案 (Best Answer)

main difference is

memcached is cache, Redis is IMDB (In memory database).

it means, in memcached, data is full , it will be removed by eviction logic like (LRU etc). and if server is down, the whole data will be lost.

but in case of Redis, it persist the data to file, so even if it has been crashed, it can recover data.

in addition there are so many difference. Only same thing is those are memory based K/V store.

Redis can support clustering and Master/slave replication, Data model also different etc.

主要的区别是

memcached缓存,redis是IMDB(内存数据库)。

这意味着,在缓存,数据是完整的,它将会被驱逐的逻辑(LRU等)。如果服务器关闭,所有数据将丢失。

但如果它坚持使用,数据文件,所以即使它已经坠毁,它可以恢复数据。

此外还有很多不同的。只有相同的事情是那些基于K / V存储记忆。

redis支持聚类和主/从复制,数据模型也不同等。

答案 (Answer) 2

As Terry Cho said, the main difference is the method of storing the data.

Memcaching stores the data in the RAM on each server, or in the RAM of your memcache server. Redis stores the data in an in memory database, and pretty much every operation in Redis has an operational complexity of O(1) which makes it extremely fast.

Personally, I use Redis for caching as I can share the same cache between a cluster of servers and set up data expiration automatically which still maintaining the minimal operational complexity for retrieving the data.

For a chat application, Redis would work better as you likely want the data to persis if your server restarts. I would use a database like MongoDB or PostgreSQL for the best performance of a persistent chat application though.

特里首席人事官说,主要的区别是存储数据的方法。

memcaching存储在RAM的数据在每个服务器上,或在你的其他服务器内存。使用存储的数据在内存中的数据库,几乎在每一个操作redis为O(1)操作的复杂性,这使得它非常快。

就我个人而言,我使用Redis缓存可以共享一个群集的服务器建立数据期满自动维持检索数据的最小运算复杂度之间的相同的缓存。

一个聊天程序,使用会更好地工作,你可能想要的数据持续如果你的服务器重新启动。我会使用一个数据库MongoDB或PostgreSQL的持久性的聊天应用程序尽管最佳性能。

本文翻译自StackoverFlow,英语好的童鞋可直接参考原文:http://stackoverflow.com/questions/22142266