Frontcache for Java web applications
Add a servlet filter, set response headers, and Frontcache caches the fragments of a page. The one block that has to be live no longer forces the whole page to render.
<fc:include> fragments resolve in parallel, each with its own lifetime and invalidation tags.median response time, measured on a replay of 100,000 production requests — cache on vs. off, same app, same machine; 6.1× the throughput at the same concurrency. How it was measured
$200, credited toward a Cacheability Assessment or Pro. Servlet filter or reverse proxy, on your own pages.
How It Works
Frontcache caches nothing until your application says so. Cacheability is a property of the response, declared by the code that knows what the response means — not a rule list someone has to maintain in a separate tier.
A page becomes a shell plus <fc:include> fragments. Each fragment is its
own request with its own TTL: the header and the catalog can live for an hour, the
recommendations for five minutes, and the mini-cart not at all. Fragments that miss are
fetched in parallel and stitched into the response.
Invalidate by URL pattern or by tag — one product update clears every fragment tagged
product-42, on every page that includes it.
Requirements: filter mode needs Java 25 and
Jakarta EE 10 (Servlet 6.0) — Spring Boot 3.x. On an older JVM or a
javax.servlet container, run Frontcache as a standalone reverse proxy in front of
the app instead: it carries its own runtime, and your app only has to set response headers.
Builds for Java 17 and 21 are on our roadmap.
repositories {
mavenCentral()
maven { url = 'https://repo.eternita.co/maven2' }
}
dependencies {
implementation 'org.frontcache:frontcache-core:2.12.0'
implementation 'org.frontcache:frontcache-agent:2.12.0'
}
Gradle; Maven works the same way. Configuration comes from a
FRONTCACHE_HOME directory, shipped as frontcache-core-2.12.0-home.zip.
@Bean
FilterRegistrationBean<FrontcacheFilter> frontcacheFilter() {
var reg = new FilterRegistrationBean<>(new FrontcacheFilter());
reg.addUrlPatterns("/example/*");
reg.setName("FrontcacheFilter");
reg.setOrder(1);
return reg;
}
Spring Boot registration. A plain web.xml
<filter> mapping works too.
<%@ taglib uri="http://frontcache.org/core" prefix="fc" %>
<fc:component maxage="1h" tags="catalog|product-42" />
<fc:include url="/common/header.jsp" />
<fc:include url="/store/product-details-42" />
<fc:include url="/account/mini-cart" /> <%-- sets no maxage: always live --%>
Not JSP? Any controller can set the same thing as headers:
x-frontcache-component-maxage: 1h and
x-frontcache-component-tags: catalog|product-42.
Coming From a Retired Cache?
Fragment caching inside a Java application used to be the app server’s job. Those products are legacy or gone; the JSP and Spring MVC applications that relied on them are still in production.
Servlet and JSP fragment caching inside the app server, configured in
cachespec.xml and tied to WebSphere. Frontcache keeps the in-process model and
the fragment-level invalidation — as tags — on any Jakarta servlet container.
JSP tag-based fragment caching, abandoned around 2007. <fc:component>
and <fc:include> play the same role, with per-fragment TTLs, tags, and
parallel resolution of includes.
A filter that caches whole responses — such as Ehcache’s page-caching filter — has to skip any page with one personal block on it. Caching fragments instead is what lets those pages cache at all.
Extend It in Java
Since 2.13.0 a Frontcache node runs plugins: Java code, built against an Apache-2.0 plugin API
and tested with a public testkit. A plugin can react to what happened (a rule matched, the
origin failed), serve a page of its own under /fc-x/, run in the background, or
add a condition your guard rules can use — !ext:geo:country=DE,FR.
It ships as a jar in the node’s plugins/ directory, enabled by name and
pinned by its SHA-256. A plugin that fails to start is a plugin that is absent: the node
starts without it. The Pro features are plugins on the same API.
dependencies {
compileOnly 'org.frontcache:frontcache-plugin-api:2.13.0'
testImplementation 'org.frontcache:frontcache-plugin-testkit:2.13.0'
}
# src/main/resources/META-INF/frontcache-plugin.properties
id = geo
class = com.example.GeoPlugin
version = 1.0.0
plugin-api = 1
kinds = decide
The testkit runs your plugin in-process with the node’s own checks: its manifest, start/stop/start, and every condition it adds — never throwing, and within its time budget.
Measured, With the Method
A replay of 100,000 real production requests against a live app, run twice back to back: once with the cache on, once with it switched off. Same app, same machine, same request stream, byte-identical responses.
hobbyray.com, a site we operate. The mechanism generalizes; the exact multiplier does not.
98.7% is that replay’s working set — a hot set by construction. Over the site’s full 681k-request log the same harness measures about 66.7%. Yours will depend on your TTLs and traffic shape.
The worst case. p99 improved only 42% and the single slowest request got slower: the uncached remainder queues behind 6× the throughput. Size the origin for that fraction.
Five Minutes
Next Step
Start with 45 minutes with an engineer on your own JVM — $200, credited toward the Assessment, which replays your traffic against your app and tells you the hit ratio, the fragment plan, and the saving.