Page MenuHomePhabricator

option to keep plain, uncompressed html files files when using $wgUseGzip
Closed, DeclinedPublicFeature

Description

Could you please also add $wgUseKeepUncompressed or so? This is a feature request related to $wgUseGzip and $wgUseBrotli (T254743)

Quote compression (bold is mine)

If compression is enabled, the cache files are saved as .html.gz. Browsers that advertise support for gzip in their Accept-Encoding field will be given the gzipped version straight; for those browsers that don't, we unzip the data on the fly and send them the plaintext.

That sounds rather inefficient having to keep uncompromising. Also needless CPU exhaution DDOS vector.

When $wgUseKeepUncompressed is set, keep the plain .html file.

When using all three optoins

  • $wgUseGzip
  • $wgUseBrotli (T254743)
  • $wgUseKeepUncompressed

The following would happen:

  • /var/www/w/cache/Documentation.html
  • /var/www/w/cache/Documentation.html.gz
  • /var/www/w/cache/Documentation.html.br

Then one could use nginx gzip_static on;, brotli_static on (or the apache equivalents).

Alternatively $wgUseDeletePlainHtml could be considered or drooping deletion of uncompressed file by default.

Event Timeline

Aklapper changed the subtype of this task from "Task" to "Feature Request".Jun 12 2020, 7:53 AM

The vast majority of browsers and other HTTP clients accept compressed responses. It is better for end-user performance and cheaper for your server to optimise for the compressed than for the uncompressed scenario.

If CPU exhaution is a genuine concern, then I recommend letting a cache proxy store both variants. See https://www.mediawiki.org/wiki/Manual:Performance_tuning for various recommendations in that area.

When use Nginx to cache HTTP responses, I recommend you turn off MediaWiki's File cache as is it will not add significant value and could also make things worse ($wgUseFileCache = false;). Letting Nginx handle compression makes sense indeed. MediaWiki allows clients/proxies to disable compression automatically, but there exists also the $wgDisableOutputCompression = true; option to make it easier.