CN105487965A - Universal server pressure testing method and device - Google Patents

Universal server pressure testing method and device Download PDF

Info

Publication number
CN105487965A
CN105487965A CN201510998472.5A CN201510998472A CN105487965A CN 105487965 A CN105487965 A CN 105487965A CN 201510998472 A CN201510998472 A CN 201510998472A CN 105487965 A CN105487965 A CN 105487965A
Authority
CN
China
Prior art keywords
network packet
module
server
action
binary code
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.)
Pending
Application number
CN201510998472.5A
Other languages
Chinese (zh)
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.)
Beijing Changyou Tianxia Network Technologies Co Ltd
Original Assignee
Beijing Changyou Tianxia Network Technologies 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 Beijing Changyou Tianxia Network Technologies Co Ltd filed Critical Beijing Changyou Tianxia Network Technologies Co Ltd
Priority to CN201510998472.5A priority Critical patent/CN105487965A/en
Publication of CN105487965A publication Critical patent/CN105487965A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • G06F11/3414Workload generation, e.g. scripts, playback
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • G06F11/3433Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment for load management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3457Performance evaluation by simulation

Abstract

The invention discloses a universal server pressure testing device. The device comprises a receiving and transmitting module, a packaging module, a byte analysis module and an action module. The receiving and transmitting module adapts to a network protocol adopted by a to-be-tested server and receives and transmits network data packages. The packaging module de-packages the network data packages to obtain binary code streams, and the binary code streams from the upper layer are packaged to obtain network data packages. The byte analysis module restores the binary code streams from the lower layer into specific network package objects or converts the network package objects from the upper layer into binary code streams. The actuating module defines the action for a virtual user to transmit each specific network package object, the corresponding network package object to be transmitted by the action is defined in each action and transmitted, if the expected network package object is received, the action is successfully executed, or else the action is not successfully executed. The invention further discloses a universal server pressure testing method.

Description

A kind of general server stress method of testing and device
Technical field
The application relates to technical field of the computer network, particularly relates to a kind of general server stress method of testing and device.
Background technology
In network game development process, server stress test is one of them important step.The performance point that online game pressure test is bottleneck by determining a system or can not receives, the test of the maximum service rank that the system that obtains can provide.Here namely " pressure " of indication be the player constantly increasing game the inside.Player in pressure test can be real player, and also can be " virtual players " that specific test and measure software simulates, these virtual players be also referred to as Ya Ce robot.Large piezometric can be realized survey robot in same client device, Ya Ce robot is adopted to carry out server stress test, carry out pressure test relative to by true player, the cycle that server stress is tested and expense shorten greatly, therefore obtain applying more and more widely.
In prior art, the usual self-developing of Game development teams and project assorted Ya Ce robot, robot needs the network packet module of dependent file client or server, and coupling is strong.The development language of the Ya Ce robot employing of different game item is also different simultaneously, has C++, java, C# etc.Ya Ce robot for a project development cannot use to sundry item, does not possess versatility.A game company on a large scale often has multiple network game project grinding, and each project needs the underlying basis framework from the beginning realizing a Ya Ce robot, and this is also the one waste of resource.
Summary of the invention
This application provides a kind of general server stress method of testing and device, all can be suitable for for the procotol of disparity items, network packet structure, thus shorten cycle and the cost of pressure test.
The embodiment of the present application provides a kind of general server stress proving installation, and this device comprises from bottom to top: transceiver module, package module, byte parsing module, action module;
Described transceiver module is used for the procotol that the adaptive server that will test adopts, and the network packet from upper strata is sent to server; Or the network packet received from server, and described network packet is sent to upper strata;
Package module, for carrying out decapsulation to the network packet from lower floor, binary code stream decapsulation obtained is sent to upper strata; Or encapsulation is carried out to the binary code stream from upper strata and obtains network packet, described network packet is sent to lower floor;
Byte parsing module, for the binary code stream from lower floor is reduced into concrete network packet object, and object's property value is set, concrete network packet object is sent to upper strata simultaneously, or the network packet object from upper strata is converted into binary code stream and is sent to lower floor;
Action module, for the action that defining virtual user sends each particular network bag object, defines the network packet object that this action will send, the network packet object that desired service device returns inside each action, and the input parameter that this action accepts; Action module constructs the network packet object that will send to server by the property value of input parameter and player role, and is sent to lower floor; And the network packet object returned is received from lower floor, if receive the network packet object of expectation, think this action successful execution, otherwise think that this action executing is unsuccessful.
Alternatively, on package module, and also comprise Encryption Decryption module under byte parsing module, for to the binary code stream encryption from upper strata, binary code stream after encryption is sent to lower floor, or the binary code stream from lower floor is decrypted, the binary code stream after deciphering is sent to upper strata.
Alternatively, the layer at described byte parsing module place comprises analytical tool storehouse further, for providing the public method of various parsing binary code stream, so that byte parsing module calls.
Alternatively, described transceiver module comprises multiple Transmit-Receive Unit, and each Transmit-Receive Unit is used for adaptive a kind of procotol, and according to the procotol that server adopts, one of them Transmit-Receive Unit is in enabled state and carries out network service.
Alternatively, described transceiver module comprises transmitting-receiving Socket unit, transmitting-receiving HTTP unit and transmitting-receiving WebSocket unit.
Alternatively, described byte parsing module comprises two function interfaces, a function interface is used for the binary code stream being obtained this network packet object by network packet object, another function interface is used for arranging network packet object's property value according to binary code stream, and described function interface adopts the programming language irrelevant with server to realize.
Alternatively, this device comprises response time logging modle further, sends network packet object to the time receiving the network packet object that desired service device returns, the responsively time for recording from action module.
Alternatively, on action module, comprise task module further, for the task of defining virtual user, described task is made up of a series of actions, and adds Logic judgment process.
Alternatively, on task module, this device comprises virtual subscriber objects module further, for arranging the task queue of virtual subscriber objects, and preserves the attribute of virtual players role.
Alternatively, this device comprises functional test script module and unit testing frame module further,
What described functional test script module used for On-board test uses case script, according to case script initialization of virtual user object, and connect with game server, game server also completes corresponding test assignment, obtain the data attribute value that server returns, whether the function carrying out validate service device is correct;
Unit testing frame module is used for function of organization's test.
Alternatively, this device comprises scheduler module further, goes out multiple Virtual User and server carries out alternately for calling virtual subscriber objects module simulation.
Alternatively, described scheduler module adopts association's journey technology to switch between the task of multiple Virtual User.
Alternatively, described scheduler module is that each Virtual User distributes execution time section;
Virtual User is in the execution time section of correspondence, and the message queue bag that processing server is sent, sends heartbeat message bag to server, and a task in queue of executing the task.
The embodiment of the present application additionally provides a kind of general server stress method of testing,
Steps A, defining virtual user send the action of each particular network bag object, define the network packet object that this action will send, the network packet object that desired service device returns inside each action, and the input parameter that this action accepts;
Step B, construct the network packet object that will send to server by the property value of input parameter and player role, described network packet object is converted into binary code stream, and encapsulation is carried out to described binary code stream obtain network packet, by described network packet by being sent to server with the procotol of server adaptation;
Step C, receive network packet from server, carry out decapsulation to described network packet, binary code stream decapsulation obtained is reduced into concrete network packet object, if receive the network packet object of expectation, think action successful execution, otherwise think that this action executing is unsuccessful.
Alternatively, step B comprises taking a step forward of encapsulating of described binary code stream: to binary code stream encryption;
Before the binary code stream that decapsulation obtains being reduced into concrete network packet object described in step C, comprise further: binary code stream is decrypted.
Alternatively, the method comprises further: record from transmission network packet object to responsively time time receiving the network packet object that desired service device returns.
Alternatively, taking a step forward of steps A comprises: the task queue arranging virtual subscriber objects, and the attribute preserving virtual players role, described task is made up of a series of actions, and adds Logic judgment process.
Alternatively, the method comprises further: simulate multiple Virtual User and server carries out alternately.
Alternatively, association's journey technology is adopted to switch between the task of multiple Virtual User.
Alternatively, for each Virtual User distributes execution time section;
Described employing association journey technology is carried out switching and is comprised between the task of multiple Virtual User:
Virtual User is in the execution time section of correspondence, and the message queue bag that processing server is sent, sends heartbeat message bag to server, and a task in queue of executing the task.
As can be seen from the above technical solutions, adopt the game server of different network protocol by transceiver module adaptation, adopt independently encapsulation and again realize network packet, thus break away from the dependence of disparity items for network packet definition and code, auxiliary analytical tool storehouse, improves development efficiency simultaneously; In order to back-level server functional test and pressure test, each network packet that Virtual User sends is designed to concrete action, multiple action group has been synthesized task.Action layer and task layer, support writing of functional test script.Also facilitate pressure test scheduler program to dispatch simultaneously.
In certain embodiments, by adopting association's journey technology, by software simulation thread, when avoiding the pressurization of robot simulation's a large number of users, multithreading switches the performance consumption to physical machine CPU.When Virtual User does not receive the network packet expecting to return, Virtual User initiatively can surrender right of execution, avoids the execution obstructing problem for wait network packet returns and cause.Call for robot, the problem that single virtual user can only perform an action in the timeslice distributing to oneself, by task queue mode, the task of needing to perform successively is put into inside a queue, allows Virtual User call according to queue.For the pressure test scene problem needing to support many people mutual, by many people task queue mode, particular user is needed the specific tasks performed, be put into successively in a queue, allow Virtual User call according to queue.
Accompanying drawing explanation
Fig. 1 is the configuration diagram of the pressure test device in the present invention's specific embodiment;
Fig. 2 completes the schematic diagram of pressure test by scheduling Virtual User for pressure test device 100 shown in Fig. 1;
Fig. 3 for the pressure test device 100 shown in Fig. 1 carry out between Virtual User switching scheduling treatment scheme schematic diagram;
The embodiment schematic diagram of the pressure test scene that solution many people logic that Fig. 4 provides for the embodiment of the present application is mutual.
Embodiment
For making the know-why of technical scheme, feature and technique effect clearly, below in conjunction with specific embodiment, technical scheme is described in detail.
The embodiment of the present application provides a kind of general server stress proving installation, and this device comprises from bottom to top: transceiver module, package module, byte parsing module, action module;
Described transceiver module is used for the procotol that adaptive described server adopts, and the network packet from upper strata is sent to server; Or the network packet received from server, and described network packet is sent to upper strata;
Package module, for carrying out decapsulation to the network packet from lower floor, binary code stream decapsulation obtained is sent to upper strata; Or encapsulation is carried out to the binary code stream from upper strata and obtains network packet, described network packet is sent to lower floor;
Byte parsing module, for the binary code stream from lower floor is reduced into concrete network packet object, and object's property value is set, concrete network packet object is sent to upper strata simultaneously, or the network packet object from upper strata is converted into binary code stream and is sent to lower floor;
Action module, for the action that defining virtual user sends each particular network bag object, defines the network packet object that this action will send, the network packet object that desired service device returns inside each action, and the input parameter that this action accepts; Action module constructs the network packet object that will send to server by the property value of input parameter and player role, and is sent to lower floor; And the network packet object returned is received from lower floor, if receive the network packet object of expectation, think this action successful execution, otherwise think that this action executing is unsuccessful.
Alternatively, on package module, and also comprise Encryption Decryption module under byte parsing module, for to the binary code stream encryption from upper strata, binary code stream after encryption is sent to lower floor, or the binary code stream from lower floor is decrypted, the binary code stream after deciphering is sent to upper strata.
Alternatively, the layer at described byte parsing module place comprises analytical tool storehouse further, for providing the public method of various parsing binary code stream, so that byte parsing module calls.
Alternatively, described transceiver module comprises multiple Transmit-Receive Unit, and each Transmit-Receive Unit is used for adaptive a kind of procotol, and according to the procotol that server adopts, one of them Transmit-Receive Unit is in enabled state and carries out network service.
Because hand trip (mobile phone network game) development time is nervous, in prior art, the Ya Ce robot of some hand trip project only adopts device pattern of giving out a contract for a project, Ji Yace robot only achieves section at one time and sends a large amount of network packet to server, not processing server return bag, make Ya Ce robot cannot realize comparatively complicated logical process function, after single Ya Ce robot goes wrong, can not the user account number of quick position to concrete Ya Ce robot and the network packet of appearance mistake.
For solving the problem, the server stress proving installation provided in another embodiment of the application also comprises the task module for each different behavior of defining virtual user and task; For the behavior of some complexity of defining virtual user, such as, log in, these behaviors are all made up of the object by multiple action module, also include some logical process of Virtual User simultaneously.
Alternatively, on task module, this device comprises virtual subscriber objects module further, for arranging the task queue of virtual subscriber objects, and preserves the attribute of virtual players role.
Some projects adopt the patten's design Ya Ce robot of multithreading, one Ge Yace robot takies a thread, but after thread produces some, cross-thread switching can take a large amount of cpu times of client device, causes single client end equipment can only start at most the Ya Ce robot of 400 to 1000 quantity.
For solving the problem, this device, when dispatching virtual subscriber objects, have employed association's journey technology, and association's journey technology simulates plan multithreading with software approach, be switch program block to perform in turn under single thread, avoid thread and switch the cpu performance consumption brought.
Some pressures of simultaneously playing survey scene, multiple player is needed to coordinate, such as many people form a team, mutual plusing good friend etc., the Ya Ce robot more than enumerated first designs individual machine people what is done, then simulate a large number of users and do same thing, do not consider the interaction scenario between many people.
For solving the problem, this apparatus design method of many people task queue, queue record which Virtual User concrete will perform the execution sequence of which task, and scheduler program can perform according to this sequence order
Project also needs to test the function accuracy of server module simultaneously, and whether the function carrying out validate service device performs according to design.Such as test player when creating role name, if role's name meets the requirement of length and character, whether server can create successfully, if do not met, whether can return create unsuccessfully with the information of failure cause.
For solving the problem, this device may further include functional test script module and unit testing frame module,
What described functional test script module used for On-board test uses case script, according to case script initialization of virtual user object, and connect with game server, game server also completes corresponding test assignment, obtain the data attribute value that server returns, whether the function carrying out validate service device is correct;
Unit testing frame module is used for function of organization's test.
Alternatively, this device comprises scheduler module further, goes out multiple Virtual User and server carries out alternately for calling virtual subscriber objects module simulation.Wherein, described scheduler module adopts association's journey technology to switch between the task of multiple Virtual User.
Described scheduler module is that each Virtual User distributes execution time section;
Virtual User is in the execution time section of correspondence, and the message queue bag that processing server is sent, sends heartbeat message bag to server, and an and task of executing the task in queue.
The embodiment of the present application additionally provides a kind of general server stress method of testing, comprises the steps:
Steps A, defining virtual user send the action of each particular network bag object, define the network packet object that this action will send, the network packet object that desired service device returns inside each action, and the input parameter that this action accepts;
Step B, construct the network packet object that will send to server by the property value of input parameter and player role, described network packet object is converted into binary code stream, and encapsulation is carried out to described binary code stream obtain network packet, by described network packet by being sent to server with the procotol of server adaptation;
Step C, receive network packet from server, carry out decapsulation to described network packet, binary code stream decapsulation obtained is reduced into concrete network packet object, if receive the network packet object of expectation, think action successful execution, otherwise think that this action executing is unsuccessful.
Alternatively, step B comprises taking a step forward of encapsulating of described binary code stream: to binary code stream encryption;
Before the binary code stream that decapsulation obtains being reduced into concrete network packet object described in step C, comprise further: binary code stream is decrypted.
Alternatively, the method comprises further: record from transmission network packet object to responsively time time receiving the network packet object that desired service device returns.
Alternatively, taking a step forward of steps A comprises: the task queue arranging virtual subscriber objects, and the attribute preserving virtual players role, described task is made up of a series of actions, and adds Logic judgment process.
Alternatively, the method comprises further: simulate multiple Virtual User and server carries out alternately.
Alternatively, association's journey technology is adopted to switch between the task of multiple Virtual User.
Alternatively, for each Virtual User distributes execution time section;
Described employing association journey technology is carried out switching and is comprised between the task of multiple Virtual User:
Virtual User is in the execution time section of correspondence, and the message queue bag that processing server is sent, sends heartbeat message bag to server, and a task in queue of executing the task.
Please refer to Fig. 1, it is the configuration diagram of the pressure test device in the present invention's specific embodiment.As shown in Figure 1, the transmitting-receiving of internet message bag is carried out between pressure test device 100 and game server 115 by transceiver module.Due to different game items, different procotols may be adopted, three kinds of dissimilar transceiver modules (transmitting-receiving Socket module 112, transmitting-receiving HTTP module 113, transmitting-receiving WebSocket module 114) are devised for the different game server project of adaptation in this embodiment, according to the procotol that game server 115 adopts, one of them Transmit-Receive Unit is in enabled state and carries out network service.Wherein,
Transmitting-receiving Socket unit 112 adopts the game server of the long connection mode of socket for adaptation, set up socket be connected with server, judges socket on connecting with or without message bag.
Transmitting-receiving HTTP unit 113 adopts http protocol to carry out the game server communicated for adaptation.Send http protocol network packet, structure HTTP packet header, read HTTP and return bag, judge HTTP return code.
Transmitting-receiving WebSocket unit 114 adopts the game server of WebSocket protocol communication for adaptation.This module comprises to be set up WebSocket with server and is connected, and reads bag mask and also resolves network packet, tectonic network bag, transmission packet and read the function of message bag.
Package module 111 on three transceiver modules.The server network bag that transceiver module is collected can be given package module 111 and carry out decapsulation, and the binary code stream from upper strata is given transceiver module and is sent to game server after package module 111 is packaged into network packet.Package module 111 for encapsulation network packet in, network packet add on identification number, length, the fields such as check bit, and when transceiver module get game server return come network packet after, from network packet resolve read these fields, obtain binary code stream.Because the mode of disparity items encapsulation network packet is different, package module 111 needs the functional unit for the adaptive corresponding encapsulation of detailed programs and decapsulation.
Is Encryption Decryption module 110 on package module 111.Major part project sends after all can be encrypted to network packet again, Encryption Decryption module 110 for being sent to package module 111 by from after the binary code stream encryption of byte parsing module 108, and is sent to byte parsing module 108 after being decrypted by the binary code stream from package module 111.Due to different projects, encrypting and decrypting mode is different, and Encryption Decryption module 110 needs for the adaptive corresponding encrypting and decrypting functional unit of detailed programs.
Be the byte parsing module 108 of project on Encryption Decryption module 110, data attribute value for the binary code stream from Encryption Decryption module 110 is reduced into concrete data attribute value, and is output into binary code stream by byte parsing module 108.The network packet of each type is a network packet class, each network packet class is needed to define this and is surrounded by which property value, all need to realize two function interfaces: a function interface is used for being obtained by bag property value the binary code stream of this bag, another function interface is used for the property value content arranging bag according to binary code stream simultaneously.Above-mentioned function interface can realize with the programming language irrelevant with server.Because function interface and project have nothing to do, this avoid the code module of dependent file, accomplish adaptive various project.
Because needs byte parsing module 108 pairs of binary code streams are resolved, for increasing work efficiency, in the present embodiment, analytical tool storehouse 109 is further comprises in this pressure test device 100, same layer is in byte parsing module 108, for providing the public method of various parsing binary code stream, so that byte parsing module 108 calls.It comprises following methods: by the shaping of different length, floating type, character type, and the statistical conversion of long shaping becomes binary code stream, and restores the method for above-mentioned Value Types by binary code stream, and the large end of definition stores or the method for small end storage networking byte.Network packet object attribute values is exported to binary code stream, and property value does not exceed shaping substantially, floating type, character type, the basic value types such as Boolean type, possesses very large general character between project.By analytical tool storehouse 109, the efficiency of the adaptive detailed programs of pressure test device 100 can be improved.
Because a lot of hand swims the network packet realization of project all based on the protobuf technology of Google at present, this technology provides unified network packet and the mutual conversion module of byte stream, project only needs the proto file providing its network packet to define.Because this embodiment adopts python language development, the python instrument that developer can adopt protobuf to provide, proto file is exported to the network packet module of python language definition, the reading of all-network bag and write function can be realized, thus realize byte parsing module 108.
Be action module 106 on byte parsing module, this module is used for each action of giving out a contract for a project of defining virtual user.Each network packet of pressure test device 100 is considered as a specific action, inside each action, defines the network packet object that this action will send, the network packet object that desired service device returns, and the input parameter that this action accepts.Action module 106 is by the parameter of input, and the property value of player role constructs the network packet object that will send to server.
Expect the network packet object that returns of game server owing to defining in action module 106, after virtual subscriber objects calls this action, if receive the network packet object of expectation, think this action successful execution, otherwise think that this action executing is unsuccessful.Can record simultaneously and give out a contract for a project and receive the time returning bag, as the response time of this bag; If there is the network packet that certain sends, do not return bag, can not specify in action module 106 and concrete return bag, when such robot calls this action, this action will not be recorded and whether run succeeded, and not recording responses time.The function of recording responses time is realized by response time logging modle 107.
Be task module 105 on action module 106, task module 105 defines the operation of Virtual User more complicated, and each task of task module 105 is made up of a series of actions, and adds Logic judgment process.To log in task, the task of logging in may comprise connection server, checking client version information, sends account, according to server rreturn value, judge, if new user, can new role be created, create role name, enter scene of game, if old user, old role can be chosen, enter scene of game.Task module 105 is exactly by this more complicated, and can be become task object one by one by the behavior that Virtual User often calls, and facilitates calling of the virtual subscriber objects on upper strata and functional test framework.
It is exactly virtual subscriber objects module 103 on task module 105, for arranging the task queue of virtual subscriber objects, the everything that all tasks of task module 105 comprise, constitute " behavior " of this virtual subscriber objects, virtual subscriber objects module 103 saves all properties of virtual players role simultaneously, such as grade, money, muscle power etc., these property values constitute " attribute " of this Virtual User.Such virtual subscriber objects, has possessed " attribute ", has also possessed " behavior ", and this virtual subscriber objects can isolated operation, tests for server capability; A large amount of virtual subscriber objects is called simultaneously, tests for server stress.
Functional test script module 102, it is the use case script used for On-board test, according to case script initialization of virtual user object, and connect with game server, game server also completes corresponding test assignment, obtain the data attribute value that server returns, whether the function carrying out validate service device is correct.Such as, time sometimes player gives a name to role, server can have length to limit to role name word, and character content is restricted, whether correct for testing this function, a test script can be write, allow Virtual User game server, create role and give a name to role, the message bag returned by server, judging that the whether serviced device of role's name receives, if create successfully, then delete this role, exit server, and run next use-case.By writing different test case, different name situations can be tested, avoids manual operations like this.
Unit testing frame module 101 is tested for function of organization.A complete test, needs to comprise test environment and prepares, test execution, test verification, test environment cleaning etc.Utilize the test frame that ripe, test script is organized, facilitate test script exploitation and run.
The virtual subscriber objects that scheduler module 104 depends on carries out pressure test to server, and it simulates a large amount of Virtual User, and game server carries out alternately, thus to server build-up of pressure.
Below in conjunction with Fig. 2, describe pressure test device 100 in detail and how to complete pressure test by scheduling Virtual User.Due to multithreading switching, to cause taking cpu performance too high, adopts association's journey technology in the present embodiment.Association's journey technology simulates multithreading by the method for software, is switch program block to perform in turn under single thread.Meanwhile, when occurring that IO blocks, being switched to other program blocks and performing, after IO blocks solution, then be switched to original program block execution.Pressure test device 100 is when a large amount of Virtual User of simulation, after the task of executing a Virtual User A, be switched to the task that another one Virtual User B performs its setting at once, Virtual User A needs the next task performed can be put into scheduling queue end, is performed after all executing before waiting list again.Meanwhile, if Virtual User immediately do not receive server return bag time, also can surrender right of execution, avoid performing obstruction.With single virtual user, the scheduler module 104 of pressure test device 100 can to distributing to the time period that its performs, and Virtual User needs a series of task that oneself performed or action, rationally takes apart and the system that is assigned to get on execution to its time period.
Meanwhile, generally a large amount of network packet of irregular transmission is to Virtual User for game server, and Virtual User needs to collect in time and responds these network packet, otherwise server can think that this user goes offline, and disconnects the connection with Virtual User.Such as, some game servers timing can send heartbeat packet to Virtual User, if Virtual User does not return a response packet, server can disconnect.Some game servers also need Virtual User regularly initiatively to send heartbeat packet to server, confirm that this user is online.
For solving the problem, method shown in the present embodiment Fig. 2 example: each Virtual User has a task queue 202, the task that this Virtual User of this queue record needs circulation to perform, comprises task 1, task 2, task 3, scheduler module 201 can according to the task list that Subscriber Queue stores, calling task successively, after task queue is complete, can from the beginning continue to call again, circulation be always gone down.After having dispatched a task of a Virtual User, the task of next Virtual User can be switched to and by that analogy, after all Virtual User have all dispatched a task, then switch back the next task of this Virtual User of scheduling.In the execution time section distributing to each Virtual User, Virtual User, except performing some tasks, also needs before executing the task, the message queue bag that processing server is sent, and sends heartbeat message bag to server.When some Virtual User do not receive the network packet expecting to return, Virtual User initiatively can surrender right of execution, is switched to next Virtual User, avoids the execution obstructing problem for wait network packet returns and cause.
As shown in Figure 2, processing messages queue, heartbeat packet sends and task 1 defines and needs in the scheduling time of Virtual User 1 work that performs in section.
Processing messages queue is used for collecting the message bag that between the last time period to current slot, server sends over, if server have sent heartbeat packet, then also needs return service device response packet.
Heartbeat packet transmission is used at the appointed time interval and sends heartbeat packet to server, and it can record the last time sending heartbeat packet, if current time interval has exceeded setting interval, will send heartbeat packet to server.
By above-mentioned design, avoid Virtual User answering server not in time, and solve under association's journey scheduling, the problem of timed sending heartbeat packet.
Below in conjunction with Fig. 3, explain how pressure test device 100 carries out the switching scheduling between Virtual User in detail.Pressure test device 100, except being switched to other Virtual User after the task of completing a Virtual User, is switched to other Virtual User when also can return bag at the server not receiving expectation.In some cases, game server can just return the network packet of response after a certain time to Virtual User, wait for this during in, in fact pressure test device 100 has been switched to other Virtual User and goes to have executed the task.
The principle realizing this mechanism is: the network of pressure test device 100 connects employing non-blocking fashion, when Virtual User performs specific tasks, after transmission packet to game server, check whether game server has network packet to return, if there is network packet to return, then all network packet returned are judged whether one by one be expect return bag, if not, then perform the process function of this bag correspondence; If so, then perform the process function of this expectation bag, and mark this tasks carrying success, after running succeeded, can right of execution be surrendered, allow robot dispatch the task of next Virtual User.If check that the network packet do not expected of server returns, this Virtual User can't wait always stay, but surrenders right of execution, when waiting for next time and be dispatched to this Virtual User, reexamines the expectation bag whether receiving server and return.If the time waited for exceedes certain time length, can mark this tasks carrying failure, this Virtual User can then perform next task.
Be illustrated in figure 3 scheduling flow when two Virtual User, first main thread dispatches Virtual User 1 (step 301), perform its queue task 1 (step 302), after tasks carrying completes, can switch back main thread (step 303), main thread then dispatches Virtual User 2 (step 304), performs its queue task 1 (step 305), after tasks carrying completes, switch back main thread (step 306), main thread then dispatches Virtual User 1 (step 307), the task 2 of executing the task in queue, now Virtual User 1 have sent message bag (step 308), and do not receive in time server return bag time, main thread (step 309) can be switched back, main thread scheduling Virtual User 2 (step 310) also performs its queue task 2 (step 311), after executing task 2, switch back main thread (step 312), and reschedule Virtual User 1 (step 313), what whether inquiry received that last task do not receive returns bag, after acknowledging receipt of and returning bag, the task 2 of Virtual User 1 just complete (step 314), switch back main thread again and dispatch Virtual User 2 (step 315-316), perform its queue task 3 (step 317).
This scheduling mode, avoid when Virtual User/association's journey do not collect in time server return bag time, cause to robot perform obstructing problem.
The application still another embodiment provides the embodiment solving the mutual pressure test scene of many people logic.As shown in Figure 4, adopt multiple Virtual User task queue, in queue, each member's content comprises: the task that concrete Virtual User and this user specifically will perform.Module 403 inside legend, namely 404,405 be the content stored inside queue, and scheduler module can the member of this queue of searching loop successively, dispatches concrete user to perform concrete task, has carried out many people interactive task.Such as, pressure surveys good friend's function, and need user A to add user B good friend, then user A removes the friend relation with user B again, just by this above-mentioned scene, can be designed to a task queue:
Task 1, user A initiates good friend's request,
Task 2, user B agrees to this request,
Task 3, the friend relation of user A releasing and user B.
Before each particular user task of execution, the message queue that this Virtual User needs processing server to send, and send heartbeat packet to server.
By many people task queue mechanism, solve the pressure test scene problem that many people logic is mutual.
Be to be understood that, although this instructions describes according to each embodiment, but not each embodiment only comprises an independently technical scheme, this narrating mode of instructions is only for clarity sake, those skilled in the art should by instructions integrally, technical scheme in each embodiment also through appropriately combined, can form other embodiments that it will be appreciated by those skilled in the art that.
The foregoing is only the preferred embodiment of the application; not in order to limit the protection domain of the application; within all spirit in technical scheme and principle, any amendment made, equivalent replacements, improvement etc., all should be included within scope that the application protects.

