Armageddon
Wanderer
I had originally posted this over at the Ultima Online Second Age forums but someone suggested I try it here since it more globally affects all RunUO shards.
This topic is meant as a discussion and/or brainstorming session and, maybe, eventually a step into changing the code to improve save times.
What I know:
1. All items/mobiles are serialized and saved as a binary world save.
2. Save times can be lengthy if there are lots of items stored/hoarded in the world.
3. The world has lots of items that sit in containers and never get touched or moved.
4. The server is restarted every day (I think, this may apply only to UOSA).
My thought is to do the following is to create a system where unchanged items are not repeatedly saved. If only modified items are saved, then world saves would be far smaller...
- At server startup: All containers in the world are flagged as 'untouched'. The world save is loaded from an untouched database.
- During the server operation, any time a container is opened, moved, or otherwise changed, it is flagged as touched. This includes player backpacks, banks, boxes in houses, etc.
- Each time the world saves, all 'touched' items are saved to a separate temporary save file. Untouched items are not saved, as they have not changed.
- Each day before the server is taken down (Or once every maintenance interval), the untouched database and the touched database are compared, merged, and saved off as a new untouched database for the next days operation. This process can be slower, as it will only happen once and only happen once players are booted.
- There would also need to be a restore functionality to relaunch the server using both the untouched database and the touched database, just in case there is a server crash. This would be, I imagine, similar to the above merge and save code and would basically be loading all untouched data, then loading touched data (being sure to overwrite any untouched that it encounters).
So for you RunUO experts out there. Why isn't something like this already implemented? Are there any big gotcha's or walls that you'd hid? I am not an expert on RunUO but I am an experienced software engineer. Based on what I know and see, the whole 'saving' system seems a little clunky and could use some improvement.
This topic is meant as a discussion and/or brainstorming session and, maybe, eventually a step into changing the code to improve save times.
What I know:
1. All items/mobiles are serialized and saved as a binary world save.
2. Save times can be lengthy if there are lots of items stored/hoarded in the world.
3. The world has lots of items that sit in containers and never get touched or moved.
4. The server is restarted every day (I think, this may apply only to UOSA).
My thought is to do the following is to create a system where unchanged items are not repeatedly saved. If only modified items are saved, then world saves would be far smaller...
- At server startup: All containers in the world are flagged as 'untouched'. The world save is loaded from an untouched database.
- During the server operation, any time a container is opened, moved, or otherwise changed, it is flagged as touched. This includes player backpacks, banks, boxes in houses, etc.
- Each time the world saves, all 'touched' items are saved to a separate temporary save file. Untouched items are not saved, as they have not changed.
- Each day before the server is taken down (Or once every maintenance interval), the untouched database and the touched database are compared, merged, and saved off as a new untouched database for the next days operation. This process can be slower, as it will only happen once and only happen once players are booted.
- There would also need to be a restore functionality to relaunch the server using both the untouched database and the touched database, just in case there is a server crash. This would be, I imagine, similar to the above merge and save code and would basically be loading all untouched data, then loading touched data (being sure to overwrite any untouched that it encounters).
So for you RunUO experts out there. Why isn't something like this already implemented? Are there any big gotcha's or walls that you'd hid? I am not an expert on RunUO but I am an experienced software engineer. Based on what I know and see, the whole 'saving' system seems a little clunky and could use some improvement.