superzanti / ServerSync

Sync files between client and server for Minecraft Forge
GNU General Public License v3.0
163 stars 26 forks source link

Add gzip compression for files #204

Open rheimus opened 4 years ago

rheimus commented 4 years ago

Easy enough to zip up files before transfer.

Thoughts:

Compression should be

Hadyark commented 4 years ago

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.

rheimus commented 4 years ago

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.

rheimus commented 4 years ago

We could probably combine this with saving the generated file manifest, could do something basic like a last modified check to cache bust files.