Method, device and electronic device for determining process load

By obtaining and analyzing the load information of the game process, and using the prediction model to calculate the predicted load of the game process, it solves the problem that it is difficult to accurately count the load of the game server in the existing technology, and improves the stability of the server.

CN114392548BActive Publication Date: 2025-05-16NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111553536.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-17
Publication Date
2025-05-16
Estimated Expiration
2041-12-17

AI Technical Summary

Technical Problem

The existing technology is difficult to accurately count the load of multiplayer online tactical competitive game servers, resulting in unbalanced server load and affecting server stability.

Method used

By obtaining the load information of each game process, including the sampling load, the upcoming game games, the game games in non-game states, and the game games in the game states, the prediction model is used to calculate the predicted load of the current cycle.

Benefits of technology

It improves the accuracy of process load, makes the load more in line with the actual game running state, enriches the load dimension, and thus improves the stability of the server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114392548B_ABST
    Figure CN114392548B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device and electronic device for determining process load, including: obtaining the load information of the game process through the game process running in the game server; wherein the load information includes: sampled load, the first game session that is about to join the game process, the second game session in a non-game state, and the third game session in a game state; according to the load information, determining the predicted load of the game process in the current cycle. In this method, the current state of each game session in the game process and the game session that is about to join the game process are taken into account, and the load occupied by the game session that is about to join the game process and the game session that is in a non-game state in the game state is reserved for the game process, so that the final determined process load is more in line with the actual running state of the game, enriches the dimension of the process load, improves the accuracy of the process load, and thus improves the stability of the server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of game technology, and in particular to a method, device and electronic device for determining a process load. Background Art

[0002] Multiplayer online tactical competitive games usually have a large user base and generally use a distributed multi-server architecture to provide services. In order to balance the pressure on each server in the distributed multi-server architecture, it is necessary to count the load borne by each server. In related technologies, a relatively simple or unified method is usually used to count the server load, such as determining the server load by CPU (Central Processing Unit) sampling or counting the number of server network connections. However, the servers of multiplayer online tactical competitive games have the characteristics of large concurrency, concentrated user connections, complex system status, and rapid load changes. The above method cannot accurately count the load of the game server, which can easily lead to an imbalance in the load borne between servers and affect the stability of the server. Summary of the invention

[0003] In view of this, the purpose of the present invention is to provide a method, device and electronic device for determining process load, so that the determined process load is more in line with the actual game operation, enriches the dimension of process load, improves the accuracy of process load, and thus improves the stability of the server.

[0004] In a first aspect, an embodiment of the present invention provides a method for determining a process load, which is applied to a game server in which multiple game processes are running; the method comprises: obtaining load information of each game process; the load information comprises: a sampled load, a first game session to be added to the game process, a second game session in a non-game state, and a third game session in a game state; and determining the predicted load of the game process in the current cycle based on the load information.

[0005] Furthermore, the step of obtaining the load information of each game process includes: obtaining the sampling load of the game process in the current cycle by a preset sampling method; wherein the sampling load is a sampling value of the CPU load of the game process; determining the first game session that will be added to the game process in the current cycle by a forward prediction method; and determining the number of games in a non-game state as the second game session and the number of games in a game state as the third game session according to the game status of each game in the game process.

[0006] Furthermore, the step of determining the first game session that will be added to the game process in the current cycle by forward prediction includes: obtaining the current game session newly added to the game process in the current cycle, and the historical game sessions added to the game process in the historical cycle; wherein the game sessions in the game process at the initial moment are preset values; determining the first game session that will be added to the game process in the current cycle based on the current game session, the historical game sessions and the preset weight coefficient.

[0007] Further, the step of determining the first game session to be added to the game process in the current cycle according to the current game session, the historical game session and the preset weight coefficient includes: determining the first game session by the following linear exponential smoothing model: Among them, C(t) represents the first game session that will be added to the game process in the current cycle; S(ti) represents the historical game session added to the game process in the historical ti cycle, where t represents the current cycle; S0 represents the preset value; α is the preset weight coefficient.

[0008] Furthermore, the step of determining the predicted load of the current cycle game process based on the load information includes: calculating the first compensation load of the game process based on the sampled load, the second game session and the third game session; calculating the second compensation load of the game process based on the sampled load, the first game session and the third game session; calculating the predicted load of the current cycle game process based on the sampled load, the first compensation load and the second compensation load.

[0009] Furthermore, the step of calculating the predicted load of the game process in the current cycle based on the sampled load, the first compensation load and the second compensation load includes: calculating the predicted load of the game process specifically through the following prediction model: Wherein, T(cpu) represents the predicted load of the game process in the current cycle; Y(t) represents the sampled load of the game process in the current cycle; C(t) represents the first game session that will be added to the game process in the current cycle; N(t) represents the second game session that is in a non-game state in the game process in the current cycle; B(t) represents the third game session that is in a game state in the game process in the current cycle; is the first compensation load; is the second compensation load; a, b, c are model parameters of the prediction model.

[0010] Furthermore, after the step of obtaining the load information of each game process, the method further includes: calculating the single-game load of the current cycle game process according to the sampled load and the third game session.

[0011] Furthermore, the step of calculating the single game load of the current cycle game process based on the sampled load and the third game session includes: calculating the single game load of each cycle game process in the historical cycle based on the sampled load of each cycle game process in the preset historical cycle and the third game session; calculating the average value of the single game load of each cycle game process in the historical cycle to obtain the single game load of the current cycle game process.

[0012] Furthermore, after the step of determining the predicted load of the current cycle game process based on the load information, the method includes: calculating the weight of the current cycle game process based on the predicted load; sending the weight and the single game load to the matching server, so that the matching process in the matching server can allocate the corresponding game process to the game sessions in the received process matching request based on the weight and the single game load.

[0013] In a second aspect, an embodiment of the present invention provides a device for determining a process load, wherein the device is arranged in a game server, and a plurality of game processes are running in the game server; the device comprises: an acquisition module for acquiring load information of each game process; the load information comprises: a sampled load, namely, a first game session to be added to the game process, a second game session in a non-game state, and a third game session in a game state; and a determination module for determining a predicted load of the game process of the current cycle according to the load information.

[0014] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement any method for determining a process load of the first aspect.

[0015] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement any one of the methods for determining a process load of the first aspect.

[0016] The embodiments of the present invention bring the following beneficial effects:

[0017] The present invention provides a method, device and electronic device for determining process load, including: obtaining the load information of the game process through the game process running in the game server; wherein the load information includes: sampled load, the first game session that is about to join the game process, the second game session in a non-game state, and the third game session in a game state; according to the load information, determining the predicted load of the game process in the current cycle. In this method, the current state of each game session in the game process and the game session that is about to join the game process are taken into account, and the load occupied by the game session that is about to join the game process and the game session that is in a non-game state in the game state is reserved for the game process, so that the final determined process load is more in line with the actual running state of the game, enriches the dimension of the process load, improves the accuracy of the process load, and thus improves the stability of the server.

[0018] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0019] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0021] Figure 1 A flowchart of a method for determining a process load provided by an embodiment of the present invention;

[0022] Figure 2 A schematic diagram of state changes during a game process provided by an embodiment of the present invention;

[0023] Figure 3 A schematic diagram of a specific game server provided by an embodiment of the present invention;

[0024] Figure 4 A schematic diagram of the structure of a device for determining a process load provided by an embodiment of the present invention;

[0025] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0027] At present, with the development of online games, MOBA (Multiplayer Online Battle Arena, multiplayer online tactical competitive games) online games gradually have a large user base, and MOBA games usually use a distributed multi-server architecture to provide services. In order to balance the pressure borne by each server in the distributed multi-server architecture and ensure the stability of the server, it is necessary to count the load borne by each server. In the related art, a single hardware indicator or a unified method is usually used to count the server load, such as determining the server load by CPU sampling or counting the number of server network connections. However, unlike traditional network services, the server of multiplayer online tactical competitive games has the characteristics of large concurrency, concentrated user connections, complex system status, and fast load changes. Therefore, the above method cannot accurately count the load of the game server, or predict the change of the server load, which may cause the load carried by the servers to be unbalanced, affecting the stability of the server. Based on this, a method, device and electronic device for determining a process load are provided in an embodiment of the present invention. The technology can be applied to a game server, and in particular, it can be applied to a device with a function of determining a server or process load.

[0028] To facilitate understanding of this embodiment, a method for determining a game process disclosed in an embodiment of the present invention is first described in detail. The method is applied to a game server, and a plurality of game processes are running in the game server. The game may be a battle-related game, and the game process includes at least one battle session. Figure 1 As shown, the method comprises the following steps:

[0029] Step S102, obtaining load information of each game process; the load information includes: sampled load, the first game session to be added to the game process, the second game session in a non-game state, and the third game session in a game state;

[0030] The above-mentioned game may be a game related to combat, the game process may be a combat process related to combat, and the game process generally includes multiple games or combats; the above-mentioned sampling load generally refers to the CPU load occupied by the game process, and the above-mentioned first game session includes the number of games that are about to join the game process; the above-mentioned second game session includes the number of games that are in a non-game state in the game process; wherein the non-game state generally includes a pause state and a ready state; the above-mentioned third game session includes the number of games that are in a game state in the game process.

[0031] Usually, there are multiple game states in online games, such as ready state, pause state, and game state. Different states consume different CPU loads, and there is a certain conversion relationship between the states, such as Figure 2 A schematic diagram of state changes in a game process is shown, in which the game sessions in the game state (corresponding to BATTLE in the figure) need to constantly synchronize the player's position and operation, so the game sessions in the game state occupy a higher CPU load, while the game sessions in the preparation state (corresponding to WAIT in the figure) and the paused state (corresponding to PAUSE in the figure) consume relatively less CPU load because the players do not need to move and operate. However, since the game sessions in the preparation state and the paused state are likely to be randomly switched to the game state, in order to ensure that each game session in the game process can run stably, the game process needs to reserve enough load space for these second game sessions to carry the load changes caused by the game switching state of the second game field at any time. That is, the game sessions in the preparation state and the paused state can be calculated as game sessions in the game state.

[0032] In addition, since the sampling process for determining the sampling load is usually periodic, for a low-load game process, more game sessions will usually be allocated to the game process during the sampling interval, resulting in large fluctuations in the CPU load of the game process. To avoid this problem, the upcoming game sessions in each game process can be predicted. For example, the game sessions that may be allocated to the current game process within 5 seconds, and then the CPU load consumed by these game sessions can be pre-determined into the load occupied by the game process.

[0033] In actual implementation, the game process determines different load information of the game process in different ways. For example, the sampling load of the game process in the current cycle can be obtained by sampling, where the sampling load refers to the CPU load actually consumed by the game process in the current cycle, and can also be understood as the CPU load consumed by the game sessions in the game state. For example, the game sessions in different states in the game process can be identified by state recognition, so as to obtain the second game session and the third game session mentioned above. For another example, the game session that will be added to the game process, that is, the first game session mentioned above, can be determined by prediction or by the game sessions added by the game process in historical time. The game sessions include the number of game sessions and can also include specific game information.

[0034] Step S104: Determine the predicted load of the current cycle game process based on the load information.

[0035] The above-mentioned predicted load usually includes the above-mentioned sampling load, and also includes the CPU load occupied by the above-mentioned first game session and the second game session. The CPU load occupied by the above-mentioned first game session can be calculated based on the sampling load, the third game session and the first game session; the CPU load occupied by the above-mentioned second game session can be calculated based on the sampling load, the third game session and the second game session. Specifically, the sampling load, the CPU load occupied by the first game session, and the CPU load occupied by the second game session can be directly added to obtain the predicted load of the current cycle game process. It is also possible to calculate the above-mentioned predicted load by assigning different weights to each load in a weighted manner.

[0036] There is also a central process running in the above-mentioned game server. In actual implementation, the game process needs to periodically obtain load information, and then the game process sends the obtained load information to the central process. The central process determines the predicted load of the game process in the current period based on the load information. The above-mentioned sampling period (also called period) can be set according to actual needs, such as 5 seconds. In addition, since the game process is organized as a server unit and the cost of cross-server communication is relatively high, the method of calculating the predicted load of each process can avoid the centralized load calculation solution.

[0037] The embodiment of the present invention provides a method for determining the process load, including: obtaining the load information of the game process through the game server running in the game server; the load information includes: sampled load, the first game session that is about to join the game process, the second game session in a non-game state, and the third game session in a game state; according to the load information, determining the predicted load of the game process in the current cycle. In this method, the current state of each game session in the game process and the game session that is about to join the game process are taken into account, and the load occupied by the game session that is about to join the game process and the game session that is in a non-game state in the game state is reserved for the game process, so that the final determined process load is more in line with the actual running state of the game, enriches the dimension of the process load, improves the accuracy of the process load, and thus improves the stability of the server.

[0038] Since the above load information includes sampled load, the first game session to be added to the game process, the second game session in a non-game state, and the third game session in a game state, the following describes how to obtain different load information; specifically, including:

[0039] (1) Obtaining a sampling load of the current cycle game process through a preset sampling method; wherein the sampling load is a sampling value of the CPU load of the game process;

[0040] The preset sampling method can be to sample the CPU load of the game process at preset intervals, where the preset time can be 1 to 10 seconds, which can also be called a sampling interval, i.e. the sampling period. The shorter the sampling interval, the closer it is to the actual situation, but the higher the extra server performance consumed. Therefore, the sampling interval can be set according to actual needs. In fact, the sampling load is the CPU load occupied by game sessions in different states. Generally, the CPU load occupied by game sessions in the preparation state and the pause state can be ignored. Therefore, the sampling load can be considered as the CPU load occupied by game sessions in the game state in the current cycle game process.

[0041] (2) Determine the first game session that will be added to the game process in the current cycle by forward prediction;

[0042] Usually, the game sessions historically added to the game process in the historical time period, such as the previous sampling period (i.e., the sampling period set when obtaining the sampling load), or the previous sampling periods can be obtained. If it is the initial state, the newly added game sessions in the game process at the initial moment can be directly set according to actual needs. If the newly added game sessions in the game process in the previous sampling period are obtained, the obtained game sessions can be directly determined as the above-mentioned first game session. If the newly added game sessions in the game process in the previous sampling periods are obtained, the average value of these game sessions can be calculated, and the calculated average value can be determined as the above-mentioned first game session; these game sessions can also be calculated in a weighted manner to obtain the above-mentioned first game session.

[0043] A possible implementation method is as follows: obtaining the current game session newly added to the current cycle game process and the historical game sessions added to the historical cycle game process; wherein the game session in the game process at the initial moment is a preset value; and determining the first game session to be added to the game process in the current cycle based on the current game session, the historical game session and a preset weight coefficient.

[0044] The above preset value is a relatively large value. Specifically, the game process will always detect the newly added game sessions in each sampling period, so the newly added game sessions in the game process in the current sampling period detected by the game process can be obtained. Alternatively, the game process can also sample the newly added game sessions in each period at all times; at the same time, it can also obtain the historical game sessions added to the game process in the historical period. It should be noted that if it is the initial moment, the preset value can be directly obtained, and the preset value can be set according to actual needs. Usually, in order to avoid the determined load being small, resulting in the matching process allocating more game sessions to the game process, the above preset value is generally set to a larger value.

[0045] The above-mentioned historical cycle includes all cycles from the initial moment to the current moment, so the historical game sessions include multiple ones. The first game session that will be added to the game process in the current cycle can be continuously iterated and calculated based on the historical game sessions, the current game session and the preset weight coefficient. Usually, corresponding weights can be assigned to the current game session and each historical game session, and the weight coefficient is usually between 0 and 1. For example, there is only one historical weight, and a weight of 0.5 can be assigned to the current game session and a weight of 0.5 can be assigned to the historical game session. In this way, the newly added game sessions in the current sampling cycle and the historical sampling cycle can be considered more evenly, so that the predicted first game session will be more in line with the game process, and the prediction will be more accurate. In addition, by setting a larger preset value, the load of the newly added game process can be controlled to gradually decrease from a larger value to the true value.

[0046] Specifically, the first game session can be determined through the following exponential smoothing model:

[0047] C(t)=αS(t)+(1-α)C(t-1);

[0048] Among them, C(t) represents the first game session that will be added to the game process in the current cycle; S(t) represents the current game session newly added to the game process in the current cycle; C(t-1) represents the game session that will be added to the game process in the previous cycle; α is the preset weight coefficient; 0<α<1.

[0049] C(t-1) is also calculated by the above formula. It can be understood that C(t-1) is the result of continuous weighted accumulation of S(0), S(1) and S(t-2). S(0) is the above preset value. α is the smoothing coefficient, and 0<α<1. If the above exponential smoothing model is expanded, we can get:

[0050]

[0051] Among them, C(t) represents the first game session that will be added to the game process in the current cycle; S(ti) represents the historical game session added to the game process in the historical ti cycle, where t represents the current cycle; S0 represents the preset value; α is the preset weight coefficient.

[0052] Where i represents the first i sampling periods, and t represents the length of time the game has been running on the game server; however, since 0<α<1, when t→∞, (1-α) t →0, so the above formula can be simplified to:

[0053]

[0054] because The coefficients of each time series change exponentially from near to far, so the first game session C(t) is affected by the sampling period and also changes exponentially with time, which has the effect of smoothing with the historical game sessions. It can be understood that the longer the time, the smaller the coefficient of the earliest historical game session, and the smaller the impact on the first game session, and thus the load of the newly added game process can be controlled to gradually decrease from a large value to the real value.

[0055] Usually at the initial moment of a game process, that is, when the game server just starts running, or when the process is expanded, if the newly expanded game process obtains the CPU load according to the current sampling method, the obtained load is low, and a large number of game sessions may be allocated to the game process, causing the CPU load of the process to rise sharply. Through the above-mentioned exponential smoothing model, by setting the initial value, the first game session newly added to the game process can be controlled to gradually decrease from a higher value to the real value. At the same time, by controlling the first game session, the predicted load determined by the game process can be controlled to gradually decrease from a larger load value to the real load value over time.

[0056] (3) According to the game status of each game in the game process, the number of games in the non-game state is determined as the second game round, and the number of games in the game state is determined as the third game round.

[0057] Since each game session in the game process will have a different game status, you can first identify the status of each game, including the preparation state, pause state and game state, and then determine the number of games in the preparation state and pause state, as well as the number of games in the game state. Finally, determine the number of games in the preparation state and pause state as the second game session, and determine the number of games in the game state as the third game session.

[0058] In the above method, not only the load is obtained, but also the various states of the game in the game process are distinguished. The game sessions in different states are obtained by identifying the states. It is also considered that new games may be added to the game process during the sampling period. The upcoming game sessions of the game process in the current period are obtained by prediction. The space occupied by the possible load can be reserved for the game process in advance. The process load determined later will be more in line with the current operating status, thereby improving the stability of the server.

[0059] The following describes the specific implementation steps of determining the predicted load of the current cycle game process based on the load information, which specifically include:

[0060] According to the sampling load, the second game session and the third game session, the first compensation load of the game process is calculated; according to the sampling load, the first game session and the third game session, the second compensation load of the game process is calculated; based on the sampling load, the first compensation load and the second compensation load, the predicted load of the game process in the current cycle is calculated.

[0061] Since the above-mentioned sampled load can represent the CPU load occupied by the game session in the game state, the CPU load occupied by each game session in the game state can be obtained by dividing the sampled load by the third game session, and then by multiplying the CPU load occupied by each game session by the second game session, the CPU load occupied by the game session in the ready state and the paused state when switching to the game state can be obtained, that is, the above-mentioned first compensation load. Similarly, by multiplying the CPU load occupied by each game session by the first game session, the CPU load occupied by the upcoming game session if it is in the game state can be obtained, that is, the above-mentioned second compensation load.

[0062] Finally, the sampling load, the first compensation load and the second compensation load can be directly added together to calculate the predicted load of the current cycle game process. Weights can also be assigned to the sampling load, the first compensation load and the second compensation load, respectively, and the weight can be a value between 0 and 1 to obtain the above-mentioned predicted load. The closer the weight is to 1, the more conservative the calculated predicted load is. The above method uses the load information that can be directly obtained by the game process to calculate the compensation load that the game process may occupy. The predicted load calculated by the sampling load and the compensation load can reserve enough load space for the game process to prevent the load increase caused by the internal state change of the game process, and the load increase caused by the game that may be added, so that the predicted load is more in line with the current running state.

[0063] Specifically, the predicted load of the game process can be calculated by the following prediction model:

[0064]

[0065] Wherein, T(cpu) represents the predicted load of the game process in the current cycle; Y(t) represents the sampled load of the game process in the current cycle; C(t) represents the first game session that will be added to the game process in the current cycle; N(t) represents the second game session that is in a non-game state in the game process in the current cycle; B(t) represents the third game session that is in a game state in the game process in the current cycle; is the first compensation load; is the second compensation load; a, b, c are the model parameters of the prediction model. Indicates the CPU load occupied by each game session in the game state.

[0066] In addition, the method further includes: calculating the single-game load of the current cycle game process according to the sampled load and the third game session. Specifically, the single-game load can be calculated by the sampled load Y(t) and the third game session B(t), that is, It should be noted that PB(t) is the single-game load of the current cycle game process; usually, the single-game load calculated in different cycles may be different.

[0067] A possible implementation method is: based on the sampled load of each game process in the preset historical period and the third game session, calculate the single game load of each game process in the historical period; calculate the average value of the single game load of each game process in the historical period to obtain the single game load of the current game process.

[0068] The above preset historical period can be set according to actual needs, such as the first 20 seconds, or the first 4 sampling periods. In actual games, the CPU load occupied by a single game fluctuates. In order to eliminate the influence of time and number of players on PB(t), the average value of PB(t) over a period of time can be calculated based on statistical methods. This embodiment uses the following sliding window average method to predict it:

[0069]

[0070] Where m represents the number of cycles; the single-game load calculated in the above manner takes into account the single-game load in the historical time period, and the predicted result is more realistic and more in line with the actual running status of the game.

[0071] The above method also includes: calculating the weight of the game process in the current cycle according to the predicted load; sending the weight and the single game load to the matching server, so that the matching process in the matching server can allocate the corresponding game process to the game sessions in the received process matching request according to the weight and the single game load.

[0072] After calculating the above predicted load, in order for the matching process in the matching server to better allocate the corresponding game process to the game sessions in the received process matching request according to the predicted load, the weight of the game process in the current cycle can also be calculated by the central process running in the game server: W = 1-T (cpu); for a single-core CPU, assuming that the highest CPU of each process is 100%, 0≤T (cpu) ≤ 100%). After the central process in the game server calculates the weight of each game process and the single-game load, the weight of each game process and the single-game load are sent to the corresponding matching server. The matching server includes multiple matching processes, and each matching process will receive the weight and single-game load of each game process. The matching process will determine the game process that exceeds the preset weight, such as 10% or 5%, as the game process to be allocated according to the weight of each game process, and then randomly allocate the game sessions in the received process matching request to one of the game processes to be allocated. The random allocation can usually be randomly allocated according to the weight, that is, the larger the weight, the greater the probability of the process to be allocated. In addition, the above preset weight is usually set to a smaller value, or even to 0.

[0073] Traditional distributed multi-server architecture load balancing solutions for game servers are often based on centralized sorting or load balancing to balance the load of each game process, but the cross-server communication frequency is low and costly, resulting in a long sampling period. The present embodiment can achieve decentralization through a unified weight, and each game process can independently calculate the weight of each game process through a central process and achieve high-frequency synchronization.

[0074] In addition, in order to prevent the matching process from continuously allocating multiple game sessions to the same game process, the weight of the game process can be reduced according to the single game load after the matching process allocates the game session in the process matching request to the corresponding game process. The single game load can be directly subtracted from the weight of the received game process, and the weight of the game process to be reduced can be calculated based on the current number of matching processes, the number of game processes to be allocated, the number of all game processes, and the single game load. If the weights of all game processes to be allocated are reduced to 0, the game process can be allocated to the new game session by purely randomly selecting the process.

[0075] Specifically, the weight to be reduced can be expressed as: Δw = f*PB(cpu); where CB is the number of processes to be assigned that can be randomly selected directly at present, TB is the total number of game processes, and M is the number of matching processes working together in the same cycle. Among them, each matching process will cache the weights of all game processes and the load of a single game. It can be understood that when the number of matching processes working together in the same cycle is large and the number of game processes to be assigned is small, f will be larger, and Δw will also become larger. In this case, after the matching process assigns a game session, the weight of the assigned game process will decrease faster, so that there will not be too many game sessions assigned to the game process, avoiding the problem of a sudden increase in load due to the large weight of the game process, which can achieve better load balancing capabilities.

[0076] This embodiment combines the sampling load with the game sessions to calculate the weight of each process that can accommodate new game sessions, so that new game sessions can be more likely to be allocated to processes with lower pressure, thereby improving the stability of the server.

[0077] For details, see Figure 3 The schematic diagram of the specific game server shown is that a multiplayer online tactical competitive game is usually a distributed multi-server architecture, which includes multiple battle servers (corresponding to the aforementioned game servers) that carry the game battle logic, such as battle server 1 and battle server 2 in the figure. It also includes multiple matching servers (corresponding to the aforementioned matching servers) that carry the player logic required for matching a single battle. Each battle server runs multiple battle processes (corresponding to the aforementioned game processes) and a central process. Similarly, each matching server runs multiple matching processes and a central process. Each battle server communicates with the matching server through the central process. Each battle process in the battle server communicates with the central process, and each matching process in the matching server communicates with the central process.

[0078] This embodiment is based on a distributed system of multiple battle servers and multiple matching servers, in which each battle process establishes a connection with the central process on the battle server, and the central process establishes a connection with the matching process. In the matching process, this embodiment selects a server selection algorithm based on weighted randomness, and the server selection steps generally include:

[0079] Step 1. Each battle process periodically samples the CPU usage Y(t) of the battle process, and observes the newly arrived battles S(t) from time t-1 to time t, the battles N(t) being prepared and paused at time t, and the battles B(t) currently in progress.

[0080] Step 2. Each battle process is based on the formula Calculate PB(t) and based on the formula Perform sliding window averaging on PB(t) to predict the average value PB(cpu) over a period of time, based on the formula C(t) = αS(t) + (1-α)C(t-1); calculate C(t), and synchronize Y(t), C(t), N(t) and PB(cpu) to the current battle service center process.

[0081] Step 3. The combat service center process calculates the total CPU load T(cpu) of each combat process based on the collected information; then calculates the weight of each combat process according to the formula W=1-T(cpu).

[0082] Step 4. The battle server center process sends all current battle process weight information and PB (cpu) to the matching server.

[0083] Step 5. The matching process pulls and caches all battle process weight information and PB (cpu), and selects the server through weighted randomness when a new battle arrives. After each selection, the local weight of the battle process is subtracted from Δw. If the weights of all optional battle processes are reduced to 0, it will fall back to pure random server selection.

[0084] Corresponding to the above method embodiment, the embodiment of the present invention also provides a device for determining process load, such as Figure 4 As shown, the device is set in a game server, and multiple game processes are running in the game server; Figure 4 As shown, the device comprises:

[0085] The acquisition module 41 is used to acquire the load information of each game process; the load information includes: sample load, the first game session to be added to the game process, the second game session in a non-game state, and the third game session in a game state;

[0086] The determination module 42 is used to determine the predicted load of the current cycle game process according to the load information.

[0087] The embodiment of the present invention provides a device for determining the process load, including: obtaining the load information of the game process through the game server running in the game server; the load information includes: sampled load, the first game session that is about to join the game process, the second game session in a non-game state, and the third game session in a game state; according to the load information, determining the predicted load of the game process in the current cycle. In this method, the current state of each game session in the game process and the game session that is about to join the game process are taken into account, and the load occupied by the game session that is about to join the game process and the game session that is in a non-game state in the game state is reserved for the game process, so that the final determined process load is more in line with the actual running state of the game, enriches the dimension of the process load, improves the accuracy of the process load, and thus improves the stability of the server.

[0088] Furthermore, the above-mentioned acquisition module is also used to: obtain the sampling load of the current cycle game process through a preset sampling method; wherein the sampling load is the sampling value of the CPU load of the game process; determine the first game session that will be added to the game process in the current cycle through a forward prediction method; according to the game status of each game in the game process, determine the number of games in the non-game state as the second game session, and determine the number of games in the game state as the third game session.

[0089] Furthermore, the above-mentioned acquisition module is also used to: obtain the current game session newly added to the current cycle game process, and the historical game sessions added to the historical cycle game process; wherein the game sessions in the initial cycle game process are preset values; and determine the first game session that will be added to the game process in the current cycle based on the current game session, the historical game session and the preset weight coefficient.

[0090] Furthermore, the acquisition module is also used to determine the first game session by using the following exponential smoothing model: Among them, C(t) represents the first game session that will be added to the game process in the current cycle; S(ti) represents the historical game session added to the game process in the historical ti cycle, where t represents the current cycle; S0 represents the preset value; α is the preset weight coefficient.

[0091] Furthermore, the above-mentioned determination module is also used to: calculate the first compensation load of the game process based on the sampling load, the second game session and the third game session; calculate the second compensation load of the game process based on the sampling load, the first game session and the third game session; calculate the predicted load of the game process in the current cycle based on the sampling load, the first compensation load and the second compensation load.

[0092] Furthermore, the above determination module is also used to calculate the predicted load of the game process specifically through the following prediction model: Wherein, T(cpu) represents the predicted load of the game process in the current cycle; Y(t) represents the sampled load of the game process in the current cycle; C(t) represents the first game session that will be added to the game process in the current cycle; N(t) represents the second game session that is in a non-game state in the game process in the current cycle; B(t) represents the third game session that is in a game state in the game process in the current cycle; is the first compensation load; is the second compensation load; a, b, c are model parameters of the prediction model.

[0093] Furthermore, the above-mentioned device also includes a single-game load calculation module, which is used to calculate the single-game load of the current cycle game process based on the sampled load and the third game session.

[0094] Furthermore, the single game load calculation module is also used to: calculate the single game load of each game process in the historical period according to the sampling load of each game process in the historical period and the third game session; calculate the average value of the single game load of each game process in the historical period to obtain the single game load of the current game process.

[0095] Furthermore, the above-mentioned device also includes a weight calculation module, which is used to: calculate the weight of the current cycle game process according to the predicted load; send the weight and the single game load to the matching server, so that the matching process in the matching server can allocate the corresponding game process to the game sessions in the received process matching request according to the weight and the single game load.

[0096] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above method for determining the process load. The electronic device can be a server or a terminal device.

[0097] See also Figure 5 As shown, the electronic device includes a processor 100 and a memory 101, wherein the memory 101 stores machine executable instructions that can be executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the above method for determining the process load.

[0098] Further, Figure 5 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .

[0099] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0100] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware.

[0101] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned method for determining the process load.

[0102] The device for determining process load provided in the embodiment of the present invention has the same technical features as the method for determining load provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0103] The computer program product of the method, device and electronic device for determining process load provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.

[0104] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0105] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0106] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0107] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0108] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for determining a process load, characterized in that: The method is applied to a game server, wherein a plurality of game processes are running in the game server; The method comprises: Obtaining the load information of each of the game processes; the load information includes: sampled load, the first game session to be added to the game process, the second game session in a non-game state, and the third game session in a game state; wherein, by forward prediction, determining the first game session to be added to the game process in the current cycle; Determine the predicted load of the game process in the current cycle according to the load information; The step of determining the predicted load of the game process in the current cycle based on the load information includes: calculating the first compensation load of the game process based on the sampled load, the second game session and the third game session; calculating the second compensation load of the game process based on the sampled load, the first game session and the third game session; calculating the predicted load of the game process in the current cycle based on the sampled load, the first compensation load and the second compensation load.

2. The method according to claim 1, characterized in that The step of obtaining the load information of each of the game processes comprises: Acquire the sampling load of the game process in the current cycle through a preset sampling method; wherein the sampling load is a sampling value of the CPU load of the game process; Determine, by forward prediction, the first game session that will be added to the game process in the current cycle; According to the game status of each game in the game process, the number of games in the non-game state is determined as the second game session, and the number of games in the game state is determined as the third game session.

3. The method according to claim 2, characterized in that The step of determining the first game session to be added to the game process in the current cycle by forward prediction includes: Obtain the current game sessions newly added to the game process in the current cycle, and the historical game sessions added to the game process in the historical cycle; wherein the game sessions in the game process at the initial moment are preset values; The first game session to be added to the game process in the current cycle is determined according to the current game session, the historical game sessions and a preset weight coefficient.

4. The method according to claim 3, characterized in that The step of determining the first game session to be added to the game process in the current cycle according to the current game session, the historical game session and a preset weight coefficient includes: The first game session is determined by the following exponential smoothing model: Among them, C(t) represents the first game session that will be added to the game process in the current cycle; S(ti) represents the historical game sessions added to the game process in the historical ti cycle, where t represents the current cycle; S0 represents the preset value; α is the preset weight coefficient.

5. The method according to claim 1, characterized in that The step of calculating the predicted load of the game process in the current cycle based on the sampled load, the first compensation load and the second compensation load comprises: Specifically, the predicted load of the game process is calculated through the following prediction model: Wherein, T(cpu) represents the predicted load of the game process in the current cycle; Y(t) represents the sampled load of the game process in the current cycle; C(t) represents the first game session that will be added to the game process in the current cycle; N(t) represents the second game session in the non-game state in the game process in the current cycle; B(t) represents the third game session in the game state in the game process in the current cycle; is the first compensating load; is the second compensation load; a, b, c are model parameters of the prediction model.

6. The method according to claim 1, characterized in that After the step of obtaining the load information of each of the game processes, the method further includes: The single-game load of the game process in the current cycle is calculated based on the sampled load and the third game session.

7. The method according to claim 6, characterized in that The step of calculating the single-game load of the game process in the current cycle according to the sampled load and the third game session includes: Calculate the single-game load of the game process in each period of the historical period according to the sampled load of the game process in each period of the historical period and the third game number; The average value of the single-game load of the game process in each period within the historical period is calculated to obtain the single-game load of the game process in the current period.

8. The method according to claim 6, characterized in that After the step of determining the predicted load of the game process in the current cycle according to the load information, the method includes: Calculate the weight of the game process in the current cycle according to the predicted load; The weight and the single-game load are sent to a matching server, so that a matching process in the matching server can allocate corresponding game processes to the game sessions in the received process matching request according to the weight and the single-game load.

9. A device for determining a process load, characterized in that: The device is arranged on a game server, and a plurality of game processes are running in the game server; The device comprises: The acquisition module is used to acquire the load information of each of the game processes; the load information includes: sampled load, the first game session to be added to the game process, the second game session in a non-game state, and the third game session in a game state; wherein the first game session to be added to the game process in the current cycle is determined by forward prediction; A determination module, used to determine the predicted load of the game process in the current cycle according to the load information; The determination module is further used to calculate the first compensation load of the game process based on the sampled load, the second game session and the third game session; calculate the second compensation load of the game process based on the sampled load, the first game session and the third game session; and calculate the predicted load of the game process in the current cycle based on the sampled load, the first compensation load and the second compensation load.

10. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for determining a process load as described in any one of claims 1-8.

11. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for determining a process load as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Server load balancing method and device

    CN110209500A

  • Game server cluster management method and device and electronic equipment

    CN110457138A