Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Zstd/LZ4 support for region files (1.16 edition) #4715

Closed
wants to merge 4 commits into from

Conversation

egg82
Copy link
Contributor

@egg82 egg82 commented Nov 1, 2020

Zstd using zstd-jni: https://github.com/luben/zstd-jni
LZ4 using lz4-java: https://github.com/lz4/lz4-java

Added new command-line option, --forceWrite, which will forcibly write the chunk/flush to disk regardless of whether or not the chunk has actually changed in a --forceUpgrade.
New compression only happens when a chunk is saved, so running a --forceUpgrade AND --forceWrite may be desirable.

New (hidden) config option for the compression method to use.
There's a new option in PaperConfig (compression level) for Zstd which defaults to 6.
There's a new option in PaperConfig (compression level) for Zlib which defaults to 5.
Added a getter to the API to retrieve the current chunk compression method being used.

Since the patch hooks Mojang's versioning system for new compression methods, it
should be internally consistent, easily-updatable, and reversible with a --forceUpgrade AND a --forceWrite.

This will likely conflict with plugins and programs expecting region files to be compressed using the current standard.

Supercedes #2814

TODO

  • Test it to make sure it actually works
  • Add API getter for current Zstd dict version
  • Update to 1.16.4 (why does this happen every time?)

@egg82 egg82 requested a review from a team as a code owner November 1, 2020 09:49
@Proximyst Proximyst linked an issue Nov 5, 2020 that may be closed by this pull request
@schoentoon
Copy link
Contributor

Perhaps it'd be an idea to have another look at #4192 around the same time this would get merged, as these two pull requests would likely benefit from each other.

@Titaniumtown
Copy link
Contributor

Titaniumtown commented Dec 18, 2020

Bump! Is there going to be more work on this any time soon? I'm really excited for the benefits a patch like this could add! Of course no rush, you guys are doing this for free of course, but I just wanted to check in and see if anything has changed :)

@egg82
Copy link
Contributor Author

egg82 commented Dec 29, 2020

School took priority so it had to wait a bit, but yes there's plans to finish that to-do list.

@Titaniumtown
Copy link
Contributor

@egg82 ok! Keep us posted :)

@mechoriet
Copy link
Contributor

@egg82
maybe a not related question to this pr,
how much more compression/storage benefit will you get compared to extra processing power needed if any?
how would one generate a dict for zstd for minecraft? if there is a example for that, that your willing to share?
context:
looking into making a gamemode with lots of small worlds that could possibly benefit from this to lower storage and/or network traffic

thanks for the response in advance

@Proximyst
Copy link
Contributor

You can generate the dictionary using the guide on another repository of his: https://github.com/egg82/CompressionTests

@egg82
Copy link
Contributor Author

egg82 commented Jan 8, 2021

Closed in favor of #5029

@egg82 egg82 closed this Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Disabling world compression
5 participants