Stress testing method, device, equipment and computer readable storage medium

By using Poisson distribution and negative exponential distribution to simulate service request queues in stress tests in the financial field, the problem of inaccurate stress test results in the existing technology is solved, more accurate test results and reasonable resource deployment are achieved, and improved Financial business processing capabilities.

CN111625469BActive Publication Date: 2024-09-20WEBANK (CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010529116.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-11
Publication Date
2024-09-20
Estimated Expiration
2040-06-11

AI Technical Summary

Technical Problem

Existing stress testing methods cannot accurately simulate real service request scenarios in the financial field, resulting in test results that are far from reality, unable to achieve the effect of stress testing, and can easily cause negative interference to subsequent service deployment strategies, resulting in a waste of resources.

Method used

By generating a probability random number sequence and a time random number sequence, the service request queue obeying Poisson distribution is simulated, and the inverse function of the negative exponential distribution is used to calculate the time interval, and the service request is sent to the server under test for stress testing to obtain more accurate stress test results. .

Benefits of technology

It improves the accuracy of stress test results, makes the deployment strategy of subsequent services more reasonable, avoids the waste of hardware resources caused by excessive server deployment, and improves the concurrency and response speed of financial services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111625469B
    Figure CN111625469B
Patent Text Reader

Abstract

The present invention relates to the field of financial technology, and discloses a stress testing method, comprising the following steps: upon receiving a stress testing instruction, obtaining stress testing parameters associated with the stress testing instruction; generating a probability random number sequence according to the number of service requests in the stress testing parameters; generating a time random number sequence according to the probability random number sequence and the time period and exponential distribution mean in the stress testing parameters; and sending a service request to a server under test to perform a stress test according to the time random number sequence, and obtaining a stress testing result. The present invention also discloses a stress testing device, equipment, and computer-readable storage medium. The present invention performs a stress test on a service request queue that is sent to obey a Poisson distribution based on the queuing theory in operations research, so that the stress test is closer to reality and the accuracy of the stress test results is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of financial technology (Fintech), and in particular to a stress testing method, device, equipment and computer-readable storage medium. Background Art

[0002] In recent years, with the rapid development of Internet financial technology (Fintech), more and more technologies (big data, distributed, blockchain, artificial intelligence, etc.) are being applied in the financial field.

[0003] The data volume and business volume of financial services are growing exponentially. In this case, higher requirements are placed on the concurrency and response speed of servers processing financial services. Currently, in the financial field, in order to improve the response efficiency of financial service requests and reduce the pressure on servers, it is usually necessary to stress test the servers processing financial services. The current server stress test pre-sets a fixed number of test service requests, generating thousands, tens of thousands or even more service requests at almost the same time. This simple and brute-force method of stress testing produces stress test results that are far from the actual situation and cannot achieve the desired stress test effect. At the same time, it is very easy to have a negative impact on the deployment strategy of subsequent services, thereby causing a waste of resources. Summary of the invention

[0004] The main purpose of the present invention is to propose a stress testing method, device, equipment and computer-readable storage medium, aiming to solve the technical problem that the current stress testing results are far from the actual situation, cannot achieve the stress testing effect, and are very likely to have a negative interference with the deployment strategy of subsequent services, thereby causing a waste of resources.

[0005] To achieve the above object, the present invention provides a pressure testing method, which comprises the following steps:

[0006] Upon receiving a stress test instruction, obtaining stress test parameters associated with the stress test instruction;

[0007] Generate a probabilistic random number sequence according to the number of service requests in the stress test parameters;

[0008] Generate a time random number sequence according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameters;

[0009] According to the time random number sequence, a service request is sent to the server under test to perform a stress test and obtain a stress test result.

[0010] Optionally, the step of generating a probabilistic random number sequence according to the number of service requests in the stress test parameter includes:

[0011] Inputting the number of service requests in the stress test parameter into a random number generator with a preset uniform distribution to obtain a probabilistic random number with the same number as the number of service requests;

[0012] Arrange the probability random numbers in the order of generation to form a probability random number sequence.

[0013] Optionally, the step of generating a time random number sequence according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameter includes:

[0014] The probability random numbers in the probability random number sequence and the time period and exponential distribution mean in the stress test parameters are cyclically brought into a preset negative exponential distribution inverse function to generate time interval random numbers with the same number of service requests;

[0015] The time interval random numbers are arranged in a generation order to form a time random number sequence.

[0016] Optionally, the inverse function of the negative exponential distribution is Ti = -LN(1-Xi) / Lamda, where Ti is represented as a time interval random number, Xi is represented as a probability random number, and Lamda is represented as an exponential distribution mean. The exponential distribution mean refers to the average number of service requests that occur per unit time. The exponential distribution mean can be obtained by dividing the number of service requests by the time period, or the exponential distribution mean can also be obtained based on actual statistics.

[0017] Optionally, the step of sending a service request to the server under test to perform a stress test according to the time random number sequence and obtaining a stress test result includes:

[0018] At a time point corresponding to a time interval random number in the time random number sequence, calling a sleep function to send a service request to a load gateway, wherein the service requests at the load gateway are arranged to form a service request queue that obeys a Poisson distribution;

[0019] The service requests in the service request queue are sent to the server under test connected to the load gateway for stress testing to obtain stress test results.

[0020] Optionally, after the step of sending a service request to the server under test to perform a stress test according to the time random number sequence and obtaining a stress test result, the method includes:

[0021] Obtaining the service processing rate and service response time in the stress test result, comparing the service processing rate with a preset processing rate, and comparing the service response time with a preset response time;

[0022] If the service processing rate matches the preset processing rate, and the service response time matches the preset response time, then the stress test is determined to have passed;

[0023] If the service processing rate does not match the preset processing rate, or the service response time does not match the preset response time, it is determined that the stress test fails.

[0024] Optionally, after the step of sending a service request to the server under test to perform a stress test according to the time random number sequence and obtaining a stress test result, the method includes:

[0025] When the stress test result is that the stress test fails, obtaining the service processing rate and service response time in the stress test result;

[0026] Calculating a relative value of the service processing rate and a preset processing rate, and calculating a relative value of the service response time and a preset response time;

[0027] Output a server deployment adjustment strategy according to the relative value of the rate and the relative value of the time consumption.

[0028] In addition, to achieve the above object, the present invention also provides a pressure testing device, the pressure testing device comprising:

[0029] An instruction receiving module is used to obtain the pressure test parameters associated with the pressure test instruction when receiving the pressure test instruction;

[0030] A probability generation module, used to generate a probability random number sequence according to the number of service requests in the stress test parameters;

[0031] A time generation module, used to generate a time random number sequence according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameters;

[0032] The service request sending module is used to send a service request to the server under test to perform a stress test according to the time random number sequence and obtain a stress test result.

[0033] In addition, to achieve the above-mentioned purpose, the present invention also provides a stress testing device, which includes: a memory, a processor, and a computer program corresponding to the stress test stored in the memory and run on the processor, and when the computer program corresponding to the stress test is executed by the processor, the steps of the stress testing method described above are implemented.

[0034] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium, on which a computer program corresponding to the stress test is stored. When the computer program corresponding to the stress test is executed by a processor, the steps of the stress testing method described above are implemented.

[0035] The present invention provides a stress test method, device, equipment and computer-readable storage medium. In this embodiment of the present invention, when a stress test instruction is received, the stress test parameters associated with the stress test instruction are obtained; a probability random number sequence is generated according to the number of service requests in the stress test parameters; a time random number sequence is generated according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameters; according to the time random number sequence, a service request is sent to the tested server for stress testing to obtain a stress test result, so that the queue of service requests received in the server conforms to the Poisson distribution (Poisson distribution refers to the discrete probability distribution commonly seen in statistics and probability, that is, the frequency of service request sending conforms to the probability of random events). In the embodiment of the present invention, according to the queuing theory in operations research, a stress test is performed on the queue of service requests that obey the Poisson distribution, so that the stress test is closer to reality and the accuracy of the stress test results is improved; at the same time, the accurate stress test results make the deployment strategy of subsequent services more reasonable and avoid the waste of hardware resources caused by excessive server deployment. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;

[0037] Figure 2 This is a flow chart of a first embodiment of a pressure testing method of the present invention;

[0038] Figure 3 Schematic diagram of functional modules of a pressure testing device according to an embodiment of the present invention.

[0039] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0040] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0041] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.

