Pressure testing method for flow on simulation line
1. A pressure test method for simulating online flow is characterized by comprising the following steps:
carrying out online packet capturing on the port of the real client by using a plurality of packet capturing service terminals;
sending the packets grabbed by at least two packet grabbing service ends to a packet grabbing client;
recombining the captured packets by using a packet processing module to amplify the flow;
the reassembled packets are sent to a simulator for stress testing.
2. The method for simulating the pressure testing of the online traffic as claimed in claim 1, wherein a plurality of packet capturing service terminals are used to perform online packet capturing on ports of a plurality of real clients.
3. The method for stress testing of traffic on a simulation line according to claim 1, wherein the packets captured by at least two of the packet capturing servers are sent to a plurality of packet receiving clients.
4. The method of pressure testing of simulated inline traffic as claimed in claim 1, wherein said recombining said captured packets with a packet processing module to amplify traffic comprises:
and filtering the captured packets by using the packet processing module, leaving the packets of the same type, and combining the packet files of the same type into one packet file.
5. The method for pressure testing of simulation online traffic as recited in claim 4, wherein the merging of package files of the same type into one package file is:
and carrying out staggered combination on the package files of the same type according to the time stamp of the package receiving time.
6. The method of pressure testing of simulated inline traffic as claimed in claim 1, further comprising, prior to said recombining said captured packets with a packet processing module to amplify traffic:
and forging a packet by using the packet processing module and adding the forged packet into the captured packet.
7. The method of claim 1, wherein sending the reassembled packet to a simulator for pressure testing comprises:
establishing different links according to the link information in the recombined packet;
and sending the packets with the same link information to the simulator by the same link.
8. The method for pressure testing of a flow on a simulation line of claim 7, further comprising:
and simulating the time interval packet sending of real client packet sending to carry out pressure test by utilizing the thread dormancy of the simulator.
Background
With the rapid development of the internet industry, various types of software appear on the market, software testing becomes increasingly important, a robust software is bound to be subjected to various tests, when the software just appears, a real user is often lacked, under the condition, if simulation is performed only through a simple client, the effect of a real environment cannot be simulated, and in the software iteration process, specific optimization is often required to be performed according to the real environment, so that the authenticity during testing is guaranteed, and a key problem is solved.
Disclosure of Invention
In order to solve the problems, the invention provides a pressure testing method for simulating the online flow, which can improve the authenticity during the simulation of a testing environment and make a developer better know the online condition, thereby specifically optimizing software.
The invention provides a pressure test method for simulating online flow, which comprises the following steps:
carrying out online packet capturing on the port of the real client by using a plurality of packet capturing service terminals;
sending the packets grabbed by at least two packet grabbing service ends to a packet grabbing client;
recombining the captured packets by using a packet processing module to amplify the flow;
the reassembled packets are sent to a simulator for stress testing.
Preferably, in the above method for testing pressure of simulation online traffic, a plurality of packet capturing service terminals are used to perform online packet capturing on ports of a plurality of real clients.
Preferably, in the method for testing the pressure of the traffic on the simulation line, the packets captured by at least two of the packet capturing service terminals are sent to a plurality of packet receiving client terminals.
Preferably, in the above method for testing pressure of a flow on a simulation line, the recombining, by using a packet processing module, the captured packets to amplify the flow includes:
and filtering the captured packets by using the packet processing module, leaving the packets of the same type, and combining the packet files of the same type into one packet file.
Preferably, in the above method for testing pressure of flow on a simulation line, the merging of package files of the same type into one package file is:
and carrying out staggered combination on the package files of the same type according to the time stamp of the package receiving time.
Preferably, in the above method for testing pressure of a flow on a simulation line, before the reassembling the captured packets by using a packet processing module to amplify the flow, the method further includes:
and forging a packet by using the packet processing module and adding the forged packet into the captured packet.
Preferably, in the above method for testing pressure of a flow on a simulation line, sending the reassembled packet to a simulator for pressure testing includes:
establishing different links according to the link information in the recombined packet;
and sending the packets with the same link information to the simulator by the same link.
Preferably, in the above method for testing pressure of a flow on a simulation line, the method further includes:
and simulating the time interval packet sending of real client packet sending to carry out pressure test by utilizing the thread dormancy of the simulator.
According to the above description, the method for testing the pressure of the simulation online flow provided by the invention comprises the steps of performing online packet capture on a port of a real client by using a plurality of packet capture service ends; then sending the packets grabbed by at least two packet grabbing service ends to a packet grabbing client; then, a packet processing module is used for recombining the captured packets to amplify the flow; finally, the recombined packets are sent to a simulator for pressure testing, and the method combines the online packet capturing and offline testing, and increases the testing flow by using the combination of the online real packets captured, thereby improving the authenticity during the simulation of the testing environment, leading a developer to better know the online condition and further specifically optimizing the software.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a schematic diagram of an embodiment of a method for pressure testing of an on-line flow simulation according to the present invention;
fig. 2 is a detailed flowchart of a pressure testing method for simulating an on-line flow.
Detailed Description
The core of the invention is to provide a pressure testing method for simulating the online flow, which can improve the authenticity during the simulation of a testing environment and make a developer better know the online condition, thereby specifically optimizing software.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 shows an embodiment of a method for testing pressure of a simulation online flow provided by the present invention, where fig. 1 is a schematic diagram of an embodiment of a method for testing pressure of a simulation online flow provided by the present invention, and the method may include the following steps:
s1: carrying out online packet capturing on the port of the real client by using a plurality of packet capturing service terminals;
it should be noted that, referring to fig. 2 and fig. 2 are specific flow charts of a method for testing pressure of a simulation online traffic, when a real user requests a packet capturing server, if a packet capturing function is currently enabled, several fixed ports of a real client are monitored, there are two packet flowing directions, one of the two packet flowing directions is handled as a normal request, and the other packet flows is sent to other processes through a network, and the other processes handle trivial matters such as the format of the packet.
S2: and sending the packets grabbed by the at least two packet grabbing service ends to the packet grabbing client.
If a port of a monitoring packet receiving program is connected with a client, the packet capturing server sends a packet sent by a real client to the packet receiving client as it is, and the packet capturing server does not process the packet in any format, otherwise, the performance of the original service is possibly influenced.
S3: recombining the captured packets by using a packet processing module to amplify the flow;
it should be noted that after the package is grabbed from the line, the package can be used as an input of different tools, for example, different packages can be separated and tested separately, if the pressure test is required and the number of current real users is not so large, the obtained packages can be recombined, and the pressure can be amplified to different times according to the requirement. If the chronological order of the requests needs to be guaranteed and the test of the packages sent for the different services at the time is required, the server for the different services can send the packages to a server which is specially used for receiving the packages, so that the chronological order of the captured packages is guaranteed.
S4: the reassembled packets are sent to a simulator for stress testing.
It should be noted that after the packets are processed, a simulation test can be performed, where the simulator is a client that inputs the packets and outputs the performance analysis reports, and the simulator can resend the packets acquired online to the server in the test environment in a time sequence.
As can be seen from the above description, in the embodiment of the method for testing pressure of the above-mentioned simulation online traffic, the method includes performing online packet capture on a port of a real client by using a plurality of packet capture service ends; then sending the packets grabbed by the at least two packet grabbing service ends to the packet receiving client; the packet processing module is used for recombining the captured packets to amplify the flow; finally, the recombined packets are sent to a simulator for pressure testing, and the method combines the online packet capturing and offline testing, and increases the testing flow by using the combination of the online real packets captured, thereby improving the authenticity during the simulation of the testing environment, leading a developer to better know the online condition and further specifically optimizing the software.
In a specific embodiment of the above method for testing pressure of simulation online traffic, a plurality of packet capturing service ends are used to perform online packet capturing on ports of a plurality of real clients, so that more packets can be captured by the packet capturing service ends for combination, thereby better simulating amplification of traffic.
In another embodiment of the method for testing the pressure of the simulation online traffic, the packets captured by the at least two packet capturing service terminals are sent to the plurality of packet receiving client terminals.
It should be noted that there may be more than one packet receiving client, and when the network bandwidth is not fully utilized, multiple packet receiving clients may be connected to the packet capturing server, and at this time, the packet capturing server needs to send the received packets to different packet receiving clients.
In another embodiment of the above method for pressure testing of a simulation online traffic, the recombining the captured packets with the packet processing module to amplify the traffic comprises:
and filtering the captured packets by using a packet processing module, leaving the packets of the same type, and combining the packet files of the same type into a packet file.
It should be noted that, with a packet sent by a real client in an online environment, different processing may be performed on the packet, and if a current scene needs to be objectively and truly simulated, no processing is required on the packet, and if a pressure test needs to be performed on a server program and an actual flow is not so large, the same packet files may be combined, for example, if the flow needs to be doubled, two identical packets may be combined together.
In a preferred embodiment of the above method for testing pressure of traffic on a simulation line, merging package files of the same type into one package file may be:
and carrying out staggered combination on the package files of the same type according to the time stamp of the package receiving time.
Specifically, it should be noted that the merging order is a problem, because after the packet capturing server sends the packet to the packet receiving client, the packet receiving client records the timestamp of the packet receiving time, and therefore the packet needs to be interleaved and merged. This is more true.
In another preferred embodiment of the above method for testing pressure of a simulation online traffic, before recombining the captured packets by using the packet processing module to amplify the traffic, the method may further include:
and forging the packet by using the packet processing module and adding the forged packet into the captured packet.
It should be noted that, because there are some states in the online environment when the packet capture is started, the environments need to be restored first in the simulation test, and one of the methods is to forge some packets to initiate requests to the server, and if the packets are not forged, the server may make errors.
In another preferred embodiment of the above method for pressure testing of a simulation of an in-line flow, sending the reassembled packet to a simulator for pressure testing may include:
establishing different links according to the link information in the packets after the recombination;
the packets with the same link information are sent to the simulator by the same link.
That is, when the captured packet contains link information, different links need to be established according to the link information, and the packet with the same link information is sent out from the same link, so that no error occurs.
Further, on the basis of the pressure testing method for the flow on the simulation line, the method may further include:
and simulating the time interval packet sending of real client side packet sending to carry out pressure test by utilizing the thread dormancy of the simulator.
Specifically, in order to make the test more realistic, the simulator needs to simulate the time interval of real client packet sending, which can achieve the purpose by making the simulator thread sleep, and during the simulation test, the simulator can output the delay distribution of the response time at a fixed time interval.
In summary, the existing test is performed according to the fictive data, and the method adopts the real package of the online environment to perform the test, so that the authenticity of the simulation test is improved, the current scene can be restored, and the corresponding server program can be specifically optimized.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:一种评估应用系统健康度的方法及装置