Use Brotli instead of Gzip
C0Nd3Mnd opened this issue ยท 5 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).
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 :)
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.
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.
With the new BlueMap 5 release, there is now the possibility to install BlueMap Native addons.
Brotli support was made as one such addon, by Blue himself!
https://github.com/BlueMap-Minecraft/BlueMapBrotli