[0042] In the embodiment of the present invention, the stress test device may be a PC or a server device, on which a Java virtual machine is running. Figure 1As shown, the stress testing equipment may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0043] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0044] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a computer program corresponding to the stress test.

[0045] exist Figure 1 In the device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the computer program corresponding to the stress test stored in the memory 1005, and perform the operations in the following stress testing method.

[0046] In the stress testing method of the prior art, the service request generated by the stress testing equipment is just a simple simulation to verify the correctness of the response of the server under test, which is far from the actual situation. In the current stress testing scenario, thousands, tens of thousands or even more service requests are generated almost at the same time. This method is simple and violent, and the obtained stress testing results are seriously inconsistent with the actual situation, which can easily have a negative impact on the deployment strategy of subsequent services, thereby causing a waste of resources. For example, during the current stress test, tens of thousands of service requests are sent to the server under test at the same time. To meet the set service response standards, too many servers need to be deployed. However, the actual service requests will not be sent as simply and violently as in the test scenario. Such stress testing is not very meaningful. Servers deployed according to such stress test results will cause a waste of server hardware resources.

[0047] In addition, when some testing tools send requests to the server, they simply randomly generate a specified number of service requests. This is different from the actual service request generation situation, and cannot truly simulate the actual service request sending scenario, nor can it achieve the purpose of real stress testing.

[0048] The stress test device in the embodiment of the present invention is based on Monte Carlo simulation. Monte Carlo simulation is a calculation method based on probability and statistical theory methods. It is known that a distribution simulates the generation of random variables. From operations research, mathematicians have proved that queues in the real world obey Poisson distribution, and the time interval of the queue obeys negative exponential distribution. The present invention uses the queue time interval to obey negative exponential distribution to simulate the queue of service requests. The specific steps are as follows:

[0049] Based on the above hardware structure, an embodiment of the stress testing method of the present invention is proposed.

[0050] Reference Figure 2 , Figure 2 This is a flow chart of the first embodiment of the pressure testing method of the present invention. In the first embodiment of the pressure testing method of the present invention, the pressure testing method includes:

[0051] Step S10, when receiving a stress test instruction, obtaining stress test parameters associated with the stress test instruction.

[0052] In this embodiment, the stress testing method is applied to stress testing equipment in financial institutions (banking institutions, insurance institutions, securities institutions, etc.) in the financial industry. The stress testing equipment refers to a hardware platform equipped with a computer program corresponding to the stress test. The stress testing equipment is used to perform stress testing on the server under test. A JVM (Java Virtual Machine) runs on the server under test. This process requires the server under test to have a strong stress resistance effect to meet the concurrency and access speed requirements of financial services. In this embodiment, the number of servers under test is not specifically limited, and the servers under test may include one or more.

[0053] The stress testing device is communicatively connected with the server under test and the simulated client. The stress testing device is the main control node, which controls the simulated client (also called the stress source device, or the pressure-applying device) to simulate the real client to send an operation request to the server under test, so as to apply pressure on the server under test to perform a stress test on the server under test. It can be understood that the function of the simulated client can be integrated into the stress testing device.

[0054] In this embodiment, the pressure test device receives a pressure test instruction, wherein the triggering method of the pressure test instruction is not specifically limited, that is, the pressure test instruction may be actively triggered by the user, for example, the user clicks a "pressure test" button on the pressure test device to trigger the pressure test instruction; or the pressure test instruction may be automatically triggered by the pressure test device, for example, the pressure test device is preset to automatically trigger the pressure test instruction on the 1st of each month, and the pressure test device automatically triggers the pressure test instruction when detecting that the preset pressure test conditions are met.

[0055] When receiving the stress test instruction, the stress test device obtains the stress test parameters carried by the stress test instruction, where the stress test parameters include the number of service requests, the time period, and the exponential distribution mean;

[0056] That is, the number of service requests refers to the number of service requests K that the stress test equipment needs to simulate the client sending to the server under test. The number of service requests K can be flexibly set according to the service type, such as the number of service requests can be set to ten thousand, hundreds of thousands or millions;

[0057] The time period refers to the time period of the stress test, which can also be understood as the time period P of the service request queue, which can be 10 minutes, 2 hours, etc.

[0058] The exponential distribution mean (also called Lamda) refers to the average number of service requests per unit time, the number of queues per unit time, and the exponential distribution mean per unit time must be consistent with the time period parameter P: such as 10 requests per second or 10,000 requests per hour, etc. There is no specific limitation on the setting method of the exponential distribution mean, that is, there are two ways to obtain the exponential distribution mean. Method 1, the exponential distribution mean is obtained from the existing system statistics, such as 20,000 requests per hour, or 200 requests per minute; Method 2, the exponential distribution mean is calculated according to the input parameters K and P based on the specific purpose to be simulated. For example, if 90,000 requests are to be simulated for 3 hours, then 30,000 requests per hour are required. If a stress test is performed, 600,000 requests are required for 1 hour, then Lamda is 10,000 requests per minute. That is, the specific interpretation of these parameters together is that the stress test equipment sends K service requests to the server under test through the simulated client within P time, and there are Lamda requests per unit time on average.

[0059] In addition, in this embodiment, the stress testing device also determines the server under test that needs to be stress tested, that is, after the stress testing device determines the server under test, the stress testing device obtains the test target value, which refers to the pre-set stress test standard value. For example, the test target value can be TPS (TPS preset processing efficiency, 1000 tasks per second) or ART (preset response time, preset response time is 100ms).

[0060] In this embodiment, stress test parameters are pre-configured in the stress test device. When performing stress test on the server under test, the stress test device performs stress test on the server under test according to the stress test parameters, so that the stress test is more in line with the actual service request sending scenario.

[0061] Step S20, generating a probabilistic random number sequence according to the number of service requests in the stress test parameters.

[0062] The stress test device generates a probabilistic random number sequence according to the number of service requests in the stress test parameters, specifically including:

[0063] Step a1, inputting the number of service requests in the stress test parameter into a random number generator with a preset uniform distribution to obtain a probabilistic random number that is the same as the number of service requests;

[0064] Step a2, arranging the probability random numbers in the order of generation to form a probability random number sequence.

[0065] That is, a uniformly distributed random number generator is preset in the stress testing device, and the random number generator can generate random numbers according to preset rules. The stress testing device inputs the number of service requests in the stress testing parameters into the preset uniformly distributed random number generator to obtain the same number of probabilistic random numbers as the number of service requests; the stress testing device arranges the probabilistic random numbers in the order of generation to form a probabilistic random number sequence.

[0066] For example, the stress testing device randomly generates K probability random numbers Xi of the number of service requests through a preset uniformly distributed random number generator. That is, the stress testing device generates a uniformly distributed random number generator in the interval [0, 1] through a random number generator. It just so happens that the probability value range of a random event is also [0, 1]. The stress testing device implements the computer program corresponding to the random number generator by looping K times, generating a random number Xi each time. The probability random number Xi belongs to the interval [0, 1]. The stress testing device arranges the generated probability random numbers Xi in the order of generation to form a probability random number sequence X1-Xk.

[0067] Step S30, generating a time random number sequence according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameters.

[0068] The stress test device generates a time random number sequence according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameters, specifically including:

[0069] Step b1, subjecting the probability random numbers in the probability random number sequence and the time period and exponential distribution mean in the stress test parameters to a preset negative exponential distribution inverse function to generate time interval random numbers with the same number of service requests;

[0070] Step b2, arranging the time interval random numbers in the order of generation to form a time random number sequence.

[0071] According to the queuing theory of operations research in the stress test equipment, the time interval of independent and identically distributed individuals in the queue obeys the negative exponential distribution function, as shown below:

[0072]

[0073] The stress testing equipment calculates the inverse function of the negative exponential distribution based on the negative exponential distribution function. The inverse function of the negative exponential distribution is Ti = -LN(1-Xi) / Lamda, where Ti is represented by a random number for the time interval, Xi is represented by a probability random number, and Lamda is represented by the exponential distribution mean. The exponential distribution mean refers to the average number of service requests that occur per unit time. The exponential distribution mean can be obtained by dividing the number of service requests by the time period, or the exponential distribution mean can also be obtained based on actual statistics.

