发布信息

memcached和redis的区别 (memcached)

     2024-10-22 20:38:13     340

本文目录导航:

memcached和redis的区别

Redis的作者Salvatore Sanfilippo曾经对这两种基于内存的数据存储系统启动过比拟:

1、Redis支持主机端的数据操作:Redis相比Memcached来说,领有更多的数据结构和并支持更丰盛的数据操作,理论在Memcached里,你要求将数据拿到客户端来启动相似的修正再set回去。

这大大参与了网络IO的次数和数据体积。 memcached和redis的区别

在Redis中,这些复杂的操作理论和普通的GET/SET一样高效。

所以,假设要求缓存能够支持更复杂的结构和操作,那么Redis会是不错的选用。

2、内存经常使用效率对比:经常使用繁难的key-value存储的话,Memcached的内存应用率更高,而假设Redis驳回hash结构来做key-value存储,由于其组合式的紧缩,其内存应用率会高于Memcached。

3、性能对比:由于Redis只经常使用单核,而Memcached可以经常使用多核,所以平均每一个核上Redis在存储小数据时比Memcached性能更高。

而在100k以上的数据中,Memcached性能要高于Redis,只管Redis最近也在存储大数据的性能上启动提升,但是比起Memcached,还是稍有逊色。

详细为什么会出现上方的论断,以下为搜集到的资料:

1、数据类型支持不同

与Memcached仅支持繁难的key-value结构的数据记载不同,Redis支持的数据类型要丰盛得多。

最为罕用的数据类型关键由五种:String、Hash、List、Set和Sorted Set。

Redis外部经常使用一个redisObject对象来示意一切的key和value。

redisObject最关键的消息如图所示:

type代表一个value对象详细是何种数据类型,encoding是不同数据类型在redis外部的存储模式,比如:type=string代表value存储的是一个普通字符串,那么对应的encoding可以是raw或许是int,假设是int则代表实践redis外部是按数值型类存储和示意这个字符串的,当然前提是这个字符串自身可以用数值示意,比如:”123″ “456”这样的字符串。

只要关上了Redis的虚构内存性能,vm字段字段才会真正的调配内存,该性能自动是封锁形态的。

Memcached真的过时了吗?Redis与Memcached的比拟

这两年Redis火得可以,Redis也经常被当作Memcached的应战者被提到桌面过去。

关于Redis与Memcached的比拟更是亘古未有。

但是,Redis真的在性能、性能以及内存经常使用效率上都逾越了Memcached吗?上方内容来自Redis作者在stackoverflow上的一个回答,对应的疑问是《Is memcached a dinosaur in comparison to Redis?》(相比Redis,Memcached真的过时了吗?)You should not care too much about performances. Redis is faster per core with small values, but memcached is able to use multiple cores with a single executable and TCP port without help from the client. Also memcached is faster with big values in the order of 100k. Redis recently improved a lot about big values (unstable branch) but still memcached is faster in this use case. The point here is: nor one or the other will likely going to be your bottleneck for the query-per-second they can deliver.没有必要过多的关心性能,由于二者的性能都曾经足够高了。

由于Redis只经常使用单核,而Memcached可以经常使用多核,所以在比拟上,平均每一个核上Redis在存储小数据时比Memcached性能更高。

而在100k以上的数据中,Memcached性能要高于Redis,只管Redis最近也在存储大数据的性能上启动提升,但是比起Memcached,还是稍有逊色。

说了这么多,论断是,无论你经常使用哪一个,每秒处置恳求的次数都不会成为瓶颈。

(比如瓶颈或许会在网卡)You should care about memory usage. For simple key-value pairs memcached is more memory efficient. If you use Redis hashes, Redis is more memory efficient. Depends on the use case.假设要说内存经常使用效率,经常使用繁难的key-value存储的话,Memcached的内存应用率更高,而假设Redis驳回hash结构来做key-value存储,由于其组合式的紧缩,其内存应用率会高于Memcached。

当然,这和你的运行场景和数据特性无关。

You should care about persistence and replication, two features only available in Redis. Even if your goal is to build a cache it helps that after an upgrade or a reboot your>redis与mc的区别,redis支持的数据结构有哪些

1、redis是非相关型内存数据库,memcached仅仅是内存键值缓存2、redis数据类型丰盛,有五种:string(字符串),list(链表),hash(字典),set(汇合),zset(有序汇合);mc仅仅支持字符串3、丰盛的数据类型选择了redis的经常使用愈加繁复、易懂、易保养;以及成功丰盛的运行,对比实时排行,购置介绍等

相关内容 查看全部