Abstract
This paper gives a solution for how the server/client software can improve the performance significantly. We try to find way in the software itself, rather than the environment outside.
At last, I write an open source software, named game platform, to demonstrate this way is feasible and it can be expanded to all the server/client software's architecture.
Problem Statement
In traditional server/client software patterns, clients connect to the server directly (see the dimo-below ). server has to handle all kinds of tasks such as user login/off, business logic processing, data management, etc. it costs lots of server resources.
Figure 1 traditional pattern of server/client software
As we know, the server resources are limited. as more and more clients connect to the server, for example, over 10,000 users, the server may run out of the memory, the performance may be low, and sometimes, the server may even run down.
One solution to this problem is to add more servers. however, as more and more users join in, more servers may need to be added. it will result in spending more money on purchasing and maintaining these servers. obviusly, it is not a good approach.
Solution
I discovered a P2P based approach to solve the problem. The core of this approach is smart Proxy Server (SPS ).
SPS is the Client Connecting to the server directly. Other clients connect to the SPS, instead of ing to server directly.
The revised pattern has been shown in Figure 1 and can be attached strated as below:
Figure 2 revised pattern of server/client software
SPS is created by server. when a topic is set up, for example, we set up a meeting; server will set the first client as SPS, using y other clients in this group SPS's IP and port, and set up the connection between SPs and clients.
Then we can separate some functions from the server such as complicated logic and special algorithm, and assign them to SPs.
Because SPS takes over some functions from the server, server only needs to handle registry and maintain SPS. This approach balances server's burden to the greatest extent.
Once SPS disconnect to the server, server will detect that and assign a new SPS automatically between the clients left in this group, then all the clients in the group will connect to the new SPS. the process is going on.
SPS is created by software itself, not depending on the environment outside. that is to say, only one server is enough. we can save more budgets by developing software. we can concentrate ourselves on SPS's management, rather than server cluster's configuration.
The figure below shows the result of a performance test, comparing SPs with traditional Mechanic (supposed only one server here, no server cluster). The server performance is improved significantly.
Figure 3 result of performance test
Evidence the solution works
Game platform is a good solution to demonstrate SPS thesis. We can get the latest released version at: http://www.codeplex.com/gameplatform.
In game platform, when 4 users set up a new game, such as the bridge card, the user who joins in the desk first will be the SPs. the other three users will set up socket connection with SPs. during the whole process, the other three users will send socket messages to the SPS, and SPS receive the messages. the SPS will judge whether the logic is valid or not, and send the result back to the corresponding client. this process will hold on until the game is over. finally SPS send the messages to the server, including who has won and how much score he has got, then server will record the result.
Competitive approaches
The SPS mechanic is similar to P2P programming, but a little different from it. we integrate P2P into SPS, and maintain user account in the server, and also, we need server to setup client automatically.
Current Status
Now the project status of game platform is:
1. The main platform is implemented, including login different hall and desk.
2. The communication is implemented by TCP, paused on UDP develop stage.
Next steps
The next step in the game platform wocould be to implement Nat protocol, to give a perfect solution in server/client domain.