How long does it take for your website to load? Web performance is just as critical for small and medium-sized websites as it is for massive websites that receive tons of hits. Before you pour money and time into rewriting your code or replacing your infrastructure, first consider a reverse-caching proxy server like Varnish. With this practical book, you’ll learn how Varnish can give your website or API an immediate performance boost.
Varnish mimicks the behavior of your webserver, caches its output in memory, and serves the result directly to clients without having to access your webserver. If you’re a web developer familiar with HTTP, this book helps you master Varnish basics, so you can get up and running in no time. You’ll learn how to use the Varnish Configuration Language and HTTP best practices to achieve faster performance and a higher hit rate.
Understand how Varnish helps you gain optimum web performance
Use HTTP to improve the cache-ability of your websites, web applications, and APIs
Properly invalidate your cache when the origin data changes
Optimize access to your backend servers
Avoid common mistakes when using Varnish in the wild
Use logging and debugging tools to examine the behavior of Varnish
Chapter 1What Is Varnish Cache?
Why Does Web Performance Matter?
Where Does Varnish Fit In?
The Varnish Cache Open Source Project
How Does Varnish Work?
Caching Is Not a Trick
Chapter 2Go, Go, Go and Get Started!
What About TLS/SSL?
Chapter 3Varnish Speaks HTTP
Varnish Built-In VCL Behavior
Chapter 4The Varnish Configuration Language
Hooks and Subroutines
The execution flow
Backends and Health Probes
Access Control Lists
Varnish’s Built-In VCL
A Real-World VCL File
Chapter 5Invalidating the Cache
Caching for Too Long
Banning from the Command Line
Forcing a Cache Miss
Cache Invalidation Is Hard
Chapter 6Dealing with Backends
Chapter 7Improving Your Hit Rate
Do You Really Want to Cache Static Assets?
URL Blacklists and Whitelists
Decide What Gets Cached with Cache-Control Headers
Thijs Feryn is a technical evangelist at a Belgian webhosting company called Combell. His goal is to bring technology to the people and people to technology. He focuses on bridging the gap between code and infrastructure. Thijs is also involved in many open source communities and leads the PHPBenelux community. He speaks, listens, writes, codes, teaches, organizes and is above all very excited to be writing this book.