Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Varnish: How We Do It

Varnish: How We Do It

SF Varnish Meetup
June 1st, 2015

Ce86d68173d477a17396b5e611468f52?s=128

Matt Robenolt

June 01, 2015
Tweet

More Decks by Matt Robenolt

Other Decks in Technology

Transcript

  1. Varnish: How we do it SF Varnish Meetup June 1st

    2015 Matt Robenolt
  2. Hello < me irl

  3. Lead Operations Engineer

  4. First Generation edge (haproxy) shield app (python) Failover

  5. Why this sucked

  6. Duplicate routing logic Complex Caching logic WasteD RAM for failover

    Why this sucked
  7. Failover == lose all cache Varnish held cache rules Hard

    to add/remove backends Why this sucked
  8. Current Generation edge shield app (python)

  9. Why this is rad

  10. App owns all caching logic Unified request routing Utilize RAM

    from all nodes Why this is rad
  11. If-Modified-Since Vary on cookie values Less deploys to Varnish Why

    this is rad
  12. 60,000 15,000 13,000 Caching funnel edge shield app

  13. edge shield app Onion skin view

  14. edge shield app recv pass fetch hit miss hash synth

    fetch deliver error Onion skin view
  15. edge 60,000 req/s

  16. edge Closest to users (geographically) Absorbs most traffic Blocks abuse

    60,000 req/s
  17. edge Makes decisions for shield Sort querystrings (boltsort/std) Promote cookies

    to headers 60,000 req/s
  18. Cookies. as headers? Why?

  19. Vary: Cookie-sessionid

  20. shield 15,000 req/s

  21. shield Routing to app backends Serve stale content (grace) Do

    If-modified-Since 15,000 req/s
  22. shield Parse response cache rules Backend healthchecks Store lots of

    content 15,000 req/s
  23. application 13,000 req/s

  24. application Declare response cache rules Respond to If-modified-Since 13,000 req/s

  25. WaiT. 13,000 req/s still?

  26. 46% 53% 1% App Response Codes

  27. 46% 53% 1% App Response Codes 304 200

  28. miss Hit Hit/update If-Modified-Since Hit/IMS 200 OK 200 OK 304

    Not Modified v1 v2
  29. tl;dr 60k req -> 7k at app Every request thru

    Varinsh Complex logic written once
  30. tl;dr App has complete control We still <3 haproxy Each

    layer worth deep dive
  31. We’re hiring people who hate comptuers. disqus.com/jobs

  32. Check it. HTTP for Great Good speakerdeck.com/mattrobenolt/http-for-great-good Cheating Your Way

    to #webscale speakerdeck.com/mattrobenolt/cheating-your-way-to-webscale
  33. Questions? I have answers. ^ github.com/mattrobenolt @mattrobenolt some