Pre- and Post-task Processing Methods Applied to Stress Testing

By mounting the agent program in the pressure test environment and automatically judging and cleaning data using front and post-post task scripts, the problem that the stress test environment does not meet the conditions is solved, and the accuracy and efficiency of the pressure test data is improved.

CN114153737BActive Publication Date: 2025-07-25HANGZHOU BENMA NETWORK TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111490353.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-08
Publication Date
2025-07-25
Estimated Expiration
2041-12-08

AI Technical Summary

Technical Problem

It is impossible to accurately determine whether the environment meets the conditions before the stress test, resulting in inaccurate test results. At the same time, the residual data after the stress test is over affecting the next test, and the cost of artificial collaborative cleaning is high, which reduces the pressure measurement efficiency.

Method used

Mount the agent program on the server to be tested or the press, and automatically determine whether the environment meets the pressure measurement requirements through the pre-task script, and automatically clean up the data through the post-task script after the pressure measurement is completed to ensure that the environment returns to the initial state.

Benefits of technology

It improves the accuracy and efficiency of pressure measurement, reduces collaboration costs, and ensures the accuracy of pressure measurement data and standardization of process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114153737B_ABST
    Figure CN114153737B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for processing pre - and post - test tasks applied to stress testing, including mounting an agent program on the server under test or the stress testing machine process; the stress testing platform sends a pre - test task script to the server under test or the stress testing machine through the gateway service to the agent program, and the agent program executes the pre - test task script; the result of the agent program executing the pre - test task script is returned to the stress testing platform, and the stress testing platform judges whether the execution result of the server under test or the stress testing machine passes according to the pre - configured settings; after the stress testing program is completed, the stress testing platform sends a post - test task script to the server under test or the stress testing machine through the gateway service to the agent program, and the agent program executes the post - test task. The present invention can judge whether the stress testing environment meets the expectations before stress testing or configure the business before stress testing, automatically clean up the garbage files and data generated during stress testing after stress testing, ensure that the accuracy of stress testing data is not affected by environmental problems, and improve the stress testing quality while improving the efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software system testing, and particularly relates to a method for processing pre - and post - tasks applied to stress testing. Background Art

[0002] In software testing: Stress Test, also known as intensity test or load test. Stress test is to simulate the software and hardware environment of actual applications and the system load during the user's usage process, and run the test software for a long time or under an extremely large load to test the performance, reliability, stability, etc. of the system under test. Link stress test is a process of simulating a large number of user requests and data to perform stress testing on the entire business chain based on the actual production business scenario and system environment, and continuously optimizing. Currently, business scenarios are becoming increasingly complex. In the entire business chain, the correlation between different application services is getting closer and closer, which can be described as "pulling one hair and moving the whole body". However, before stress testing, if the CPU usage rate exceeds 5% and the memory usage rate exceeds 70%, the conditions for stress testing are not met. But during general stress testing, it is impossible to distinguish whether the stress testing conditions are met. At this time, if stress testing is performed, it will cause problems with inaccurate test results. At the same time, if too much log data remains after stress testing, it will affect the next stress testing. When performing full - link stress testing on a complex business system, it will involve cooperation between multiple departments. If manual judgment or data cleaning is relied on, there will be high cooperation costs, thereby reducing the stress testing efficiency. Summary of the Invention

[0003] The purpose of the present invention is to provide a method for processing pre - and post - tasks applied to stress testing. The present invention can automatically determine whether the stress testing environment meets the expectations before stress testing or configure the business before stress testing, and automatically clean up the garbage files and data generated during stress testing after stress testing, ensuring that the accuracy of stress testing data is not affected by environmental problems, improving the stress testing quality while enhancing the efficiency.

[0004] To solve the above - mentioned technical problems, the technical solution provided by the present invention is as follows: A method for processing pre - and post - tasks applied to stress testing, specifically including the following steps:

[0005] S1. Mount an agent program on the server under test or the stress machine process. The agent program is used to execute the script issued by the stress testing platform;

[0006] S2. Before executing the stress testing task, the stress testing platform issues a pre - task script to the server under test or the stress machine through the gateway service to the agent program, and the agent program executes the pre - task script;

[0007] S3. Return the result of the execution pre - task script of the agent program to the stress testing platform, and the stress testing platform determines whether the execution result of the server under test or the stress testing machine passes according to the pre - configured settings;

[0008] S4. If it is determined that the execution result does not pass, immediately stop the stress testing task; if it is determined that the execution result passes, then proceed to the next stress testing procedure;

[0009] S5. After the stress testing procedure is completed, the stress testing platform sends the post - task script to the agent program of the server under test or the stress testing machine through the gateway service. The agent program executes the post - task, and after the post - task ends, the stress testing task is completed.

[0010] The above - mentioned pre - and post - task processing method applied to stress testing, wherein the pre - task script is used to determine whether the server status, hardware configuration, application configuration, middleware configuration, and data status meet the stress testing requirements. If they do not meet the stress testing requirements, the stress testing is terminated.

