`
zhuzhiguosnail
  • 浏览: 110899 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Memcache和Redis比较

阅读更多

Today marks the day that memcached no longer has any significant advantages over redis, while redis continues to have many distinct advantages over memcached. Today, redis 3.0, which includes Redis Cluster, exited beta and entered the Release Candidate stage. Previously when looking at memcached vs redis you might be inclined to chose memcached due to the 3rd party clustering tools available. Now redis offers clustering, and unlike memcached support is provided out-of-the-box. Being built-in provides a more robust solution that is easier to administrate. Combined with other high availability tools in-the-box like replication and Sentinel (monitoring), redis clearly has the more compelling scaling story today.

As of today every major feature and strength memcached offers are now a subset of redis' features and strengths. Any use case you might use memcached for redis can solve equally well. They are both lightning fast as volatile caches. While that's all that memcached is its only the tip of the redis iceberg.

Memcached is a volatile in-memory key/value store. Redis can act like one (and do that job as well as memcached), but it is a data structure server.

The Redis Superset

Here are a few of the features that redis offers which memcached doesn't and allows redis to be used as a "real" data store instead of just a cache.

  • Powerful data types and powerful commands to leverage them. Hashes, Sorted Sets, Lists, and more.
  • Persistence to disk, by default.
  • Transactions with optimistic locking (WATCH/MULTI/EXEC)
  • Pub/sub. Extremely fast.
  • Values up to 512MB in size (memcached limited to 1MB per key)
  • Lua scripting (as of 2.6)
  • Built in clustering (as of 3.0)
  • Extremely fast at everything. Benchmarks are often conflicting, but this much is clear: when used like memcached Redis falls somewhere between nearly as fast or maybe even a little faster. Like memcached it is often bound by available network or memory bandwidth instead of CPU or other bottlenecks and will rarely be the culprit when your app is slowing down.

The powerful data types are particularly important. They allow redis to provide a fantastic shared queue (lists), a great messaging solution (pub/sub), a good place for storing sessions (hashes), and a compelling place for high score tracking (sorted sets). These are just a few examples that scratch the surface.

Conclusion

To answer your original question: The performance and memory usage of Redis compared to memcached should be relatively similar. Close enough that for most uses any performance difference in either direction is academic as neither is likely to be the bottleneck.

Unless you already have a large investment in memcached, going forward redis is the obvious solution. For solutions both tools would solve, go with the one that offers more flexibility for new use cases and also provides better out-of-the-box availability, scalability, and administration: redis.

Not only is redis the better option for places you might use memcached, it enables whole new types of use cases and usage patterns.

Memcached is a fine piece of software that is stable and hardened. If you already have a large investment in memcached then you may want to stick with it. There are many use cases where redis is as-good-as memcached but isn't better. Evaluate the benefits of redis (if any) and compare that to the cost of switching. Make your own determination if moving to redis is worth your time.

TL;DR: For anything new, use Redis.

 

0
0
分享到:
评论

相关推荐

    MemCache和Redis缓存介绍

    **MemCache和Redis缓存介绍** 在IT行业中,缓存技术是提高系统性能和响应速度的关键因素之一。MemCache和Redis是两种广泛使用的分布式内存缓存系统,它们能够有效地存储和检索数据,减轻数据库的负担,提升应用的...

    memcache与redis的比较

    在分布式系统中,缓存机制是非常重要的一部分,memcache和Redis都是常用的缓存解决方案,本文将对两者进行比较,探讨它们的异同。 数据类型支持 Redis支持多种数据类型,如string、list、set、zset、hash等,而...

    php 5.3.13memcache和redis扩展

    相比Memcache,Redis提供了更丰富的数据结构和持久化功能。 1. **安装Redis扩展** - 对于PHP 5.3.13,你需要下载适用于Windows的Redis扩展,如`phpredis`。这个扩展通常包含多个`.dll`文件。 - 把这些文件放到PHP...

    session共享之memcache Redis

    标题中的“session共享之memcache Redis”指的是在Web开发中如何使用memcache和Redis来实现会话(session)数据的跨服务器共享。会话管理是Web应用中的关键部分,它允许用户在不同页面间保持状态,例如登录信息、...

    Redis和Memcache的区别总结

    1、Redis和Memcache都是将数据存放在内存中,都是内存数据库。不过memcache还可用于缓存其他东西,例如图片、视频等等; 2、Redis不仅仅支持简单的k/v类型的数据,同时还提供list,set,hash等数据结构的存储; 3...

    memcache、redis、tair性能对比测试报告

    总结来说,本测试报告提供了一套详细的性能对比,揭示了memcache、redis和tair在不同工作场景下的优劣。对于选择合适的缓存解决方案,开发者可以根据自身需求,如数据量、并发需求以及操作类型等因素,参考这些测试...

    memcache&redis构建缓存服务器.pdf

    在构建缓存服务器的过程中,Memcached和Redis是两个重要的高性能分布式内存缓存系统,它们的使用可以显著提升Web应用的响应速度和扩展性。以下是详细介绍这两个系统的知识内容。 首先,RDBMS(关系型数据库管理系统...

    php5.3 memcache和redis.dll

    windows下PHP5.3的memcache和redis.dll memcache客户端也在里面了,亲测可用。

    windowsLinux下memcache 和Redis 配置文件 php5.0-7.0

    在实际应用中,为了充分利用memcache和Redis,你需要考虑如何选择合适的缓存策略,如LRU(最近最少使用)、LFU(最不经常使用)等。同时,还要注意监控和调整缓存大小,避免内存溢出或资源浪费。另外,确保正确处理...

    ehcache memcache redis 差异

    本文将深入探讨三种常见的缓存系统:Ehcache、Memcached和Redis,分析它们之间的差异,以便于选择最适合特定业务场景的解决方案。 Ehcache是一款广泛应用于Java环境中的开源分布式缓存系统。它最初设计为本地内存...

    设计模式之PHP项目应用——单例模式设计Memcache和Redis操作类源码

    1)程序功能:单例模式设计Memcache和Redis操作类,采用PHP编写。 2)程序详解地址:http://blog.csdn.net/clevercode/article/details/46410055。 3)原创作品,出自"CleverCode的博客",分类为《设计模式之PHP项目...

    memcache redis tair 性能测试报告

    【性能测试报告概述】 ...tair在各种场景下的性能都较为稳定,但在高并发和大数据量操作时不如redis和memcache。这些结果对于选择合适的缓存解决方案具有指导意义,具体选择应考虑应用的具体需求和工作负载特征。

    memcache、redis、tair性能对比测试报告.docx

    该测试报告主要对比分析了三种流行的分布式缓存系统——memcache、redis和tair在不同条件下的性能表现,以供选择适合特定需求的缓存解决方案。测试场景涵盖了单机环境和分布式环境,关注点在于缓存数据的设置和获取...

    Redis、Memcache、MongoDB区别

    1、里面包含Redis、MongoDB、Memcache相关的学习文档 2、对这三者有比较详细的应用场景告之,并描述出了三者之间区别 3、提供JAVA连接Redis常见问题的解决方案 4、对MongoDB的特性有专门文档作描述 5、对于新手而言...

    Overlord是哔哩哔哩基于Go语言编写的memcache和redis&cluster

    Overlord是哔哩哔哩基于Go语言编写的memcache和redis&cluster的代理及集群管理功能,致力于提供自动化高可用的缓存服务解决方案。 Go语言(也称为Golang)是由Google开发的一种静态强类型、编译型的编程语言。它...

    PHP4.3 mongo memcache solr redis.dll扩展包.zip 以及配置方法

    5. 配置数据库连接:对于每个扩展,需要配置连接参数,如MongoDB的主机名、端口,memcache和redis服务器的地址,以及Solr的URL。这可以通过代码实现,也可以通过ini配置文件。 6. 开始编程:现在,你可以使用PHP4.3...

    php memcache redis.dll

    Memcache更简单,仅支持基本的键值对存储,而Redis则提供更丰富的数据结构,如字符串、哈希表、列表、集合和有序集合,同时支持事务、发布/订阅、持久化等功能。 在实际项目中,选择Memcache还是Redis取决于具体...

    php apache mysql memcache redis mongodb

    :“php5.4.26 apache mysql memcache redis mongodb整套环境配置用到的包”提示了具体使用的软件版本,这是一个用于搭建开发或测试环境的打包文件,包含了PHP5.4.26、Apache、MySQL、Memcache、Redis和MongoDB的...

    16.memcache&redis构建缓存服务器.学习笔记整理分享给需要的同学

    16.memcache&redis构建缓存服务器.学习笔记整理分享给需要的同学

Global site tag (gtag.js) - Google Analytics