zoukankan      html  css  js  c++  java
  • New P2P communication base on Smart Proxy Server

    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 diagram 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.

    clip_image002

                        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. Obviously, 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 connecting to server directly.

        The revised pattern has been shown in figure 1 and can be illustrated as below:

    clip_image004

                        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, notify 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 mechanism (Supposed only one server here, no server cluster). The server performance is improved significantly.

    clip_image006

                            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 mechanism 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 would be to implement NAT protocol, to give a perfect solution in Server/Client domain.

  • 相关阅读:
    现身说法“好奇心害死人啊”
    代码错误集合(全是低级错误,欢迎高手前来指教)
    Return from TAOKEE
    泡了DOUBAN一个下午,思考中。。。
    买了两本书
    PDFBox,PDF文件处理
    数据库营销,DM杂志
    一个JS写的时间选择显示的控件,源文件下载
    WEB2.0新想法,让明星还有你无所遁行,让你我都做“狗仔队”
    hdu 1237 简单计算器 (栈的简单应用)
  • 原文地址:https://www.cnblogs.com/Jax/p/1752733.html
Copyright © 2011-2022 走看看