scale autosave interval by game speed to prevent IO bottlenecks and greatly increase UPS

Ideas that are too old (too many things have changed since) and ones which won't be implemented for certain reasons or if there are obviously better suggestions.

Moderator: ickputzdirwech

sben
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Sat Nov 23, 2024 5:33 pm
Contact:

scale autosave interval by game speed to prevent IO bottlenecks and greatly increase UPS

Post by sben »

The autosave is currently tied to game ticks. While this works for normal play, it causes critical issues when using high tick rates (eg. 64x speed using the editor):
  • performance bottleneck: reduces UPS rate by at least 60%. I tested a 1.5MB map using PCIe 4.0 NVMe and 64x tick rate: 30 game minutes take 35s without, 57s with autosave enabled. This is more than 60% performance penalty due to IO bottleneck; on larger map sizes and slower SSDs the impact might be even more noticable.
  • hardware wear: at 64x speed, the 5 minutes interval is reduced to 4.6s. This likely results in writing multiple GB of redundant data per minute, causing unnecessary SSD wear.
  • the safety net disappears: at these speeds, all three autosaves get overwritten every 14 seconds. This is often faster than a user could react to errors and failures, effectively invalidating the given safety that it is meant to provide
Proposed solutions:

1. Keep the autosave functionality tied to game ticks, but dynamically scale the interval to match the current tick rate modifier. This solution would be great by preserving deterministic autosave behaviour while simulating wall clock intervals.

2. Alternatively, trigger the autosave based on system time instead of game ticks.


This could also prevent painful data losses, like the one I experienced yesterday:

When stress-testing my new spaceship design, the defense failed and the platform was destroyed.
By the time I realized that the platform was gone, all three autosaves were already overwritten, losing 4 hours of design work due to the rapid 14 seconds cycle.

The intuition says that autosaves would give a safety net and obviate the need of securing the progress manually;
I was quite sad to find out that this effect disappears when using upscaled game speeds.
User avatar
Stargateur
Filter Inserter
Filter Inserter
Posts: 415
Joined: Sat Oct 05, 2019 6:17 am
Contact:

Re: scale autosave interval by game speed to prevent IO bottlenecks and greatly increase UPS

Post by Stargateur »

what about change auto save interval in game option ?
Rseding91
Factorio Staff
Factorio Staff
Posts: 16773
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: scale autosave interval by game speed to prevent IO bottlenecks and greatly increase UPS

Post by Rseding91 »

This sounds nice in theory until it's applied to any real-world save file that has no hope of running at a given game speed. As save file(s) start having anything actually interesting happening the update time rises and simulation speed has zero chance of keeping up with game.speed.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Outdated/Not implemented”