[0074] The stress testing equipment loops the probability random numbers in the probability random number sequence and the time period and exponential distribution mean in the stress testing parameters into a preset negative exponential distribution inverse function to generate time interval random numbers with the same number of service requests; the stress testing equipment arranges the time interval random numbers in the order of generation to form a time random number sequence.

[0075] That is, in actual applications, the time when users send service requests to the server is random. In this embodiment, the probability random number is first determined according to the number of service requests, and then the probability random number and the time period for sending the service requests are substituted into the inverse function of the negative exponential distribution. The time nodes at which each service request is sent in the time period are simulated through the inverse function of the negative exponential distribution. The stress testing equipment sorts these time nodes to form a time random number sequence.

[0076] In this embodiment, the stress test device generates a time random number sequence, and the stress test device sends a service request according to the time random number sequence, so that the service request queue formed by sorting the service requests conforms to the actual stress test scenario, specifically:

[0077] Step S40: sending a service request to the server under test to perform a stress test according to the time random number sequence, and obtaining a stress test result.

[0078] The stress test equipment sends a service request to the server under test for stress testing according to the time random number sequence to obtain the stress test result. For example, if the number of service requests is 200 and the time period is 1 minute, 200 probability random numbers are simulated, namely x1, x2, x3, x4 to x200. The stress test equipment brings the probability random numbers x1, x2, x3, x4 to x200 in the probability random number sequence and the time period of 1 minute and the exponential distribution mean in the stress test parameters into the preset negative exponential distribution inverse function to obtain 200 time random numbers, for example, 0.1s, 0.5s, 1s, 2s, 0.7s, 0.6s, 0.7s, and so on. That is, the stress test equipment divides the 60s time period according to the time random number to determine that the initial time is 0s, and then sends the first service request at 0+0.1s. Request, 0+0.1s+0.5s to send the second service request, 0+0.1s+0.5s+1s to send the third service request, 0+0.1s+0.5s+1s+2s to send the fourth service request, 0+0.1s+0.5s+1s+2s+0.7s to send the fifth service request, 0+0.1s+0.5s+1s+2s+0.7s to send the sixth service request, 0+0.1s+0.5s+1s+2s+0.7s+0.3s to send the seventh service request, until 200 service requests are sent within 1 minute, so that the queue of service requests received in the server conforms to the Poisson distribution (Poisson distribution refers to the discrete probability distribution commonly seen in statistics and probability, that is, the frequency of service request sending conforms to the probability of random events). The queue of service requests received in the server obeys the Poisson distribution, so the stress test results obtained are more accurate.

[0079] It is understandable that current servers usually exist in a clustered manner. Therefore, this embodiment provides specific steps for testing clustered servers and scheduling service requests through a load gateway to complete stress testing, including:

[0080] Step c1, at a time point corresponding to a time interval random number in the time random number sequence, calling a sleep function to send a service request to a load gateway, wherein the service requests at the load gateway are arranged to form a service request queue that obeys a Poisson distribution;

[0081] Step c2: sending the service requests in the service request queue to the server under test connected to the load gateway to perform a stress test and obtain a stress test result.

[0082] At the time point corresponding to the random number of the time interval in the time random number sequence, the stress testing device calls the sleep function to send a service request to the load gateway in front of multiple servers under test, and the load gateway is communicated with the servers under test, wherein the service requests at the load gateway are arranged to form a service request queue that obeys the Poisson distribution; the stress testing device sends the service requests in the service request queue to the servers under test connected to the load gateway for stress testing to obtain the stress testing results.

[0083] That is, the stress test device is connected to the simulated client for communication, and the stress test device sends a unified scheduling instruction to the simulated client. After each simulated client receives the scheduling instruction sent by the stress test device, the simulated client calls the sleep function to send a service request to the server under test, and the service requests are arranged to form a service request queue that obeys the Poisson distribution; the stress test device sends the service requests in the service request queue to the load gateway, and the message queue formed by the service requests in the load gateway conforms to the actual situation. The service request is sent to one or more servers under test connected to the load gateway through the load gateway for stress testing to obtain the stress test results. In this embodiment, the service request is sent to the load gateway, and the load gateway schedules the service request to multiple servers connected to it, so that it can be determined whether the server settings are reasonable and avoid the waste of hardware resources caused by deploying too many servers.

