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


+ 1

+ 1

+ 1

Memcached vs Redis vs guava: What are the differences?

Key Differences between Memcached and Redis and Guava

Memcached and Redis are both popular in-memory data stores that are commonly used for caching and improving the performance of web applications. Guava, on the other hand, is a Java library that provides various utility classes and functions. While all three have caching capabilities, there are some key differences between them.

  1. Data Structure Support: Redis and Guava provide more extensive data structure support compared to Memcached. Redis includes data structures such as strings, hashes, lists, sets, and sorted sets, making it more suitable for complex data manipulation. Guava, on the other hand, offers data structures like collections, caching, and functional types that are highly efficient.

  2. Persistence: Redis has built-in persistence options, allowing data to be stored on disk and loaded back into memory upon restart. This feature makes Redis more suitable for use cases that require persistence and data durability. Memcached, on the other hand, does not provide built-in persistence and is generally used for caching purposes only. Guava does not offer persistence as it is mainly focused on providing utility functions.

  3. Scalability: Redis and Memcached are designed to be highly scalable and can be easily scaled horizontally by adding more servers to the cache cluster. Memcached is a distributed cache that allows data to be spread across multiple nodes, while Redis supports replication and sharding for scalability. Guava, being a Java library, does not provide built-in scalability features and is limited by the resources of a single Java Virtual Machine (JVM).

  4. Support for Multiple Programming Languages: Memcached and Redis are both designed to support multiple programming languages and can be accessed from various application frameworks. Redis supports clients for different programming languages, including Java, C++, Python, and more. Guava, being a Java library, is primarily targeted for Java developers and does not have direct support for other programming languages.

  5. Cache Eviction Policies: Redis and Guava both provide flexible cache eviction policies, allowing control over how data is evicted from the cache in case it becomes full. Redis offers a variety of eviction options, including LRU (Least Recently Used), LFU (Least Frequently Used), and more. Guava also provides different eviction policies like LRU, LFU, and size-based eviction. Memcached, however, does not provide built-in eviction policies and relies on application logic to manage cache eviction.

  6. Additional Features: Redis provides additional features such as pub/sub messaging, transactions, and Lua scripting, making it more suitable for use cases requiring real-time messaging and atomic operations. Guava, being a utility library, offers various additional features like functional programming support, string manipulation utilities, and concurrency primitives.

In Summary, Memcached and Redis are powerful in-memory data stores with key differences in data structure support, persistence, scalability, programming language support, cache eviction policies, and additional features. Guava, on the other hand, is a Java library focused on providing utility classes and functions.

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
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of guava
Pros of Memcached
Pros of Redis
  • 5
    Interface Driven API
  • 1
    Easy to setup
  • 139
    Fast object cache
  • 129
  • 91
  • 65
  • 33
    Distributed caching system
  • 11
    Improved response time and throughput
  • 3
    Great for caching HTML
  • 2
  • 886
  • 542
    Super fast
  • 513
    Ease of use
  • 444
    In-memory cache
  • 324
    Advanced key-value cache
  • 194
    Open source
  • 182
    Easy to deploy
  • 164
  • 155
  • 121
  • 42
  • 40
    High Availability
  • 35
    Data Structures
  • 32
    Very Scalable
  • 24
  • 22
    Great community
  • 22
  • 19
    "NoSQL" key-value data store
  • 16
  • 13
  • 11
    Sorted Sets
  • 10
  • 10
  • 9
    Async replication
  • 9
    BSD licensed
  • 8
  • 8
    Integrates super easy with Sidekiq for Rails background
  • 7
    Keys with a limited time-to-live
  • 7
    Open Source
  • 6
    Lua scripting
  • 6
  • 5
    Awesomeness for Free
  • 5
  • 4
  • 4
    Outstanding performance
  • 4
    Runs server side LUA
  • 4
    LRU eviction of keys
  • 4
    Feature Rich
  • 4
    Written in ANSI C
  • 4
  • 3
    Data structure server
  • 3
    Performance & ease of use
  • 2
    Dont save data if no subscribers are found
  • 2
    Automatic failover
  • 2
    Easy to use
  • 2
    Temporarily kept on disk
  • 2
  • 2
    Existing Laravel Integration
  • 2
    Channels concept
  • 2
    Object [key/value] size each 500 MB
  • 2

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
    • 15
      Cannot query objects directly
    • 3
      No secondary indexes for non-numeric data types
    • 1
      No WAL

    Sign up to add or upvote consMake informed product decisions

    - No public GitHub repository available -

    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), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams.

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

    Jobs that mention guava, Memcached, and Redis as a desired skillset
    Oakland, California, United States
    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 EC2C langMemcached+4
    Nov 20 2019 at 3:38AM


    Jun 6 2019 at 5:11PM


    What are some alternatives to guava, Memcached, and Redis?
    JavaScript is most known as the scripting language for Web pages, but used in many non-browser environments as well such as node.js or Apache CouchDB. It is a prototype-based, multi-paradigm scripting language that is dynamic,and supports object-oriented, imperative, and functional programming styles.
    Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
    GitHub is the best place to share code with friends, co-workers, classmates, and complete strangers. Over three million people use GitHub to build amazing things together.
    Python is a general purpose programming language created by Guido Van Rossum. Python is most praised for its elegant syntax and readable code, if you are just beginning your programming career python suits you best.
    jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML.
    See all alternatives