Techtalk Varnish

download Techtalk Varnish

of 47

  • date post

    22-Apr-2015
  • Category

    Technology

  • view

    1.138
  • download

    4

Embed Size (px)

description

 

Transcript of Techtalk Varnish

  • 1. Varnish voor webbouwers Openminds TechTalk 6 juli 2011 www.openminds.be Managed hosting solutionsWednesday 6 July 2011
  • 2. SOFTWAREWednesday 6 July 2011
  • 3. Varnish Noorse tabloid Verdens Gang - 1.0 in 2006 - 3.0 enkele dagen terug Snelheidswinst site: 10x - 300x caching HTTP reverse proxyWednesday 6 July 2011
  • 4. normaal Client Internetlijn Server DatacentrumWednesday 6 July 2011
  • 5. klassieke proxy Trage Internetlijn Client Client Proxy Server Client DatacentrumWednesday 6 July 2011
  • 6. reverse proxy Client Snelle lijnen Client Client Proxy Server DatacentrumWednesday 6 July 2011
  • 7. reverse proxy Client Snelle lijnen Client Client Proxy Server Server Server DatacentrumWednesday 6 July 2011
  • 8. caching reverse proxy Client Caching Client Client Server Server Proxy Server DatacentrumWednesday 6 July 2011
  • 9. Waarom? Serverbelasting omlaag Veel snellere site-ervaring Veel meer hits/s afwerken met zelfde hardware Ademruimte voor serverhitsWednesday 6 July 2011
  • 10. Wednesday 6 July 2011
  • 11. Caching Identieke aanvraag - identiek antwoord We houden het volledige antwoord bij Headers Data (HTML)Wednesday 6 July 2011
  • 12. Identieke aanvraag Identiek antwoordWednesday 6 July 2011
  • 13. Aanvraag GET / HTTP/1.1 Host: www.openminds.be User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20100101 Firefox/5.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en,en-us;q=0.7,nl-be;q=0.3 Accept-Encoding: gzip, deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Connection: keep-alive Cookie: __utma=121817557.1268321880.1308719392.1309764385.1309861948.8; __utmz=121817557.1308719392.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _openminds_session=BAh7CToQX2NzcmZfdG9rZW4iMXBqNFJyS1RKRUxqNVpSNXBRb2R4N1RTN25GY1RSaVhKQVZscXR6alBqRU09 Og9zZXNzaW9uX2lkIiU3YzEwNjI4YjQ2ODhmMGE4OWE2NTRhYjU2ZmU1NTgxNyIMdXNlcl9pZGkKIgpmbGFzaElDOidBY3Rpb25Db25 0cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewY6C25vdGljZSIkWW91ciBwYWdlIGhhcyBiZWVuIHNhdmVkIGJlbG93LgY6CkB1c2Vkew Y7CFQ%3D--f8439d4c16ca7b72afebf9ae05f150700d6ee0e1; __utmc=121817557; __utmb=121817557.2.10.1309861948Wednesday 6 July 2011
  • 14. Aanvraag GET / HTTP/1.1 Host: www.openminds.be User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20100101 Firefox/5.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en,en-us;q=0.7,nl-be;q=0.3 Accept-Encoding: gzip, deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Connection: keep-alive Cookie: __utma=121817557.1268321880.1308719392.1309764385.1309861948.8; __utmz=121817557.1308719392.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _openminds_session=BAh7CToQX2NzcmZfdG9rZW4iMXBqNFJyS1RKRUxqNVpSNXBRb2R4N1RTN25GY1RSaVhKQVZscXR6alBqRU09 Og9zZXNzaW9uX2lkIiU3YzEwNjI4YjQ2ODhmMGE4OWE2NTRhYjU2ZmU1NTgxNyIMdXNlcl9pZGkKIgpmbGFzaElDOidBY3Rpb25Db25 0cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewY6C25vdGljZSIkWW91ciBwYWdlIGhhcyBiZWVuIHNhdmVkIGJlbG93LgY6CkB1c2Vkew Y7CFQ%3D--f8439d4c16ca7b72afebf9ae05f150700d6ee0e1; __utmc=121817557; __utmb=121817557.2.10.1309861948Wednesday 6 July 2011
  • 15. Aanvraag Host URI (pad, method/verb, version) Cookies Encoding / compressieWednesday 6 July 2011
  • 16. AntwoordHTTP/1.1 200 OKServer: nginx/0.5.32Date: Tue, 05 Jul 2011 10:52:36 GMTContent-Type: text/html; charset=utf-8Connection: keep-aliveX-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.2.15Etag: "25ec477310b3f81f097d5f6f3b5824f6"X-Rack-Cache: stale, invalid, storeX-Content-Digest: af41dfcde5cfeaa55717261890560d56595be969X-Runtime: 2559Cache-Control: max-age=300, publicAge: 21Set-Cookie:_openminds_session=BAh7CToQX2NzcmZfdG9rZW4iMXBqNFJyS1RKRUxqNVpSNXBRb2R4N1RTN25GY1RSaVhKQVZscXR6alBqRU09Og9zZXNzaW9uX2lkIiU3YzEwNjI4YjQ2ODhmMGE4OWE2NTRhYjU2ZmU1NTgxNyIMdXNlcl9pZGkKIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewY6C25vdGljZSIkWW91ciBwYWdlIGhhcyBiZWVuIHNhdmVkIGJlbG93LgY6CkB1c2VkewY7CFQ%3D--f8439d4c16ca7b72afebf9ae05f150700d6ee0e1; path=/; HttpOnlyContent-Length: 11565Status: 200X-server: pro-005X-Proxy: fosforWednesday 6 July 2011
  • 17. Wat cachen? Statische content (images, css, js, ...) Hoofdpaginas / hoofdpaden Zoveel mogelijk Versie per variatie bijhouden (encoding...) GET/HEADWednesday 6 July 2011
  • 18. Wednesday 6 July 2011
  • 19. Wat niet cachen admin/management secties paginas die zich aanpassen aan user (logged in, winkelmandje, proelen, ...) 404 / 500 / ... POST/PUT/DELETEWednesday 6 July 2011
  • 20. Cookies Sessie - antwoord niet cachen Google - doet er op zich niet toe Variaties - antwoord wel cachebaarWednesday 6 July 2011
  • 21. Stel... ... dat de webapplicatie dit meegeeft browser-cache hints worden gestuurd meestal foutWednesday 6 July 2011
  • 22. Cache-ControlHTTP/1.1 200 OKServer: nginx/0.5.32Date: Tue, 05 Jul 2011 10:52:36 GMTContent-Type: text/html; charset=utf-8Connection: keep-aliveX-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.2.15Etag: "25ec477310b3f81f097d5f6f3b5824f6"X-Rack-Cache: stale, invalid, storeX-Content-Digest: af41dfcde5cfeaa55717261890560d56595be969X-Runtime: 2559Cache-Control: max-age=300, publicAge: 21Set-Cookie:_openminds_session=BAh7CToQX2NzcmZfdG9rZW4iMXBqNFJyS1RKRUxqNVpSNXBRb2R4N1RTN25GY1RSaVhKQVZscXR6alBqRU