[0084] In this embodiment of the present invention, upon receiving a stress test instruction, the stress test parameters associated with the stress test instruction are obtained; a probability random number sequence is generated according to the number of service requests in the stress test parameters; a time random number sequence is generated according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameters; and a service request is sent to the server under test for stress testing according to the time random number sequence to obtain stress test results. In the embodiment of the present invention, based on the queuing theory in operations research, a stress test is performed on a service request queue that follows a Poisson distribution, so that the stress test is closer to reality and the accuracy of the stress test results is improved; at the same time, accurate stress test results make the deployment strategy of subsequent services more reasonable and avoid the waste of hardware resources caused by excessive server deployment.

[0085] In this embodiment, the above-mentioned stress testing method is adopted in financial institutions such as banks. The financial business servers under stress testing have higher stress resistance, so that financial institutions can handle financial business more efficiently. In addition, through the above-mentioned testing process, the stress testing effect under the distributed architecture is improved, which is more in line with the needs of financial institutions such as banks.

[0086] Furthermore, based on the first embodiment of the pressure testing method of the present invention, a second embodiment of the pressure testing method of the present invention is proposed.

[0087] This embodiment is the step after step S40 in the first embodiment. The difference between this embodiment and the first embodiment is that:

[0088] Obtaining the service processing rate and service response time in the stress test result, comparing the service processing rate with a preset processing rate, and comparing the service response time with a preset response time;

[0089] If the service processing rate matches the preset processing rate, and the service response time matches the preset response time, then the stress test is determined to have passed;

[0090] If the service processing rate does not match the preset processing rate, or the service response time does not match the preset response time, it is determined that the stress test fails.

[0091] The stress testing device obtains the service processing rate and service response time in the stress test results, and compares the service processing rate with the preset processing rate (the preset processing rate refers to the server service request processing rate preset during the stress test), and compares the service response time with the preset response time (the preset response time refers to the preset average service response time); if the service processing rate is less than or equal to the preset processing rate, and the service response time is less than or equal to the preset response time, the stress testing device determines that the service processing rate matches the preset processing rate, and the service response time matches the preset response time, and the stress testing device determines that the stress test has passed; if the service processing rate is greater than the preset processing rate, or the service response time is greater than the preset response time, the stress testing device determines that the service processing rate does not match the preset processing rate, or the service response time does not match the preset response time, and the stress testing device determines that the stress test has failed.

[0092] In this embodiment, the stress testing device compares the service processing rate and service response time in the stress testing result with the preset processing rate and preset response time, so that the stress testing result analysis is more accurate.

[0093] Furthermore, based on the above-mentioned embodiments of the pressure testing method of the present invention, a third embodiment of the pressure testing method of the present invention is proposed.

[0094] This embodiment is the step after step S40 in the first embodiment. The difference between this embodiment and the above embodiment is that:

[0095] When the stress test result is that the stress test fails, obtaining the service processing rate and service response time in the stress test result;

[0096] Calculating a relative value of the service processing rate and a preset processing rate, and calculating a relative value of the service response time and a preset response time;

[0097] Output a server deployment adjustment strategy according to the relative value of the rate and the relative value of the time consumption.

[0098] In this embodiment, when the stress test result of the stress testing device is that the stress test fails, the stress testing device obtains the service processing rate and the service response time in the stress test result; the stress testing device calculates the relative value of the service processing rate and the preset processing rate, and calculates the relative value of the service response time and the preset response time; the stress testing device outputs a server deployment adjustment policy based on the relative rate value and the relative time value. For example, if the stress testing device determines that the relative rate value is 1.5, then the server deployment adjustment policy is output to increase the number of servers deployed by 1.5 times the original number. In this embodiment, the server deployment adjustment policy can be flexibly set according to other scenarios. When the service processing rate is much lower than the preset processing efficiency and the service response time is much lower than the preset response time, the server deployment amount can be reduced.

[0099] In this embodiment, the stress testing device generates a server deployment adjustment strategy based on the stress testing device, so that the server deployment can meet the requirements.

