CN112866062B - Distributed pressure test system, method, device, equipment and storage medium - Google Patents
Distributed pressure test system, method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN112866062B CN112866062B CN202110130827.4A CN202110130827A CN112866062B CN 112866062 B CN112866062 B CN 112866062B CN 202110130827 A CN202110130827 A CN 202110130827A CN 112866062 B CN112866062 B CN 112866062B
- Authority
- CN
- China
- Prior art keywords
- test
- request
- service
- tested
- response
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Environmental & Geological Engineering (AREA)
- Debugging And Monitoring (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the invention provides a distributed pressure test system, a method, a device, equipment and a storage medium, wherein: the method comprises the steps that a central node obtains interface information and parallelism of a service to be tested and sends the interface information to test nodes, wherein the number of the test nodes is in direct proportion to the parallelism; the test node sends a test request to the service to be tested according to the interface information, generates response information according to the response result and the response time of the service to be tested to the test request, and returns the response information to the central node; and the central node analyzes the response information to obtain a pressure test result of the service to be tested. Therefore, the plurality of test nodes are called according to the parallelism, the plurality of test nodes can send test requests in the test process, and sufficient test pressure is generated, so that the pressure test requirement of the service to be tested is met.
Description
Technical Field
The invention relates to the technical field of internet, in particular to a distributed pressure test system, a method, a device, equipment and a storage medium.
Background
With the increasing number of internet users and the wide use of Application Programming Interfaces (APIs) in a system, the pressure on system services is increasing, and considering the peak effect of the user's request volume under the hot content and activity scenarios, it is becoming more and more important to perform a pressure test on the service performance of the system in order to maintain the stability of the system services.
The pressure test is a method for testing the service performance of the system, and the limit and hidden danger of the service performance of the system can be inspected. Before the system is on line or updated, the system service can be subjected to pressure test, and the maximum request quantity which can be borne by the system service in the current environment is determined, so that the capacity expansion and the capacity contraction of system resources are reasonably arranged, and the service performance of the system is improved.
At present, stress testing on a system is realized by open-source Apache JMeter testing software, but as the expected value of the maximum load of the system service is increased continuously, the request quantity required by the stress testing is increased, and when the Apache JMeter testing software runs on testing equipment, the request quantity capable of being generated is limited due to the limitation of the performance of the testing equipment, so that the requirement for the stress testing on the system service is difficult to meet.
Disclosure of Invention
Embodiments of the present invention provide a distributed pressure test system, method, apparatus, device, and storage medium, so as to meet a requirement for performing a pressure test on a system service. The specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a distributed stress testing system, including a central node and at least one testing node, wherein:
the central node is used for acquiring interface information and parallelism of a service to be tested; sending the interface information to test nodes, wherein the number of the test nodes is in direct proportion to the parallelism;
the test node is used for sending a test request to the service to be tested according to the interface information; generating response information according to the response result and the response time of the service to be tested to the test request; returning response information to the central node;
the central node is further configured to analyze the response information to obtain a pressure test result of the service to be tested.
Optionally, the central node is further configured to obtain a test time of the service to be tested; sending the interface information and the test time to a test node;
the test node is specifically configured to send a test request to the service to be tested according to the interface information and at a first preset time interval within the test time.
Optionally, the interface information of the service to be tested includes a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol;
the test node is specifically configured to establish a connection with the service to be tested according to the communication parameters according to the preset communication protocol; sending a test request to the service to be tested through the established connection, and receiving a response result and response time returned by the service to be tested; and disconnecting with the service to be tested according to the preset communication protocol.
Optionally, the response result is a request success or a request failure, and the response information includes a request success number, a request failure number, a request timeout number, and a total response time corresponding to the test node;
the central node is specifically configured to calculate a total number of request successes, a total number of request failures, and a total number of request timeouts of the service to be tested according to the number of request successes, the number of request failures, and the number of request timeouts of the test node; and calculating the average response time of the service to be tested according to the request success number and the total response time of each test node.
In a second aspect of the present invention, there is also provided a distributed pressure testing method, including:
acquiring interface information and parallelism of a service to be tested;
sending the interface information to test nodes, wherein the number of the test nodes is in direct proportion to the parallelism;
receiving response information returned by the test node, wherein the response information is generated according to the response result and the response time of the service to be tested to the test request;
and analyzing the response information to obtain a pressure test result of the service to be tested.
Optionally, before the sending the interface information to a plurality of test nodes, the method further includes:
acquiring test time of a service to be tested;
the sending the interface information to a test node includes:
and sending the interface information and the test time to a test node.
Optionally, the interface information of the service to be tested includes a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol.
Optionally, the response result is a request success or a request failure, the response information includes a request success number, a request failure number, a request timeout number, and a total response time corresponding to the test node, and the analyzing the response information to obtain the stress test result of the service to be tested includes:
calculating the request success total number, the request failure total number and the request overtime total number of the service to be tested according to the request success number, the request failure number and the request overtime number of the test node;
and calculating the average response time of the service to be tested according to the request success number and the total response time of each test node.
In a third aspect of the present invention, there is also provided a distributed pressure testing method, including:
receiving interface information of a service to be tested;
sending a test request to the service to be tested according to the interface information;
generating response information according to the response result and the response time of the service to be tested to the test request;
and sending the response information as feedback data of the interface information.
Optionally, the receiving interface information of the service to be tested, sent by the central node, includes:
receiving interface information and test time of a service to be tested;
the sending a test request to the service to be tested according to the interface information includes:
and sending a test request to the service to be tested according to the interface information and a first preset time interval in the test time.
Optionally, the interface information of the service to be tested includes a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol;
the sending a test request to the service to be tested according to the interface information includes:
according to the preset communication protocol, establishing connection with the service to be tested according to the communication parameters;
sending a test request to the service to be tested through the established connection, and receiving a response result and response time returned by the service to be tested;
and disconnecting the connection established with the service to be tested according to the preset communication protocol.
Optionally, the generating response information according to the response result and the response time of the service to be tested to the test request includes:
aiming at each test request, calculating the response time of the test request according to the sending time of the test request and the receiving time of the corresponding response result;
judging whether the response time of each test request exceeds a preset threshold value, if so, judging that the test request is overtime;
and counting the request success number, the request failure number, the request timeout number and the total response time of the service to be tested to the test request in the current time interval according to a second preset time interval to obtain response information corresponding to the current time interval.
In a fourth aspect of the present invention, there is also provided a distributed pressure testing apparatus, the apparatus comprising:
the interface information acquisition module is used for acquiring the interface information and the parallelism of the service to be tested;
the interface information sending module is used for sending the interface information to the test nodes, and the number of the test nodes is in direct proportion to the parallelism;
the response information receiving module is used for receiving response information returned by the test node, and the response information is generated according to the response result and the response time of the service to be tested to the test request;
and the pressure test analysis module is used for analyzing the response information to obtain a pressure test result of the service to be tested.
In a fifth aspect of the present invention, there is also provided a distributed pressure testing apparatus, the apparatus comprising:
the interface information receiving module is used for receiving the interface information of the service to be tested;
the test request sending module is used for sending a test request to the service to be tested according to the interface information;
the response information generating module is used for generating response information according to the response result and the response time of the service to be tested to the test request;
and the response information sending module is used for sending the response information as the feedback data of the interface information.
In another aspect of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any one of the distributed pressure testing methods when executing the program stored in the memory.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to perform any of the above-described distributed pressure testing methods.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the above described distributed stress testing methods.
First, a central node acquires interface information and parallelism of a service to be tested and sends the interface information to test nodes, wherein the number of the test nodes is in direct proportion to the parallelism; and then, the test node sends a test request to the service to be tested according to the interface information, generates response information according to the response result and the response time of the service to be tested to the test request, returns the response information to the central node, and then analyzes the response information by the central node to obtain the pressure test result of the service to be tested. Therefore, the central node can call a plurality of test nodes according to the parallelism of the service to be tested, and the plurality of test nodes send test requests to the service to be tested, so that enough test pressure can be generated for the service to be tested, and the pressure test requirement of the service to be tested is met.
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.
FIG. 1 is an information interaction diagram of a distributed pressure test system according to an embodiment of the present invention;
FIG. 2 is a diagram of a distributed pressure test system according to an embodiment of the present invention;
FIG. 3 is a flow chart illustrating steps of a distributed pressure testing method according to an embodiment of the present invention;
FIG. 4 is a flow chart of steps in another distributed pressure testing method in accordance with an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a distributed pressure testing apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of another distributed pressure testing apparatus according to an embodiment of the present invention;
fig. 7 is a schematic diagram of an electronic device provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
In the related art, the stress test on the system is realized by open-source Apache JMeter test software, but as the expected value of the maximum load of the system service is increased, the request quantity required by the stress test is increased, and due to the limitation of the performance of the test equipment, the request quantity capable of being generated is limited, so that the requirement for the stress test on the system service is difficult to meet.
In order to solve the above problem, embodiments of the present invention provide a distributed pressure testing system, which includes a central node and at least one testing node, and the distributed pressure testing system provided by embodiments of the present invention is generally described below.
The central node is used for acquiring interface information and parallelism of a service to be tested; sending the interface information to test nodes, wherein the number of the test nodes is in direct proportion to the parallelism;
the test node is used for sending a test request to the service to be tested according to the interface information; generating response information according to the response result and the response time of the service to be tested to the test request; returning response information to the central node;
and the central node is also used for analyzing the response information to obtain a pressure test result of the service to be tested.
As can be seen from the above, in the distributed pressure testing system provided in the embodiment of the present invention, the central node may invoke a plurality of testing nodes according to the parallelism of the service to be tested, and the plurality of testing nodes send testing requests to the service to be tested, so that sufficient testing pressure may be generated for the service to be tested, and the pressure testing requirements of the service to be tested are met.
The distributed pressure testing system provided by the embodiment of the invention will be described in detail through specific embodiments.
Referring to fig. 1, an information interaction diagram of a distributed stress testing system according to an embodiment of the present invention is shown, where the distributed stress testing system includes a plurality of nodes, and the nodes may be divided into a central node and at least one testing node. In the embodiment of the invention, the distributed stress test system can be realized based on Apache Spark and is in the distributed stress test system. Any node in the distributed stress test system may be a central node or a test node, that is, if the node performs the operation of the central node, it is the central node, and vice versa, if the node performs the operation of the test node, it is the test node.
The process of information interaction between the central node and the test node is as follows:
s1, a central node acquires interface information and parallelism of a service to be tested.
In some scenarios, a pressure test needs to be performed on the service to be tested, and the maximum request amount that the service to be tested can bear in the current environment is determined, so that the capacity expansion and the capacity reduction of the service resource to be tested are reasonably arranged, and the performance of the service to be tested is improved. The service to be tested may be any type of service, for example, HTTP (HyperText Transfer Protocol) service, mySQL (structured query Language) service, remote directory Server (Remote data service) service, or Dubbo RPC (Remote Procedure Call) service, and the like, which is not limited specifically.
The interface information and the parallelism of the services to be tested are set by a user, each service to be tested has unique corresponding interface information and can communicate with the corresponding service to be tested according to the interface information, the parallelism of the services to be tested can be set by the user according to the test requirements of the services to be tested, and the higher the test requirement of the services to be tested is, the more the required test request quantity is, the higher the parallelism of the services to be tested is.
The interface information of the service to be tested may include a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol, where the preset communication protocol may be any one of a HTTP protocol, a socket protocol, and the like, and is not particularly limited. The different preset communication protocols usually correspond to different communication parameters, for example, if the preset communication protocol is an HTTP protocol, the corresponding communication parameters may be information such as a URL (Uniform Resource Locator) address of the service to be tested.
Therefore, the central node can realize the communication between the service to be tested and the distributed pressure test system only by acquiring the preset communication protocol of the service to be tested and the communication parameters corresponding to the preset communication protocol, the realization process is simpler, the difficulty of developers is lower, and the expansibility is better.
And S2, the central node sends the interface information to the test nodes, wherein the number of the test nodes is in direct proportion to the parallelism.
In this step, the central node may send interface information of the service to be tested to the test nodes in the distributed pressure test system. For example, when the parallelism is 10, the number of the test nodes may be 1, and when the parallelism is 100, the number of the test nodes may be 10, and the specific proportion is not limited and may be determined according to user settings.
It can be known from S1 that the parallelism of the service to be tested can be set by the user according to the test requirement of the service to be tested, and the greater the test requirement of the service to be tested, the more the number of test requests is, the higher the parallelism of the service to be tested is, that is, the greater the test requirement of the service to be tested is, the more the number of test requests is, the more the number of test nodes is, so that the test requirement of the service to be tested can be satisfied.
In one implementation, the distributed pressure testing system may adopt a Spark Streaming of an Apache Spark, in which a plurality of Receiver threads are provided, each Receiver thread corresponds to one or more testing nodes, and the number of the Receiver threads may be determined according to the parallelism of the service to be tested and is in direct proportion to the parallelism of the service to be tested, that is, the higher the parallelism of the service to be tested is, the more the number of the Receiver threads is, the more the number of the corresponding testing nodes is.
In the application, the central node can also obtain the test time of the service to be tested and send the test time to the test node. The testing time is the duration of the pressure test on the service to be tested, in other words, the distributed pressure testing system continues to perform the pressure test on the service to be tested until the duration reaches the testing time, and then the testing process on the service to be tested is stopped. Therefore, the stream processing function of the Apache Spark can be reasonably utilized, and continuous pressure is generated in the test time, so that the test efficiency is improved.
S3, the test node sends a test request to the service to be tested according to the interface information; and generating response information according to the response result and the response time of the service to be tested to the test request.
For example, the interface information of the service to be tested includes a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol, so that the test node may establish a connection with the service to be tested according to the communication parameter according to the preset communication protocol, send a test request to the service to be tested through the established connection, receive a response result and response time returned by the service to be tested, and further disconnect the service to be tested according to the preset communication protocol when the pressure test is finished.
Therefore, the test node can realize the communication with the service to be tested only according to the preset communication protocol in the interface information and the communication parameters corresponding to the preset communication protocol, the realization process is simple, the difficulty of developers is low, and the expansibility is good.
In one implementation, the central node further sends the test time to the test node, and then the test node may send, according to the interface information, a test request to the service to be tested according to a first preset time interval within the test time, where the first preset time interval may be determined according to the setting of the user. Therefore, the testing node can reasonably utilize the streaming processing function of the distributed pressure testing system and generate continuous pressure in the testing time, thereby improving the testing efficiency.
In this step, each test node may generate response information corresponding to the test node according to a response result and response time of the service to be tested to the test request sent by the test node. The response result of the service to be tested to the test request is request success or request failure, and the response information may include the number of request successes, the number of request failures, the number of request exceeds the time and the total response time corresponding to each test node.
For example, each test node may calculate, for each test request, a response time of the test request according to a sending time of the test request and a receiving time of a corresponding response result; judging whether the response time of each test request exceeds a preset threshold value, if so, judging that the test request is overtime; and according to a second preset time interval, counting the request success number, the request failure number, the request timeout number and the total response time of the service to be tested to the test request in the current time interval to obtain response information corresponding to the current time interval.
The second preset time interval may be set by a user, for example, the second preset time interval may be set to 1 second, that is, the test node performs pre-aggregation on the response time and the response result of the service to be tested every second, so as to obtain the response information of the service to be tested in the second. In this way, by pre-aggregating the response result and the response time, a larger amount of information can be included in the response information, so that the calculation pressure of the subsequent central node can be reduced.
For example, the distributed stress testing system may adopt Spark Streaming of Apache Spark, and in this case, it may also count the request success number, the request failure number, the request timeout number, and the total response time of the test request sent by the service to be tested to one or more test nodes corresponding to each Receiver thread in the current time interval according to a second preset time interval by taking each Receiver thread as a unit, and obtain the response information corresponding to each Receiver thread in the current time interval. In this way, the computational pressure of subsequent central nodes may be further reduced.
And S4, the test node returns response information to the central node.
In this step, the test node may return response information to the central node in real time, that is, immediately return response information to the central node each time a new response information is generated. The response information is generated after the response time and the response result are subjected to statistical calculation, and the redundancy is lower compared with the response time and the response result aiming at each test request, so that the communication times between the test node and the central node can be reduced, the resource occupation is reduced, and the processing efficiency is improved.
And S5, the central node analyzes the response information to obtain a pressure test result of the service to be tested.
In this step, the central node may calculate the total number of request successes, the total number of request failures, and the total number of request timeouts of the service to be tested according to the number of request successes, the number of request failures, and the number of request timeouts of the plurality of test nodes; then, the average response time of the service to be tested is calculated according to the request success number and the total response time of each test node. Thus, the information such as the request success total number, the request failure total number, the request overtime total number, the average response time and the like of the pressure test of the service to be tested is obtained, namely the pressure test result of the service to be tested. According to the pressure test result, the user can evaluate the performance of the service to be tested and judge whether the performance of the service to be tested meets the requirement.
For example, referring to FIG. 2, an architecture diagram of a distributed pressure test system in an embodiment of the present invention is shown. The distributed pressure test system comprises a pressure test engine, a pressure test starter, background services and a Web (webpage) page, wherein the pressure test engine comprises a kernel, a service interface and a service plug-in, and in addition, the distributed pressure test system also needs the support of external systems such as a Hadoop cluster and a database.
The Web page can interact with a user, information such as parallelism, test time and interface information of a service to be tested set by the user is obtained and used as metadata, the obtained metadata is sent to a background service, the background service has functions of pressure test starting and metadata management, on one hand, the metadata can be stored in a MySQL database, on the other hand, a pressure test starter can be started, so that a pressure test engine based on a Hadoop cluster obtains the metadata from the MySQL database, connection is established with service plug-ins of various services to be tested through service interfaces, then pressure test is conducted on the service to be tested according to a distributed pressure test method in a pressure test engine kernel, and a pressure test result is stored in an InfluxDB database.
As can be seen from the above, in the distributed pressure testing system provided in the embodiment of the present invention, the central node may invoke a plurality of testing nodes according to the parallelism of the service to be tested, and the plurality of testing nodes send testing requests to the service to be tested, so that sufficient testing pressure may be generated for the service to be tested, and the pressure testing requirements of the service to be tested are met.
Referring to fig. 3, a flowchart illustrating steps of a distributed pressure testing method according to an embodiment of the present invention is shown, where the method may specifically include the following steps:
s101: and acquiring interface information and parallelism of the service to be tested.
The interface information of the service to be tested may include a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol, where the preset communication protocol may be any one of a HTTP protocol, a socket protocol, and the like, and is not particularly limited.
Therefore, the communication between the service to be tested and the distributed pressure test system can be realized only by acquiring the preset communication protocol of the service to be tested and the communication parameters corresponding to the preset communication protocol, the realization process is simpler, the difficulty of developers is lower, and the expansibility is better.
S102: and sending the interface information to the test nodes, wherein the number of the test nodes is in direct proportion to the parallelism.
In the application, the test time of the service to be tested can be obtained, and the test time is sent to the test node. The testing time is the duration of the pressure test on the service to be tested, in other words, the distributed pressure testing system continues to perform the pressure test on the service to be tested until the duration reaches the testing time, and then the testing process on the service to be tested is stopped.
Therefore, the streaming processing function of the Apache Spark can be reasonably utilized, and continuous pressure is generated in the testing time, so that the testing efficiency is improved.
S103: and receiving response information returned by the test node, wherein the response information is generated according to the response result and the response time of the service to be tested to the test request.
In this step, each test node may generate response information corresponding to the test node according to a response result and response time of the service to be tested to the test request sent by the test node. The response result of the service to be tested to the test request is request success or request failure, and the response information may include the number of request successes, the number of request failures, the number of request exceeds the time and the total response time corresponding to each test node.
In this way, by pre-aggregating the response result and the response time, a larger amount of information can be included in the response information, so that the calculation pressure of the subsequent central node can be reduced.
S104: and analyzing the response information to obtain a pressure test result of the service to be tested.
In this step, the request success total number, the request failure total number and the request overtime total number of the service to be tested can be calculated according to the request success number, the request failure number and the request overtime number of the plurality of test nodes; then, the average response time of the service to be tested is calculated according to the request success number and the total response time of each test node.
Thus, the information such as the request success total number, the request failure total number, the request overtime total number, the average response time and the like of the pressure test of the service to be tested is obtained, namely the pressure test result of the service to be tested. According to the pressure test result, the user can evaluate the performance of the service to be tested and judge whether the performance of the service to be tested meets the requirement.
As can be seen from the above, in the distributed pressure testing method provided in the embodiment of the present invention, any node can call multiple testing nodes according to the parallelism of the service to be tested, and the multiple testing nodes send testing requests to the service to be tested, so that sufficient testing pressure can be generated for the service to be tested, and the pressure testing requirement of the service to be tested is met.
Referring to fig. 4, a flowchart illustrating steps of another distributed pressure testing method according to an embodiment of the present invention is shown, where the method may specifically include the following steps:
s201: interface information of a service to be tested is received.
The interface information of the service to be tested may include a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol, where the preset communication protocol may be any one of a HTTP protocol, a socket protocol, and the like, and is not particularly limited.
S202: and sending a test request to the service to be tested according to the interface information.
For example, the interface information of the service to be tested includes a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol, so that a connection can be established with the service to be tested according to the communication parameter according to the preset communication protocol, a test request is sent to the service to be tested through the established connection, a response result and response time returned by the service to be tested are received, and then, when the pressure test is finished, the connection with the service to be tested is disconnected according to the preset communication protocol.
Therefore, communication with the service to be tested can be realized only according to the preset communication protocol in the interface information and the communication parameters corresponding to the preset communication protocol, the realization process is simple, the difficulty of developers is low, and the expansibility is good.
In the present application, a test time of a service to be tested may also be received. The testing time is the duration of the pressure test on the service to be tested, in other words, the distributed pressure testing system continues to perform the pressure test on the service to be tested until the duration reaches the testing time, and then the testing process on the service to be tested is stopped.
Therefore, the streaming processing function of the Apache Spark can be reasonably utilized, and continuous pressure is generated in the testing time, so that the testing efficiency is improved.
S203: and generating response information according to the response result and the response time of the service to be tested to the test request.
In this step, each test node may generate response information corresponding to the test node according to a response result and response time of the service to be tested to the test request sent by the test node. The response result of the service to be tested to the test request is request success or request failure, and the response information may include the number of request successes, the number of request failures, the number of request exceeds the time and the total response time corresponding to each test node.
In this way, by pre-aggregating the response result and the response time, a larger amount of information can be included in the response information, so that the calculation pressure of the subsequent central node can be reduced. The response information is generated after the response time and the response result are subjected to statistical calculation, and compared with the response time and the response result aiming at each test request, the redundancy is low, so that the communication times between the test node and the central node can be reduced, the resource occupation is reduced, and the processing efficiency is improved.
S204: and sending the response information as feedback data of the interface information.
As can be seen from the above, in the distributed pressure testing method provided in the embodiment of the present invention, any node may send a test request to the service to be tested according to the interface information, generate response information according to a response result and a response time of the service to be tested to the test request, and then send the response information as feedback data of the interface information, thereby implementing the test pressure on the service to be tested. The greater the number of nodes sending test requests to the service to be tested, the greater the test pressure on the service to be tested.
Referring to fig. 5, a schematic structural diagram of a distributed pressure testing apparatus according to an embodiment of the present invention is shown, where the apparatus includes:
an interface information obtaining module 401, configured to obtain interface information and parallelism of a service to be tested;
an interface information sending module 402, configured to send the interface information to test nodes, where the number of the test nodes is proportional to the parallelism;
a response information receiving module 403, configured to receive response information returned by the test node, where the response information is generated according to a response result and response time of the service to be tested to the test request;
and a pressure test analysis module 404, configured to analyze the response information to obtain a pressure test result of the service to be tested.
In one implementation, the interface information obtaining module 401 is further configured to obtain a test time of a service to be tested;
the interface information sending module 402 is further configured to send the interface information and the test time to a test node.
In one implementation manner, the interface information of the service to be tested includes a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol.
In one implementation, the response result is a request success or a request failure, the response information includes a request success number, a request failure number, a request timeout number and a total response time corresponding to the test node,
the stress test analysis module 404 is specifically configured to calculate a total number of request successes, a total number of request failures, and a total number of request timeouts of the service to be tested according to the number of request successes, the number of request failures, and the number of request timeouts of the test node; and calculating the average response time of the service to be tested according to the request success number and the total response time of each test node.
As can be seen from the above, in the distributed pressure testing apparatus provided in the embodiment of the present invention, any node can call multiple testing nodes according to the parallelism of the service to be tested, and the multiple testing nodes send testing requests to the service to be tested, so that sufficient testing pressure can be generated for the service to be tested, and the pressure testing requirement of the service to be tested is met.
Referring to fig. 6, a schematic structural diagram of another distributed pressure testing apparatus in an embodiment of the present invention is shown, the apparatus including:
an interface information receiving module 501, configured to receive interface information of a service to be tested;
a test request sending module 502, configured to send a test request to the service to be tested according to the interface information;
a response information generating module 503, configured to generate response information according to a response result and response time of the service to be tested to the test request;
a response information sending module 504, configured to send the response information as feedback data of the interface information.
In one implementation, the interface information receiving module 501 is specifically configured to receive interface information of a service to be tested and test time;
the test request sending module 502 is specifically configured to send a test request to the service to be tested according to the interface information and according to a first preset time interval within the test time.
In one implementation manner, the interface information of the service to be tested includes a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol;
the test request sending module 502 is specifically configured to establish a connection with the service to be tested according to the communication parameters according to the preset communication protocol; sending a test request to the service to be tested through the established connection, and receiving a response result and response time returned by the service to be tested; and disconnecting the connection established with the service to be tested according to the preset communication protocol.
In one implementation, the response information generating module 503 is specifically configured to:
aiming at each test request, calculating the response time of the test request according to the sending time of the test request and the receiving time of the corresponding response result;
judging whether the response time of each test request exceeds a preset threshold value, if so, judging that the test request is overtime;
and according to a second preset time interval, counting the request success number, the request failure number, the request timeout number and the total response time of the service to be tested to the test request in the current time interval to obtain response information corresponding to the current time interval.
As can be seen from the above, in the distributed pressure testing apparatus provided in the embodiment of the present invention, any node may send a test request to a service to be tested according to the interface information, generate response information according to a response result and a response time of the service to be tested to the test request, and then send the response information as feedback data of the interface information, thereby implementing the test pressure on the service to be tested. The greater the number of nodes sending test requests to the service to be tested, the greater the test pressure on the service to be tested.
An embodiment of the present invention further provides an electronic device, as shown in fig. 7, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704,
a memory 703 for storing a computer program;
the processor 701 is configured to implement the following steps when executing the program stored in the memory 703:
acquiring interface information and parallelism of a service to be tested;
sending the interface information to test nodes, wherein the number of the test nodes is in direct proportion to the parallelism;
receiving response information returned by the test node, wherein the response information is generated according to the response result and the response time of the service to be tested to the test request;
and analyzing the response information to obtain a pressure test result of the service to be tested.
Or the following steps are realized:
receiving interface information of a service to be tested;
sending a test request to a service to be tested according to the interface information;
generating response information according to the response result and the response time of the service to be tested to the test request;
and sending the response information as feedback data of the interface information.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to perform the distributed pressure testing method of any of the above embodiments.
In yet another embodiment provided by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the distributed stress testing method of any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It should be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.
Claims (15)
1. A distributed stress testing system comprising a central node and at least one test node, the central node and test node randomly determined from a plurality of nodes of the distributed stress testing system, wherein:
the central node is used for acquiring interface information and parallelism of a service to be tested; sending the interface information to test nodes, wherein the number of the test nodes is in direct proportion to the parallelism;
the test node is used for sending a test request to the service to be tested according to the interface information; aiming at each test request, calculating the response time of the test request according to the sending time of the test request and the receiving time of the corresponding response result; judging whether the response time of each test request exceeds a preset threshold value, if so, judging that the test request is overtime; counting the request success number, the request failure number, the request timeout number and the total response time of the service to be tested to the test request in the current time interval according to a second preset time interval to obtain response information corresponding to the current time interval; returning response information to the central node;
the central node is further configured to analyze the response information to obtain a pressure test result of the service to be tested.
2. The system of claim 1,
the central node is also used for acquiring the test time of the service to be tested; sending the interface information and the test time to a test node;
the test node is specifically configured to send a test request to the service to be tested according to the interface information and at a first preset time interval within the test time.
3. The system according to claim 1, wherein the interface information of the service to be tested includes a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol;
the test node is specifically configured to establish a connection with the service to be tested according to the communication parameters according to the preset communication protocol; sending a test request to the service to be tested through the established connection, and receiving a response result and response time returned by the service to be tested; and disconnecting the service to be tested according to the preset communication protocol.
4. The system according to claim 1, wherein the response result is a request success or a request failure, and the response information includes a request success number, a request failure number, a request timeout number, and a total response time corresponding to the test node;
the central node is specifically configured to calculate a total number of request successes, a total number of request failures, and a total number of request timeouts of the service to be tested according to the number of request successes, the number of request failures, and the number of request timeouts of the test node; and calculating the average response time of the service to be tested according to the request success number and the total response time of each test node.
5. A distributed stress testing method applied to a central node of a distributed stress testing system, the central node being randomly determined from a plurality of nodes of the distributed stress testing system, the method comprising:
acquiring interface information and parallelism of a service to be tested;
sending the interface information to test nodes, wherein the number of the test nodes is in direct proportion to the parallelism, and the test nodes are randomly determined from a plurality of nodes of the distributed pressure test system except the central node;
receiving response information returned by the test node, wherein the response information is obtained by calculating the response time of the test request by the test node aiming at each test request according to the sending time of the test request and the receiving time of the corresponding response result, judging whether the response time of each test request exceeds a preset threshold value, if so, judging that the test request is overtime, and finally counting the request success number, the request failure number, the request overtime number and the total response time of the service to be tested to the test request in the current time interval according to a second preset time interval;
and analyzing the response information to obtain a pressure test result of the service to be tested.
6. The method of claim 5, wherein prior to said sending the interface information to a test node, the method further comprises:
acquiring the test time of a service to be tested;
the sending the interface information to a test node includes:
and sending the interface information and the test time to a test node.
7. The method of claim 5, wherein the interface information of the service to be tested includes a preset communication protocol of the service to be tested and communication parameters corresponding to the preset communication protocol.
8. The method of claim 5, wherein the response result is a request success or a request failure, the response information includes a request success number, a request failure number, a request timeout number and a total response time corresponding to the test node, and the analyzing the response information to obtain the stress test result of the service to be tested comprises:
calculating the request success total number, the request failure total number and the request overtime total number of the service to be tested according to the request success number, the request failure number and the request overtime number of the test node;
and calculating the average response time of the service to be tested according to the request success number and the total response time of each test node.
9. A distributed stress testing method applied to a test node of a distributed stress testing system, the test node being randomly determined from a plurality of nodes of the distributed stress testing system, the method comprising:
receiving interface information of a service to be tested, which is sent by a central node, wherein the central node is randomly determined from a plurality of nodes of the distributed pressure test system except the test node;
sending a test request to the service to be tested according to the interface information;
aiming at each test request, calculating the response time of the test request according to the sending time of the test request and the receiving time of the corresponding response result;
judging whether the response time of each test request exceeds a preset threshold value, if so, judging that the test request is overtime;
counting the request success number, the request failure number, the request timeout number and the total response time of the service to be tested to the test request in the current time interval according to a second preset time interval to obtain response information corresponding to the current time interval;
and sending the response information to the central node as feedback data of the interface information.
10. The method of claim 9, wherein the receiving interface information of the service to be tested sent by the central node comprises:
receiving interface information and test time of a service to be tested, which are sent by a central node;
the sending a test request to the service to be tested according to the interface information includes:
and sending a test request to the service to be tested according to the interface information and a first preset time interval in the test time.
11. The method according to claim 9, wherein the interface information of the service to be tested includes a preset communication protocol of the service to be tested and a communication parameter corresponding to the preset communication protocol;
the sending a test request to the service to be tested according to the interface information includes:
according to the preset communication protocol, establishing connection with the service to be tested according to the communication parameters;
sending a test request to the service to be tested through the established connection, and receiving a response result and response time returned by the service to be tested;
and disconnecting the connection established with the service to be tested according to the preset communication protocol.
12. A distributed stress testing apparatus for use in a central node of a distributed stress testing system, the central node being randomly determined from a plurality of nodes of the distributed stress testing system, the apparatus comprising:
the interface information acquisition module is used for acquiring the interface information and the parallelism of the service to be tested;
the interface information sending module is used for sending the interface information to test nodes, the number of the test nodes is in direct proportion to the parallelism, and the test nodes are randomly determined from a plurality of nodes of the distributed pressure test system except the central node;
a response information receiving module, configured to receive response information returned by the test node, where the response information is obtained by the test node for each test request, calculate a response time of the test request according to a sending time of the test request and a receiving time of a corresponding response result, and determine whether the response time of each test request exceeds a preset threshold, if so, the test request is overtime, and finally, according to a second preset time interval, count a request success number, a request failure number, a request timeout number, and a total response time of the service to be tested for the test request in the current time interval;
and the pressure test analysis module is used for analyzing the response information to obtain a pressure test result of the service to be tested.
13. A distributed stress testing apparatus, applied to a test node of a distributed stress testing system, the test node being randomly determined from a plurality of nodes of the distributed stress testing system, the apparatus comprising:
the interface information receiving module is used for receiving interface information of a service to be tested, which is sent by a central node, wherein the central node is randomly determined from a plurality of nodes of the distributed pressure test system except the test node;
the test request sending module is used for sending a test request to the service to be tested according to the interface information;
the response information generation module is used for calculating the response time of the test request according to the sending time of the test request and the receiving time of the corresponding response result aiming at each test request; judging whether the response time of each test request exceeds a preset threshold value, if so, judging that the test request is overtime; counting the request success number, the request failure number, the request timeout number and the total response time of the service to be tested to the test request in the current time interval according to a second preset time interval to obtain response information corresponding to the current time interval;
and the response information sending module is used for sending the response information to the central node as feedback data of the interface information.
14. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing the communication between the processor and the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 5-8 or 9-11 when executing a program stored in the memory.
15. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 5-8 or 9-11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110130827.4A CN112866062B (en) | 2021-01-29 | 2021-01-29 | Distributed pressure test system, method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110130827.4A CN112866062B (en) | 2021-01-29 | 2021-01-29 | Distributed pressure test system, method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112866062A CN112866062A (en) | 2021-05-28 |
CN112866062B true CN112866062B (en) | 2023-02-03 |
Family
ID=75987140
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110130827.4A Active CN112866062B (en) | 2021-01-29 | 2021-01-29 | Distributed pressure test system, method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112866062B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115842763A (en) * | 2021-09-17 | 2023-03-24 | 青岛海信智慧生活科技股份有限公司 | Performance detection method and equipment and communication system |
CN113900915B (en) * | 2021-09-28 | 2024-03-08 | 盐城天眼察微科技有限公司 | Method and device for determining service performance state, storage medium and electronic equipment |
CN114465927B (en) * | 2022-04-12 | 2022-08-02 | 鹏城实验室 | DNS server pressure testing method, electronic equipment and readable storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110297766A (en) * | 2019-06-03 | 2019-10-01 | 合肥移瑞通信技术有限公司 | Method for testing software and software testing system based on distributed test node cluster |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104079445A (en) * | 2013-03-29 | 2014-10-01 | 英业达科技有限公司 | Distributed type pressure testing system and method |
US10498625B1 (en) * | 2016-10-14 | 2019-12-03 | Amazon Technologies, Inc. | Distributed testing service |
CN111343048B (en) * | 2020-02-28 | 2024-04-09 | 深圳市网心科技有限公司 | Pressure testing method and device, computer device and storage medium |
CN111913884A (en) * | 2020-07-30 | 2020-11-10 | 百度在线网络技术(北京)有限公司 | Distributed test method, device, equipment, system and readable storage medium |
-
2021
- 2021-01-29 CN CN202110130827.4A patent/CN112866062B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110297766A (en) * | 2019-06-03 | 2019-10-01 | 合肥移瑞通信技术有限公司 | Method for testing software and software testing system based on distributed test node cluster |
Also Published As
Publication number | Publication date |
---|---|
CN112866062A (en) | 2021-05-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112866062B (en) | Distributed pressure test system, method, device, equipment and storage medium | |
CN109005085B (en) | Service availability monitoring system, method, device and equipment | |
CN111092877B (en) | Data processing method and device, electronic equipment and storage medium | |
CN111400777B (en) | Network storage system, user authentication method, device and equipment | |
CN111046310A (en) | Page processing method, device, server and computer readable storage medium | |
CN109921925B (en) | Dial testing method and device | |
CN108647240B (en) | Method and device for counting access amount, electronic equipment and storage medium | |
CN108366012B (en) | Social relationship establishing method and device and electronic equipment | |
CN108259266B (en) | Website performance monitoring method and system | |
CN110851290A (en) | Data synchronization method and device, electronic equipment and storage medium | |
CN108156257B (en) | Information pushing method and device | |
CN111147310A (en) | Log tracking processing method, device, server and medium | |
CN110222034A (en) | A kind of database maintenance method and device | |
CN112118151A (en) | Network speed measuring method, device, system, electronic equipment and storage medium | |
CN109446445B (en) | Resource acquisition method and device | |
CN109862074B (en) | Data acquisition method and device, readable medium and electronic equipment | |
CN112653736B (en) | Parallel source returning method and device and electronic equipment | |
CN111327588A (en) | Network access security detection method, system, terminal and readable storage medium | |
CN108255672B (en) | Data verification method and device, storage medium and electronic equipment | |
CN112468585B (en) | Data transmission method and device, electronic equipment and storage medium | |
CN114301800A (en) | Network equipment quality difference analysis method and device | |
CN108390770B (en) | Information generation method and device and server | |
CN112579682A (en) | Data model change notification method and device, electronic device and storage medium | |
CN112988589A (en) | Interface testing method, device and system | |
CN115118583B (en) | Log query method and device, electronic equipment and computer readable storage equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |