BBlack has submitted this change and it was merged.

Change subject: cache_upload: two-hit-wonder experiment, hit/2+
......................................................................


cache_upload: two-hit-wonder experiment, hit/2+

Bug: T144187
Change-Id: Ibe2fcfba9005f72295c179b63a3fe67f7048395d
---
M modules/varnish/templates/upload-frontend.inc.vcl.erb
1 file changed, 21 insertions(+), 0 deletions(-)

Approvals:
  BBlack: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/varnish/templates/upload-frontend.inc.vcl.erb 
b/modules/varnish/templates/upload-frontend.inc.vcl.erb
index 2ced015..8e4e2c9 100644
--- a/modules/varnish/templates/upload-frontend.inc.vcl.erb
+++ b/modules/varnish/templates/upload-frontend.inc.vcl.erb
@@ -77,6 +77,27 @@
        }
        <%- end -%>
 
+       // Two-hit-wonder experiment: if the immediate backend does not indicate
+       // hit/2 or higher, deliver the object as normal but do not create a new
+       // cache entry of any kind.  We start caching in the frontend when an
+       // object is accessed for the 3rd time across all frontends in this DC.
+       // The ttl>3600 check is to ensure we don't apply this to any short-TTL
+       // edge cases we're not thinking of.
+       // We probably want to either back out this experiment later or improve
+       // on it, especially re: multiplying backend requests when warming a
+       // cold cache.
+       if (beresp.status == 200
+            && beresp.http.X-Cache-Int !~ " hit/([2-9]|[0-9]{2,})$"
+            && beresp.ttl > 3600s) {
+               set beresp.ttl = 0s;
+               <%- if @varnish_version4 -%>
+               set beresp.uncacheable = true;
+               return (deliver);
+               <%- else -%>
+               return (hit_for_pass);
+               <%- end -%>
+       }
+
        // hit-for-pass objects >= 1MB size
        if (std.integer(beresp.http.Content-Length, 1048576) >= 1048576 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
                set beresp.http.X-CDIS = "pass";

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe2fcfba9005f72295c179b63a3fe67f7048395d
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Ema <e...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to