From 57c27b76fbb7dcc7477a573585f1366364bccdd6 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Sat, 22 Oct 2016 15:16:15 +0200 Subject: Big broken push of graphing - Adds latency graphs everywhere, even where they shouldn't be. For PoC. - Fixes a frontend leakage of handlers - Adds a nasty way of getting latency-data into graphite (needs to be improved) - Adds working graphite integration in varnish - Adds config for graphite Lots of things broken here, but it's a half-decent start. --- extras/misc/varnish.vcl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'extras/misc') diff --git a/extras/misc/varnish.vcl b/extras/misc/varnish.vcl index 492f001..b10a640 100644 --- a/extras/misc/varnish.vcl +++ b/extras/misc/varnish.vcl @@ -7,6 +7,11 @@ backend default { .port = "80"; } +backend graphite { + .host = "gondul-graphite"; + .port = "80"; +} + sub vcl_recv { if (req.url ~ "^/where" || req.url ~ "^/location") { set req.url = "/api/public/location"; @@ -27,6 +32,10 @@ sub vcl_recv { return (pass); } + if (req.url ~ "/render") { + set req.backend_hint = graphite; + } + # Brukes ikke. Cookies er for nubs. unset req.http.Cookie; @@ -48,6 +57,15 @@ sub vcl_backend_response { if (beresp.http.x-ban) { ban("obj.http.x-url ~ " + beresp.http.x-ban); } + if (bereq.url ~ "/render") { + # Graphite claims "no-cache", which is dumb. + # Let's blindly cache for 5+10s. Which is 10000 times better. + set beresp.http.Cache-Control = "max-age=5s"; + unset beresp.http.Pragma; + set beresp.uncacheable = false; + set beresp.grace = 10s; + set beresp.ttl = 5s; + } if (beresp.status != 200) { set beresp.uncacheable = false; set beresp.ttl = 5s; -- cgit v1.2.3