17
Running with Scissors RTE.ie’s path to caching in Varnish Varnish Summit London 10th April 2014 John Moylan - http://8t8.eu

Running with scissors - RTE.ie's path to caching with Varnish

Embed Size (px)

DESCRIPTION

Running with Scissors - RTÉ's path to caching in Varnish I share how Varnish became RTÉ's preferred method for caching. I also walk attendees through how things are getting easier and more complex at the same time with Varnish, and why it is important to know what your systems are doing.

Citation preview

Page 1: Running with scissors - RTE.ie's path to caching with Varnish

Running with Scissors

RTE.ie’s path to caching in Varnish

Varnish Summit London 10th April 2014

John Moylan - http://8t8.eu

Page 2: Running with scissors - RTE.ie's path to caching with Varnish

RTÉ Digital

Page 3: Running with scissors - RTE.ie's path to caching with Varnish

PLATFORMS

Page 4: Running with scissors - RTE.ie's path to caching with Varnish

Started working with RTÉ.ie in 1999

The internet was a very different place

Page 5: Running with scissors - RTE.ie's path to caching with Varnish

In the beginning there was squid

Page 6: Running with scissors - RTE.ie's path to caching with Varnish

Squid V. Varnish

Lessons learned

Page 7: Running with scissors - RTE.ie's path to caching with Varnish

Then there was Varnish

Ram doesn’t come in 64MB sticks anymore.

Page 8: Running with scissors - RTE.ie's path to caching with Varnish

Then there was Varnish

Bandwidth isn’t counted in Mb/s anymore

● 2001 10Mb’s● 2014 40Gb/s

excluding CDN

409,600% Increase

Page 9: Running with scissors - RTE.ie's path to caching with Varnish

The great thing about mod_rewrite is it gives you all the configurability and flexibility of Sendmail. The downside to mod_rewrite is that it gives you all the configurability and flexibility of Sendmail.''

-- Brian Behlendorf Apache Group

With Great Power Comes Responsibility

Page 10: Running with scissors - RTE.ie's path to caching with Varnish

The great thing about VCL is it gives you all the configurability and flexibility of Sendmail. The downside to VCL is that it gives you all the configurability and flexibility of Sendmail.''

-- John MoylanRTÉ Digital

With Great Power Comes Responsibility

Page 11: Running with scissors - RTE.ie's path to caching with Varnish

Scope

#don't cache ajax requests

if (req.http.X-Requested-With == "XMLHttpRequest") { return (pass); }

Whoops! Scope

Page 12: Running with scissors - RTE.ie's path to caching with Varnish

Scope

# don't cache authenticated sessions if (req.http.Cookie && req.http.Cookie ~ "(wordpress_|PHPSESSID)") { return(pass); }

Whoops Scope

Page 13: Running with scissors - RTE.ie's path to caching with Varnish

Lessons learned

1. Scope special conditions properly2. GET’s and HEADS no longer work

for checking cache issues

Third party web app developers:Please don’t break the webGET’s should not have side effects(and while I’m on my soapbox, please use proper status codes)

Page 14: Running with scissors - RTE.ie's path to caching with Varnish

Old School Monitoring

RRDToolRPS, Bandwidth, pagefaults, Hit Ratio, FD’s, CPU, MemoryGrep’ing, cut’ing, sort’ing origin server logs

Plus GET’s are normally GET’s. Cache is dumb

Page 15: Running with scissors - RTE.ie's path to caching with Varnish

Varnish Monitoring

VCSVACVarnishlogVarnishstatNewrelicPyVarnish

Page 16: Running with scissors - RTE.ie's path to caching with Varnish

Varnish Monitoring

PyVarnishhttps://github.com/redsnapper8t8/pyvarnish

Page 17: Running with scissors - RTE.ie's path to caching with Varnish

Thanks for listening

Questions?