NoahGameFrame icon indicating copy to clipboard operation
NoahGameFrame copied to clipboard

Topic3: How to save your data when the application crash

Open ketoo opened this issue 7 years ago • 4 comments

Background:

Player's data is our income. How to save your customer's data when the program crash for whatever reason is a critical problem when designing the architecture.

How can we do something to avoid losing too much data when the disaster happened? Please leave your idea here to help others solve this problem.

在游戏中,玩家的数据是极其重要的.在程序异常崩溃的情况下,如何尽可能的保存用户的信息是服务器架构的一个关键问题.

因此,如何避免在这种极端情况下丢失大量的用户数据?请尽情发表你的看法来帮助大家解决这个问题吧!

ketoo avatar Feb 02 '18 08:02 ketoo

Regularly save player's properties to database (10min? 30min?)

lafreak avatar Mar 10 '18 15:03 lafreak

@lafreak It's a way to do this, the disadvantage is that it will lose the data if the process crashed. In my experience, using the share memory object management to manage the player's properties which you want to store that would be better, based on this, it would don't lose any data once the process crashed. Move over we can use another process to save the player's data by order.

In NF world, just need to replace the data of the class "Property" by share memory object can reach the goal.

ketoo avatar Mar 11 '18 21:03 ketoo

There are 3 possible approaches for this topic:

  • Flush player data to database every 15 minutes.
  • Always flush player data to database whenever requested or used.
  • Create a crash capturing system so it would save the data of the player before crash ether;
    • Save player data to the database
    • Save player data into a file if database is unavailable during this time and then when the app starts, it would load the saved data from the file and flush it to database before server starts.

I think using an external application for managing the data ("share memory object management to manage the player's properties") would be exactly the same as just pushing data into the database immediately.

H1X4Dev avatar Mar 16 '18 17:03 H1X4Dev

@H1X4Dev Great sum. Most of the time people flush player data to the database every 5 minutes or 15 minutes, this solution easy to implement and just only lose 5 or 15 minutes data once the app crashed.

The solution always flushes player data to the database whenever requested or used is great but too expensive, as the result, I want to use an external application for managing the data to reduce the workload of the database.

ketoo avatar Apr 22 '18 21:04 ketoo