[0011] The aforementioned pre - and post - task processing method applied to stress testing, wherein the pre - task script further includes an execution business configuration for reducing log output and an execution server configuration for reducing the system's connection close waiting time and the maximum number of connections.

[0012] The aforementioned pre - and post - task processing method applied to stress testing, wherein the script distribution process of the pre - task is that the stress testing platform asynchronously calls the agent program of the stress testing machine or the server under test through the gateway service to send the script. The calling method between the stress testing platform and the gateway service is rpc, and the calling method between the gateway service and the agent program is http. The specific steps are as follows:

[0013] Script execution: The script content is a shell script, and the execution program directly synchronously executes the shell script by creating a new subprocess and must complete the execution within 60 seconds, otherwise the execution is forcibly interrupted;

[0014] Execution result reporting process: The agent program first transmits the execution result to the gateway service, and then the gateway service transmits it to the stress testing platform through the message middleware;

[0015] Execution result determination: If the execution result contains the expected string, it is determined to pass; if the regular expression result of the execution result is non - empty, it is determined to pass; if the stress testing platform does not receive the result within 60 seconds, it is automatically determined that the call has timed out.

[0016] The aforementioned pre - and post - task processing method applied to stress testing, wherein the post - task script restores the stress testing environment to the initial state for the next stress testing, including the following processes:

[0017] Process data cleaning: Delete the log files, database data, and cache data generated during the stress testing process;

[0018] Business configuration restoration: Reset the business configuration to the initial state by calling the service under test through the interface;

[0019] Data collection: Continuously record and collect the data returned by the server during the stress test through files, which will be used as the input data for the next stress test. At the end of the stress test, the data file needs to be transferred to the file server.

[0020] Compared with the prior art, the present invention mounts an agent program on the server under test and the stress testing program. Before the stress testing platform sends a stress test request to the server under test or the stress testing program, a pre - script is sent to the agent program, and after the stress test ends, a post - script is sent to the agent program. By adopting the above steps, factors that may affect the accuracy of stress test data can be uniformly collected before the stress test and automatically excluded through pre - tasks. Adding this link to the stress test process is conducive to standardizing the stress test process and improving the stress test quality; in addition, for a large, complex, and microservices - transformed system, the collaboration cost of organizing a stress test is extremely high. During the stress test, it is necessary to continuously coordinate relevant personnel to clean up data or restore configurations, which will further increase the communication and collaboration cost, reduce efficiency, and is also prone to omissions or execution errors. However, the present invention uses a post - task script to automatically and low - cost solve the above problems. Therefore, when the present invention conducts a stress test, it can automatically determine whether the stress test environment meets the conditions for executing the stress test and automatically execute the configuration after the stress test is completed for data cleaning after the stress test. While improving the stress test efficiency and reducing costs, it can also ensure the accuracy of the data. Description of the Drawings

[0021] Figure 1 is a flowchart of the present invention. Detailed Embodiments

[0022] The present invention will be further described below in conjunction with embodiments and drawings, but it is not used as a basis for limiting the present invention.

[0023] Embodiment: A pre - and post - task processing method applied to stress testing, as Figure 1 shown, and is carried out according to the following steps:

[0024] S1. Mount an agent program on the server under test or the stress testing process (Agent is a computing entity that can continuously and autonomously play a role in a distributed system or a collaborative system, simply referred to as an "intelligent agent"). The agent program is used to execute the script issued by the stress testing platform;

