Minecolonies & Core-Rework-Refactoring-Madness #3

Hey everyone, as mentioned here one last step was missing to complete my final refactoring madness.

Since we, as mentioned already, store all our colonies in the same data file, we have to write all of them together to the same data file the moment one of them changes, and, as you may imagine, this causes a huge amount of IO overhead as soon as we have a decent amount of colonies.

Therefore, I rewrote the mechanic a bit.

First of all, where we previously marked the colonyManager dirty so he writes all colonies to disk we now adapted this the following way:

So that he immediatly writes only the colony to disk.

Then in the colonyManager when loading colonies we store a "dummy" in the colonies dat to see if we already switched to the new mode and if not, we'll retrieve the colonies the old way to store them the new way afterwards:

The new way would then be the following:

As mentioned we check for the dummy, then we get the amount of colonies we want to retrieve, we add a certain buffer if anyone lost their colony the last time.
And then we retrieve File per file of each colony.

Besides that I had to adapt our "backup" storage and I made it quite nice.

I take all colonyX.dat files and the overall colonies.dat file and I add them to a backup.zip file. This way it will need less space and we have clearly organized backups.

Last but not least we have to delete every colony.dat as soon as we delete a colony or else the world will try to retrieve them on the next restart.

This should improve our overall server performance with ~ 200 colonies by approximately 20%.

I hope this improves our mod a lot, it will also allow us to rollback single colony files and overally improves out mod performance by a lot.
And leave our minecolonies folder like this:

Pasted image at 2018_01_11 04_44 PM.png

See you the next update.

Ray



Posted on Utopian.io - Rewarding Open Source Contributors

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center