diff options
author | Kristian Lyngstol <kly@kly.no> | 2016-10-22 15:16:15 +0200 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2016-10-22 15:16:15 +0200 |
commit | 57c27b76fbb7dcc7477a573585f1366364bccdd6 (patch) | |
tree | 899015b37b5ac5d76740235e0702b567673b4d3e /extras/misc/varnish.vcl | |
parent | d47cef0006b93680a8b5b77772154d7644ebbcb5 (diff) |
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.
Diffstat (limited to 'extras/misc/varnish.vcl')
-rw-r--r-- | extras/misc/varnish.vcl | 18 |
1 files changed, 18 insertions, 0 deletions
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; |