CN112717376B - Method and system for enhancing stability of mobile phone online game - Google Patents

Method and system for enhancing stability of mobile phone online game Download PDF

Info

Publication number
CN112717376B
CN112717376B CN202110004159.0A CN202110004159A CN112717376B CN 112717376 B CN112717376 B CN 112717376B CN 202110004159 A CN202110004159 A CN 202110004159A CN 112717376 B CN112717376 B CN 112717376B
Authority
CN
China
Prior art keywords
server
data
message
rudp
load
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110004159.0A
Other languages
Chinese (zh)
Other versions
CN112717376A (en
Inventor
张威
庄凡
卢珊
郑震
罗道斌
朱鹰仁
王志刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Mengjia Network Technology Co ltd
Original Assignee
Xiamen Mengjia Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Mengjia Network Technology Co ltd filed Critical Xiamen Mengjia Network Technology Co ltd
Priority to CN202110004159.0A priority Critical patent/CN112717376B/en
Publication of CN112717376A publication Critical patent/CN112717376A/en
Application granted granted Critical
Publication of CN112717376B publication Critical patent/CN112717376B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/30Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers
    • A63F13/33Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers using wide area network [WAN] connections
    • A63F13/332Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers using wide area network [WAN] connections using wireless networks, e.g. cellular phone networks
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/30Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers
    • A63F13/35Details of game servers
    • A63F13/352Details of game servers involving special game server arrangements, e.g. regional servers connected to a national server or a plurality of servers managing partitions of the game world
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/40Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterised by details of platform network
    • A63F2300/406Transmission via wireless network, e.g. pager or GSM
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/50Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers
    • A63F2300/53Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers details of basic data processing
    • A63F2300/531Server assignment

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a method and a system for enhancing the stability of a mobile phone network game, which comprises a client side sending a handshake request to a server through a Reliable User Datagram Protocol (RUDP), and establishing connection with the server; responding to the data received by the client side by the server, caching the fixed data by using a memory, and caching the variable data and a large amount of data by adopting a distributed caching service; carrying out periodic detection on the load of the server, and carrying out load balancing processing in response to the fact that the load of the current server is larger than a first threshold value; the server sends data including current and previous operating instructions to the client. By using the method and the system, good game experience can be ensured in game peak time or relatively poor network environment.

Description

Method and system for enhancing stability of mobile phone online game
Technical Field
The invention relates to the technical field of mobile phone network games, in particular to a method and a system for enhancing the stability of a mobile phone network game.
Background
Since 2006, smart phones appeared to the present, mobile internet also goes deep into the aspects of people's life along with the market popularization of smart phones, providing more efficient means, more convenient solutions and more endless entertainment for people's life. The development of online games has been over 30 years old, and the development of online games successfully affects the public life due to the excellent entertainment, changes the entertainment modes of people and becomes one of important entertainment industries. In 2006, the release of apple smartphones raised the heat tide of smartphones and mobile internet again, and the gaming industry rapidly spread to smart mobile devices as well. With the portability of the intelligent device, the online game further occupies the fragmented time of the user, and the future entertainment center is gradually shifted from the PC to the mobile phone. The intelligence, interactivity, simulation and competitive nature become the most attractive force for the game to attract the eyes and interests of people. In a virtual game world, people can exert capabilities that cannot be realized in reality. The popularity of the internet, and in particular the mobile internet, has made everyone a node in the network. Games and competitions at any time and any place become the mainstream way of people's entertainment.
The existing mobile phone network game is influenced by network delay, flexibility/cost, data consistency and system reliability, and the condition that the delay of a server is aggravated and even the service is down is often caused under the condition that a large number of users access simultaneously in a very short time. The mobile phone network game can periodically appear in the peak visit period, and once the architecture design and the load balancing solution of the game are unreasonable, the smooth experience of the game in the peak visit period can be seriously influenced. These can greatly harm the experience of the game player, resulting in market losses.
Disclosure of Invention
In order to solve the technical problem that the smooth experience of the game is influenced by the system load caused by the periodic occurrence of the peak visit period of the mobile phone network game in the prior art, the invention provides a method and a system for enhancing the stability of the mobile phone network game, which are used for solving the problem.
According to one aspect of the invention, a method for enhancing the stability of a mobile phone network game is provided, which comprises the following steps:
s1: a client sends a handshake request to a server through a Reliable User Datagram Protocol (RUDP) to establish connection with the server;
s2: responding to the data received by the client side by the server, caching the fixed data by using a memory, and caching the variable data and a large amount of data by adopting a distributed caching service;
s3: carrying out periodic detection on the load of the server, and carrying out load balancing processing in response to the fact that the load of the current server is larger than a first threshold value; and
s4: the server sends data including current and previous operating instructions to the client.
In some embodiments, the handshake request includes an encryption key for subsequent communication with the server. The encryption operation can prevent the request from being attacked and the like.
In some embodiments, the client times out in connection within one operation instruction cycle, and the client retransmits the handshake request until the server wraps back or the maximum connection number is reached. The reconnection mechanism can avoid the possible situation that the connection cannot be successfully connected.
In some particular embodiments, the distributed caching service comprises a distributed Memcached/Redis caching service.
In some specific embodiments, the load balancing processing in step S3 specifically includes:
responsive to the area idle load being less than a second threshold, split and merge the current server to the neighboring servers;
and in response to the area difference ratio being greater than a third threshold, migrating the neighboring server to the current server.
According to a second aspect of the invention, a computer-readable storage medium is proposed, on which one or more computer programs are stored, which when executed by a computer processor implement the method of any of the above.
According to a third aspect of the present invention, there is provided a system for enhancing the stability of a mobile phone network game, the system comprising:
establishing a connection unit: the method comprises the steps that a client side is configured to send a handshake request to a server through a Reliable User Datagram Protocol (RUDP), connection with the server is established, and the handshake request comprises an encryption key for subsequent communication with the server;
a cache unit: the configuration is used for responding to the data received by the server from the client, caching the fixed data by using a memory, and caching the variable data and a large amount of data by adopting a distributed cache service;
a load balancing unit: the load balancing method comprises the steps that the load of a server is periodically detected, and load balancing processing is carried out in response to the fact that the load of a current server is larger than a first threshold value; and
a data transmission unit: the server is configured to send data including current and previous operating instructions to the client.
In some embodiments, the client times out in connection within one operation instruction cycle, and the client retransmits the handshake request until the server wraps back or the maximum connection number is reached.
In some particular embodiments, the distributed caching service comprises a distributed Memcached/Redis caching service.
In some specific embodiments, the load balancing process specifically includes:
responsive to the area idle load being less than a second threshold, split and merge the current server to the neighboring servers;
and in response to the area difference ratio being greater than a third threshold, migrating the neighboring server to the current server.
The invention provides a method and a system for enhancing the stability of a mobile phone network game, which solve the problem of reliable and timely transmission of game data under the network environment with high packet loss rate, high delay and instability through the Reliable UDP (RUDP), ensure the game experience of a delay-sensitive game, and solve the problems of synchronous pressure during service and hot spots of a large network game through reasonable configuration of load balance.
Drawings
The accompanying drawings are included to provide a further understanding of the embodiments and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments and together with the description serve to explain the principles of the invention. Other embodiments and many of the intended advantages of embodiments will be readily appreciated as they become better understood by reference to the following detailed description. Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of a method for enhancing the stability of a cell phone network game according to one embodiment of the present application;
FIG. 3 is a block diagram of a system for enhancing the stability of a cell phone network game according to one embodiment of the present application;
FIG. 4 is a block diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present application, the embodiments and features of the embodiments may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 illustrates an exemplary system architecture 100 to which the method for enhancing the stability of a cell phone network game of the embodiments of the present application may be applied.
As shown in FIG. 1, system architecture 100 may include a data server 101, a network 102, and a host server 103. Network 102 serves as a medium for providing a communication link between data server 101 and host server 103. Network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The main server 103 may be a server that provides various services, such as a data processing server that processes information uploaded by the data server 101.
It should be noted that the analysis method for enhancing the stability of the mobile phone network game provided by the embodiment of the present application is generally executed by the main server 103, and accordingly, the device for enhancing the stability of the mobile phone network game is generally disposed in the main server 103.
The data server and the main server may be hardware or software. When the hardware is used, the hardware can be implemented as a distributed server cluster consisting of a plurality of servers, or can be implemented as a single server. When software, it may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services) or as a single piece of software or software module.
It should be understood that the number of data servers, networks, and host servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 2 shows a flowchart of a method for enhancing the stability of a mobile phone network game according to an embodiment of the present application. As shown in fig. 2, the method includes:
s201: and the client sends a handshake request to the server through a Reliable User Datagram Protocol (RUDP) to establish connection with the server.
In a specific embodiment, the most basic unit in the game communication protocol is an operation instruction, each operation instruction is data with relative completeness, and a receiving party can complete corresponding operation according to the operation instruction. Generally, the operation instruction data amount is small, which is not suitable for being used as a communication transmission unit between the game client and the server, and causes network bandwidth waste and network congestion, and the game client and the server communicate with each other by messages. Often, a message encapsulates many operation instructions, which greatly improves the transmission efficiency. The message is also different from the network packet of the underlying network protocol because a message may be very large, which depends on the communication requirement of the game, and an upper limit of the message size is generally set, so that in the network transmission process, a very large message packet may be fragmented into individual message fragments for transmission, the message fragments are encapsulated into the network packet of the underlying network protocol for transmission, and the size of the encapsulated network packet is controlled to be smaller than the size of one frame of data of the ethernet, thereby avoiding the data fragmentation of the IP layer.
In each game cycle, the message consists of three parts: one is reliable operation instruction (operation instruction which must be reliably communicated) buffer the instruction data in the queue; second, the instruction data related to game state; and thirdly, unreliable operation instruction (operation instruction which does not need to be reliably transmitted is generated in a cycle period, and the loss also influences game operation and experience) data. After the message data is generated, whether fragmentation is needed is determined according to the size of the message, a reliable UDP packet header is added to the complete message data or the message fragment, and finally the complete message data or the message fragment is encapsulated into a datagram of a bottom layer transmission protocol (namely a UDP protocol) and sent out. From the viewpoint of safety and efficiency, a message is compressed and encrypted before being transmitted.
In a specific embodiment, the reliable user datagram protocol RUDP specifically includes: 1. establishment and release of a connection. Although the bottom protocol of the RUDP is UDP which is a connectionless protocol, the RUDP realizes a 'handshake' process, and the game client can be allowed to enter the game only through establishing connection through the 'handshake'; 2. and transmitting and receiving data. The RUDP layer is full duplex and can simultaneously send and receive data, the same port is used for sending and receiving the data by the RUDP layer, the sending end is responsible for sending or retransmitting messages or message fragments according to a set rate, and the receiving end is responsible for receiving the messages or the message fragments or discarding repeated packets; 3. acknowledgements and timed-out retransmissions. The RUDP layer ensures the reliability of data through a confirmation and overtime retransmission mechanism, and ensures that only one unacknowledged data packet exists between the sending end and the receiving end; 4. packetization and group packaging. In order to avoid fragmentation at an IP layer, when the size of a message packet exceeds the size of one frame of an Ethernet, a transmitting end of an RUDP layer performs sub-packaging on the message packet, a receiving end caches message fragments, and the message fragments are packaged after the receiving is finished; 5. a keep-alive mechanism. The RUDP layer keeps the connection between the servers and the client by sending heartbeat data packets; 6. and (5) data compression. From the perspective of transmission efficiency, the RUDP layer uses Huffman coding to compress and transmit the message data; 7. and (5) encrypting data. The RUDP layer provides a security mechanism based on a simple xor encryption algorithm.
In a specific embodiment, when a new client wants to establish a connection with a server, the client first needs to send a handshake packet to the server, the handshake packet mainly functions to enable the client to obtain some basic information of the server and negotiate a key required by subsequent communication encryption with the server, and the key of the negotiation has another function of preventing DDos attack service from occurring on the client for the server to authenticate a valid client. Since the message sent by the Handshake packet is an external message and there is no reliability guarantee, the client checks the status of the client in each cycle, and if the client is in the connection status and times out, the client will resend the Handshake packet until the server returns the packet or the maximum number of times (Max handover Time) is reached to abandon the connection.
S202: and responding to the server to receive the data of the client, caching the fixed data by using a memory, and caching the variable data and a large amount of data by adopting a distributed caching service.
In a specific embodiment, the memory cache is to directly use the memory of the server to cache a certain amount of frequently used data. When the system is started or the data is used for the first time, the data is loaded to the memory from the database or the hard disk, and when the same data is used again, the data is directly read from the memory without passing through the hard disk or the database, so that the fastest reading efficiency is achieved. However, the cache method has inherent defects, in a cluster environment, the same request may be handed over to different servers for processing due to the influence of load balancing, and the different servers cannot directly share the memory data, so that once the cache data is modified, a logic error and a functional failure may be caused, and the cache method fails. In addition, due to the limitation of the physical memory of the server, there is also a risk of memory overflow caused by caching a large amount of data into the memory. Therefore, the data is fixed and the data size is as large as possible to use the memory cache within the safety range of the game server based on the data attribute.
In a specific embodiment, the development of the distributed Memcached/Redis and other caching technologies overcomes the limitation of a physical memory of a server, a large amount of data can be cached to memories of a plurality of servers in a distributed mode, all caching objects are managed through a HashMap, and corresponding caching data can be directly searched with the query efficiency of O (1). The method is a more perfect caching method, but the distributed caching method must transmit data through a network, and therefore certain network consumption is brought. Because the data reading in the game service is frequent and continuous, the network delay of single cache data reading in one service logic processing has additive effect, and even if the single network delay is short, the time delay after the accumulation of multiple reading is relatively large. Therefore, when using a cache service such as Memcached/Redis, the entire system must be deployed using a high-speed local area network to ensure minimal network latency. Meanwhile, in a data reading mechanism, repeated reading in system implementation is avoided as much as possible, and an optimization mechanism for reading cache data at least times is preferably implemented. Variable data and a large amount of data are cached based on the characteristics of the Memcached/Redis caching technology.
In a specific embodiment, in the process of the network game, a player can continuously perform a large number of operations on the game within a period of time, and each operation always performs repeated modification on data of a certain player, so that a certain number of modifications or modifications within a certain period of time can be cached, and finally an IO persistence operation is performed. This is the concept of a cache pool. In the process of data operation, the data of the cache pool is always used as the latest data for operation, and meanwhile, the data of the cache pool is periodically written into the database in an asynchronous mode. By the method, the number of times of disk IO can be greatly reduced, the concurrency and the calculation performance of the system can be maximized, and the calculation speed and the concurrency efficiency of the system can be completely free from the limitation of the disk IO.
S203: and periodically detecting the load of the server, and responding to the condition that the load of the current server is greater than a first threshold value to perform load balancing processing.
In a specific embodiment, the difference in the attractiveness of the game function to the players will result in the uneven distribution of the users in the whole game scene, and a hot spot phenomenon will inevitably occur in the mobile phone network game. And dynamically realizing overload scheduling of load balancing by setting a scheduling server and a backup pool in a high-speed local area network. When a server overload condition occurs in a certain game service area, a processing server or a cache pool server sends a scheduling request to a scheduling server, and the scheduling server calls a server in a backup pool to perform dynamic loading and registers the server in a load balancer or a cache manager. In an actual application scenario, the load balancer and the scheduling server are generally the same server. In the scheme, under the condition of low load, the game server and the cache pool server both work normally, once the self load overload condition occurs, the game server actively sends a request to the scheduling server, and the load of the server can not be increased due to scheduling work. And the dispatch server is in idle state most of the time, after receiving the dispatch command, the backup server environment is initialized dynamically and registered to the load balancer, and the load balancer only needs to use a weighted round robin method to distribute the load to the newly registered server in a short time.
In a specific embodiment, the game world is divided into a plurality of independent areas based on a partitioned server architecture, and the areas can be the same in shape or different in shape; and the segmentation may be dynamic or static. Each partition is managed by one server, and the servers are connected by a high-speed network. Each server is only responsible for the control calculation of one partition, so that the calculation load can be effectively reduced; gaming entities within the same partition at the same time typically only need to communicate within the partition, thus reducing unnecessary cross-server communications. The partition-based server architecture can effectively divide the load. When more servers need to be expanded, more partitions can be divided and controlled by new servers.
In a specific embodiment, the server load condition is periodically detected, when the server load SL is greater than the first threshold OT, it is determined that the server is in an overload state, and then a load balancing mechanism is started. When the server load SL is smaller than a first threshold OT, continuously judging whether the area idle load RIL is smaller than a second threshold IT, and performing area merging adjustment when the area idle load RIL is smaller than the second threshold IT, in the process, releasing current server resources to be added into a backup server pool to deal with the processing of a hot spot area, when the area idle load RIL is larger than the second threshold IT, continuously judging whether the area difference RDR is larger than a third threshold DT, when the area difference RDR is larger than the third threshold, considering that the current server is obviously higher than a neighboring server, the load needs to be locally adjusted, and when the area difference RDR is smaller than the third threshold, continuously performing periodic detection.
In a particular embodiment, the server load is defined as:
Figure BDA0002882858020000071
where P represents the amount of player data controlled by the server, N represents the amount of non-player data controlled by the server,
Figure BDA0002882858020000072
representing the average amount of user data supported by the server (the ratio of the maximum amount of user data supported by the server to the number of servers),
Figure BDA0002882858020000073
representing the average amount of non-player data controlled by the server (the ratio of the maximum amount of non-player data generated by the system to the number of servers), C represents the number of micro-units controlled by the server,
Figure BDA0002882858020000074
representing the average number of microcells controlled by the server. Regional idle load
Figure BDA0002882858020000075
Figure BDA0002882858020000076
When the area idle load RIL is small, the current server load and the neighboring server are in an extremely light load state, and the current server can be split and merged into the neighboring server for processing. Ratio of regional difference
Figure BDA0002882858020000077
Figure BDA0002882858020000078
Where n represents the number of neighbor servers for the current server. When the area difference is larger than the RDR, the local adjustment is required, which can effectively indicate that the current server is obviously higher than the adjacent server.
S204: and the server sends data including current and previous operating instructions to the client.
In a specific embodiment, the data sent by the client includes a buffer array for storing the reliable operation instructions and a buffer array for storing the player operation instructions. The buffer array for storing the reliable operation instruction stores the newly generated reliable operation instruction in the current cycle and the reliable operation instruction which is sent in the previous cycle but not confirmed by the server. That is, each transmission packet also carries an operation instruction to be retransmitted; the reliable operation instruction must be retransmitted without receiving the confirmation packet, for example, the operation of purchasing items by the player. However, in the real-time competitive game, much data related to the player status, such as player position information, is not meaningful to retransmit. Therefore, the player operation instruction adopts the increment sending mode, if the data packet is lost, the player operation instruction sent in the next sending period only needs to obtain the latest increment data, and the lost data is not important for the client at the current moment. The reliable operation instruction needs to be retransmitted when being overtime, and the player operation instruction in the client and the snapshot frame data in the server do not need to be retransmitted when being overtime. The most important data structure involved in the acknowledgement and back-packaging mechanism of reliable operation instructions is a reliable instruction buffer queue, and each time the sending end sends reliable instructions which are not acknowledged in the reliable instruction buffer queue. An unconfirmed reliable instruction has two layers of implications: the first is to send the reliable instruction newly generated in the period, and the second is to send the reliable instruction which is sent in the previous period but has not received the acknowledgement packet of the opposite terminal. That is, the reliable instruction data retransmitted in time-out and the new reliable instruction data are transmitted in the same transmission packet.
With continued reference to FIG. 3, FIG. 3 illustrates a block diagram of a system for enhancing the stability of cell phone network games in accordance with one embodiment of the present application. The system specifically includes a connection establishing unit 301, a caching unit 302, a load balancing unit 303, and a data sending unit 304.
In a specific embodiment, the connection establishing unit 301 is configured to send, by the client, a handshake request to the server through the reliable user datagram protocol, RUDP, and establish a connection with the server, where the handshake request includes an encryption key for subsequent communication with the server; the cache unit 302 is configured to, in response to the server receiving the data of the client, cache the fixed data using a memory, and cache the variable data and a large amount of data using a distributed cache service; the load balancing unit 303 is configured to periodically detect a server load, and perform load balancing processing in response to that the current server load is greater than a first threshold; the data sending unit 304 is configured to send data including current and previous time operation instructions to the client by the server.
In a specific embodiment, the client side is connected to timeout in an operation instruction period, and the client side retransmits the handshake request until the server returns a packet or the maximum connection times are reached. The distributed caching service comprises a distributed Memcached/Redis caching service. The load balancing processing specifically includes: responsive to the area idle load being less than a second threshold, split and merge the current server to the neighboring servers; and in response to the area difference ratio being greater than a third threshold, migrating the neighboring server to the current server.
Referring now to FIG. 4, shown is a block diagram of a computer system 400 suitable for use in implementing the electronic device of an embodiment of the present application. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 4, the computer system 400 includes a Central Processing Unit (CPU) 401 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the system 400 are also stored. The CPU 401, ROM 402, and RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input portion 406 including a keyboard, a mouse, and the like; an output section 407 including a display such as a Liquid Crystal Display (LCD) and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. A driver 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 409, and/or installed from the removable medium 411. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 401. It should be noted that the computer readable storage medium of the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable storage medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, sma l lta l k, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present application may be implemented by software or hardware.
As another aspect, the present application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer-readable storage medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: the method comprises the steps that a client sends a handshake request to a server through a Reliable User Datagram Protocol (RUDP), and connection with the server is established; responding to the data received by the client side by the server, caching the fixed data by using a memory, and caching the variable data and a large amount of data by adopting a distributed caching service; carrying out periodic detection on the load of the server, and carrying out load balancing processing in response to the fact that the load of the current server is larger than a first threshold value; the server sends data including current and previous operating instructions to the client.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (8)

