StackShareStackShare
Follow on
StackShare

Discover and share technology stacks from companies around the world.

Follow on

© 2025 StackShare. All rights reserved.

Product

  • Stacks
  • Tools
  • Feed

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  1. Stackups
  2. Application & Data
  3. Databases
  4. Databases
  5. Ehcache vs Memcached

Ehcache vs Memcached

OverviewDecisionsComparisonAlternatives

Overview

Memcached
Memcached
Stacks7.9K
Followers5.7K
Votes473
GitHub Stars14.0K
Forks3.3K
Ehcache
Ehcache
Stacks616
Followers160
Votes4
GitHub Stars2.1K
Forks585

Ehcache vs Memcached: What are the differences?

Introduction

Ehcache and Memcached are both popular caching solutions used by developers to improve the performance and scalability of their applications. While they serve a similar purpose, there are key differences between the two.

  1. Architecture: Ehcache is an in-memory caching solution that can be used as a standalone cache or integrated with other frameworks. It stores data in the Java heap memory of the application. On the other hand, Memcached is a distributed caching system that stores data in a separate process or server, allowing it to be shared across multiple applications or servers.

  2. Data Persistence: Ehcache provides the option to persist cached data on disk or in a database. This allows data to be retained even after the application restarts. In contrast, Memcached does not provide built-in data persistence and relies on the principle of ephemeral caching, where data is temporary and not guaranteed to be available after a restart.

  3. Scalability: Memcached is designed for high scalability and can be easily deployed in a distributed manner. It supports a distributed hash table (DHT) algorithm for data partitioning and replication across multiple Memcached servers. In comparison, Ehcache is primarily designed for single-server deployments and does not have built-in support for distributed caching.

  4. API and Language Support: Ehcache is tightly integrated with the Java programming language and provides a comprehensive set of APIs for Java developers. It also offers support for some other JVM languages like Scala and Groovy. In contrast, Memcached has a language-agnostic API, making it accessible to developers using languages such as PHP, Python, Ruby, and more.

  5. Consistency and Synchronization: Ehcache provides strong consistency guarantees and supports synchronization mechanisms like locking and transactional caching. This ensures data integrity in multi-threaded or clustered environments. Memcached, on the other hand, does not provide built-in mechanisms for consistency and synchronization, as it primarily focuses on high-speed caching operations.

  6. Community and Ecosystem: Ehcache has a strong community support and is widely used in Java-based enterprise applications. It is actively maintained and backed by companies like Terracotta. Memcached also has a large community and is popular among developers working with web and distributed systems. It is open-source and has numerous client libraries available for various programming languages.

In Summary, Ehcache and Memcached differ in their architecture, data persistence, scalability, language support, consistency guarantees, and community/ecosystem. These differences make them suitable for different use cases and development environments.

Share your Stack

Help developers discover the tools you use. Get visibility for your team's tech choices and contribute to the community's knowledge.

View Docs
CLI (Node.js)
or
Manual

Advice on Memcached, Ehcache

Francisco José
Francisco José

Software engineer

Nov 9, 2019

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...

9.89k views9.89k
Comments

Detailed Comparison

Memcached
Memcached
Ehcache
Ehcache

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.

Ehcache is an open source, standards-based cache for boosting performance, offloading your database, and simplifying scalability. It's the most widely-used Java-based cache because it's robust, proven, and full-featured. Ehcache scales from in-process, with one or more nodes, all the way to mixed in-process/out-of-process configurations with terabyte-sized caches.

Statistics
GitHub Stars
14.0K
GitHub Stars
2.1K
GitHub Forks
3.3K
GitHub Forks
585
Stacks
7.9K
Stacks
616
Followers
5.7K
Followers
160
Votes
473
Votes
4
Pros & Cons
Pros
  • 139
    Fast object cache
  • 129
    High-performance
  • 91
    Stable
  • 65
    Mature
  • 33
    Distributed caching system
Cons
  • 2
    Only caches simple types
Pros
  • 1
    Easy setup
  • 1
    Container doesn't have to be running for local tests
  • 1
    Way Faster than Redis and Elasticache Redis
  • 1
    Simpler to run in testing environment

What are some alternatives to Memcached, Ehcache?

MongoDB

MongoDB

MongoDB stores data in JSON-like documents that can vary in structure, offering a dynamic, flexible schema. MongoDB was also designed for high availability and scalability, with built-in replication and auto-sharding.

MySQL

MySQL

The MySQL software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.

PostgreSQL

PostgreSQL

PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions.

Microsoft SQL Server

Microsoft SQL Server

Microsoft® SQL Server is a database management and analysis system for e-commerce, line-of-business, and data warehousing solutions.

SQLite

SQLite

SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files. A complete SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file.

Cassandra

Cassandra

Partitioning means that Cassandra can distribute your data across multiple machines in an application-transparent matter. Cassandra will automatically repartition as machines are added and removed from the cluster. Row store means that like relational databases, Cassandra organizes data by rows and columns. The Cassandra Query Language (CQL) is a close relative of SQL.

MariaDB

MariaDB

Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry. MariaDB is designed as a drop-in replacement of MySQL(R) with more features, new storage engines, fewer bugs, and better performance.

RethinkDB

RethinkDB

RethinkDB is built to store JSON documents, and scale to multiple machines with very little effort. It has a pleasant query language that supports really useful queries like table joins and group by, and is easy to setup and learn.

ArangoDB

ArangoDB

A distributed free and open-source database with a flexible data model for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript extensions.

InfluxDB

InfluxDB

InfluxDB is a scalable datastore for metrics, events, and real-time analytics. It has a built-in HTTP API so you don't have to write any server side code to get up and running. InfluxDB is designed to be scalable, simple to install and manage, and fast to get data in and out.

Related Comparisons

Bootstrap
Materialize

Bootstrap vs Materialize

Laravel
Django

Django vs Laravel vs Node.js

Bootstrap
Foundation

Bootstrap vs Foundation vs Material UI

Node.js
Spring Boot

Node.js vs Spring-Boot

Liquibase
Flyway

Flyway vs Liquibase