Saving game data with performance in mind

I am working on small MMO project where data loading and saving speed is very important. What is the best choice between:

  • performance (most important, no more than 0,2 s for 10 mb of data)
  • compatibility (possibility to add/remove fields without compatibility loss)

Currently I am using KryoNet for both networking and saving server state, but I am wondering if there is even better solution.

Depends on how much effort you willing to put into it…specifically handling multiple formats.

Asynchronous saving and/or splitting up the saving into smaller parts.

compression

I think that compression would make opossite effect - making data loading longer. :slight_smile:

I will check asynchronous saving/loading, it seems like a good idea.

Can you give any more details? How frequently do you need to save state, are you able to save the state in pieces or do you need to save everything at the same time? Are you saving across a network or is all of the work happening on one machine? What sort of structures do you have to save?

I am saving and loading map fragments (together with all objects and items in this area). The whole map is too big to be stored in RAM, so I must save and load 500X500 fragments when player come close to them and trigger loading. The whole saving and loading happens on server.

Client is receiving 100X100 map fragments when he is close to the edge of visible area. Game is not too dynamic, so players usually spend most time near the same place unless they want to go exploring, hunting or switch layer (for example, going from surface to interior).

for the ease of it, I would try to load/save json through xstream. also try out roquens advice to use compression by wrapping the input and output streams with inflater or gzip streams. chances are that network/filesystem bandwidth is more limiting than cpu

A few more questions, sorry.

How much system ram does your server have? What sorts of objects are you saving, and how are they stored?

Yeah that’s why I mentioned compression…without thinking it through it seems like it would slow things down but often it’s actually faster.

Multithreading: lower priority thread for preloading of static data for instance.