Summary of the invention
The technical problems to be solved by the invention and the technical assignment of proposition are improved to the prior art, provide one
Kind realizes the method, apparatus and system that pressure test is carried out to server performance.
According to the first aspect of the embodiments of the present disclosure, a kind of side for realizing and carrying out pressure test to server performance is provided
Method the described method comprises the following steps:
S1. client request executes the speed limiting function in the preset limiter of speed of server end, realizes to server
At least one business function carries out speed limit;
S2. pressure test is carried out at least one business function of server and generate pressure testing results file;
S3. it is reported according to acquired pressure sensing result file generated pressure sensing result.
In a kind of optional embodiment, the step S1 is further included steps of
S101. communication connection is established between client and server end;
S102. client at least one service device function by far call to server-side application for registration limiter of speed,
The registration information of limiter of speed includes and the associated first identifier of limiter of speed and at least one scheduled unit time business processing amount
Threshold value;
S103. the registration information of the client new registration limiter of speed received is added to limiter of speed management queue by server-side,
To realize the management to limiter of speed;
S104. client is sent and execution that limiter of speed is initiated and limiter of speed associated first identifier by server end
Request;
S105. server end calls limiter of speed to manage the limiter of speed in queue according to the associated first identifier of limiter of speed,
It realizes and speed limit is carried out to respective server function.
In a kind of optional embodiment, the first identifier may include limiter of speed title.
In a kind of optional embodiment, at least one described unit time business processing amount threshold value includes processing per second
The quantity of service request.
In a kind of optional embodiment, the step S105 is further included steps of
S1051., first counter is set in limiter of speed, and the business function of the service request for counting client is held
Row number;
S1052. judge that the corresponding business function of limiter of speed was applied executing whether number has reached within our unit's time
To at least one scheduled unit time business processing amount threshold value, if not yet reached, client is returned at once and is continued to execute,
Count is incremented for the first counter being arranged in limiter of speed simultaneously;If having reached at least one unit time business processing amount threshold value,
Then block the execution of business function corresponding with the limiter of speed, and be added into waiting list, until next unit time
The counting for the first counter being arranged in limiter of speed is zeroed, and re-starts and judges whether to need to continue to block.
In a kind of optional embodiment, the unit time can be one second.
In a kind of optional embodiment, at least one business function of the server includes chat feature and transaction
Function.
According to a second aspect of the embodiments of the present invention, a kind of dress realized and carry out pressure test to server performance is provided
It sets, described device includes:
Memory, for storing an application program;
Processor, for running the application program to execute above-mentioned method.
According to a third aspect of the embodiments of the present invention, provide a kind of realize is to server performance progress pressure test
System, the system comprises:
Business function speed limit module is configured to execute by client request in the preset limiter of speed of server end
Speed limiting function, realize to server at least one of business function carry out speed limit;
Pressure test module is configured to carry out pressure test at least one of server business function and generates pressure
Test result file;
Pressure sensing result generation module is configured to according to acquired pressure sensing result file generated pressure detecting
As a result it reports.
In a kind of optional embodiment, the system further comprises:
Communication module is configured to establish communication connection between client and server end;
Limiter of speed registration module, be configured to by client at least one service device function by far call to
Server-side application for registration limiter of speed, the registration information of limiter of speed include and the associated first identifier of limiter of speed and scheduled at least one
A unit time business processing amount threshold value;
Limiter of speed management module is configured to be added to by the registration information for the client new registration limiter of speed that will be received
Limiter of speed manages queue, to realize the management to limiter of speed;
Limiter of speed executes request module, is configured to send and limiter of speed associated first by client
It identifies and that initiates limiter of speed executes request;
Limiter of speed calling module is configured to call speed limit according to the associated first identifier of limiter of speed by server end
Device manages the limiter of speed in queue, realizes and carries out speed limit to respective server function.
In a kind of optional embodiment, the system further comprises:
The first counter being arranged in limiter of speed is configured to count holding for the business function of the service request of client
Row number;
Business function executes number judgment module, is configured to judge the corresponding business function of limiter of speed in our unit
Interior application executes whether number has reached at least one scheduled unit time business processing amount threshold value, if not yet arrived
It reaches, then returning to the first counter that client continues to execute, while being arranged in limiter of speed at once, count is incremented;If reached
A few unit time business processing amount threshold value, then block the execution of business function corresponding with the limiter of speed, and by its
Waiting list is added, until the counting for the first counter being arranged in limiter of speed is zeroed by next unit time, and re-starts
Judge whether to need to continue to block.
The technical solution that the embodiment of the present invention provides has the advantages that
The realization provided through the invention carries out the method, apparatus and system of pressure test to server performance, opposite to pass
The cost of manual amendment's code can be greatly reduced in the modes such as the modification code of system or constraint route device, bandwidth, and solves to support more
Task supports the efficiency concurrently carried out simultaneously, and can be precisely controlled the multi-frequency of each feature operation, agreement, such as
The access pressure limit to server is carried out in seconds, more meets reality, to the result tested out with more ginseng
Meaning is examined, meanwhile, the Performance tuning of server is capable of providing and accurately presses measured data according to lazyness.It is sent out for tradition based on network
The speed limit of packet and flow, the drawbacks of can only uniformly be controlled.The present invention realizes multi-frequency control using more flexible CS structure,
Different limit frequencies, more true reduction and simulation pressure test scene can be added at different processes.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention 1-6, technical solution in the embodiment of the present invention carry out it is clear,
It is fully described by, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Base
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts it is all its
His embodiment, shall fall within the protection scope of the present invention.
It is only to be not intended to be limiting the disclosure merely for for the purpose of describing particular embodiments in the term that the disclosure uses.
The "an" of the singular used in disclosure and the accompanying claims book, " described " and "the" are also intended to including plural number
Form, unless the context clearly indicates other meaning.It is also understood that term "and/or" used herein refers to includes
One or more associated any or all of project listed may combine.
As shown in Figure 1, Fig. 1 is that a kind of realize shown according to an exemplary embodiment carries out pressure survey to server performance
The method of examination, comprising the following steps:
In step sl, client request executes the speed limiting function in the preset limiter of speed of server end, realization pair
At least one business function of server carries out speed limit;Server at least one of business function include that response is asked with client
Ask and the information forwarding transmitting between the client realized and the trading function for realizing ideal money or virtual objects.Such as
In game server, at least one business function of server can be the function that information communication exchange is carried out between different players
Can, and realize the dealing of ideal money or virtual objects between each player, give etc. business function.
In step s 2, pressure test is carried out at least one business function of server and generate the pressure test
Destination file;In this step, one threshold value can be set for the quantity of pressure testing results file, whenever meeting preset threshold
The pressure that pressure testing results file backup to remote server and is accordingly deleted to local server when value condition is surveyed
Test result file realizes the pressure testing results file during being directed to the pressure test of server from local clothes
Business device is transferred to remote server, avoids due to for the pressure test knot generated in the pressure test sequence of local server
The record file of fruit file is excessively huge and the disk space of pressure test server is caused to become bottleneck, so as to realize length
The pressure test of time, so that the service quality provided in the more acurrate reflection practical business function of pressure testing results, such as
It when game server is tested, even more needs to test for a long time, just can ensure that obtain accurate pressure testing data report, from
And preferably improve server performance and software performance.As a preferred embodiment, pressure test can be directed to
A threshold value is arranged in the total amount file size of destination file, or a threshold value can be arranged for pressure test time interval, reaches
The time interval pre-seted just carries out the backup of local server pressure testing results file, and those skilled in the art completely can be with
It is configured according to the actual situation.
In step s3, it is reported according to acquired pressure sensing result file generated pressure sensing result.In the step
In, the specific data in pressure sensing result file can be called to carry out the analysis of testing result according to the actual situation, for example,
It can choose the interruption logging that server generates in pressure test sequence, such as when executing a certain business function, due to
Function interrupts data caused by server.According to the data of calling, carries out data analysis and summarize to generate pressure test
As a result it reports.
As shown in Fig. 2, in step sl, realizing a certain item for being directed to server as one preferred embodiment of the disclosure
The step of business function progress speed limit includes the following steps:
In step s101, communication connection is established between client and server end;In this step, client and dress
Communication connection basis can be established by way of far call by setting between server-side;
In step s 102, client is applied for the registration of by far call to server-side at least one service device function
Limiter of speed, the registration information of limiter of speed include and the associated first identifier of limiter of speed and at least one scheduled unit time business
Treating capacity threshold value;Optionally, the first mark can be the specific names of limiter of speed, the unique identifier as limiter of speed.
In step s 103, the registration information of the client new registration limiter of speed received is added to limiter of speed pipe by server-side
Queue is managed, to realize the management to limiter of speed;Unified management is carried out for limiter of speed in this step.
In step S104, client initiates speed limit and sending to server end with limiter of speed associated first identifier
Device executes request;
In step s105, server end calls in limiter of speed management queue according to the associated first identifier of limiter of speed
Limiter of speed is realized and carries out speed limit to respective server function.
As shown in figure 3, step S105 is further included steps of
S1051., first counter is set in limiter of speed, and the business function of the service request for counting client is held
Row number;
S1052. judge that the corresponding business function of limiter of speed was applied executing whether number has reached within our unit's time
To at least one scheduled unit time business processing amount threshold value, if not yet reached, client is returned at once and is continued to execute,
Count is incremented for the first counter being arranged in limiter of speed simultaneously;If having reached at least one unit time business processing amount threshold value,
Then block the execution of business function corresponding with the limiter of speed, and be added into waiting list, until next unit time
The counting for the first counter being arranged in limiter of speed is zeroed, and re-starts and judges whether to need to continue to block.
As preferred embodiment, above step be can be set are as follows:
Communication infrastructure is established by far call between S101 client C and server-side S;
S102 client C registers limiter of speed information to server-side S by far call, and registration information includes limiter of speed name
(unique identification) and preset limitation QPS (maximum frequency each second);
After S103 server-side S receives the registration information of client C, the limiter of speed of new registration is added to limiter of speed management team
Column, are managed.Server-side S can manage the limiter of speed of multiple registrations simultaneously;
S104 is sent out by far call to server-side S in the place of any required speed limit, client C according to limiter of speed name
It rises and executes request;
S105 server-side S is after the execution request for receiving client C, according to limiter of speed queue, judges the limiter of speed at this
Application executes the speed limit upper limit whether number has reached registration in second, if not yet reached, returns to client C at once and continues
It executes, while this second of limiter of speed executes number and adds 1;If having reached the upper limit, block client C, and is added into and waits team
Column, until the lower second, re-starts and judge whether to need to continue to block;To reach the function of speed limit;
It should be noted that server-side S is in seconds, the primary each limiter of speed of resetting per second executes number.
As another more detailed embodiment of the disclosure, such as primary pressure test, it needs to mix chat and transaction
Resultant pressure test, it is desirable that the step of setting limiter of speed includes: in chat limitation 60QPS, transaction limits 30QPS, step S1
Step 1: registering two limiter of speeds in test cases
REG_SPEEDER(“Chat”,60)
REG_SPEEDER(“Trade”,30)
The setting of the two limiter of speeds is uploaded to control server first after test cases operation
Step 2: the place of the test cases circulation in chat, is added WAIT (" Chat ")
Step 3: the place of the test cases circulation in transaction, is added WAIT (" Trade ")
Step 4: control server request can be gone to execute, control server when test cases runs to WAIT (" Chat ")
Judge whether this second has reached the upper limit according to the QPS registered inside step 1, if it is reach the upper limit, allow test cases after
It is continuous to execute, if having reached the upper limit, case is blocked and is waited, and queue is added in request, executed after restore after the lower second.To reach
It can only at most be executed 60 times to case per second.
Step 5: the test cases of transaction is also the same.Each case have independent controller carry out control and mutually
It does not influence, to reach for different processes and affairs, accurately controls frequency.
As shown in figure 4, the another aspect as the embodiment of the present disclosure, provides a kind of realize and presses server performance
The device of power test, described device include:
Memory, for storing an application program;
Processor, for running the application program to execute method described in any of the above-described embodiment.
Wherein, the memory can for magnetic disk, CD, read-only memory (Read-Only Memory, ROM) or
Random access memory (Random Access Memory, RAM) etc..
Correspondingly, it the embodiment of the invention also provides a kind of pressure test server, including processor, memory and deposits
The computer program executed by the processor is stored up in the memory and is configured as, the processor executes the calculating
The method that realization carries out pressure test to server performance described in above-described embodiment is realized when machine program.
Alleged processor can be central processing unit (Central Processing Unit, CPU), can also be it
His general processor, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processor
It is the control centre that the pressure surveys server Deng, the processor, entirely press survey server using various interfaces and connection
Various pieces.
Corresponding with preceding method embodiment, the present invention also provides the embodiments of system.For system embodiments,
Since it corresponds essentially to embodiment of the method, so the relevent part can refer to the partial explaination of embodiments of method.It is following to be retouched
The system embodiment stated is only schematical, wherein unit may or may not be object as illustrated by the separation member
Separated in reason, component shown as a unit may or may not be physical unit, it can and it is in one place,
Or it may be distributed over multiple network units.Some or all of the modules therein can be selected according to the actual needs
Realize the purpose of disclosure scheme.Those of ordinary skill in the art are without creative efforts, it can understand
And implement.
As shown in figure 5, the another aspect as the embodiment of the present disclosure, provides a kind of realize and presses server performance
The system of power test, the system comprises:
Business function speed limit module 101 is configured to execute by client request in the preset limit of server end
The speed limiting function of fast device is realized and carries out speed limit at least one business function of server;
Pressure test module 102 is configured to carry out pressure test at least one of server business function and generate
Pressure testing results file;
Pressure sensing result generation module 103 is configured to according to acquired pressure sensing result file generated pressure
Test results report.
As shown in fig. 6, the preferred embodiment as the embodiment of the present disclosure, the system further comprises:
Communication module 104 is configured to establish communication connection between client and server end;
Limiter of speed registration module 105 is configured to through client at least one service device function by remotely adjusting
With to server-side application for registration limiter of speed, the registration information of limiter of speed include with the associated first identifier of limiter of speed and it is scheduled extremely
A few unit time business processing amount threshold value;
Limiter of speed management module 106 is configured to add by the registration information for the client new registration limiter of speed that will be received
Enter to limiter of speed and manage queue, to realize the management to limiter of speed;
Limiter of speed executes request module 107, is configured to send by client associated with limiter of speed
First identifier and that initiates limiter of speed execute request;
Limiter of speed calling module 108 is configured to call by server end according to the associated first identifier of limiter of speed
Limiter of speed manages the limiter of speed in queue, realizes and carries out speed limit to respective server function.
It should be appreciated that the embodiment of the present invention can be by computer hardware, the combination of hardware and software or by depositing
The computer instruction in non-transitory computer-readable memory is stored up to be effected or carried out.Standard volume can be used in the method
Journey technology-includes that the non-transitory computer-readable storage media configured with computer program is realized in computer program,
In configured in this way storage medium make computer operated in a manner of specific and is predefined-according to describing in a particular embodiment
Method and attached drawing.Each program can be realized with the programming language of level process or object-oriented with logical with computer system
Letter.However, if desired, the program can be realized with compilation or machine language.Under any circumstance, the language can be compiling or
The language of explanation.In addition, the program can be run on the specific integrated circuit of programming for this purpose.
Further, this method can be realized in being operably coupled to suitable any kind of computing platform, including
But it is not limited to PC, mini-computer, main frame, work station, network or distributed computing environment, individual or integrated
It computer platform or is communicated with charged particle tool or other imaging devices etc..Each aspect of the present invention can be with storage
No matter machine readable code on non-transitory storage medium or equipment is moveable or is integrated to calculate and put down to realize
Platform, such as hard disk, optically read and/or write-in storage medium, RAM, ROM, so that it can be read by programmable calculator, when depositing
Storage media or equipment can be used for configuration and operation computer to execute process described herein when being read by computer.In addition,
Machine readable code, or part thereof can be transmitted by wired or wireless network.When such media include in conjunction with microprocessor or
When other data processors realize the instruction or program of steps described above, invention as described herein includes that these and other are different
The non-transitory computer-readable storage media of type.When methods and techniques according to the present invention programming, the present invention is also
Including computer itself.
Computer program can be applied to input data to execute function as described herein, to convert input data with life
At storing to the output data of nonvolatile memory.Output information can also be applied to one or more output equipments as shown
Device.In the preferred embodiment of the invention, the data of conversion indicate physics and tangible object, including the object generated on display
Reason and the particular visual of physical objects are described.