1. A method for enhancing the stability of a mobile phone network game, comprising:
s1: a client sends a handshake request to a server through a Reliable User Datagram Protocol (RUDP) and establishes connection with the server;
s2: responding to the server to receive the data of the client, caching the fixed data by using a memory, and caching the variable data and a large amount of data by adopting a distributed caching service;
s3: carrying out periodic detection on the server load, and carrying out load balancing processing in response to the fact that the load of the current server is larger than a first threshold value; and
s4: the server sends operation instruction data including current and previous time to the client;
wherein, step S1 specifically includes: in each game cycle, the message consists of three parts: firstly, reliably operating instruction data in an instruction buffer queue; second, the instruction data related to game state; thirdly, unreliable operation instruction data generated in a cycle period; after the message data is generated, whether fragmentation is needed or not is determined according to the size of the message, a reliable UDP packet header is added to the complete message data or the message fragment, the complete message data or the message fragment is finally encapsulated into a datagram of a bottom-layer transmission protocol to be sent out, and the message is subjected to compression and encryption processing before being sent;
the reliable user datagram protocol, RUDP, specifically includes: 1. the RUDP realizes a 'handshake' process, and the game client is allowed to enter the game only after the 'handshake' is established and connected; 2. the method comprises the steps that data are transmitted and received, an RUDP layer is full-duplex and can transmit and receive the data at the same time, the same port is used for transmitting and receiving the data by the RUDP layer, a transmitting end is responsible for transmitting or retransmitting messages or message fragments according to a set rate, and a receiving end is responsible for receiving the messages or the message fragments or discarding repeated packets; 3. confirming and overtime retransmission, wherein the reliability of data is ensured by an RUDP layer through a confirmation and overtime retransmission mechanism, and the RUDP layer ensures that only one unacknowledged data packet exists between a sending end and a receiving end; 4. subpackaging and packaging, wherein when the size of the message packet exceeds the size of one frame of the Ethernet, the transmitting end of the RUDP layer subpackages the message packet, the receiving end caches the message segment, and the packaging is carried out after the receiving is finished; 5. the RUDP layer keeps the connection between the servers and the client by sending heartbeat data packets; 6. data compression, wherein the RUDP layer compresses and transmits message data by using Huffman coding; 7. data encryption, wherein the RUDP layer provides a security mechanism based on a simple XOR encryption algorithm;
the load balancing processing in step S3 specifically includes:
responsive to the area idle load being less than a second threshold, split and merge the current server to the neighboring servers;
in response to the area difference ratio being greater than a third threshold, migrating the neighboring server to the current server,
wherein the server load is defined as:
Figure FDA0003891529900000021
p represents the amount of player data controlled by the server, N represents the amount of non-player data controlled by the server,
Figure FDA0003891529900000022
representing the average amount of user data supported by the server,
Figure FDA0003891529900000023
representing the average amount of non-player data controlled by the server, C representing the number of micro-units controlled by the server,
Figure FDA0003891529900000024
representing server controlled average microcellsThe number of the particles; regional idle load
Figure FDA0003891529900000025
When the area idle load RIL is smaller, the current server load and the adjacent server are in an extremely light load state, and the current server can be split and merged into the adjacent server for processing; ratio of regional difference
Figure FDA0003891529900000026
Wherein n represents the number of neighbor servers of the current server; when the area difference is larger than the RDR, the local adjustment is required, which can effectively indicate that the current server is obviously higher than the adjacent server.
2. The method for enhancing the stability of mobile phone network games of claim 1, wherein the handshake request comprises an encryption key for subsequent communication with the server.
3. The method of claim 1, wherein the client is connected over time within an operation instruction period, and the client retransmits the handshake request until the server returns packet or the maximum connection number is reached.
4. The method for enhancing the stability of mobile phone network games according to claim 1, wherein said distributed caching service comprises a distributed Memcached/Redis caching service.
5. A computer readable storage medium having one or more computer programs stored thereon which, when executed by a computer processor, perform the method of any of claims 1 to 4.
6. A system for enhancing the stability of a mobile phone network game, the system comprising:
establishing a connection unit: the method comprises the steps that a client side sends a handshake request to a server through a Reliable User Datagram Protocol (RUDP), connection with the server is established, and the handshake request comprises an encryption key for subsequent communication with the server;
a cache unit: the configuration is used for responding to the data of the client received by the server, caching the fixed data by using a memory, and caching the variable data and a large amount of data by adopting a distributed cache service;
a load balancing unit: the load balancing method comprises the steps that the load of the server is periodically detected, and load balancing processing is carried out in response to the fact that the load of a current server is larger than a first threshold value; and
a data transmission unit: the server is configured to send data including current and previous operating instructions to the client;
wherein, the establishing of the connection unit specifically comprises: in each game cycle, the message consists of three parts: firstly, reliably operating instruction data in an instruction buffer queue; second, the instruction data related to game state; thirdly, unreliable operation instruction data generated in a cycle period; after the message data is generated, whether fragmentation is needed is determined according to the size of the message, a reliable UDP packet header is added to the complete message data or the message fragment, the complete message data or the message fragment is finally encapsulated into a datagram of a bottom-layer transmission protocol to be sent, and compression and encryption processing can be carried out on the message before the message is sent;
the reliable user datagram protocol, RUDP, specifically includes: 1. the RUDP realizes a 'handshake' process, and the game client is allowed to enter the game only after the 'handshake' is established and connected; 2. the method comprises the steps that data are transmitted and received, an RUDP layer is full-duplex and can transmit and receive the data at the same time, the same port is used for transmitting and receiving the data by the RUDP layer, a transmitting end is responsible for transmitting or retransmitting messages or message fragments according to a set rate, and a receiving end is responsible for receiving the messages or the message fragments or discarding repeated packets; 3. confirming and overtime retransmission, wherein the reliability of data is ensured by an RUDP layer through a confirmation and overtime retransmission mechanism, and the RUDP layer ensures that only one unacknowledged data packet exists between a sending end and a receiving end; 4. subpackaging and packaging, wherein when the size of the message packet exceeds the size of one frame of the Ethernet, an RUDP layer sending end subpackages the message packet, a receiving end caches message segments, and packaging is carried out after receiving is finished; 5. the RUDP layer keeps the connection between the servers and the client by sending heartbeat data packets; 6. data compression, wherein the RUDP layer compresses and transmits message data by using Huffman coding; 7. data encryption, wherein the RUDP layer provides a security mechanism based on a simple XOR encryption algorithm;
wherein, the load balancing process in the load balancing unit specifically includes:
responsive to the area idle load being less than a second threshold, split and merge the current server to the neighboring servers;
in response to the area difference ratio being greater than a third threshold, migrating the neighboring server to the current server,
wherein the server load is defined as:
Figure FDA0003891529900000031
p represents the amount of player data controlled by the server, N represents the amount of non-player data controlled by the server,
Figure FDA0003891529900000032
representing the average amount of user data supported by the server,
Figure FDA0003891529900000033
representing the average amount of non-player data controlled by the server, C representing the number of micro-units controlled by the server,
Figure FDA0003891529900000034
representing the average number of microcells controlled by the server; regional idle load
Figure FDA0003891529900000035
When the area idle load RIL is smaller, the current server load and the adjacent servers are positionedIn an extreme light load state, the current server can be split and merged into a neighboring server for processing; ratio of regional difference
Figure FDA0003891529900000036
Wherein n represents the number of neighbor servers of the current server; when the area difference is larger than the RDR, the local adjustment is required, which can effectively indicate that the current server is obviously higher than the adjacent server.
7. The system of claim 6, wherein the client is connected over time within an operation instruction period, and the client retransmits the handshake request until the server returns packet or the maximum connection number is reached.
8. The system for enhancing the stability of mobile phone network games of claim 6, wherein said distributed caching service comprises a distributed Memcached/Redis caching service.
CN202110004159.0A 2021-01-04 2021-01-04 Method and system for enhancing stability of mobile phone online game Active CN112717376B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110004159.0A CN112717376B (en) 2021-01-04 2021-01-04 Method and system for enhancing stability of mobile phone online game

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110004159.0A CN112717376B (en) 2021-01-04 2021-01-04 Method and system for enhancing stability of mobile phone online game

