The data storage server
Game data is broadly divided into static configuration data and dynamic players. Here focuses on the player data storage solutions.
Although the game application write operations than read operations, but added the cache layer is still necessary. Another problem is that multiple application servers start to read data from the database in an instant to the database enormous pressure, relatively static data in the form of a document on the application server local to avoid this problem, but at the same time bring increase in the cost of maintenance of static data.
The introduction of static data caching layer to avoid the pressure of centralized access to the database at the same time facilitate the maintenance of data. The data notification has been modified to read all the data of the application server.
On the other hand, perform a SQL statement, whether single or batch a rather time-consuming communication, pending receipt of a response from the database server because the client program flow is blocked, which is typical CPU waiting io idle . Although the big designers can use asynchronous thread to execute SQL but the asynchronous use the cpu can no longer plan carefully you?
If the sync player data performed by SQL into an application server and data storage server application protocol communication, the situation will be different, designers can be designed to be asynchronous, or even no patience.
Cache player data to support synchronous player data application protocol, memory is always faster than disk. In addition, the players off the assembly line and not immediately be removed from the cache, but will be classified as an off-line players collections, meet people meet again, off-line is likely to be a short period of time on-line.
Players (login Line / martial art / gender) cache can shorten the search time.
Design ideas before a project is the player data (Properties and articles) updates will generate a sql statement, one-time regular batch perform these SQL. There are two worthy of improvement. 1For a player to have more than one SQL, and these SQL will cover SQL execution result, unnecessary to increase the burden on the database, increasing the connection takes time. 2 If a large number of players, behavior, will in a short time a large number of difficult to digest SQL memory caused by the storage system risks.
The application uses the source memory business computing (client-oriented read and write functions) the Cache subsystem classification management source memory handle (read-only) for data storage. Cache subsystems timing the players data structure to do a snapshot synchronized to the data server or when the updated number of players reaches a threshold synchronized in time, the other where it comes to player transaction data update do synchronization and leave business log.
The design did not consider the number of application server load. If the game application load is very large, timing synchronization point in time may produce a large number of difficult to digest sql. We said player data every certain period of time will be synchronized to the storage system, but without said data for all players in the same point in time for synchronization. We have reason to believe that the players on the occupational distribution is broadly similar, so the first synchronization monks, priests resynchronization resynchronization beggars, final settlement Detective, can serve as a solution.
This idea applies to both the application server and data storage services to lower write applications.