[0025] S2. Before executing the stress testing task, the stress testing platform sends a pre-task script to the server under test or the stressor through the gateway service to the agent program, and the agent program executes the pre-task script; the pre-task script is used to judge whether the server status (such as CPU usage rate, available memory, remaining disk space, etc.), hardware configuration (such as CPU core count, total memory size, hard disk specification, network card specification, etc.), application configuration (such as application memory configuration, thread pool size configuration, etc.), middleware configuration (such as cache size, whether the cache uses persistence, etc.) and data status (such as database data volume, index configuration and data distribution, etc.) meet the conditions. Failing to meet the conditions will cause the test results to be distorted; execute business configuration (such as reducing the log output of certain services to reduce the impact of large-traffic stress testing on real services), and execute server configuration (such as reducing the system's connection close waiting time, maximum connection count, etc.).

[0026] The script distribution process of the pre-task is that the stress testing platform asynchronously calls the agent program of the stressor or the server under test through the gateway service to distribute the script. The call method between the stress testing platform and the gateway service is rpc, and the call method between the gateway service and the agent program is http. The specific steps are as follows:

[0027] Script execution: The script content is a shell script, and the execution program directly synchronously executes the shell script by creating a new child process and must complete the execution within 60 seconds, otherwise the execution will be forcibly interrupted;

[0028] Execution result reporting process: The agent program first transmits the execution result to the gateway service, and then the gateway service transmits it to the stress testing platform through the message middleware;

[0029] Execution result determination: If the execution result contains the expected string, it is determined to pass; if the regular expression result of the execution result is non-empty, it is determined to pass; if the stress testing platform does not receive the result within 60 seconds, it is automatically determined that the call has timed out.

[0030] S3. Return the result of the agent program's execution of the pre-task script to the stress testing platform, and the stress testing platform judges whether the execution result of the server under test or the stressor passes according to the pre-configuration;

[0031] S4. If it is judged that the execution result fails, immediately stop the stress testing task; if it is judged that the execution result passes, then proceed to the next stress testing procedure;

[0032] S5. After the stress testing procedure is completed, the stress testing platform sends a post-task script to the server under test or the stressor through the gateway service to the agent program, and the agent program executes the post-task, and the post-task ends to complete the stress testing task.

[0033] The post - test task script is to restore the stress - testing environment to its initial state for the next stress test, including the following processes:

[0034] Process data cleaning: Delete the log files, database data, and cache data generated during the stress test;

[0035] Business configuration restoration: Reset the business configuration to its initial state by calling the service under test through an interface;

[0036] Data collection: Continuously record and collect the data returned by the server through files during the stress test as the input data for the next stress test. At the end of the stress test, the data files need to be transferred to the file server.

[0037] In this embodiment, the stress - testing platform automatically determines the result after receiving it. The judgment method for a single result is whether it contains the expected string and whether the result of executing the regular expression on the execution result is non - empty. When multiple agent programs execute the same task program simultaneously, only when the result judgments returned by each agent program are all successful can the result of this execution be determined to be successful.

[0038] In summary, the present invention can automatically determine whether the stress - testing environment meets the expectations before the stress test or configure the business before the stress test, and automatically clean up the garbage files and data generated during the stress test after the stress test, ensuring that the accuracy of the stress - test data is not affected by environmental problems, improving the stress - test quality while enhancing the efficiency.

Claims

1. A method for processing pre- and post-task in stress testing, characterized in that: Specifically, it includes the following steps: S1. Mount the agent program on the server under test or the stress testing machine process. The agent program is used to execute the scripts issued by the stress testing platform; S2. Before executing the stress testing task, the stress testing platform sends the pre-task script to the server under test or the stress testing machine through the gateway service to the agent program, and the agent program executes the pre-task script; S3. Return the result of the agent program executing the pre-task script to the stress testing platform, and the stress testing platform judges whether the execution result of the server under test or the stress testing machine passes according to the pre-configuration; S4. If it is judged that the execution result fails, immediately stop the stress testing task; if it is judged that the execution result passes, then proceed to the next stress testing procedure; S5. After the stress testing procedure is completed, the stress testing platform sends the post-task script to the server under test or the stress testing machine through the gateway service to the agent program, and the agent program executes the post-task. After the post-task ends, the stress testing task is completed; The pre-task script is used to judge whether the server status, hardware configuration, application configuration, middleware configuration, and data status meet the stress testing requirements. If the stress testing requirements are not met, the stress testing task is terminated; The pre-task script also includes the execution service configuration for reducing log output and the execution server configuration for reducing the connection closing waiting time and the maximum number of connections of the system; The script issuing process of the pre-task is that the stress testing platform asynchronously calls the agent program of the stress testing machine or the server under test through the gateway service to issue the script. The calling method between the stress testing platform and the gateway service is rpc, and the calling method between the gateway service and the agent program is http. Specifically, it includes the following steps: Script execution: The script content is a shell script, and the execution program directly synchronously executes the shell script by creating a new subprocess and must complete the execution within 60 seconds, otherwise the execution is forced to interrupt; Execution result reporting process: The agent program first transmits the execution result to the gateway service, and then the gateway service transmits it to the stress testing platform through the message middleware; Execution result determination: If the execution result contains the expected string, it is judged to pass; if the regular expression result of the execution result is non-empty, it is judged to pass; if the stress testing platform does not receive the result within 60 seconds, it is automatically judged that the call times out.

2. The pre- and post-task processing method applied to stress testing according to claim 1, wherein: The post-task script is to restore the stress testing environment to the initial state for the next stress testing, including the following processes: Process data cleaning: Delete the log files, database data, and cache data generated during the stress testing process; Business configuration restoration: Reset the business configuration to the initial state by calling the server under test through the interface; Data collection: Continuously record and collect the data returned by the server during the stress testing process through files as the input data for the next stress testing, and the data file needs to be transferred to the file server at the end of the stress testing.

Citation Information

Patent Citations

  • Service resource control system and service resource control method

    CN102904942A

  • Distributed cloud pressure measurement machine resource management system and method

    CN107707638A

  • Cloud management platform online pressure measurement method and cloud management platform online pressure measurement system

    CN107948012A