Claims (20)

1. a general server stress proving installation, is characterized in that, this device comprises from bottom to top: transceiver module, package module, byte parsing module, action module;
Described transceiver module is used for the procotol that the adaptive server that will test adopts, and the network packet from upper strata is sent to server; Or the network packet received from server, and described network packet is sent to upper strata;
Package module, for carrying out decapsulation to the network packet from lower floor, binary code stream decapsulation obtained is sent to upper strata; Or encapsulation is carried out to the binary code stream from upper strata and obtains network packet, described network packet is sent to lower floor;
Byte parsing module, for the binary code stream from lower floor is reduced into concrete network packet object, and object's property value is set, concrete network packet object is sent to upper strata simultaneously, or the network packet object from upper strata is converted into binary code stream and is sent to lower floor;
Action module, for the action that defining virtual user sends each particular network bag object, defines the network packet object that this action will send, the network packet object that desired service device returns inside each action, and the input parameter that this action accepts; Action module constructs the network packet object that will send to server by the property value of input parameter and player role, and is sent to lower floor; And the network packet object returned is received from lower floor, if receive the network packet object of expectation, think this action successful execution, otherwise think that this action executing is unsuccessful.
2. device according to claim 1, it is characterized in that, on package module, and also comprise Encryption Decryption module under byte parsing module, for to the binary code stream encryption from upper strata, binary code stream after encryption is sent to lower floor, or the binary code stream from lower floor is decrypted, the binary code stream after deciphering is sent to upper strata.
3. device according to claim 1, is characterized in that, the layer at described byte parsing module place comprises analytical tool storehouse further, for providing the public method of various parsing binary code stream, so that byte parsing module calls.
4. device according to claim 1, it is characterized in that, described transceiver module comprises multiple Transmit-Receive Unit, and each Transmit-Receive Unit is used for adaptive a kind of procotol, according to the procotol that server adopts, one of them Transmit-Receive Unit is in enabled state and carries out network service.
5. device according to claim 4, is characterized in that, described transceiver module comprises transmitting-receiving Socket unit, transmitting-receiving HTTP unit and transmitting-receiving WebSocket unit.
6. device according to claim 1, it is characterized in that, described byte parsing module comprises two function interfaces, a function interface is used for the binary code stream being obtained this network packet object by network packet object, another function interface is used for arranging network packet object's property value according to binary code stream, and described function interface adopts the programming language irrelevant with server to realize.
7. device according to claim 1, is characterized in that, this device comprises response time logging modle further, sends network packet object to the time receiving the network packet object that desired service device returns, the responsively time for recording from action module.
8. device according to claim 1, is characterized in that, on action module, comprise task module further, and for the task of defining virtual user, described task is made up of a series of actions, and adds Logic judgment process.
9. device according to claim 8, is characterized in that, on task module, this device comprises virtual subscriber objects module further, for arranging the task queue of virtual subscriber objects, and preserves the attribute of virtual players role.
10. device according to claim 9, is characterized in that, this device comprises functional test script module and unit testing frame module further,
What described functional test script module used for On-board test uses case script, according to case script initialization of virtual user object, and connect with game server, game server also completes corresponding test assignment, obtain the data attribute value that server returns, whether the function carrying out validate service device is correct;
Unit testing frame module is used for function of organization's test.
11. devices according to claim 9, is characterized in that, this device comprises scheduler module further, go out multiple Virtual User and server carries out alternately for calling virtual subscriber objects module simulation.
12. devices according to claim 11, is characterized in that, described scheduler module adopts association's journey technology to switch between the task of multiple Virtual User.
13. devices according to claim 11, is characterized in that, described scheduler module is that each Virtual User distributes execution time section;
Virtual User is in the execution time section of correspondence, and the message queue bag that processing server is sent, sends heartbeat message bag to server, and a task in queue of executing the task.
14. 1 kinds of general server stress method of testings, is characterized in that,
Steps A, defining virtual user send the action of each particular network bag object, define the network packet object that this action will send, the network packet object that desired service device returns inside each action, and the input parameter that this action accepts;
Step B, construct the network packet object that will send to server by the property value of input parameter and player role, described network packet object is converted into binary code stream, and encapsulation is carried out to described binary code stream obtain network packet, by described network packet by being sent to server with the procotol of server adaptation;
Step C, receive network packet from server, carry out decapsulation to described network packet, binary code stream decapsulation obtained is reduced into concrete network packet object, if receive the network packet object of expectation, think action successful execution, otherwise think that this action executing is unsuccessful.
15. methods according to claim 14, is characterized in that, step B comprises taking a step forward of encapsulating of described binary code stream: to binary code stream encryption;
Before the binary code stream that decapsulation obtains being reduced into concrete network packet object described in step C, comprise further: binary code stream is decrypted.
16. methods according to claim 14, it is characterized in that, the method comprises further: record from transmission network packet object to responsively time time receiving the network packet object that desired service device returns.
17. methods according to claim 14, is characterized in that, taking a step forward of steps A comprises: the task queue arranging virtual subscriber objects, and the attribute preserving virtual players role, described task is made up of a series of actions, and adds Logic judgment process.
18. methods according to claim 17, it is characterized in that, the method comprises further: simulate multiple Virtual User and server carries out alternately.
19. methods according to claim 18, is characterized in that, adopt association's journey technology to switch between the task of multiple Virtual User.
20. methods according to claim 18, is characterized in that, for each Virtual User distributes execution time section;
Described employing association journey technology is carried out switching and is comprised between the task of multiple Virtual User:
Virtual User is in the execution time section of correspondence, and the message queue bag that processing server is sent, sends heartbeat message bag to server, and a task in queue of executing the task.
CN201510998472.5A 2015-12-28 2015-12-28 Universal server pressure testing method and device Pending CN105487965A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510998472.5A CN105487965A (en) 2015-12-28 2015-12-28 Universal server pressure testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510998472.5A CN105487965A (en) 2015-12-28 2015-12-28 Universal server pressure testing method and device

Publications (1)

Publication Number Publication Date
CN105487965A true CN105487965A (en) 2016-04-13

Family

ID=55674957

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510998472.5A Pending CN105487965A (en) 2015-12-28 2015-12-28 Universal server pressure testing method and device

Country Status (1)

Country Link
CN (1) CN105487965A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108733527A (en) * 2017-04-24 2018-11-02 北京京东尚科信息技术有限公司 System, method and apparatus for test server function
CN108762904A (en) * 2018-05-23 2018-11-06 武汉山骁科技有限公司 A kind of configurable turn-based game frame implementation method
CN109462491A (en) * 2017-09-06 2019-03-12 北京京东尚科信息技术有限公司 System, method and apparatus for testing service device function
CN109698771A (en) * 2018-12-07 2019-04-30 网易(杭州)网络有限公司 Game server method for testing pressure and device
CN109726102A (en) * 2018-05-14 2019-05-07 网联清算有限公司 Flow pressure test method and device
CN109739708A (en) * 2019-01-02 2019-05-10 网易(杭州)网络有限公司 Test the methods, devices and systems of pressure
CN114584500A (en) * 2022-02-25 2022-06-03 网易(杭州)网络有限公司 Asynchronous communication testing method and device and electronic equipment
CN114615171A (en) * 2022-03-16 2022-06-10 网易(杭州)网络有限公司 Pressure measurement processing method, device, medium and program product for cloud game server
CN114844814A (en) * 2022-03-30 2022-08-02 中国农业银行股份有限公司 Pressure testing method and device
CN114969731A (en) * 2022-03-28 2022-08-30 慧之安信息技术股份有限公司 Malicious software detection method and device based on operating system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6049828A (en) * 1990-09-17 2000-04-11 Cabletron Systems, Inc. Method and apparatus for monitoring the status of non-pollable devices in a computer network
CN101388800A (en) * 2007-09-12 2009-03-18 百度在线网络技术(北京)有限公司 Method, device and system for pressed test to network performance of server
CN103793305A (en) * 2014-02-24 2014-05-14 浪潮电子信息产业股份有限公司 Method for testing parallel pressure of server subsystems

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6049828A (en) * 1990-09-17 2000-04-11 Cabletron Systems, Inc. Method and apparatus for monitoring the status of non-pollable devices in a computer network
CN101388800A (en) * 2007-09-12 2009-03-18 百度在线网络技术(北京)有限公司 Method, device and system for pressed test to network performance of server
CN103793305A (en) * 2014-02-24 2014-05-14 浪潮电子信息产业股份有限公司 Method for testing parallel pressure of server subsystems

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108733527A (en) * 2017-04-24 2018-11-02 北京京东尚科信息技术有限公司 System, method and apparatus for test server function
CN108733527B (en) * 2017-04-24 2021-10-01 北京京东尚科信息技术有限公司 System, method and apparatus for testing server functionality
CN109462491A (en) * 2017-09-06 2019-03-12 北京京东尚科信息技术有限公司 System, method and apparatus for testing service device function
CN109726102A (en) * 2018-05-14 2019-05-07 网联清算有限公司 Flow pressure test method and device
CN108762904B (en) * 2018-05-23 2021-08-20 武汉山骁科技有限公司 Configurable turn-based game framework implementation method
CN108762904A (en) * 2018-05-23 2018-11-06 武汉山骁科技有限公司 A kind of configurable turn-based game frame implementation method
CN109698771A (en) * 2018-12-07 2019-04-30 网易(杭州)网络有限公司 Game server method for testing pressure and device
CN109739708A (en) * 2019-01-02 2019-05-10 网易(杭州)网络有限公司 Test the methods, devices and systems of pressure
CN109739708B (en) * 2019-01-02 2023-07-21 网易(杭州)网络有限公司 Method, device and system for testing pressure
CN114584500A (en) * 2022-02-25 2022-06-03 网易(杭州)网络有限公司 Asynchronous communication testing method and device and electronic equipment
CN114584500B (en) * 2022-02-25 2024-03-22 网易(杭州)网络有限公司 Asynchronous communication testing method and device and electronic equipment
CN114615171A (en) * 2022-03-16 2022-06-10 网易(杭州)网络有限公司 Pressure measurement processing method, device, medium and program product for cloud game server
CN114615171B (en) * 2022-03-16 2024-01-30 网易(上海)网络有限公司 Pressure measurement processing method, device, medium and program product of cloud game server
CN114969731A (en) * 2022-03-28 2022-08-30 慧之安信息技术股份有限公司 Malicious software detection method and device based on operating system
CN114844814A (en) * 2022-03-30 2022-08-02 中国农业银行股份有限公司 Pressure testing method and device

