I'm new to game development, and I'm trying to make a multi-player game server. One design issue I've run into is trying to find a fast but safe way to keep server data (account info, game states, etc) and file data synchronized. I thought about just saving directly to the file whenever any internal data structure is changed, but I don't know how much that would impact performance to constantly write to the disk. I also want to minimize the chance of putting the files in an inconsistent state in the event of a crash. Which the current server gleefully makes a hobby of doing.
So what's a good disk I/O strategy to keep the performance decent, the data consistent, and code complexity/size down?