[BlueOnyx:11884] Re: Varnish Cache

Michael Stauber mstauber at blueonyx.it
Wed Jan 2 15:26:16 -05 2013


Hi all,

I agree with Chris and Ken and usually it's a good idea to try to
optimize the site and to maybe also do some Apache, PHP and MySQL
related tweaks first. That way you usually get more of a performance
gain than to directly throw a cache or accelerator at the problem.

But yes, while this also applies to Varnish Cache, it's also a bit out
of the ordinary. It's a pure HTTP cache that can also act as load
balancer. Aside from that it also has some nice features that other
cache's don't typically have.

Take on example:

Say there is a client with a Typo 3 page. He expects 5000 simultaneous
visitors, which click on links every 10 seconds. That boils down to 500
GET requests per second.

Imagine how well a "stock" Apache will handle that on an average
machine. It'll cook, even if the Typo 3 site and the server is fully
optimized for best results.

The cache isn't the problem either. The problem is how well the cache
handles the expiry of the cached data and what it does when the expiry
happens.

Say you use a reverse Squid proxy instead of Varnish. At first the 500
GET requests are served out of the proxy. But once the content expires,
you'll have 500 squid proxy instances refreshing their data. Boom, there
goes your Apache. It'll get hammered again.

Varnish instead just notices that the cache expires. It pauses all
requests briefly, makes one call to the "real" server and then (when it
has updated it's internal cache) starts serving the data to the clients
again.

That is pretty awesome.

What's more? You can define different TTL's for various parts of the
content you serve. Like you cache the menu structure of your Typo 3 page
for X minutes, the header and footer for Y minutes and the "meat" of the
page for Z minutes.

Varnish also has a pretty good and easy handling for load balancing with
checks to see what data sources (i.e.: real web servers) are available
and how fast they react. If one of the data sources is no longer good
and slow to respond, it'll be ignored for a configurable amount of time.

So yes, I can imagine usage cases where a Varnish Cache is a pretty nice
thing to have.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list