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.

     

  • 相关阅读:
    c 的内存分配与释放原则: 通常应遵循“谁malloc,谁free”的原则。
    总算知道怎样从ImageMagick生成的数据转换成HICON: MagickGetImageBlob & LookupIconIdFromDirectoryEx
    收藏:Non-direct与direct ByteBuffer区别
    java NIO 直接与非直接缓冲区
    [收藏]:[算法]LRU和LFU的区别
    异步IO的并发能力:backlog的配置很重要
    ByteBuffer: 当由一个byte[]来生成一个固定不变的ByteBuffer时,使用ByteBuffer.wrap(byte[]);
    ByteBuffer的allocate与allocateDirect2013-01-11
    Windows完成端口与Linux epoll技术简介
    Java并发——Fork/Join框架与ForkJoinPool
  • 原文地址:https://www.cnblogs.com/lintong/p/4383236.html
Copyright © 2011-2022 走看看