SF Varnish Meetup June 1st, 2015
Varnish:How we do itSF Varnish MeetupJune 1st 2015Matt Robenolt
View Slide
Hello< me irl
Lead Operations Engineer
First Generationedge(haproxy)shieldapp(python)Failover
Why this sucked
Duplicate routing logicComplex Caching logicWasteD RAM for failoverWhy this sucked
Failover == lose all cacheVarnish held cache rulesHard to add/remove backendsWhy this sucked
Current Generationedgeshieldapp(python)
Why this is rad
App owns all caching logicUnified request routingUtilize RAM from all nodesWhy this is rad
If-Modified-SinceVary on cookie valuesLess deploys to VarnishWhy this is rad
60,00015,00013,000Caching funneledgeshieldapp
edgeshieldappOnion skin view
edgeshieldapprecvpassfetchhitmisshashsynthfetchdelivererrorOnion skin view
edge 60,000 req/s
edgeClosest to users (geographically)Absorbs most trafficBlocks abuse60,000 req/s
edgeMakes decisions for shieldSort querystrings (boltsort/std)Promote cookies to headers60,000 req/s
Cookies.as headers?Why?
Vary: Cookie-sessionid
shield 15,000 req/s
shieldRouting to app backendsServe stale content (grace)Do If-modified-Since15,000 req/s
shieldParse response cache rulesBackend healthchecksStore lots of content15,000 req/s
application 13,000 req/s
applicationDeclare response cache rulesRespond to If-modified-Since13,000 req/s
WaiT.13,000 req/s still?
46%53%1%App Response Codes
46%53%1%App Response Codes304200
miss Hit Hit/updateIf-Modified-SinceHit/IMS200 OK 200 OK 304 Not Modifiedv1 v2
tl;dr60k req -> 7k at appEvery request thru VarinshComplex logic written once
tl;drApp has complete controlWe still <3 haproxyEach layer worth deep dive
We’re hiring peoplewho hate comptuers.disqus.com/jobs
Check it.HTTP for Great Goodspeakerdeck.com/mattrobenolt/http-for-great-goodCheating Your Way to#webscalespeakerdeck.com/mattrobenolt/cheating-your-way-to-webscale
Questions? I have answers.^github.com/mattrobenolt@mattrobenoltsome