Ema has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/393227 )
Change subject: WIP: cache: size-based cutoff for exp caching policy ...................................................................... WIP: cache: size-based cutoff for exp caching policy - Limit the exp caching policy to Varnish 5 (v4 has no HFM) - Unconditionally return HFM for exp - Add a size-based HFP cutoff Bug: T144187 Change-Id: I5a326e128153af9e3f21840eaf53164a4eb586d6 --- M modules/varnish/templates/vcl/wikimedia-common.inc.vcl.erb M modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb 2 files changed, 18 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/27/393227/1 diff --git a/modules/varnish/templates/vcl/wikimedia-common.inc.vcl.erb b/modules/varnish/templates/vcl/wikimedia-common.inc.vcl.erb index a4d32e0..bcbd68c 100644 --- a/modules/varnish/templates/vcl/wikimedia-common.inc.vcl.erb +++ b/modules/varnish/templates/vcl/wikimedia-common.inc.vcl.erb @@ -447,6 +447,22 @@ return (deliver); <%- end -%> } + +<% if @varnish_version == 5 && @vcl_config.fetch("admission_policy", "nhw") == "exp" -%> + // XXX: this should most likely not be defined here, as the exp policy need + // to be applied on the frontend layer only + + // We want to apply the "exp" caching policy only to objects with CL below + // 10M (but present). The "exp" caching policy is defined in + // wikimedia-frontend.vcl.erb, but the logic below can not be added there + // because by returning HFP we would skip calling various VCL subroutines such + // as cluster_fe_backend_response_early. + if (beresp.status == 200 && bereq.http.X-CDIS == "miss" + && std.integer(beresp.http.Content-Length, 0) >= 1024 * 1024 * 10) { + // HFP + return(pass(120s)); + } +<%- end -%> } // call just before wm_common_xcache_deliver, but only in vcl_deliver, not vcl_synth diff --git a/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb b/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb index a3f5826..7ea9c50 100644 --- a/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb +++ b/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb @@ -2,7 +2,7 @@ vcl 4.0; -<% if @vcl_config.fetch("admission_policy", "nhw") == "exp" -%> +<% if @varnish_version == 5 && @vcl_config.fetch("admission_policy", "nhw") == "exp" -%> // Includes for Exp cache admission policy, admission probability exponentially // decreasing with size. See vcl_backend_response. T144187 C{ @@ -358,7 +358,7 @@ if (beresp.status == 503 && bereq.retries == 0 && bereq.method ~ "^(GET|HEAD|OPTIONS|PUT|DELETE)$") { return(retry); } -<% if @vcl_config.fetch("admission_policy", "nhw") == "exp" -%> +<% if @varnish_version == 5 && @vcl_config.fetch("admission_policy", "nhw") == "exp" -%> if (beresp.status == 200 && bereq.http.X-CDIS == "miss") { C{ const struct gethdr_s hdr = { HDR_BERESP, "\017Content-Length:" }; @@ -391,12 +391,8 @@ // If admission test succeeds, mark as uncacheable if (admissionprob < urand) { - <%- if @varnish_version == 5 -%> // HFM with ttl=67 to avoid stalling VRT_l_beresp_ttl(ctx,67); - <%- else -%> - VRT_l_beresp_ttl(ctx,0); - <%- end -%> VRT_l_beresp_uncacheable(ctx,1); } } -- To view, visit https://gerrit.wikimedia.org/r/393227 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5a326e128153af9e3f21840eaf53164a4eb586d6 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Ema <e...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits