14
SF 2015 NYC 2015 Varnish Custom Statistics Analyzing traffic in real time

Varnish custom statistics

Embed Size (px)

Citation preview

Page 1: Varnish custom statistics

SF 2015NYC 2015

Varnish Custom StatisticsAnalyzing traffic in real time

Page 2: Varnish custom statistics

Why gather data in Varnish?

● Everything flows through Varnish

● Logging doesn’t slow down

Varnish

● Flexible metrics

Page 3: Varnish custom statistics

VCS features

● Aggregates data from Varnish

● Time series database

● Real time statistics engine

● JSON format output data

Page 4: Varnish custom statistics

VCS features (cont’d)

● VCL driven, define your own

metrics

● Flexible query API

● Regex search

Page 5: Varnish custom statistics

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

Page 6: Varnish custom statistics

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

Page 7: Varnish custom statistics

VCS advanced usage

● A/B testing

● Tracking conversion rates

● Measuring click-through rate

● Counting users per video stream

Page 8: Varnish custom statistics

Click-through rate

front page hits = viewsreferrers from front page =

clicksclicks / views = click-through

rate

Page 9: Varnish custom statistics

Traffic sources

Page 10: Varnish custom statistics

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); }}

Page 11: Varnish custom statistics

{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

}]

}

Page 12: Varnish custom statistics

What’s new in VCS

● Zero configuration mode

● New UI

Page 13: Varnish custom statistics

VCS Demo

http://vcsdemo.varnish-software.com

Page 14: Varnish custom statistics

Thank you!Thank you!