[0100] Reference Figure 3 The present invention also provides an embodiment of a pressure testing device, the pressure testing device comprising:

[0101] The instruction receiving module 10 is used to obtain the pressure test parameters associated with the pressure test instruction when receiving the pressure test instruction;

[0102] A probability generation module 20, for generating a probability random number sequence according to the number of service requests in the stress test parameter;

[0103] A time generation module 30, for generating a time random number sequence according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameter;

[0104] The service request sending module 40 is used to send a service request to the server under test to perform a stress test according to the time random number sequence, and obtain a stress test result.

[0105] In one embodiment, the probability generation module 20 is further used to:

[0106] A data input unit, used to input the number of service requests in the stress test parameter into a random number generator with a preset uniform distribution, to obtain a probabilistic random number with the same number as the number of service requests;

[0107] The data sorting unit is used to arrange the probabilistic random numbers in the order of generation to form a probabilistic random number sequence.

[0108] In one embodiment, the time generation module 30 includes:

[0109] A data input unit, used to cyclically input the probability random numbers in the probability random number sequence and the time period and exponential distribution mean in the stress test parameters into a preset negative exponential distribution inverse function to generate time interval random numbers with the same number of service requests;

[0110] The data sorting unit is used to arrange the time interval random numbers in a generation order to form a time random number sequence.

[0111] In one embodiment, the inverse function of the negative exponential distribution is Ti=-LN(1-Xi) / Lamda, where Ti is represented by a time interval random number, Xi is represented by a probability random number, and Lamda is represented by an exponential distribution mean. The exponential distribution mean refers to the average number of service requests that occur per unit time. The exponential distribution mean can be obtained by dividing the number of service requests by the time period, or the exponential distribution mean can also be obtained based on actual statistics.

[0112] In one embodiment, the service request sending module 40 includes:

[0113] A first sending unit is used to call a sleep function to send a service request to a load gateway at a time point corresponding to a time interval random number in the time random number sequence, wherein the service requests at the load gateway are arranged to form a service request queue that obeys a Poisson distribution;

[0114] The second sending unit is used to send the service requests in the service request queue to the server under test connected to the load gateway to perform stress testing and obtain stress testing results.

[0115] In one embodiment, the pressure testing device comprises:

[0116] An acquisition and comparison unit is used to acquire a service processing rate and a service response time in the stress test result, compare the service processing rate with a preset processing rate, and compare the service response time with a preset response time;

[0117] A first determination unit, configured to determine that the stress test passes if the service processing rate matches a preset processing rate and the service response time matches a preset response time;

[0118] The second determination unit is configured to determine that the stress test fails if the service processing rate does not match the preset processing rate, or the service response time does not match the preset response time.

[0119] In one embodiment, the pressure testing device comprises:

[0120] An acquiring unit, configured to acquire a service processing rate and a service response time in the stress test result when the stress test result indicates that the stress test fails;

[0121] A calculation unit, used to calculate a relative value of the service processing rate and a preset processing rate, and calculate a relative value of the service response time and a preset response time;

[0122] The strategy output unit is used to output the server deployment adjustment strategy according to the relative value of the rate and the relative value of the time consumption.

[0123] In the embodiment of the present invention, based on the queuing theory in operations research, a stress test is performed on a service request queue that follows a Poisson distribution, so that the stress test is closer to reality and the accuracy of the stress test result is improved; at the same time, accurate stress test results make the deployment strategy of subsequent services more reasonable and avoid the waste of hardware resources caused by excessive server deployment.

[0124] Among them, the methods implemented when each functional module in the pressure testing device is executed can refer to the various embodiments of the pressure testing method of the present invention, and will not be repeated here.

[0125] The present invention also provides a computer-readable storage medium.

[0126] A computer program corresponding to the stress test is stored on the computer-readable storage medium of the present invention, and the computer program corresponding to the stress test implements the steps of the stress test method described above when executed by a processor.

[0127] Among them, the method implemented when the computer program corresponding to the stress test running on the processor is executed can refer to the various embodiments of the stress testing method of the present invention, and will not be repeated here.

