[mod_deflate] use brotli quality 5 by default

BROTLI_DEFAULT_QUALITY is 11, which may lead to a higher compression
ratio, but potentially at a cost of taking *many* multiples of the
time taken to compress at quality level 5.

x-ref:
  https://almanac.httparchive.org/en/2020/compression#fig-3
  https://blog.cloudflare.com/results-experimenting-brotli/
  https://blogs.akamai.com/2016/02/understanding-brotlis-potential.html
  https://expeditedsecurity.com/blog/nginx-brotli/
master
Glenn Strauss 2 years ago
parent 3f248f0900
commit a3603074c1

@ -452,7 +452,8 @@ static encparms * mod_deflate_parse_params(const array * const a, log_error_st *
params->gzip.strategy = Z_DEFAULT_STRATEGY;
#endif
#ifdef USE_BROTLI
params->brotli.quality = BROTLI_DEFAULT_QUALITY;
/* BROTLI_DEFAULT_QUALITY is 11 and can be *very* time-consuming */
params->brotli.quality = 5;
params->brotli.window = BROTLI_DEFAULT_WINDOW;
params->brotli.mode = BROTLI_MODE_GENERIC;
#endif
@ -1127,7 +1128,8 @@ static int stream_br_init(handler_ctx *hctx) {
? params->brotli.quality
: (p->conf.compression_level >= 0) /* 0 .. 11 are valid values */
? (uint32_t)p->conf.compression_level
: BROTLI_DEFAULT_QUALITY;
: 5;
/* BROTLI_DEFAULT_QUALITY is 11 and can be *very* time-consuming */
if (quality != BROTLI_DEFAULT_QUALITY)
BrotliEncoderSetParameter(br, BROTLI_PARAM_QUALITY, quality);

Loading…
Cancel
Save