Ehcache vs Varnish Cache
Ehcache
ehcache.orgVarnish Cache
varnish.orgSide by side
| Figure | Ehcache | Varnish Cache |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | Yes | — |
| Linux | — | Yes |
| API | Yes | — |
| Self-hosted | Yes | Yes |
| Plans published | 3 | 1 |
| Spec score · Caching Software | 8.5 (#4) | 7.3 (#16) |
| Purpose | Ehcache is an open-source, standards-based Java cache that boosts performance, offloads databases, and simplifies scalability. | Varnish Cache is a reverse caching proxy that serves cached responses from memory and proxies other requests to origin servers. |
| Support | Ehcache documentation directs users with unanswered questions to its support forums. | The project points users to Discord, Stack Overflow, and LinkedIn, and says commercial support is available through Varnish Software. |
Plans
In their own words
Ehcache
Ehcache is a free, open-source Java caching library for keeping application data, database results, and web pages available to applications. It is designed to improve performance, reduce database work, and support scaling. It can run inside an application or in mixed in-process and out-of-process deployments, including terabyte-sized caches. Ehcache 3 supports off-heap storage, including configurations that rely on it exclusively, and is compatible with the JCache API defined by JSR-107. The project describes Spring Caching and Hibernate integration through javax.cache support. Configuration is available through XML or the Java API, and data can be shared between application instances using Terracotta clustered storage. Ehcache 3.11 also allows caches to share resources. It supports JTA-managed XA transactions, including two-phase commit and crash recovery, but documents Read-Committed as the only supported isolation level and Bitronix 2.1.4 as the only tested transaction manager. Ehcache 3.11 requires Java 8 or later and is the last release line to support Java 8. The license is Apache 2.0.
Varnish Cache
Varnish Cache is a reverse caching proxy for Linux and self-hosted deployments. It serves cached responses from memory and sends other requests to origin servers. Its caching policy is defined in Varnish Configuration Language (VCL), which compiles to native code. Cached objects follow standard HTTP cache headers and leave the cache when they expire. Varnish supports TLS termination within the process and TLS connections to dynamic origin backends. It includes varnishlog for structured logging and varnishstat for metrics, and offers official container images and a Kubernetes Helm chart. Installation guidance covers Debian, Ubuntu, Red Hat Enterprise Linux, and compatible distributions. Varnish modules add functions callable from VCL. Its security guide describes controls at the command-line, CLI, VCL, and HTTP request levels. The free plan costs nothing. One limit to account for: Varnish avoids caching data when it cannot determine that doing so is safe, and applications may need configuration changes to reach a high cache hit rate.