Varnish custom statistics

Preview:

Citation preview

SF 2015NYC 2015

Varnish Custom StatisticsAnalyzing traffic in real time

Why gather data in Varnish?

● Everything flows through Varnish

● Logging doesn’t slow down

Varnish

● Flexible metrics

VCS features

● Aggregates data from Varnish

● Time series database

● Real time statistics engine

● JSON format output data

VCS features (cont’d)

● VCL driven, define your own

metrics

● Flexible query API

● Regex search

Why is VCS useful?

● Real time as in now

● Debugging

● Granular Varnish statistics

● Business needs are questions■How is your site used?

■Varnish object visibility

■Metrics/data driven business

VCS

How it is deployed?

VarnishCache

VCSProbe

shared mem

VarnishCache

VCSProbe

shared mem

VarnishCache

VCSProbe

shared mem

VCSProbe

shared mem

VarnishCache

VCSProbe

shared mem

VarnishCache

VCS UI

ZeroMQ

JSON API

VCS advanced usage

● A/B testing

● Tracking conversion rates

● Measuring click-through rate

● Counting users per video stream

Click-through rate

front page hits = viewsreferrers from front page =

clicksclicks / views = click-through

rate

Traffic sources

sub vcl_recv {

# use VCS to track devices if (req.http.User-Agent ~ "android") { std.log("vcs-key:UserAgents/android"); } else if (req.http.User-Agent ~ "iphone") { std.log("vcs-key:UserAgents/iphone"); } if (req.http.User-Agent ~ "ipad") { std.log("vcs-key:UserAgents/ipad"); } if (req.http.User-Agent ~ "windows") { std.log("vcs-key:UserAgents/windows"); } else { # magic regex to get device set req.http.X-Device = regsub( … ); std.log("vcs-key:UserAgents/" + req.http.X-Device); }}

{some/key/here: [

{timestamp: "2015-05-26T20:25:00+00",n_req: 1690,n_req_uniq: 0,n_miss: 1363,avg_restarts: 0,n_bodybytes: 4401506,ttfb_miss: 0.022031,ttfb_hit: 0.000097,resp_1xx: 0,resp_2xx: 496,resp_3xx: 429,resp_4xx: 765,resp_5xx: 0

},{

timestamp: "2015-05-26T20:24:00+00",n_req: 1302,n_req_uniq: 0,n_miss: 1065,avg_restarts: 0,n_bodybytes: 3663912,ttfb_miss: 0.031299,ttfb_hit: 0.000093,resp_1xx: 0,resp_2xx: 415,resp_3xx: 301,resp_4xx: 586,resp_5xx: 0

}]

}

What’s new in VCS

● Zero configuration mode

● New UI

VCS Demo

http://vcsdemo.varnish-software.com

Thank you!Thank you!

Recommended