Global same service architecture

Just done several similar suits in the world's only server, simply talk bad No wonder, then. First of all, the game server is a server IO-intensive, it's a major bottleneck in the network IO, rather than the CPU, which points to remember. So often the problem will appear in the network server IO, bandwidth and database disk read and write above, instead of the CPU above. In fact, with global online service that is a lot of thing, such as C1000k, or even more. The same clothes, you look just the same clothes, rather than on his own on the same server, or on the same process, which is completely unrealistic. A good server process, gamers can simultaneously load of 10k (also depends on the complexity of logic games) has been pretty good. In fact, to the world with the service, the server process is to heap thing. I used to talk about one of the architectural model, the company is also pressing bigworld architecture design: 1.Gate: first of all have a (more) Gate (Gateway) server is responsible for client connections and forwards the message to GameServer (game service) (selected from the service logic), holding server and client connections without any logic, only encrypt and decrypt messages, the client and server and forwarding the message (the equivalent of a bridge between the two) 2.GameServer:. GameServer is the main course of the game, the game provides a logic function (single process (or single-threaded) bottleneck model, the game was never the server CPU, so the only logical function, then single-threaded enough, here no need to use multiple threads or processes ). 3.DBManager: database read and write, easy to read and write data Game asynchronous database server (database read-write some of the clothes on the game, there is no separate server, it probably served a single game process is not good enough). 4.GameManager: Responsible for managing all of GameServer, message forwarding between GameServer, offers broadcast to all Game features. The client even Gate, Gate even GameServer, GameServer even DBManager, GameManager manage all GameServer and inform all the Gate. In addition to GameManager only one, theoretically Gate, GameServer, DBManager can be extended to multiple instances, you have to realize the world's only clothing, in theory, is to extend GameServer, then how to make them look in a suit it? Actually very simple, COC mostly single-serving play, interactive play only when you can feel it is the same service. The main talk GameServer, which is the main place to deal with server logic, usually single-process it, epoll_wait hold a live audience, and then do the distribution, lived in theory, capable of carrying the cpu, and epoll can handle cap, general For machines with memory, is much greater than 1024, 100K normal reached, of course, close to the connector 10k considering logic complexity, a general example of processing it. That how to deal with 100k, 1000k even more, it is more than one instance, and that this is the only service it? Yes, at least appears to be, the game naturally play single and multiplayer gameplay, single play in their own natural clothes on it, no one knows with others is not a service. Of course, there are full-service rankings, how do the buddy system like it is actually very simple, we do not have GameManager, it is responsible for doing so, whenever you send a friend request, GameManager broadcast a message, and then if the presence of a player GameServer, then respond to you, you can communicate with each other, and want an easier way to get the player's server ID number, forwarded directly to the server by GameManager, naturally, can communicate, just like in the same a server. Ranking it the easiest, specify a server, or open up a single server to do list, all data changes are to inform the server, which then will naturally lined, and then broadcast. Double or fighting more than a copy of it? Such as COC, predatory war, we did approach is to directly search the enemy, then his own players, soldiers and other military needs after data serialization, spread across the servers go, deserialize, then broke straight , then kick back data transfer. More people do, it is easy to spot, and then open up a class of server, called BattleServer, responsible people play, a copy of the play and the like, when people, all the people to migrate data to BattleServer, then people (a copy of the play) end, then by GameManager migrate data back to the original server. This view, in fact, the world's only service there is no so big on. If you are interested, you can see KBEngine server engine, according to the author bigworld architecture designed to meet your requirements. You can read my blog: hand travel server development technology explain

From: https: //www.zhihu.com/question/31103751

Published 47 original articles · won praise 21 · views 110 000 +

Guess you like

Origin blog.csdn.net/boiled_water123/article/details/104776369