[0128] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0129] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0130] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0131] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A stress testing method, characterized in that: The pressure testing method comprises the following steps: Upon receiving a stress test instruction, obtaining stress test parameters associated with the stress test instruction; Generate a probabilistic random number sequence according to the number of service requests in the stress test parameters; Generate a time random number sequence according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameters; According to the time random number sequence, a service request is sent to the server under test to perform a stress test and obtain a stress test result; The step of generating a time random number sequence according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameter comprises: The probability random numbers in the probability random number sequence and the time period and exponential distribution mean in the stress test parameters are cyclically brought into a preset negative exponential distribution inverse function to generate time interval random numbers with the same number of service requests; The time interval random numbers are arranged in a generation order to form a time random number sequence.

2. The pressure testing method according to claim 1, characterized in that: The step of generating a probabilistic random number sequence according to the number of service requests in the stress test parameter comprises: Inputting the number of service requests in the stress test parameter into a random number generator with a preset uniform distribution to obtain a probabilistic random number with the same number as the number of service requests; Arrange the probability random numbers in the order of generation to form a probability random number sequence.

3. The pressure testing method according to claim 1, characterized in that: The inverse function of the negative exponential distribution is Ti = -LN(1-Xi) / Lamda, where Ti is represented by a random number for the time interval, Xi is represented by a random number for probability, and Lamda is represented by the mean of the exponential distribution. The mean of the exponential distribution refers to the average number of service requests that occur per unit time. The mean of the exponential distribution is obtained by dividing the number of service requests by the time period, or the mean of the exponential distribution is obtained based on actual statistics.

4. The pressure testing method according to claim 1, characterized in that: The step of sending a service request to the server under test to perform a stress test according to the time random number sequence and obtaining a stress test result comprises: At a time point corresponding to a time interval random number in the time random number sequence, calling a sleep function to send a service request to a load gateway, wherein the service requests at the load gateway are arranged to form a service request queue that obeys a Poisson distribution; The service requests in the service request queue are sent to the server under test connected to the load gateway for stress testing to obtain stress test results.

5. The pressure testing method according to claim 1, characterized in that: After the step of sending a service request to the server under test to perform a stress test according to the time random number sequence and obtaining a stress test result, the method includes: Obtaining the service processing rate and service response time in the stress test result, comparing the service processing rate with a preset processing rate, and comparing the service response time with a preset response time; If the service processing rate matches the preset processing rate, and the service response time matches the preset response time, then the stress test is determined to have passed; If the service processing rate does not match the preset processing rate, or the service response time does not match the preset response time, it is determined that the stress test fails.

6. The pressure testing method according to any one of claims 1 to 5, characterized in that: After the step of sending a service request to the server under test to perform a stress test according to the time random number sequence and obtaining a stress test result, the method includes: When the stress test result is that the stress test fails, obtaining the service processing rate and service response time in the stress test result; Calculating a relative value of the service processing rate and a preset processing rate, and calculating a relative value of the service response time and a preset response time; Output a server deployment adjustment strategy according to the relative value of the rate and the relative value of the time consumption.

7. A pressure testing device, characterized in that: The pressure testing device comprises: An instruction receiving module is used to obtain the pressure test parameters associated with the pressure test instruction when receiving the pressure test instruction; A probability generation module, used to generate a probability random number sequence according to the number of service requests in the stress test parameters; A time generation module, used to generate a time random number sequence according to the probability random number sequence and the time period and exponential distribution mean in the stress test parameters; A service request sending module is used to send a service request to the server under test to perform a stress test and obtain a stress test result according to the time random number sequence; The time generation module comprises: A data input unit, used to cyclically input the probability random numbers in the probability random number sequence and the time period and exponential distribution mean in the stress test parameters into a preset negative exponential distribution inverse function to generate time interval random numbers with the same number of service requests; The data sorting unit is used to arrange the time interval random numbers in a generation order to form a time random number sequence.

8. A pressure testing device, characterized in that: The stress testing device includes: a memory, a processor, and a computer program corresponding to the stress test stored in the memory and executable on the processor. When the computer program corresponding to the stress test is executed by the processor, the steps of the stress testing method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program corresponding to the stress test, and when the computer program corresponding to the stress test is executed by the processor, the steps of the stress test method according to any one of claims 1 to 6 are implemented.