Publications (2)

Publication Number Publication Date
CN112717376A CN112717376A (en) 2021-04-30
CN112717376B true CN112717376B (en) 2022-12-02

Family

ID=75590767

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110004159.0A Active CN112717376B (en) 2021-01-04 2021-01-04 Method and system for enhancing stability of mobile phone online game

Country Status (1)

Country Link
CN (1) CN112717376B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102244685B (en) * 2011-08-11 2013-09-18 中国科学院软件研究所 Distributed type dynamic cache expanding method and system for supporting load balancing
US10356197B2 (en) * 2016-11-21 2019-07-16 Intel Corporation Data management in an information-centric network
CN107104760B (en) * 2017-04-13 2020-09-08 腾讯科技(深圳)有限公司 Method for transmitting data packet, client and server
CN206775541U (en) * 2017-05-22 2017-12-19 北京中科奥科技有限公司 Distributed game services system
CN107071059B (en) * 2017-05-25 2018-10-02 腾讯科技(深圳)有限公司 Distributed caching service implementing method, device, terminal, server and system

Also Published As

Publication number Publication date
CN112717376A (en) 2021-04-30

Similar Documents

Publication Publication Date Title
Moon et al. {AccelTCP}: Accelerating network applications with stateful {TCP} offloading
CN110730105B (en) Picture data transmission method, device, equipment and storage medium
US6920501B2 (en) Communication socket migration among different devices
AU2004272192C1 (en) Internet protocol optimizer
US20090103515A1 (en) System and method for preserving socket connections over a wireless network
US20160198021A1 (en) Dynamic protocol switching
EP2741463B1 (en) Data packet transmission method
CN112583874B (en) Message forwarding method and device of heterogeneous network
US20090254667A1 (en) Method for eliminating redundant connections
US20210160311A1 (en) Load balancing method and apparatus
US20220086262A1 (en) Network packet processing method and apparatus and network server
US9288287B2 (en) Accelerated sockets
JP2022531940A (en) Fire-and-forget offload mechanism for network-based services
CN111885093B (en) Event request transmission method and device, storage medium and electronic equipment
CN112165449B (en) Control method of real-time authority of web application, electronic device and storage medium
Natarajan et al. SCTP: What, why, and how
CN114500528A (en) Data transmission method and device based on cloud platform
CN112717376B (en) Method and system for enhancing stability of mobile phone online game
US9219670B2 (en) Link-aware throughput acceleration profiles
CN109688085B (en) Transmission control protocol proxy method, storage medium and server
CN114124489B (en) Method, cleaning device, equipment and medium for preventing flow attack
Srinivasan MTCP: transport layer support for highly available network services
CN111049754B (en) Data communication method, device, equipment and computer readable storage medium
CN114095129B (en) Communication method and system for mobile terminal game network transmission
KR102184363B1 (en) Communicating method between host and client with network connector, and network connector proceeding the same

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A method and system for enhancing the stability of mobile online games

Granted publication date: 20221202

Pledgee: Xiamen Bank Co.,Ltd.

Pledgor: Xiamen Mengjia Network Technology Co.,Ltd.

Registration number: Y2024980012883

PE01 Entry into force of the registration of the contract for pledge of patent right