save interval

Content and general development discussion, including quest scripts and server code. The Mana World is a project comprising the original tmwAthena server & a designated improved engine server based on evolHercules


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board. Its current use is for the continued development of the server and game it has always served: The Mana World.

Post Reply
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

save interval

Post by o11c »

Currently, the save interval is 15 seconds. This is probably a bad idea for the disk. We could revert to the recommended default (300 seconds, aka 5 minutes), at the cost of *potential* loss.

This setting is stored in world/conf/char_athena.conf as autosave_time. I suggest this be changed in git for the next restart.

To prevent loss, always @mapexit the map-server, then kill the char-server.

(Note: the login-server is hard-coded to use 5 minutes)
Former programmer for the TMWA server.
User avatar
AnonDuck
TMW Adviser
TMW Adviser
Posts: 653
Joined: 02 Jan 2009, 04:19
Location: Catland

Re: save interval

Post by AnonDuck »

15 seconds is much too low. I'm surprised multiple save processes are not piling up!

The default of 300 seconds was chosen with some consideration. The idea is that even if the server loses data 5 minutes isn't anything much. Players here understand the software isn't perfect and won't freak out if they have to re-do a whole 5 minutes of gameplay. There's not much you can accomplish in 5 minutes that you couldn't just do over.
Head of the TMW Illuminati
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: save interval

Post by o11c »

MadCamel wrote:15 seconds is much too low. I'm surprised multiple save processes are not piling up!
There's an explicit check for that (it will just skip that fork and try again on the next interval), though on the new server it only takes 12 seconds to do a full save. Pretty sure it would delay on Platinum though.
MadCamel wrote:The default of 300 seconds was chosen with some consideration. The idea is that even if the server loses data 5 minutes isn't anything much. Players here understand the software isn't perfect and won't freak out if they have to re-do a whole 5 minutes of gameplay. There's not much you can accomplish in 5 minutes that you couldn't just do over.
The thing to beware of is that different players have their data synced at different times. So, items can disappear or appear out of nowhere. Of course, this is the map-server's fault, not the char-server. But, the char-server *does* need to beware of the last-ditch save - that really should not be called from the signal handler (the signal handler should just clear the runflag, like @mapexit)
Former programmer for the TMWA server.
User avatar
AnonDuck
TMW Adviser
TMW Adviser
Posts: 653
Joined: 02 Jan 2009, 04:19
Location: Catland

Re: save interval

Post by AnonDuck »

Maybe we could make the map server sync a user to the char-server whenever their inventory, zeny, or level changes?

IIRC the original char-server would write it's databases whenever the map-server sent it a player structure.. Updating the char-server more often now that saves are on a timer shouldn't adversely affect anything.
Head of the TMW Illuminati
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: save interval

Post by o11c »

MadCamel wrote:Maybe we could make the map server sync a user to the char-server whenever their inventory, zeny, or level changes?

IIRC the original char-server would write it's databases whenever the map-server sent it a player structure.. Updating the char-server more often now that saves are on a timer shouldn't adversely affect anything.
Hm, that would explain it. The map-server has comments to the effect that saving is expensive, but it's just network to localhost ...

There probably *should* be some caching in the map-server to make sure it doesn't send duplicate info though. This could maybe wait until I rewrite the whole network layer though.
Former programmer for the TMWA server.
User avatar
AnonDuck
TMW Adviser
TMW Adviser
Posts: 653
Joined: 02 Jan 2009, 04:19
Location: Catland

Re: save interval

Post by AnonDuck »

as an aside, the map server should fork before calling system() to gzip the log files. Alternatively we could have it call a shell script that performs the gzip in the background.
Head of the TMW Illuminati
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: save interval

Post by o11c »

MadCamel wrote:as an aside, the map server should fork before calling system() to gzip the log files. Alternatively we could have it call a shell script that performs the gzip in the background.
Already done in the 'test' branch.
Former programmer for the TMWA server.
Post Reply