BlueMap icon indicating copy to clipboard operation
BlueMap copied to clipboard

Use Brotli instead of Gzip

Open C0Nd3Mnd opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. Considering that Brotli is supported by every major browser these days you should consider using it instead of Gzip. In my tests, JSON generated by BlueMap compressed around 20-30% smaller with Brotli compared to Gzip. This saves a lot of space storing the map and a lot of bandwidth serving the map.

Describe the solution you'd like Enable Brotli compression to replace Gzip compression by default (or make it configurable). Existing Gzip files should either be unzipped and compressed again with Brotli as some sort of migration, or the map should re-render again (both are fine probably).

C0Nd3Mnd avatar Oct 26 '21 06:10 C0Nd3Mnd

The problem with brotli compression is that browsers only accept brotli from an encrypted connection. By default BlueMap-Maps are http. There is already a fork that implemented brotli: https://github.com/NikitaCartes/BlueMap/tree/feature/brotli And adding brotli-compression as an option is also already on the TODO. It will not be default tho :)

TBlueF avatar Oct 26 '21 07:10 TBlueF

I'm very much interested in this as I'm using a proxy server with TLS anyway.

BuIlDaLiBlE avatar Dec 19 '22 03:12 BuIlDaLiBlE

I'm using a proxy server with TLS anyway

Most likely, you can use the proxy server to re-compress it as Brotli (not ideal but it should work).

What I personally did is use no compression with an external webserver (Bluemap puts it on a MySQL server and an external webserver gets it from there). Then just let the external webserver handle compression.
It does take a bit more resources so you'll have to think for yourself whether it's worth it. You could move the external webserver + MySQL on a completely different box to not have your Minecraft server deal with it (and disable the built-in webserver completely).
That also means your map will remain available while your server goes down (eg. maintenance) but is a more complex setup (I'd be willing to write a guide on this if demand is there).

Please do note that png files don't always compress that well. afbeelding afbeelding

I would agree that the option for Brotli in the plugin itself would be nice but it can be achieved right now as well, just... with some extra steps.

FinlayDaG33k avatar Aug 16 '23 23:08 FinlayDaG33k