mirror of
https://github.com/BluTac10/Xbox-Neo.git
synced 2026-06-17 07:32:03 +00:00
perf: async autosave for dedicated server
Autosave previously froze the main thread for 2-6 seconds while compressing the entire save file with zlib. Now the save buffer is snapshotted under the lock (~18ms), then compression runs on a background thread. The compressed data is committed to StorageManager on the next main-thread tick via CommitPendingAsyncSave(). Also skip redundant full chunk saves during autosave on the dedicated server -- chunks are already persisted by the per-tick trickle save. Only entity data is flushed, matching Xbox/Orbis behavior. Added per-step timing to the autosave handler for diagnostics.
This commit is contained in:
@@ -977,8 +977,11 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut
|
||||
|
||||
if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS);
|
||||
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
// Our autosave is a minimal save. All the chunks are saves by the constant save process
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__) || (defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD))
|
||||
// Autosave is a minimal save. Chunks are saved continuously by the
|
||||
// per-tick trickle save process (ServerChunkCache::tick), so we only
|
||||
// need to flush entity data here. The full chunkSource->save() would
|
||||
// redundantly re-save all dirty chunks and block the main thread.
|
||||
if(bAutosave)
|
||||
{
|
||||
chunkSource->saveAllEntities();
|
||||
|
||||
Reference in New Issue
Block a user