Add gzip compression for files
rheimus opened this issue ยท 3 comments
Easy enough to zip up files before transfer.
Thoughts:
- Do we pre zip files during server startup or zip files on the fly when requested by clients ๐ค
- If we pre zip files we probably need to set up cache / cache busting etc
- Probably make it configurable for what file types get compressed, or if compression is on at all.
Compression should be
- User configurable (types of files to compress if any)
- Cacheable, we don't want to have to recompress every transfer
- Automatic, neither server nor client should need to manually work with compressed files
I don't think this feature is interesting.
I have compressed my packmods (RLCraft) with WinRar and I have a compression rate of 92% (160mo -> 150mo). If I compress only .jar files, for example the 2 biggest mods in the pack I go from 91mb to 90mb.
This gain in size is to the detriment of the client's compression / decompression time.
Compressing and Decompressing gzip is pretty fast, the server-side would most likely only compress once at startup anyway and only recompress files if they change.
ServerSync is not restricted to jar files, many users sync text-based files that benefit greatly from compression.
Some very dodgy numbers here ๐: https://docs.google.com/spreadsheets/d/1ni19pnle73FCxE-GJsEOVRBcczRO3yoJNCDWLhwpauc/edit?usp=sharing
The basic test above already shows a 10% decrease in traffic over the socket, which is a win in my books, the slow part of server sync is really the transfer speed.