Varnish Caching

3,216
-1

Published on

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.

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,216
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
49
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Varnish Caching

  1. 1. Varnish CacheClever Software for Making HTTP Applications FasterRefresh Cambridge 6th July 2011gareth rushgrove | morethanseven.net http://www.flickr.com/photos/jkannenberg/541059011
  2. 2. Gareth Rushgrovegareth rushgrove | morethanseven.net
  3. 3. Work at freeagentcentral.comgareth rushgrove | morethanseven.net
  4. 4. Blog at morethanseven.netgareth rushgrove | morethanseven.net
  5. 5. Currate devopsweekly.comgareth rushgrove | morethanseven.net
  6. 6. www.varnish-cache.orggareth rushgrove | morethanseven.net
  7. 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 fly. Official blurbWhat is Varnish?gareth rushgrove | morethanseven.net http://www.flickr.com/photos/exalthim/3597210568
  8. 8. - Cache- Reverse Proxy- HTTP AcceleratorSeriously, what is Varnish?gareth rushgrove | morethanseven.net
  9. 9. A Story of HTTP Cachinggareth rushgrove | morethanseven.net http://www.flickr.com/photos/solsken/62924477
  10. 10. Database Web Server Web TrafficA Typical Appgareth rushgrove | morethanseven.net
  11. 11. Database Web ServerMore Traffic == Slower responsesgareth rushgrove | morethanseven.net
  12. 12. Database Web ServerEventually...gareth rushgrove | morethanseven.net
  13. 13. Database Web Server VarnishAdd Varnishgareth rushgrove | morethanseven.net
  14. 14. Database Web Server VarnishDeal with more trafficgareth rushgrove | morethanseven.net
  15. 15. An Examplegareth rushgrove | morethanseven.net http://www.flickr.com/photos/jonrb/3735816042
  16. 16. www.vagrantbox.esgareth rushgrove | morethanseven.net
  17. 17. memcached Gunicorn Varnish Nginx Database memcached Gunicorn Varnish NginxOverengineering for Fun
  18. 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 Configurationgareth rushgrove | morethanseven.net
  19. 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% 164 66% 174 75% 183 80% 188 90% 207 95% 231 98% 246 99% 279 100% 408 (longest request)Without Varnishgareth rushgrove | morethanseven.net
  20. 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% 92 66% 101 75% 107 80% 111 90% 120 95% 129 98% 141 99% 149 100% 157 (longest request)With Varnishgareth rushgrove | morethanseven.net
  21. 21. Questions?gareth rushgrove | morethanseven.net http://flickr.com/photos/psd/102332391/

×