Similar Documents

Publication Publication Date Title
CN105487965A (en) Universal server pressure testing method and device
CN110351156B (en) Test method and device
CN104484273B (en) The method of testing of application program, equipment and system
CN102946616B (en) Internet of things middleware performance testing system and testing method
US20150227449A1 (en) Method and device for developing, compiling and debugging
CN103533530B (en) The user's correspondence and user tracking method, system of a kind of striding equipment
CN104978261B (en) The test method of application program, apparatus and system
CN102163173B (en) Automated testing method for distributed information system interface
CN105450476B (en) A kind of regression test system and test method
US20090313603A1 (en) System And Method For Creating Virtual Callback Objects
CN101316196B (en) Method and apparatus for implementing simulation test of service on distributed platform
CN103716356B (en) Storing process operating method, device and system based on web
CN107122252B (en) Intersystem interaction method and device
CN106658545A (en) Test method, mobile terminal and server
CN102301360A (en) Selectively Communicating Data Of A Peripheral Device To Plural Sending Computers
CN102594618A (en) Method and device for realizing storage device test of storage area network (SAN)
CN110138818A (en) Method, website application, system, device and the serving backend of Transfer Parameters
CN109815120A (en) Test method, device, computer equipment and the storage medium of application
CN111522727A (en) Simulation object test method, device and system
CN103888306A (en) Message forwarding system performance test method and performance test device
CN102855182A (en) Web system test method and device
CN103595611B (en) The realization method and system and equipment of instant messaging application
CN110399723A (en) Leak detection method and device, storage medium and electronic device
CN106708488A (en) Multi-application debugging system and method
CN104836598B (en) Method for processing business, apparatus and system based on near-field communication

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160413

RJ01 Rejection of invention patent application after publication