jeudi 5 novembre 2015

How do you test Varnish configuration, or cache layer in general

How do you test your caching layer? (be it Varnish, Nginx/Apache, Fastly or any other product/service). Given the fact that caching is hard I've found surprisingly small amount of information on the topic on Internet. Currently I'm using PhpUnit to write 'unit' tests that follow certain scenarios:

  • set up initial parameters like HTTP headers, cookies, HTTP referrer, user agent,
  • execute (possibly multiple) HTTP requests,
  • check those requests for expected result (HTTP headers, cookies, presence or absence of certain HTML code),
  • check for expected response times,
  • verify that state of client doing the HTTP request is in sync with application (testing session object contents, database etc.)

I constantly add new tests to my test case and test caching layer on each change.

I've seen people using varnishtest to test Varnish but it seems to be greatly limited in what it can do (for example you can't test backend database to confirm that some state has been set)?

What's your strategy to test caching layer?

Aucun commentaire:

Enregistrer un commentaire