Varnish Caching

  • View
    2.856

  • Download
    0

Embed Size (px)

DESCRIPTION

Lightning talk given at Refresh Cambridge event on 6th July 2011. Very quick introduction to where an HTTP Caching solution fits in, and an example of the kind of effect it could have on performance.

Text of Varnish Caching

  • 1. Varnish CacheClever Software for Making HTTP Applications FasterRefresh Cambridge 6th July 2011gareth rushgrove | morethanseven.net http://www.ickr.com/photos/jkannenberg/541059011

2. Gareth Rushgrovegareth rushgrove | morethanseven.net 3. Work at freeagentcentral.comgareth rushgrove | morethanseven.net 4. Blog at morethanseven.netgareth rushgrove | morethanseven.net 5. Currate devopsweekly.comgareth rushgrove | morethanseven.net 6. www.varnish-cache.orggareth rushgrove | morethanseven.net 7. Varnish Cache is an open source, state of the art web application accelerator. You install it on your web server and it makes your website y. Ofcial blurbWhat is Varnish?gareth rushgrove | morethanseven.net http://www.ickr.com/photos/exalthim/3597210568 8. - Cache- Reverse Proxy- HTTP AcceleratorSeriously, what is Varnish?gareth rushgrove | morethanseven.net 9. A Story of HTTP Cachinggareth rushgrove | morethanseven.net http://www.ickr.com/photos/solsken/62924477 10. Database Web Server Web TrafcA Typical Appgareth rushgrove | morethanseven.net 11. DatabaseWeb ServerMore Trafc == Slower responsesgareth rushgrove | morethanseven.net 12. Database Web ServerEventually...gareth rushgrove | morethanseven.net 13. Database Web Server VarnishAdd Varnishgareth rushgrove | morethanseven.net 14. DatabaseWeb Server VarnishDeal with more trafcgareth rushgrove | morethanseven.net 15. An Examplegareth rushgrove | morethanseven.net http://www.ickr.com/photos/jonrb/3735816042 16. www.vagrantbox.esgareth rushgrove | morethanseven.net 17. memcached Gunicorn Varnish Nginx Databasememcached Gunicorn Varnish NginxOverengineering for Fun 18. backend default {.host = "127.0.0.1";.port = "8000";}sub vcl_recv {if (req.request == "GET" && req.http.cookie) {return(lookup);}}sub vcl_fetch {if (beresp.ttl < 180s) {set beresp.ttl = 180s;}esi;if (beresp.http.Set-Cookie) {return(deliver);}}Varnish Congurationgareth rushgrove | morethanseven.net 19. ab -c 10 -n 400 http://www.vagrantbox.es/Requests per second: 59.63 [#/sec] (mean)Percentage of the requests served within a certain time (ms)50%16466%17475%18380%18890%20795%23198%24699%279 100%408 (longest request)Without Varnishgareth rushgrove | morethanseven.net 20. ab -c 10 -n 400 http://www.vagrantbox.es/Requests per second: 103.61 [#/sec] (mean)Percentage of the requests served within a certain time (ms)50% 9266%10175%10780%11190%12095%12998%14199%149 100%157 (longest request)With Varnishgareth rushgrove | morethanseven.net 21. Questions?gareth rushgrove | morethanseven.net http://ickr.com/photos/psd/102332391/