Need advice about which tool to choose?Ask the StackShare community!


+ 1

+ 1

+ 1
Advice on guava, Memcached, and Redis
Francisco Jos茅 Casasaltas Perales
Needs advice

Hi guys! I need an in-memory key/value storage with a lifespan for each key What do you recommend me to use? I was thinking about using a ConcurrentHashMap, with a scheduled thread evicting keys when apply. In fact, it is a possibility due because the performance is not important. But, on the other side, I have considered using any library such as Memcached, Ehcache, guava...

See more
Replies (1)

Redis can do the same jobs as Memcached, ECache or any other im-memory caching tool and can do them better. - Redis can act as a cache as well. It can store key/value pairs too. In Redis, they can even be up to 512MB. - Redis is better documented than Memcached and ECached. - Supports many data types. (Strings, Hashes, Lists, Sets, Sorted Sets, Geo, Bitmap and HyperLogLog) - Redis provides pub/sub as well. - Redis can be scaled easily horizontally if needed using its own tool Redis Sentinel. - Wide variety of client libraries in almost every language.

See more
Decisions about guava, Memcached, and Redis
Matthew Evans

The obvious volatile memory choices were either Memcached or Redis. We eventually sided with Redis as it natively handled replication, and this replication fell under the PCI responsibility scope of AWS. This added duribility meant that if a redis node were to die, our downtime would be in the seconds, rather than 15 minutes which we would incur using Memcached

See more
Mark Harrison

The requirement was the classic "cache the results of a SQL query for a period of time."

While the Internet is full of "Redis is fuller featured" posts, the key issue for us was the actual performance. We discovered, in various stress scenario testing, that Memcached outperformed Redis for simple key-value retrieval dramatically (over twice as fast.) That's not to say that Redis is bad - we use that in other places where the requirements are more sophisticated than simple key/value retrieval.

See more
 This was roughly 4 years ago at this point. We had been using an old iteration of memcache on Windows as the data cache per server for while and had for whatever reason opted to store our session data (to which the application is heavily dependent) in App Fabric. App Fabric had come to EOL and we needed to move away from it. As a quick search showed throughput capacity to be higher and overall features of Redis were better we initially implemented it. The number of changes required were minimal and we were able to migrate away to a more resilient system pretty quickly.
 We hit a snag in that the implementation of the Redis session handler at that point only took a single IP so we had to do use keepalived and HAProxy to display the application consistently between master and slave failovers. This caused issues on occasion of dropped connections to the backend service. We upgraded our client and could put both members into our config files and it stopped timing out. We were all happy in this and it was (for it's own part) a significant upgrade. Generally performance was better for all pages. 
 We found however, that our application was serializing all requests and locking on the thread via session lock for a great many things and this caused us and our users considerable headaches on occasion. We found that the implementation of the couchbase session handler gave us the option of ignoring session write locks and not be required to rewrite dozens of pages to handle the no session requirement as the application was working fine without the need to be threadsafe. Though the maximum throughput was not as good compared to Redis the application performance was considerably better as a result of the change. The multi-master write was a big benefit and the cross data center replication was a nice thing to have as that would allow our users to remain logged in even across DataCenter fail-over events (praying that never happened). Overall we used that for session handling and chose to use couchbase (in a 2nd cluster) to handle memcache requests as that gave us greater capacity to handle larger objects more efficiently. 
 We are, all these years later, looking to move into the newer features of couchbase to give us more and better use of this product that really has been the answer to a bunch of the growing pains we experienced. Since the decision performance has not been on wild rides and stability has never been better. So I sing the praises of couchbase to anyone that will listen.
See more
Get Advice from developers at your company using Private StackShare. Sign up for Private StackShare.
Learn More
Pros of guava
Pros of Memcached
Pros of Redis
  • 5
    Interface Driven API
  • 1
    Easy to setup
  • 137
    Fast object cache
  • 128
  • 90
  • 65
  • 33
    Distributed caching system
  • 11
    Improved response time and throughput
  • 3
    Great for caching HTML
  • 2
  • 875
  • 535
    Super fast
  • 511
    Ease of use
  • 441
    In-memory cache
  • 321
    Advanced key-value cache
  • 190
    Open source
  • 179
    Easy to deploy
  • 163
  • 153
  • 120
  • 40
  • 39
    High Availability
  • 34
    Data Structures
  • 32
    Very Scalable
  • 23
  • 20
    Great community
  • 19
  • 17
    "NoSQL" key-value data store
  • 14
  • 12
  • 10
    Sorted Sets
  • 9
  • 8
    BSD licensed
  • 8
  • 7
    Async replication
  • 7
    Integrates super easy with Sidekiq for Rails background
  • 7
  • 6
    Open Source
  • 6
    Keys with a limited time-to-live
  • 5
  • 5
    Lua scripting
  • 4
    Awesomeness for Free!
  • 4
  • 3
    outstanding performance
  • 3
    Runs server side LUA
  • 3
  • 3
    LRU eviction of keys
  • 3
    Written in ANSI C
  • 3
    Feature Rich
  • 3
  • 2
    Data structure server
  • 2
    Performance & ease of use
  • 1
    Existing Laravel Integration
  • 1
    Automatic failover
  • 1
    Easy to use
  • 1
    Object [key/value] size each 500 MB
  • 1
  • 1
    Channels concept
  • 1
  • 1
    Temporarily kept on disk
  • 1
    Dont save data if no subscribers are found
  • 0

Sign up to add or upvote prosMake informed product decisions

Cons of guava
Cons of Memcached
Cons of Redis
    Be the first to leave a con
    • 2
      Only caches simple types
    • 14
      Cannot query objects directly
    • 2
      No secondary indexes for non-numeric data types
    • 1
      No WAL

    Sign up to add or upvote consMake informed product decisions

    What is guava?

    The Guava project contains several of Google's core libraries that we rely on in our Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth.

    What is Memcached?

    Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.

    What is Redis?

    Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

    Need advice about which tool to choose?Ask the StackShare community!

    What companies use guava?
    What companies use Memcached?
    What companies use Redis?

    Sign up to get full access to all the companiesMake informed product decisions

    What tools integrate with guava?
    What tools integrate with Memcached?
    What tools integrate with Redis?

    Sign up to get full access to all the tool integrationsMake informed product decisions

    Blog Posts

    Dec 22 2020 at 9:26PM


    Amazon EC2CMemcached+4
    Nov 20 2019 at 3:38AM


    Jun 6 2019 at 5:11PM


    What are some alternatives to guava, Memcached, and Redis?
    Java 8
    It is a revolutionary release of the world鈥檚 no 1 development platform. It includes a huge upgrade to the Java programming model and a coordinated evolution of the JVM, Java language, and libraries. Java 8 includes features for productivity, ease of use, improved polyglot programming, security and improved performance.
    A library for composing asynchronous and event-based programs by using observable sequences for the Java VM.
    It tailors your application for GraalVM and HotSpot. Amazingly fast boot time, incredibly low RSS memory (not just heap size!) offering near instant scale up and high density memory utilization in container orchestration platforms like Kubernetes. We use a technique we call compile time boot.
    It is a modern server-side Java template engine for both web and standalone environments. It is aimed at creating elegant web code while adding powerful features and retaining prototyping abilities.
    It is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.
    See all alternatives