I’ve written a small tool to warm-up HTTP caches, e.g. services like nginx.
Comparison to other tools
While most tools in this area are designed to apply a certain load to a web server (often for a specified time), cache_warmer is designed to explicitly
GET a set of URLs from a file to warm-up a cache.
Warm-up URLs from a file using a mobile User-Agent
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
cache_warmer is multi-threaded. Threads can be specified using the
It uses keep-alive by default, which can be disabled with
It supports a
--captcha-string option, which scans the response body for certain strings to detect (and abort) when running into e.g. captchas.
If your URL file only contains the base URL (like
/products/spoons), you can add a
--base-uri to prepend the host and scheme, e.g.
Outgoing requests can be toned down with the
X-Cache-Status header support
If your backend sets the
X-Cache-Status header, you’ll get nice statistics about your cache hit rates at the end of the run.
When using nginx, such a header can be added with this directive:
cache_warmer defaults to a Googlebot-like User-Agent. You can use the corresponding mobile User-Agent when specifying the
In case you need a custom User-Agent, you can set it with
Attach arbitrary cookies with the
--cookie key=value option.
1 2 3 4 5