Swoole development game server

now I"m going to use swoole to develop the game server. I don"t consider other languages for the time being, because the company is not familiar with other languages, and the project deadline is coming soon
what I want to ask is, for example, when developing the server, there is an action on the game that can only be operated when the number of gold coins reaches. This server receives a socket request from the client to judge the gold coins. Is this judged from the database? The previous estimate of the number of tcp links is about 10w. If you judge directly from the database that the pressure is too great, in addition, I also need to ensure the integrity of the data! If you really want to do this, the database needs one master and more than one slave, and all the logical processing in swoole will be submitted to task and pushed to the game client after the processing is completed, so I am worried about delay!

the current solution is:
1: client sokcet link server
2: a certain action on the game commit an action
3: the backend processes logic judgment based on this action
logic judgment this
query-related data from the database (such as user"s gold coin) if it fails, send a message directly to the client
if successful You can also modify the database and insert some related data into the database. Finally, the identity of success is pushed to the client!

Please express your opinions! Thank you

Mar.06,2021

  1. write user information to redis/memcached cache after login
  2. all calculations are based on cache
  3. background processes store cached data in the database on a regular basis

can you try and see if you can achieve the Ni effect?


first of all, log in to get the token, and then there will be a gateway server to determine whether the user is connected to the gameServer, right? How did you solve it, please?


https://github.com/caohao-php. uses this database connection pool

Menu