CN112527641B - Game server load testing method - Google Patents

Game server load testing method Download PDF

Info

Publication number
CN112527641B
CN112527641B CN202011409953.5A CN202011409953A CN112527641B CN 112527641 B CN112527641 B CN 112527641B CN 202011409953 A CN202011409953 A CN 202011409953A CN 112527641 B CN112527641 B CN 112527641B
Authority
CN
China
Prior art keywords
client
data
unique
testing method
game server
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
CN202011409953.5A
Other languages
Chinese (zh)
Other versions
CN112527641A (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.)
Ultimate Attainment Interactive Network Technical Concern Co ltd In Xiamen
Original Assignee
Ultimate Attainment Interactive Network Technical Concern Co ltd In Xiamen
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 Ultimate Attainment Interactive Network Technical Concern Co ltd In Xiamen filed Critical Ultimate Attainment Interactive Network Technical Concern Co ltd In Xiamen
Priority to CN202011409953.5A priority Critical patent/CN112527641B/en
Publication of CN112527641A publication Critical patent/CN112527641A/en
Application granted granted Critical
Publication of CN112527641B publication Critical patent/CN112527641B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a game server load testing method, which comprises the following steps: s1, enabling N clients to play a normal game by a tester, distributing a unique client ID for each client, and attaching a random seed and a unique ID base number; s2, capturing network request data generated by the client, and uploading the data to a test machine in real time; s3, after receiving the network request data of the client, the tester writes the data into the data stream file named by the client ID to generate N data stream files; s4, the number M of players needing to be simulated is specified for the tester, and the load starts to be generated; and S5, comparing the load conditions of different numbers of players with the load conditions before and after the optimization server. The invention realizes accurate simulation of real user behavior, and the load test result is greatly close to the production environment, thereby reducing deviation; meanwhile, the specific test code is not required to be written aiming at the specific game service, so that the cost is reduced.

Description

Game server load testing method
Technical Field
The invention relates to the technical field of computers, in particular to a game server load testing method.
Background
In order to enable each player to have unique experience, game services often contain randomness, so that the existing load test technology can only artificially write test cases for specific services, a large amount of development cost needs to be invested, in addition, the artificially written load test cases are difficult to reflect real user behaviors, and the test results often have large deviation with the load of a production environment.
Disclosure of Invention
In order to solve the problems, the invention provides a game server load testing method.
The invention adopts the following technical scheme:
a game server load testing method comprises the following steps:
s1, enabling N clients to play a normal game by a tester, wherein each client is allocated with a unique client ID when being started, and random seeds and a unique ID base number are added to each client in communication data;
s2, capturing network request data generated by the client and uploading the network request data to a test machine in real time;
s3, after receiving the network request data of the client, the tester writes the data into a data stream file named by the client ID to generate N data stream files;
s4, the number M of players needing to be simulated is specified for the tester, and the load starts to be generated;
and S5, comparing the load conditions of different numbers of players with the load conditions before and after the optimization server.
Further, when the unique client ID is allocated to the client in step S1, a pre-allocated ID may be input to the client by human agreement, or a unique client ID may be allocated to the tester by a network request.
Further, the random seed in step S1 may be randomly derived or directly use the client ID.
Further, the ID base in step S1 may be directly multiplied by a numerical value using the client ID.
Further, the data stream file also records the time of each network request data.
Further, step S4 is specifically:
s41, the test machine creates M socket objects and is connected to the server, and the test machine generates a unique client ID and an ID base number for each socket object;
s42, each socket object randomly selects a data stream file from the N data stream files;
and S43, each socket object sequentially sends the request data to the server according to the time and the request data recorded in the data stream file.
Further, before the request data is sent each time in step S43, it is analyzed whether the request data carries a unique ID, if yes, the ID base number in the unique ID is replaced with the ID base number carried by the socket object itself, otherwise, no replacement is made.
Further, if the requested data needs to be customized and modified in step S43, a customized modification logic of the requested data is written first, and the logic is registered in a memory, and before sending the requested data each time, it is checked whether the customized modification logic needs to be executed in the memory, and if so, the modification logic is executed.
Further, the random seed needs to satisfy the condition: all client behaviors using the same random seed are completely consistent; and calculating all the calculations of the client corresponding to the random seed on the server by using the random seed.
Further, the ID base number satisfies a condition: and for the client corresponding to the ID base, all the unique ID allocation about the client is carried out on the ID base.
After adopting the technical scheme, compared with the background technology, the invention has the following advantages:
1. through a control mechanism for server business logic variables, such as: the random of the random seed control service is appointed, and the change rule of the unique ID is controlled by the appointed unique ID base number, so that the same result can be obtained by repeatedly sending the request;
2. data file recording and data copying and sending on the testing machine can be carried out simultaneously so as to support the real-time conversion of player behaviors into server loads; the modification of the unique ID in the sending data by the tester supports the copying and sending of the request data related to the unique object in the game; based on the control mechanism for the business logic variables provided by the server, the accurate simulation of the real user behavior is realized, so that the load test result is greatly close to the production environment, and the deviation is reduced;
3. because the specific test code is not written aiming at the specific game service, the additional cost is not required to be invested when the service is changed, and the method adapts to the high variability of the game service.
Drawings
FIG. 1 is a schematic flow chart of the method of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Examples
A client: namely a player client, is an application program for a player to play;
a server: the game server is a computing device which receives the network request of the player client and responds according to the game playing logic;
the test machine comprises: the load test server is a computing device that executes a load test program and performs a load capability test on the game server.
In this embodiment, the random seed needs to satisfy the following condition: all client behaviors using the same random seed are completely consistent; and calculating all the calculations of the client corresponding to the random seed on the server by using the random seed.
The ID base number satisfies the condition: and for the client corresponding to the ID base, all the unique ID allocation about the client is carried out on the ID base.
As shown in fig. 1, a method for testing the load of a game server includes the following steps:
s1, enabling N clients to play a normal game by a tester, wherein each client is allocated with a unique client ID when being started, and random seeds and a unique ID base number are added to each client in communication data;
when a unique client ID is assigned to the client, the unique client ID may be assigned by requesting the tester through the network.
The random seed may use the client ID directly.
The ID base may be directly multiplied by a value, such as 10000000, using the client ID.
S2, capturing network request data generated by the client and uploading the network request data to a test machine in real time;
there are two implementation ways for this step:
the first method comprises the following steps: directly capturing client communication data by using existing software facilities such as tcpdump, and uploading the client communication data to a testing machine in real time;
and the second method comprises the following steps: developing a data acquisition module arranged in the game client, monitoring request data generated by the client network module, and then uploading the request data to the testing machine in real time. The method comprises the following specific steps:
A. when the client network module sends network request data, a network request event is sent outwards by using an event mechanism of a language or a framework;
B. the client data acquisition module monitors network request events, and when the events occur, the client data acquisition module sends the network request data to the tester through socket connection.
The embodiment adopts a first mode to realize the capture and upload of the network request data.
S3, after receiving the network request data of the client, the tester writes the data into a data stream file named by the client ID to generate N data stream files; the data stream file also records the time each network requests data.
S4, the number M of players needing to be simulated is specified for the tester, and the load starts to be generated;
step S4 specifically includes:
s41, the test machine creates M socket objects and is connected to the server, and the test machine generates a unique client ID and an ID base number for each socket object; the ID base is generated by using the same generation rule as the client;
s42, each socket object randomly selects a data stream file from the N data stream files;
if a certain data stream file is selected, the socket object can generate game behaviors which are completely consistent with the client corresponding to the data stream; the game randomness problem can be solved by the random seed specified in the login request data.
And S43, each socket object sequentially sends the request data to the server according to the time and the request data recorded in the data stream file.
Before the request data is sent each time, whether the request data carries the unique ID is analyzed, if yes, the ID base number in the unique ID is partially replaced by the ID base number carried by the socket object, and if not, the ID base number is not replaced.
The scheme for analyzing the request data can be designed according to the game implementation pertinence, such as: extracting parameter keywords by parsing a communication interface protocol file to determine which numbers are unique IDs; for another example: when it is clear that the in-game value does not exceed X, the ID base number is set to X × 10 directly, and the number equal to or greater than X × 10 in the request data is extracted directly.
In this embodiment, when the request data includes an item ID of 10000002, the item ID is replaced with the ID base number of +2 of the socket object.
Step S43 may be used to resolve the situation where the communication request data contains a unique ID, such as using a unique item. The server load generated by M real players can be simulated through the process, and the last testing step can be repeated.
In addition, if the requested data needs to be customized and modified in step S43, the customized modification logic of the requested data is written first, and the logic is registered in a memory, and before sending the requested data, it is checked whether the customized modification logic needs to be executed in the memory, and if so, the modification logic is executed.
And S5, comparing the load conditions of different numbers of players with the load conditions before and after the optimization server.
The present embodiment is most suitable for server load testing in two cases:
the first method comprises the following steps: the weak interaction network game is mainly a single-person playing method, each player rarely interacts with other players, and the network request is sent to only modify the data of the player, so that the data of the request is copied and sent to obtain the same result;
and the second method comprises the following steps: the weak interaction stage of general network games, typically the novice stage, many games have the novice stage that is mostly a single-person business, similar to the weak interaction network games.
Under the two conditions, the load can be simulated without additionally compiling test codes aiming at the service/interface, so that the work required by the load test is greatly simplified; the simulation of real user behaviors is realized, so that the load test result is greatly close to the real load condition of the production environment, and the deviation is extremely small;
the embodiment is also suitable for load testing of a common online game, and can utilize information such as behaviors, time and the like in request data of a real client to realize load simulation close to real user behaviors by writing customized modification logic of the request data.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (8)

1. A game server load testing method is characterized in that: the method comprises the following steps:
s1, enabling N clients to play a normal game by a tester, wherein each client is allocated with a unique client ID when being started, and random seeds and a unique ID base number are added to each client in communication data;
s2, capturing network request data generated by the client and uploading the network request data to a test machine in real time;
s3, after receiving the network request data of the client, the tester writes the data into a data stream file named by the client ID to generate N data stream files;
s4, the number M of players needing to be simulated is specified for the tester, and the load starts to be generated;
step S4 specifically includes:
s41, the test machine creates M socket objects and is connected to the server, and the test machine generates a unique client ID and an ID base number for each socket object;
s42, each socket object randomly selects a data stream file from the N data stream files;
s43, each socket object sends request data to the server in sequence according to the time and the request data recorded in the data stream file;
s5, comparing the load conditions of different numbers of players with the load conditions before and after the server is optimized;
the random seed needs to satisfy the condition: all client behaviors using the same random seed are completely consistent; and calculating all the calculations of the client corresponding to the random seed on the server by using the random seed.
2. A game server load testing method as claimed in claim 1, wherein: when the unique client ID is assigned to the client in step S1, a pre-assigned ID is input to the client by human agreement, or a unique client ID is assigned to the tester by a network request.
3. A game server load testing method as claimed in claim 2, wherein: the random seed in step S1 randomly gets or directly uses the client ID.
4. A game server load testing method as claimed in claim 3, wherein: the ID base is directly multiplied by a numerical value using the client ID in step S1.
5. A game server load testing method as claimed in claim 4, wherein: the data stream file also records the time each network requests data.
6. A game server load testing method as claimed in claim 5, wherein: in step S43, before the request data is sent each time, it is analyzed whether the request data carries a unique ID, if so, the ID base number in the unique ID is partially replaced with the ID base number carried by the socket object itself, otherwise, no replacement is performed.
7. A game server load testing method as claimed in claim 6, wherein: if the requested data in step S43 needs to be customized and modified, writing a customized modification logic of the requested data, and registering the logic in a memory, checking whether the memory has the customized modification logic that needs to be executed before sending the requested data each time, and if so, executing the modification logic.
8. A game server load testing method as claimed in any one of claims 1 to 7, wherein: the ID base number satisfies the condition: and for the client corresponding to the ID base, all the unique ID allocation about the client is carried out on the ID base.
CN202011409953.5A 2020-12-04 2020-12-04 Game server load testing method Active CN112527641B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011409953.5A CN112527641B (en) 2020-12-04 2020-12-04 Game server load testing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011409953.5A CN112527641B (en) 2020-12-04 2020-12-04 Game server load testing method

Publications (2)

Publication Number Publication Date
CN112527641A CN112527641A (en) 2021-03-19
CN112527641B true CN112527641B (en) 2022-05-17

Family

ID=74998419

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011409953.5A Active CN112527641B (en) 2020-12-04 2020-12-04 Game server load testing method

Country Status (1)

Country Link
CN (1) CN112527641B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102195829A (en) * 2010-03-19 2011-09-21 升东网络科技发展(上海)有限公司 Universal pressure simulation system and control method thereof
CN105657067A (en) * 2016-03-24 2016-06-08 网易(杭州)网络有限公司 Game verification method and device, game server and verification server
CN107145444A (en) * 2017-05-04 2017-09-08 网易(杭州)网络有限公司 Method of testing, test device, computer-readable recording medium and the electronic equipment of game performance

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9268673B2 (en) * 2010-10-20 2016-02-23 Sony Computer Entertainment America Inc. Load testing online game server environment using web-based interface

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102195829A (en) * 2010-03-19 2011-09-21 升东网络科技发展(上海)有限公司 Universal pressure simulation system and control method thereof
CN105657067A (en) * 2016-03-24 2016-06-08 网易(杭州)网络有限公司 Game verification method and device, game server and verification server
CN107145444A (en) * 2017-05-04 2017-09-08 网易(杭州)网络有限公司 Method of testing, test device, computer-readable recording medium and the electronic equipment of game performance

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"网页游戏服务器负载均衡算法WLC的改进";李冬;《苏州市职业大学学报》;20160714;第27卷(第2期);第31-33页 *

Also Published As

Publication number Publication date
CN112527641A (en) 2021-03-19

Similar Documents

Publication Publication Date Title
US6772107B1 (en) System and method for simulating activity on a computer network
US10628294B2 (en) Mock services for software infrastructures
US9465718B2 (en) Filter generation for load testing managed environments
US20050066309A1 (en) Validating software in a grid environment using ghost agents
Thereska et al. Practical performance models for complex, popular applications
US6567767B1 (en) Terminal server simulated client performance measurement tool
Aquino et al. Usability evaluation of multi-device/platform user interfaces generated by model-driven engineering
US20140006358A1 (en) Creation and replay of a simulation workload using captured workloads
CN110944048A (en) Service logic configuration method and device
US20090106420A1 (en) Ghost agents for application domains within a grid environment
KR20130026919A (en) Method for distributed test and system for performing the same, method for controling distributed test and system for performing the same, method for making distributed test plan and apparatus for performing the same, method for executing distributed test plan and agent for distributed test
CN102014163B (en) Cloud storage test method and system based on transaction driving
CN115510454A (en) Game testing method and device, electronic equipment and storage medium
Wang et al. MetaOJ: A massive distributed online judge system
US20230316946A1 (en) System and method for vr training
US20090119544A1 (en) Ghost agents within a grid environment
US8713050B2 (en) Testing SQL query writing skills
CN112527641B (en) Game server load testing method
KR101138302B1 (en) Device for combination of online game server-test
CN115455059A (en) Method, device and related medium for analyzing user behavior based on underlying data
CN111414194B (en) Interface information generation method, system, electronic equipment and storage medium
CN111078527B (en) Auxiliary system and method for pressure testing of server
CN113535499A (en) Multi-type concurrent memory access flow verification method supporting multi-core shared access
US20160371433A1 (en) Content Testing During Image Production
CN113742226B (en) Software performance test method and device, medium and electronic equipment

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