zoukankan      html  css  js  c++  java
  • 关于redis与memcached区别(转载自stackoverflow)

    转载自:http://stackoverflow.com/questions/10558465/memcached-vs-redis

    Updated 10/9/2014

    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, entered the Release Candidate stage. Previously when looking at memcached vs redis you might have been inclined to choose 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.

     

  • 相关阅读:
    扒皮下音悦台的“返回顶部”图标效果
    扒皮下京东首页楼层图标的动画效果实现方式
    总结前端开发中的一些特殊规范
    用JS识别各版本浏览器
    各主流浏览器内核介绍
    CSS百分比定义高度的冷知识
    图解js中常用的判断浏览器窗体、用户屏幕可视区域大小位置的方法
    从一个简单例子来理解js引用类型指针的工作方式
    仿京东首页商品分类底部色标随鼠标移动特效
    知乎网首页一个延时交互的小思路
  • 原文地址:https://www.cnblogs.com/lintong/p/4383236.html
Copyright © 2011-2022 走看看