BBlack has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/256705

Change subject: cache_misc: stream and hit-for-pass for large objects
......................................................................

cache_misc: stream and hit-for-pass for large objects

Bug: T104004
Change-Id: I7d3137942d75a841706c46c252dd7a4ba5c97bcc
---
M templates/varnish/misc-backend.inc.vcl.erb
M templates/varnish/misc-common.inc.vcl.erb
M templates/varnish/misc-frontend.inc.vcl.erb
3 files changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/05/256705/1

diff --git a/templates/varnish/misc-backend.inc.vcl.erb 
b/templates/varnish/misc-backend.inc.vcl.erb
index 3adfcb2..f5831ff 100644
--- a/templates/varnish/misc-backend.inc.vcl.erb
+++ b/templates/varnish/misc-backend.inc.vcl.erb
@@ -73,3 +73,7 @@
     call errorpage;
     return (deliver);
 }
+
+sub vcl_fetch {
+    call misc_fetch_large_objects;
+}
diff --git a/templates/varnish/misc-common.inc.vcl.erb 
b/templates/varnish/misc-common.inc.vcl.erb
index 16e4eb4..7e9c38f 100644
--- a/templates/varnish/misc-common.inc.vcl.erb
+++ b/templates/varnish/misc-common.inc.vcl.erb
@@ -18,3 +18,14 @@
         return (pass);
     }
 }
+
+sub misc_fetch_large_objects {
+    // Stream objects >= 1MB in size
+    if (std.integer(beresp.http.Content-Length, 1048576) >= 1048576 || 
beresp.http.Content-Length ~ "^[0-9]{8}") {
+        set beresp.do_stream = true;
+        // hit_for_pass on objects >= 10MB in size (no effect on backends that 
always (pass) anyways)
+        if (std.integer(beresp.http.Content-Length, 10485760) >= 10485760 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
+            return (hit_for_pass);
+        }
+    }
+}
diff --git a/templates/varnish/misc-frontend.inc.vcl.erb 
b/templates/varnish/misc-frontend.inc.vcl.erb
index 9bd233b..27cb341 100644
--- a/templates/varnish/misc-frontend.inc.vcl.erb
+++ b/templates/varnish/misc-frontend.inc.vcl.erb
@@ -43,3 +43,7 @@
     call errorpage;
     return (deliver);
 }
+
+sub vcl_fetch {
+    call misc_fetch_large_objects;
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/256705
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7d3137942d75a841706c46c252dd7a4ba5c97bcc
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to