Content Cache
When your website receives traffic, every page request triggers work: the web server processes the request, the application executes code, and the database runs queries. For a simple page, this might take a few hundred milliseconds. Under heavy load, these small delays add up quickly, and your servers can become overwhelmed.
A content cache sits between your visitors and your application boxes. It stores copies of your web pages and serves them directly to visitors, without touching your application at all. This means your site can handle many more visitors while using fewer resources. The cache also acts as a shield: even if one of your application boxes goes down, the cache continues serving pages from memory.
A load balancer works alongside the cache to distribute incoming requests across multiple application boxes. If one box becomes slow or stops responding, the load balancer routes traffic to the healthy boxes instead. This ensures your site stays available even when individual components fail.
At freistilbox, we use Varnish to provide both content caching and load balancing. This combination is key to achieving the high performance and availability that your sites need.
Varnish
Varnish is a reverse proxy that sits in front of your web application. When a request comes in, Varnish checks if it already has a cached copy of the response. If it does, it serves that copy immediately—typically in just a few milliseconds. If not, Varnish forwards the request to one of your application boxes, stores the response in its cache, and then sends it to the visitor.
Varnish makes caching decisions based on HTTP headers. It respects standard cache control headers from your application, so you maintain full control over what gets cached and for how long. For content that changes frequently, you can set short cache lifetimes. For static assets like images and stylesheets, you can cache them for longer periods.
On freistilbox Pro and freistilbox Enterprise plans, Varnish distributes requests across multiple application boxes. It sends regular health checks to monitor each box and stops routing traffic to any box that fails to respond correctly. This means your visitors never see error pages from a failed box—they get routed to a working one instead.