Ehcache vs Memcached
Ehcache: The standard embedded JVM cache, with heap, off-heap and disk tiers and optional Terracotta clustering. Memcached: The original multi-threaded, dead-simple distributed memory cache for key-value blobs.
key differences
- Memcached is built for larger datasets (≤ 1 PB) than Ehcache (≤ 100 GB).
- Horizontal scaling is addon in Ehcache and manual in Memcached.
- Transactions: Ehcache offers limited ACID; Memcached offers none.
- Only Ehcache has durable persistence.
- Ehcache can run embedded in your application process.
choose ehcache for
- +Hibernate second-level cache
- +Spring @Cacheable method caching
- +Local caching of reference data in JVM services
best at · Cache, Embedded
choose memcached for
- +Read-through caching of database query results
- +Rendered page and fragment caching
- +Session storage when losing sessions is acceptable
- +Very large, horizontally sharded look-aside cache tiers
best at · Cache, Sessions
Ehcache vs Memcached: FAQ
What is the difference between Ehcache and Memcached?
Ehcache: The standard embedded JVM cache, with heap, off-heap and disk tiers and optional Terracotta clustering. Memcached: The original multi-threaded, dead-simple distributed memory cache for key-value blobs. Memcached is built for larger datasets (≤ 1 PB) than Ehcache (≤ 100 GB). Horizontal scaling is addon in Ehcache and manual in Memcached. Transactions: Ehcache offers limited ACID; Memcached offers none.
When should I choose Ehcache over Memcached?
Choose Ehcache for hibernate second-level cache, spring @Cacheable method caching and local caching of reference data in JVM services. Choose Memcached for read-through caching of database query results; rendered page and fragment caching; and session storage when losing sessions is acceptable.
Is Ehcache or Memcached more popular?
Memcached ranks #25 on the WhichDB Score (50.6/100) and Ehcache ranks #188 (17.6/100). Popularity is not fit: check the requirements that matter for your project.
Are Ehcache and Memcached open source?
Yes. Ehcache is open source. License: Apache License 2.0. Yes. Memcached is open source. License: BSD 3-Clause.