System pressure measurement method and device, equipment and storage medium
Unit testing is carried out through the system's own test function, and concurrent calls of business functions are realized, which solves the problems of low security and high cost of system pressure measurement, and realizes efficient and accurate performance testing, which is suitable for newly launched systems and cannot pass external transmission. The pressure equipment realizes pressure measurement scenario.
Patent Information
- Application Number
- CN202310677450.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-08
- Publication Date
- 2024-12-10
AI Technical Summary
The existing system pressure measurement method requires exposing the interface of the target system to external pressure generation equipment, resulting in low safety and inability to effectively conduct self-pressure testing, especially in newly launched systems or the pressure measurement cannot be achieved through external pressure generation equipment. In scenarios, the cost is higher.
Unit testing is carried out through the system's own test function, concurrent calls of business functions are realized, stress test results are generated, interface exposure is avoided, unit testing methods of software engineering are reused, and the minimum design unit of business functions can be independently tested, reducing the Pressure measurement cost.
It improves the system's pressure measurement safety, can more accurately detect performance bottlenecks, and reduces pressure measurement costs, which are especially suitable for newly launched systems and scenarios where pressure measurement cannot be achieved through external pressure generation equipment.
Smart Images

Figure CN119105944A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a system stress testing method, device, equipment, and storage medium. Background Art
[0002] System stress testing refers to a process of simulating the software and hardware environment of the system in actual application, as well as the load of the system during user use, running the system for a long time or with extremely large load to test the performance, reliability, stability, etc. of the system. Stress testing can also be called stress testing, performance stress testing, etc.
[0003] In the related art, for the target system to be stress tested, an external stress generating device (such as a system outside the target system) is often used to provide high concurrency capability and send simulated requests to the target system to implement stress testing of the target system. However, this process requires exposing the interface of the target system (such as network I / O) to the external stress generating device, resulting in low security of the stress test of the target system. Summary of the invention
[0004] The embodiment of the present application provides a system stress testing method, device, equipment and storage medium, which can realize the self-stress testing of the system, thereby improving the stress testing security of the system. The technical solution is as follows:
[0005] According to one aspect of an embodiment of the present application, a system stress testing method is provided, the method comprising:
[0006] Acquire a stress signal, where the stress signal is used to instruct the system to initiate a stress test on at least one business function corresponding to the system;
[0007] For each of the at least one business function, concurrently calling the business function through a test function corresponding to the business function, wherein the test function is used to perform unit testing on the business function;
[0008] During the concurrent calling of the at least one business function, performance data of the system is obtained to generate a stress testing result.
[0009] According to one aspect of an embodiment of the present application, a stress testing device for a system is provided, the device comprising:
[0010] A stress signal acquisition module, used to acquire a stress signal, wherein the stress signal is used to instruct the system to initiate a stress test on at least one business function corresponding to the system;
[0011] A business function calling module, used for concurrently calling each business function of the at least one business function through a test function corresponding to the business function, wherein the test function is used for unit testing the business function;
[0012] The stress test result acquisition module is used to obtain the performance data of the system during the concurrent call of the at least one business function to generate a stress test result.
[0013] According to one aspect of an embodiment of the present application, a computer device is provided, the computer device comprising a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the stress testing method of the above system.
[0014] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the stress testing method of the above system.
[0015] According to one aspect of an embodiment of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the stress testing method of the above system.
[0016] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0017] By utilizing the system's own test functions to implement concurrent calls to business functions in the form of unit tests, the system's self-stress testing can be achieved without the need for external stress testing equipment, thus avoiding exposure of the system's interfaces and improving the system's stress testing security.
[0018] In addition, due to the technical solution provided in the embodiment of the present application, the unit testing method corresponding to the system's software engineering can be reused to implement system self-stress testing without additional development, and the smallest design unit of the business function can be tested separately, thereby more accurately discovering the system's performance bottlenecks, which is simple and efficient.
[0019] In addition, since there is no need to process online traffic data through external stress-generating equipment to replay and stress the system, and for scenarios where stress testing cannot be achieved through external stress-generating equipment, especially for newly launched systems, the technical solution provided in the embodiment of the present application also does not need to construct online traffic data, thereby reducing the stress testing cost of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;
[0022] Figure 2 It is a schematic diagram of a solution architecture of a system self-stress testing provided by an embodiment of the present application;
[0023] Figure 3 This is a flow chart of a system stress testing method provided by an embodiment of the present application;
[0024] Figure 4 This is a flowchart of a concurrent calling method for a business function provided by an embodiment of the present application;
[0025] Figure 5 It is an interactive schematic diagram of a system stress testing method provided by an embodiment of the present application;
[0026] Figure 6-11 A schematic diagram showing, by way of example, the performance data during the system self-stress test;
[0027] Fig.12 is a block diagram of a stress testing device of a system provided by an embodiment of the present application;
[0028] Fig.13 is a block diagram of a stress testing device of a system provided by another embodiment of the present application;
[0029] Fig.14 It is a block diagram of a computer device provided by one embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0031] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application. The implementation environment may include: a signal sending platform 10 and a system 20.
[0032] The signal transmission platform 10 can be an electronic device such as a mobile phone, a tablet computer, a multimedia player, a PC (Personal Computer), an intelligent robot, a vehicle terminal, a wearable device, or other electronic devices with strong computing capabilities, or a server, which is not limited in the present embodiment of the application. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0033] The signal sending platform 10 is used to initiate or terminate the self-stress test of the system 20. Exemplarily, the signal sending platform 10 configures the control parameters required for the stress test of the system 20 to generate a stress signal, and instructs the system 20 to perform the stress test through the stress signal. The control parameters may include the business functions of the system 20 to be stress tested, the concurrency of the stress test, the duration of the stress test, the start parameters of the stress test, the stop parameters of the stress test, etc., which are not limited in the embodiments of the present application. The signal sending platform 10 instructs the system 20 to stop the stress test through the stress test stop signal.
[0034] System 20 is a system to be stress tested, which may refer to a computer system, a software system, a web service system, a shopping system, a chat system, a game system, and any system with certain business functions, which is not limited in the present embodiment of the application. Optionally, system 20 takes into account both software subsystems and hardware subsystems to achieve corresponding business functions.
[0035] The signal sending platform 10 and the system 20 can communicate with each other via a network, which can be a wired network or a wireless network.
[0036] Exemplarily, after generating a stress signal, the signal sending platform 10 sends the stress signal to the system 20. After receiving the stress signal, the system 20 performs stress testing according to the control parameters in the stress signal. For example, after the system 20 determines the business function to be stress tested, the concurrency of the stress test, the duration of the stress test, and the start parameters of the stress test according to the stress signal, it uses the test function corresponding to the business function to be stress tested to perform unit testing on the business function: continuously construct test example data and continuously replay business functions (i.e., self-stress testing). In this process, the system 20 uses its own monitoring system to self-monitor performance data to obtain stress testing results. The system 20 can send the stress testing results to the signal sending platform 10 in real time.
[0037] In an example, the solution architecture of system self-stress testing may include: a configuration platform 201 , a self-stress tool 202 , a target system 203 , and a monitoring system 204 .
[0038] The configuration platform 201 can be implemented as the above-mentioned signal sending platform 10, which can be used to generate a stress signal and a stress test stop signal. Optionally, when the stress test requirement changes, the configuration platform 201 can dynamically adjust the stress signal to instruct the target system 203 to dynamically self-stress test.
[0039] Stress testing refers to a process of simulating the hardware and software environment of a system in actual application, as well as the load of the system during user use, running the system for a long time or with an extremely large load to test the system's performance, reliability, stability, etc. Self-stress testing refers to the process of the system implementing stress testing by itself.
[0040] Optionally, the embodiment of the present application does not limit the source of the pressure signal, and the control parameters in the pressure signal can also be set and adjusted according to actual usage requirements.
[0041] The self-pressing tool 202 is used to realize the communication between the configuration platform 201 and the target system 203 , that is, the target system 203 can obtain the pressure signal from the configuration platform 201 through the self-pressing tool 202 .
[0042] Exemplarily, the self-stressing tool 202 can be implemented by the channel of the Go language itself, that is, the self-stressing tool 202 is a channel block specifically used to monitor the stress signal, which can be constructed by the target system 203. At the same time, the target system 203 also starts a special coroutine block to monitor the data in the channel. For example, when the stress signal is detected to be written into the channel block through the coroutine block, the target system 203 starts the coroutine block to read the stress signal from the channel block.
[0043] Among them, Go language is a statically strongly typed, compiled, concurrent programming language with garbage collection function. The above channel is a special type in Go language. Channel is like a conveyor belt or queue, always following the First In First Out (FIFO) rule to ensure the order of sending and receiving data.
[0044] Optionally, the above coroutine blocking can be implemented by a Goroutine, which is a function that can run simultaneously with other functions. A Goroutine can be considered a lightweight thread managed by the Go runtime.
[0045] The target system 203 refers to the system that needs to be stress tested, which can be implemented as the above-mentioned system 20. The target system 203 provides the business functions to be stress tested, and implements the unit tests corresponding to the business functions. Among them, unit testing refers to the process of checking and verifying the smallest testable unit in the software. The smallest testable unit can refer to a functional function, a business module, etc. The embodiment of the present application does not limit the smallest testable unit.
[0046] Among them, the unit test is implemented by the target system 203 itself, such as the target system 203 performs correctness verification testing on the program module (the smallest unit of software design) corresponding to the business function. The business function is the business capability implemented by the system, and the business function to be stress-tested is also the business function that needs to be stress-tested in the embodiment of the present application. The business function to be stress-tested can be one or more, and the embodiment of the present application does not limit this. For example, taking a web service system as an example, the business function to be stress-tested can be purchase, on-demand, mall, and reference function modules at the same time.
[0047] Optionally, the embodiment of the present application does not limit the pressure transmission method of the target system 203. It can use the above-mentioned configuration platform 201 (corresponding to the pressure transmission signal) to achieve pressure transmission, or it can customize the pressure transmission method that meets its own needs according to its own conditions, which is flexible and changeable.
[0048] The monitoring system 204 is a monitoring system corresponding to the target system 203, which can be used to monitor the performance data of the target system 204 to generate a stress test result, which refers to the corresponding performance, reliability, stability and other results when the system is self-stress tested. Optionally, the monitoring system 204 can send the stress test result to the configuration platform 201 in real time. Alternatively, in response to the end of the self-stress test of the target system 203, the monitoring system 204 sends the stress test result to the configuration platform 201.
[0049] Below, the technical solution provided by this application will be introduced and explained through method embodiments.
[0050] Please refer to Figure 3 , which shows a flow chart of a system stress testing method provided by an embodiment of the present application. The execution subject of each step of the method may be Figure 1 In the system 20 in the implementation environment of the solution shown, the method may include the following steps (301-303).
[0051] Step 301: Obtain a stress signal, where the stress signal is used to instruct the system to initiate a stress test on at least one business function corresponding to the system.
[0052] The pressure signal, system, business function and pressure test in the embodiment of the present application are the same as those described in the above embodiment. The contents not described in the embodiment of the present application can be referred to the above embodiment and will not be repeated here.
[0053] Optionally, the stress signal may include business function parameters, duration parameters, data parameters and stress test start parameters; wherein the business function parameters are used to indicate the business function that the system is going to test. For example, the business function parameters may refer to the identification information of the business function, and different business functions correspond to different identification information. The system can determine the business function to be tested based on the business function parameters, and can determine the number of business functions to be tested simultaneously based on the number of business function parameters. The embodiments of the present application support the separate testing of a certain business function, and also support the simultaneous testing of multiple business functions.
[0054] The above duration parameter is used to indicate the duration of the stress test corresponding to the business function. The stress test duration refers to the duration of the stress test on the business function, such as 60s, 65s, 70s, etc. That is, the system can determine the duration of the system's self-stress test based on the duration parameter.
[0055] The above data parameters are used to indicate the stress test concurrency corresponding to the business function. Stress test concurrency refers to the concurrency of stress testing the business function, such as 1100, 1000, 900, etc., that is, the system can determine the concurrency of the stress test of the business function according to the data parameters. Simply put, concurrency refers to the number of calls to the same business function at the same time. The embodiment of the present application does not limit the order of calling the business functions.
[0056] The above stress test enable parameters are used to instruct the system to enable stress testing for business functions. That is, in response to detecting the stress test enable parameters, the system starts stress testing for the business functions to be stress tested according to the stress test duration and stress test concurrency.
[0057] Optionally, the pressure signal may be generated by the signal sending platform. Testers may set the control signal in the pressure signal through the signal sending platform according to actual test requirements to generate the required pressure signal.
[0058] In one example, the system creates a channel to communicate with the signal sending platform. Optionally, the system uses the channel in the Go language to implement the channel, and the channel follows the first-in-first-out rule. In this way, the signal sending platform can instruct the system to start or stop stress testing at any time through the channel, thereby improving the control flexibility of stress testing.
[0059] Exemplarily, the process of acquiring the pressure signal may be as follows: the system monitors the channel through coroutine blocking; when the pressure signal is detected, the pressure signal is acquired from the channel through coroutine blocking.
[0060] For example, the system monitors the channel in real time through the Go coroutine, waits for the writing of the pressure signal, responds to the signal sending platform writing the pressure signal to the channel, and the system obtains the pressure signal from the channel through the Go coroutine.
[0061] Step 302: For each business function in at least one business function, the business function is concurrently called through a test function corresponding to the business function, where the test function is used to perform unit testing on the business function.
[0062] A test function can be a function that performs judgment (such as assertion), which can replay (i.e., pull up and run once) the minimum testable unit to determine the correctness of the minimum testable unit. Optionally, during the construction of the business function, the test function can be deployed in the code corresponding to the business function.
[0063] For example, a test function can be expressed as follows:
[0064] isEquals(x, add(y, z));
[0065] The test function can replay the minimum testable unit add() and compare the execution result of add(y, z) with x. If they are equal, the minimum testable unit is correct, otherwise the minimum testable unit is incorrect.
[0066] In this way, the business function is taken as the smallest testable unit, and the playback of the business function can be realized through the test function corresponding to the business function, and then the concurrent playback of the business function can be realized by calling the test function corresponding to the business function by multiple threads concurrently. A business function can correspond to multiple test functions, but the embodiment of the present application is not interested in the type of test function, but only in the concurrency of the business function. Therefore, the embodiment of the present application does not limit the selection of the test function, which can be set and adjusted according to actual usage requirements.
[0067] In some embodiments, each functional function corresponding to a business function is taken as the smallest testable unit, and the various functional functions can be replayed simultaneously to simulate the playback of the business function.
[0068] In one example, if Figure 4 As shown, step 302 may also include the following sub-steps:
[0069] Step 302a: Determine the duration of the stress test and the amount of stress test concurrency according to the stress test signal.
[0070] Optionally, the system determines the duration of the stress test of the business function according to the duration parameter in the stress signal, and determines the concurrency of the stress test of the business function according to the data parameter in the stress signal.
[0071] For example, a certain pressure signal may be represented as follows:
[0072]
[0073]
[0074] Based on the stress signal, the system can determine the business function to be stress tested, the duration of the stress test, and the number of concurrent stress tests. In addition, based on the stress test start parameters in the stress signal, the system determines that a stress test needs to be initiated.
[0075] For example, you can enable the system's self-stress test through the following code:
[0076]
[0077] Among them, true is used to indicate that stress testing is enabled.
[0078] Step 302b: During the duration of the stress test, multiple coroutines are started concurrently based on the stress test concurrency.
[0079] Each coroutine is used to execute the test function corresponding to the business function. If multiple coroutines execute the test function corresponding to the same business function at the same time, the business function can be called concurrently.
[0080] Optionally, during the duration of the stress test, the system controls the number of concurrent coroutines to be close to the stress test concurrency. That is, if the number of concurrent coroutines is greater than the stress test concurrency, the number of concurrent coroutines is reduced; if the number of concurrent coroutines is less than the stress test concurrency, the number of concurrent coroutines is increased. If the system performance allows, the number of concurrent coroutines equal to the stress test concurrency can be directly started concurrently.
[0081] Optionally, in the initial stage of stress testing, the number of concurrent coroutines can be steadily increased to avoid causing the system to be overloaded and crash the system, thereby ensuring the stability of the system. Exemplarily, in the initial stage of stress testing, the number of coroutines is controlled to increase in a step-by-step manner to the stress testing concurrency, and the number of steps corresponding to the step-by-step manner can be set and adjusted according to actual usage requirements. For example, in the initial stage of stress testing, the number of concurrent coroutines is increased from 0, 300, 600, 900 in sequence to a stress testing concurrency of 1000.
[0082] Step 302c, executing the test function corresponding to the business function through multiple coroutines to concurrently call the business function.
[0083] Since the execution process of each coroutine is the same, the following will take one of the multiple coroutines as an example to illustrate, and the process may include the following content.
[0084] 1. For each of the multiple coroutines, during the duration of the stress test, the test function is executed through the coroutine to continuously construct test sample data, which includes input values, expected values, and identification information of business functions.
[0085] The test sample data is used to verify the correctness of the code corresponding to the business function. It refers to the data obtained after clarifying the input value, expected value and identification information of the business function in the test function. Optionally, the input value corresponds to the expected value, and the expected value can refer to the correct output that should be obtained when the code corresponding to the business function executes the input value. The identification information of the business function corresponds to the business function and is used to call the code corresponding to the business function.
[0086] Optionally, for the same business function, different input values and expected values can be used to construct different test sample data.
[0087] 2. Execute the test function through the coroutine to execute the code corresponding to the business function step by step according to the test sample data; wherein the code corresponding to the business function takes the input value as input.
[0088] Optionally, the input value is used as input, and the code corresponding to the business function is executed step by step to obtain the corresponding execution result. The embodiment of the present application is not interested in whether the execution result is correct, as long as the code corresponding to the business function can be fully replayed.
[0089] Step 303: During the concurrent calling process of at least one business function, obtain system performance data to generate a stress test result.
[0090] The performance data in the embodiment of the present application is used to indicate the performance, stability, reliability, etc. of the system. The stress test result may be composed of the performance data of the system.
[0091] In an example, the process of obtaining stress testing results can be as follows:
[0092] 1. During the concurrent call of at least one business function, the system's various indicators are monitored in real time through the system's monitoring system to obtain the system's performance data.
[0093] The indicators include at least one of the following: CPU (Central Processing Unit) usage, memory usage, write bandwidth, read bandwidth, disk usage, network inflow, handle count, and restart count.
[0094] Through the monitoring system, you can obtain the data of each indicator at each moment during the duration of the stress test. By combining these data or calculating them according to specified rules, you can get the performance data of the system.
[0095] 2. Obtain stress test results based on the system performance data.
[0096] Optionally, the performance, stability, reliability, etc. of the system can be determined based on the performance data and the indicator thresholds corresponding to each indicator, thereby generating a stress test result of the system.
[0097] Optionally, the stress test results may be updated in real time during the concurrent call of at least one business function, or may be uniformly calculated after the concurrent call of at least one business function is completed, which is not limited in the embodiments of the present application.
[0098] In one example, when the system receives a stop stress testing signal, the system stops concurrently calling business functions; wherein the stop stress testing signal is generated when the load of the system is greater than or equal to a load threshold.
[0099] The stop stress test signal is used to instruct the system to stop stress testing at least one business function, and can be generated by the above-mentioned signal sending platform. For example, when the signal sending platform detects that the system load is greater than or equal to the load threshold, it sets the value of the above-mentioned "enable_pressure" to false, thereby instructing the system to stop self-stress testing. Among them, the load threshold can be set and adjusted according to actual usage requirements.
[0100] Optionally, the signal sending platform also sends a stop stress testing signal to the system through the above channel. After the system obtains the stop stress testing signal from the channel, it can stop self-stress testing.
[0101] In one example, after the corresponding stress test duration of the system has passed, the concurrent calls to the business functions are stopped. That is, the system has completed the self-stress test and can stop the self-stress test automatically. For example, the system monitors the execution time of the self-stress test in real time. If the execution time is equal to or equal to the stress test duration, the system stops the self-stress test.
[0102] Optionally, the tester can adjust the control parameters in the stress signal through the signal sending platform, and continuously control the system self-stress test to gradually find the system's load limitations and performance bottlenecks.
[0103] To sum up, the technical solution provided in the embodiment of the present application realizes concurrent calling of business functions in the form of unit testing by utilizing the system's own test functions, thereby realizing self-stress testing of the system without the need for external stress equipment, avoiding exposure of the system's interfaces, and thereby improving the system's stress testing security.
[0104] In addition, due to the technical solution provided in the embodiment of the present application, the unit testing method corresponding to the system's software engineering can be reused to implement system self-stress testing without additional development, and the smallest design unit of the business function can be tested separately, thereby more accurately discovering the system's performance bottlenecks, which is simple and efficient.
[0105] In addition, since there is no need to process online traffic data through external stress-generating equipment to replay and stress the system, and for scenarios where stress testing cannot be achieved through external stress-generating equipment, especially for newly launched systems, the technical solution provided in the embodiment of the present application also does not need to construct online traffic data, thereby reducing the stress testing cost of the system.
[0106] In some embodiments, reference Figure 5 , the interaction process between the signal sending platform and the system to be self-stress tested can be as follows:
[0107] System 502 creates a channel based on the channel in the Go language, and the channel can be used to configure the communication between platform 501 and system 502. System 502 creates a Go coroutine to monitor the channel.
[0108] The configuration platform 501 generates a stress signal, which may include a business function parameter, a duration parameter, a data parameter, and a stress test start parameter. The configuration platform 501 writes the stress signal into the channel.
[0109] When the system 502 detects a stress signal in the channel, it obtains the stress signal from the channel through the Go coroutine, and determines the business function to be stress-tested, the duration of the stress test, and the concurrency of the stress test according to the stress signal. At the same time, when the system 502 detects that the stress test enable parameter (such as the enable_pressure mentioned above) in the stress signal is true, it starts the self-stress test.
[0110] For example, for each business function, system 502 concurrently starts multiple coroutines whose number is the concurrent amount of the stress test. Each coroutine is used to execute the test function corresponding to the business function, so as to continuously construct test sample data during the duration of the stress test, and continuously execute the code corresponding to the business function step by step according to the test sample data, thereby realizing concurrent calling of the business function.
[0111] During the self-stress test of system 502 , the monitoring system of system 502 continuously monitors the performance data of system 502 and sends the performance data to configuration platform 501 .
[0112] The configuration platform 501 generates a stress test result of the system 502 according to the performance data.
[0113] When the configuration platform 501 detects that the load of the system 502 meets the load threshold, it generates a stop stress test signal and sends the stop stress test signal to the channel.
[0114] When the system 502 detects a stop stress test signal in the channel, it stops the self-stress test.
[0115] Optionally, the configuration platform 501 may perform multiple stress tests on the system 502 by continuously adjusting the stress signal, so as to gradually find the load upper limit and performance bottleneck of the system 502 .
[0116] In some embodiments, reference Figure 6-11 , which exemplarily shows performance data of system 502.
[0117] Among them, curve 601 is the change curve of CPU utilization rate during the self-stress test of system 502, curve 701 is the change curve of memory utilization rate during the self-stress test of system 502, curve 801 is the change curve of write bandwidth during the self-stress test of system 502, curve 901 is the change curve of read bandwidth during the self-stress test of system 502, curve 1001 is the change curve of disk utilization rate during the self-stress test of system 502, and curve 1101 is the change curve of network inflow rate during the self-stress test of system 502.
[0118] Exemplarily, the technical solution provided in the embodiments of the present application can be used to implement self-stress testing of target systems such as computer systems, software systems, web service systems, shopping systems, chat systems, and game systems, thereby avoiding exposure of the target system's interfaces and ensuring the stress testing security of the target system. At the same time, there is no need to develop additional scripts for self-stress testing of the target system, which is beneficial to reducing the stress testing cost of the target system.
[0119] For example, taking a game system as an example, the above-mentioned game system may refer to systems corresponding to tactical competitive games, third-person shooting games (TPS), first-person shooting games (FPS), multiplayer online tactical competitive (MOBA) games, multiplayer gunfight survival games, etc., and the embodiments of the present application are not limited to this.
[0120] By using the technical solution provided in the embodiment of the present application and continuously performing self-stress testing on the game system, the load limit and performance bottleneck of the game system can be discovered, so that the performance of the game system can be optimized, such as improving the load limit and reducing the CPU usage. Optionally, during the development of the game system, the data parameter in the stress signal can be set to 1 to implement unit testing of business functions. During the stress testing of the game system, the data parameter in the stress signal can be set to the target value according to actual usage requirements to implement self-stress testing of the game system.
[0121] By implementing self-stress testing of the game system, the safety of the game system stress testing can be improved, and the cost of the game system stress testing can be reduced. In particular, during the development or stress testing of a new game system, the interface of the new game system can be prevented from being exposed too early, which can lead to unscrupulous applications. At the same time, the new game system does not need to be tested online to collect online data, thus avoiding the premature exposure of the new game system.
[0122] To sum up, the technical solution provided in the embodiments of the present application can be used in the scenario where the system is stress tested to implement self-stress testing of the system without the intervention of a third-party external stress-generating device, thereby improving the security of the stress test.
[0123] In addition, the stress test time and duration can be customized to meet the different needs of users in terms of stress test time. In addition, the stress test concurrency can be customized to steadily increase the system load, so as not to overwhelm the system due to excessive pressure, thus ensuring the stability of the system.
[0124] In addition, for newly launched systems or scenarios where stress testing cannot be achieved through external stress testing equipment, the technical solution provided in the embodiments of the present application does not require the collection of online data for playback stress testing, does not require the exposure of stress testing identifiers to the outside, does not require the writing of a large number of stress testing scripts, and does not require the construction of stress testing data. The code is zero-intrusive and only requires the use of unit testing to automatically construct test example data to achieve self-stress testing of the system, thereby reducing the system's stress testing costs and improving the system's convenience in stress testing.
[0125] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0126] refer to Fig.12 , which shows a block diagram of a stress test device of a system provided by an embodiment of the present application. The device has the function of implementing the above method example, and the function can be implemented by hardware, or by hardware executing corresponding software. The device can be the computer device introduced above, or it can be set in a computer device. Fig.12As shown, the device 1200 includes: a stress signal acquisition module 1201, a business function calling module 1202 and a stress test result acquisition module 1203.
[0127] The stress signal acquisition module 1201 is used to acquire a stress signal, where the stress signal is used to instruct the system to initiate a stress test on at least one business function corresponding to the system.
[0128] The business function calling module 1202 is used to concurrently call each business function in the at least one business function through a test function corresponding to the business function, and the test function is used to perform unit testing on the business function.
[0129] The stress test result acquisition module 1203 is used to acquire the performance data of the system during the concurrent call of the at least one business function to generate a stress test result.
[0130] In some embodiments, Fig.13 As shown, the business function calling module 1202 includes: a parameter determination submodule 1202a, a coroutine starting submodule 1202b and a function calling submodule 1202c.
[0131] The parameter determination submodule 1202a is used to determine the duration of the stress test and the amount of stress test concurrency according to the stress signal.
[0132] The coroutine starting submodule 1202b is used to concurrently start multiple coroutines within the duration of the stress test and based on the stress test concurrency as an indicator.
[0133] The function calling submodule 1202c is used to execute the test function corresponding to the business function through the multiple coroutines to concurrently call the business function.
[0134] In some embodiments, the number of coroutines increases in steps to the stress test concurrency.
[0135] In some embodiments, the function calling submodule 1202c is used to:
[0136] For each of the coroutines in the plurality of coroutines, within the duration of the stress test, executing the test function through the coroutine to continuously construct test sample data, where the test sample data includes an input value, an expected value, and identification information of the business function;
[0137] The test function is executed through the coroutine to execute the code corresponding to the business function in a single step according to the test example data; wherein the code corresponding to the business function takes the input value as input.
[0138] In some embodiments, the pressure signal is sent from a signal sending platform to a channel, and the channel follows a first-in-first-out rule;
[0139] The pressure signal acquisition module 1201 is used to monitor the channel through coroutine blocking; when the pressure signal is monitored, the pressure signal is acquired from the channel through the coroutine blocking.
[0140] In some embodiments, the stress signal includes a business function parameter, a duration parameter, a data parameter and a stress test start parameter; wherein the business function parameter is used to indicate the business function to be tested by the system; the duration parameter is used to indicate the duration of the stress test corresponding to the business function; the data parameter is used to indicate the stress test concurrency corresponding to the business function; and the stress test start parameter is used to instruct the system to start stress testing on the business function.
[0141] In some embodiments, the stress test result acquisition module 1203 is used to monitor various indicators of the system in real time through the monitoring system of the system during the concurrent call of the at least one business function to obtain performance data of the system; and obtain the stress test result according to the performance data of the system;
[0142] The various indicators include at least one of the following: CPU usage, memory usage, write bandwidth, read bandwidth, disk usage, network inflow, handle count, and restart count.
[0143] In some embodiments, Fig.13 As shown, the device 1200 further includes: a business system pressure stopping module 1204.
[0144] The business system stress test stop module 1204 is used to stop concurrently calling the business function when receiving a stress test stop signal; wherein the stress test stop signal is generated when the load of the system is greater than or equal to a load threshold.
[0145] Alternatively, the business system stress stopping module 1204 is further configured to stop concurrently calling the business function after the stress test duration corresponding to the system has elapsed.
[0146] To sum up, the technical solution provided in the embodiment of the present application realizes concurrent calling of business functions in the form of unit testing by utilizing the system's own test functions, thereby realizing self-stress testing of the system without the need for external stress equipment, avoiding exposure of the system's interfaces, and thereby improving the system's stress testing security.
[0147] In addition, due to the technical solution provided in the embodiment of the present application, the unit testing method corresponding to the system's software engineering can be reused to implement system self-stress testing without additional development, and the smallest design unit of the business function can be tested separately, thereby more accurately discovering the system's performance bottlenecks, which is simple and efficient.
[0148] In addition, since there is no need to process online traffic data through external stress-generating equipment to replay and stress the system, and for scenarios where stress testing cannot be achieved through external stress-generating equipment, especially for newly launched systems, the technical solution provided in the embodiment of the present application also does not need to construct online traffic data, thereby reducing the stress testing cost of the system.
[0149] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0150] Please refer to Fig.14 , which shows a block diagram of a computer device provided in one embodiment of the present application. The computer device can be implemented as the above system 20 to implement the system stress testing method provided in the above embodiment, which can specifically include the following contents.
[0151] The computer device 1400 includes a central processing unit (such as a CPU (Central Processing Unit), a GPU (Graphics Processing Unit) and an FPGA (Field Programmable Gate Array)) 1401, a system memory 1404 including a RAM (Random-Access Memory) 1402 and a ROM (Read-Only Memory) 1403, and a system bus 1405 connecting the system memory 1404 and the central processing unit 1401. The computer device 1400 also includes a basic input / output system (Input Output System, I / O system) 1406 for helping various devices in the server to transmit information, and a large-capacity storage device 1407 for storing an operating system 1413, application programs 1414 and other program modules 1415.
[0152] The basic input / output system 1406 includes a display 1408 for displaying information and an input device 1409 such as a mouse and a keyboard for user inputting information. The display 1408 and the input device 1409 are connected to the central processing unit 1401 through an input / output controller 1410 connected to the system bus 1405. The basic input / output system 1406 may also include an input / output controller 1410 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1410 also provides output to a display screen, a printer, or other types of output devices.
[0153] The mass storage device 1407 is connected to the central processing unit 1401 via a mass storage controller (not shown) connected to the system bus 1405. The mass storage device 1407 and its associated computer readable medium provide non-volatile storage for the computer device 1400. That is, the mass storage device 1407 may include a computer readable medium (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.
[0154] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory or other solid-state storage technology, CD-ROM, DVD (Digital Video Disc) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 1404 and mass storage device 1407 can be collectively referred to as memory.
[0155] According to the embodiment of the present application, the computer device 1400 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 1400 can be connected to the network 1412 through the network interface unit 1411 connected to the system bus 1405, or the network interface unit 1411 can be used to connect to other types of networks or remote computer systems (not shown).
[0156] The memory also includes a computer program, which is stored in the memory and configured to be executed by one or more processors to implement the stress testing method of the above system.
[0157] In some embodiments, a computer-readable storage medium is further provided, wherein a computer program is stored in the storage medium, and when the computer program is executed by a processor, the stress testing method of the above system is implemented.
[0158] Optionally, the computer readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives) or optical disks, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0159] In some embodiments, a computer program product is further provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the stress testing method of the above system.
[0160] It should be noted that, before collecting the relevant data of the user and during the process of collecting the relevant data of the user, the embodiment of the present application can display a prompt interface, a pop-up window or output a voice prompt information, and the prompt interface, pop-up window or voice prompt information is used to prompt the user that the relevant data is currently being collected, so that the present application only starts to execute the relevant steps of obtaining the relevant data of the user after obtaining the confirmation operation issued by the user on the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user on the prompt interface or pop-up window is not obtained), the relevant steps of obtaining the relevant data of the user are terminated, that is, the relevant data of the user is not obtained. In other words, all user data collected by this application are processed strictly in accordance with the requirements of the laws and regulations of the relevant countries, and the informed consent or separate consent of the subject of personal information is obtained with the consent and authorization of the user. The subsequent data use and processing behavior is carried out within the scope of authorization of the laws and regulations and the subject of personal information, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the systems, stress test results, performance data, etc. involved in this application are all obtained with full authorization.
[0161] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.
[0162] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A system stress testing method, characterized in that: The method comprises: Acquire a stress signal, where the stress signal is used to instruct the system to initiate a stress test on at least one business function corresponding to the system; For each of the at least one business function, concurrently calling the business function through a test function corresponding to the business function, wherein the test function is used to perform unit testing on the business function; During the concurrent calling of the at least one business function, performance data of the system is obtained to generate a stress testing result.
2. The method according to claim 1, characterized in that The concurrently calling the business function through the test function corresponding to the business function includes: Determine the duration of the stress test and the amount of stress test concurrency according to the stress test signal; During the duration of the stress test, multiple coroutines are started concurrently based on the stress test concurrency as an indicator; The test functions corresponding to the business functions are executed through the multiple coroutines to concurrently call the business functions.
3. The method according to claim 2, characterized in that The number of coroutines increases in steps to the stress test concurrency.
4. The method according to claim 2, characterized in that: The executing the test function corresponding to the business function through the multiple coroutines to concurrently call the business function includes: For each of the coroutines in the plurality of coroutines, within the duration of the stress test, executing the test function through the coroutine to continuously construct test sample data, where the test sample data includes an input value, an expected value, and identification information of the business function; Executing the test function through the coroutine to execute the code corresponding to the business function step by step according to the test example data; The code corresponding to the business function is input with the input value.
5. The method according to claim 1, characterized in that The pressure signal is sent from the signal sending platform to the channel, and the channel follows the first-in-first-out rule; The obtaining of the pressure signal comprises: The channel is monitored by blocking the coroutine; When the pressure signal is detected, the pressure signal is obtained from the channel through the coroutine blocking.
6. The method according to claim 1, characterized in that The stress signal includes business function parameters, duration parameters, data parameters and stress test start parameters; Among them, the business function parameter is used to indicate the business function that the system is to test; the duration parameter is used to indicate the duration of the stress test corresponding to the business function; the data parameter is used to indicate the stress test concurrency corresponding to the business function; and the stress test start parameter is used to instruct the system to start stress testing for the business function.
7. The method according to claim 1, characterized in that The obtaining of the performance data of the system during the concurrent calling of the at least one business function to generate a stress test result includes: During the concurrent calling of the at least one business function, various indicators of the system are monitored in real time by the monitoring system of the system to obtain performance data of the system; Obtaining the stress test result according to the performance data of the system; The various indicators include at least one of the following: CPU usage, memory usage, write bandwidth, read bandwidth, disk usage, network inflow, handle count, and restart count.
8. The method according to claim 1, characterized in that The method further comprises: When a stop stress test signal is received, stop concurrently calling the business function; wherein the stop stress test signal is generated when the load of the system is greater than or equal to the load threshold; or, After the stress test duration corresponding to the system has elapsed, the concurrent calls to the business functions are stopped.
9. A system stress measurement device, characterized in that: The device comprises: A stress signal acquisition module, used to acquire a stress signal, wherein the stress signal is used to instruct the system to initiate a stress test on at least one business function corresponding to the system; A business function calling module, used for concurrently calling each business function of the at least one business function through a test function corresponding to the business function, wherein the test function is used for unit testing the business function; The stress test result acquisition module is used to obtain the performance data of the system during the concurrent call of the at least one business function to generate a stress test result.
10. A computer device, characterized in that: The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the system stress testing method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the system stress testing method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product includes a computer program, which is stored in a computer-readable storage medium. The processor reads and executes the computer program from the computer-readable storage medium to implement the system stress testing method according to any one of claims 1 to 8.
