Pressure measurement method and device, electronic equipment and storage medium

By automatically determining the target physical machine and plug-in, creating a pressure measurement thread to perform pressure measurement tasks, solving the problem of low efficiency of existing pressure measurement methods, and achieving efficient pressure measurement environment preparation and multi-node pressure measurement support.

CN119201661APending Publication Date: 2024-12-27SF TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310756661.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-25
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing pressure measurement methods are inefficient, and require manual preparation of pressure measurement environment and installation of pressure measurement plug-ins, and do not support multiple nodes at the same time, resulting in high time and labor costs.

Method used

By obtaining the configuration information in the pressure measurement template and the attribute information of the candidate physical machine, the target physical machine and the target pressure measurement plug-in are automatically determined, and the pressure measurement thread is created to perform pressure measurement tasks, reducing human operations and improving efficiency.

Benefits of technology

It realizes automated pressure measurement environment preparation and plug-in loading, reduces time and labor costs, improves pressure measurement efficiency, and supports multi-node distributed pressure measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201661A_ABST
    Figure CN119201661A_ABST
Patent Text Reader

Abstract

The invention provides a pressure measurement method and device, electronic equipment and a storage medium, and the method comprises the steps: firstly obtaining pressure measurement environment configuration information and pressure measurement plug-in configuration information in a pressure measurement template, and obtaining first attribute information of N candidate physical machines and second attribute information of a pressure measurement plug-in installed in each candidate physical machine; determining n target physical machines from the N candidate physical machines according to the pressure measurement environment configuration information, the pressure measurement plug-in configuration information, the first attribute information and the second attribute information, determining a target pressure measurement plug-in in each target physical machine, and creating n pressure measurement threads in the n target physical machines, and loading a corresponding target pressure measurement plug-in through each pressure measurement thread, finally obtaining a pressure measurement task for the target pressure measurement object, executing the pressure measurement task through the target pressure measurement plug-ins loaded by the n pressure measurement threads, and obtaining a pressure measurement result. According to the invention, manual pressure measurement environment preparation, pressure measurement plug-in installation and other operations are not needed, and the pressure measurement efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of testing technology, and in particular to a stress testing method, device, electronic device and storage medium. Background Art

[0002] With the continuous development of Internet technology, the performance requirements for application services are getting higher and higher. If you want to know the performance of a certain application service, you can simulate online requests for the service for a period of time, and then collect statistics and measure the stress test results after execution.

[0003] The existing technology requires manual preparation of the stress testing environment for different stress testing tasks, including the physical machine environment (such as the number of CPU cores, the number of memories, the Win kernel parameters, the Linux kernel parameters, etc.) and the stress testing plug-in (such as jmeter, vegeta, etc.). After the stress testing is completed, the results of the stress testing plug-in are read, and finally the stress testing environment is restored to facilitate other stress testing personnel to perform other stress testing tasks. However, on the one hand, this method takes time in terms of environment preparation, stress testing plug-in installation, and stress testing environment restoration. On the other hand, not all stress testing plug-ins can support the situation where stress testing is required on multiple nodes at the same time. It also takes time to select a suitable stress testing plug-in, which makes the current stress testing method less efficient.

[0004] Therefore, the current stress testing method has the technical problem of low efficiency and needs to be improved. Summary of the invention

[0005] The embodiments of the present application provide a stress testing method, device, electronic device and storage medium to alleviate the technical problem of low efficiency in current stress testing methods.

[0006] To solve the above technical problems, the present application provides the following technical solutions:

[0007] The present application provides a stress testing method, including:

[0008] Get the stress testing environment configuration information and stress testing plug-in configuration information in the stress testing template;

[0009] Obtain first attribute information of N candidate physical machines and second attribute information of a stress testing plug-in installed in each of the candidate physical machines, where N is a positive integer;

[0010] According to the stress testing environment configuration information, the stress testing plug-in configuration information, the first attribute information, and the second attribute information, n target physical machines are determined from the N candidate physical machines, and a target stress testing plug-in in each of the target physical machines is determined, n stress testing threads are created in the n target physical machines respectively, and corresponding target stress testing plug-ins are loaded through each stress testing thread respectively, where n is a positive integer;

[0011] Get the stress testing task for the target stress testing object;

[0012] The target stress testing plug-in loaded by the n stress testing threads executes the stress testing task and obtains the stress testing result.

[0013] At the same time, the embodiment of the present application also provides a stress testing device, including:

[0014] The first acquisition module is used to obtain the stress testing environment configuration information and the stress testing plug-in configuration information in the stress testing template;

[0015] A second acquisition module is used to acquire first attribute information of N candidate physical machines and second attribute information of the stress testing plug-in installed in each of the candidate physical machines, where N is a positive integer;

[0016] A creation module, configured to determine n target physical machines from the N candidate physical machines according to the stress testing environment configuration information, the stress testing plug-in configuration information, the first attribute information, and the second attribute information, and determine a target stress testing plug-in in each of the target physical machines, respectively create n stress testing threads in the n target physical machines, and respectively load a corresponding target stress testing plug-in through each of the stress testing threads, where n is a positive integer;

[0017] The third acquisition module is used to obtain the stress testing task for the target stress testing object;

[0018] An execution module is used to execute the stress testing task through the target stress testing plug-in loaded by the n stress testing threads and obtain the stress testing result.

[0019] The present application also provides an electronic device, comprising a memory and a processor; the memory stores an application, and the processor is used to run the application in the memory to execute the steps in any of the above-mentioned stress testing methods.

[0020] An embodiment of the present application provides a computer-readable storage medium, which stores a plurality of instructions, and the instructions are suitable for loading by a processor to execute the steps in the above-mentioned stress testing method.

[0021] Beneficial effect: The present application provides a stress testing method, device, electronic device and storage medium. The method first obtains stress testing environment configuration information and stress testing plug-in configuration information in a stress testing template, and obtains first attribute information of N candidate physical machines and second attribute information of the stress testing plug-in installed in each of the candidate physical machines, where N is a positive integer. Then, based on the stress testing environment configuration information, the stress testing plug-in configuration information, the first attribute information and the second attribute information, n target physical machines are determined from the N candidate physical machines, and a target stress testing plug-in in each of the target physical machines is determined. N stress testing threads are created in the n target physical machines respectively, and the corresponding target stress testing plug-in is loaded through each of the stress testing threads respectively, where n is a positive integer. Finally, a stress testing task for the target stress testing object is obtained, the stress testing task is executed through the target stress testing plug-in loaded by the n stress testing threads, and a stress testing result is obtained. This application first provides multiple candidate physical machines and installs a stress testing plug-in in each candidate physical machine in advance. Subsequently, only the relevant information of the stress testing environment and the stress testing plug-in needs to be configured in the stress testing template, and the first attribute information of each candidate physical machine and the second attribute information of each stress testing software can be automatically obtained, and these attribute information are matched with the configuration information in the stress testing template to determine the target physical machines and corresponding target stress testing plug-ins that meet the stress testing requirements, and then automatically create stress testing threads in these target physical machines to load these target stress testing plug-ins, and finally perform stress testing tasks through these stress testing threads. Since the above process does not require manual preparation of the stress testing environment, installation of the stress testing plug-in, etc., it can greatly reduce time and labor costs, and improve the efficiency of stress testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The technical solution and other beneficial effects of the present application will be made apparent by describing in detail the specific implementation methods of the present application in conjunction with the accompanying drawings.

[0023] Figure 1 It is a scenario diagram of the stress testing method provided in an embodiment of the present application.

[0024] Figure 2 A flowchart of a stress testing method provided in an embodiment of the present application.

[0025] Figure 3 A schematic diagram of the overall architecture of the stress testing method provided in an embodiment of the present application.

[0026] Figure 4 A schematic diagram of the structure of the pressure measurement device provided in an embodiment of the present application.

[0027] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0029] The embodiments of the present application provide a stress testing method, device, electronic device, and computer-readable storage medium, wherein the stress testing device can be integrated in an electronic device, and the electronic device can be a server, a terminal, or other device.

[0030] See also Figure 1 , Figure 1 A schematic diagram of a scenario for applying the stress testing method provided in an embodiment of the present application, the scenario may include a control device, N physical machines, and a target stress testing object, etc. The target stress testing object refers to middleware, storage or application services running on the server, etc. The control device controls all or part of the physical machines to complete the stress testing of the target stress testing object. The control device, N physical machines, and the target stress testing object are connected to a network to achieve interaction between the three, wherein:

[0031] Physical machines 1 to N are all candidate physical machines, and a stress testing plug-in is installed in each candidate physical machine. The properties of different candidate physical machines (such as the number of CPU cores, the number of memories, kernel parameters, etc.) are not completely the same, and the properties of the stress testing plug-ins installed in different candidate physical machines (such as plug-in types, etc.) are not completely the same. Before executing a stress testing task, the stress testing personnel can first configure the required stress testing environment and stress testing plug-in in the stress testing template, and input the stress testing template to the control device. The control device can obtain the stress testing environment configuration information and stress testing plug-in configuration information from the stress testing template, and then obtain the first attribute information of each candidate physical machine and the second attribute information of the stress testing plug-in installed in each candidate physical machine, and then determine the n target physical machines required for the current stress testing task from the N candidate physical machines based on the stress testing environment configuration information, the stress testing plug-in configuration information, the first attribute information, and the second attribute information, and determine the target stress testing plug-in required for the current stress testing task in each target physical machine. The control device creates n stress testing threads in n target physical machines, and loads the target stress testing plug-in in each target physical machine through each stress testing thread. Then, the stress tester inputs the stress testing task for the target stress testing object to the control device, and the control device distributes the stress testing task to n stress testing threads. Each stress testing thread simulates and sends a test request to the target stress testing object through the stress testing plug-in based on the received stress testing task. After the target stress testing object processes the request, it will return a test response. These stress testing responses are received by each target stress testing plug-in, and each target stress testing plug-in processes these stress testing responses to obtain stress testing data and returns them to the control device. The control device summarizes and organizes these stress testing data to obtain stress testing results, and finally outputs them to the stress testing personnel, so that the stress testing personnel can evaluate the performance, reliability, stability, etc. of the target stress testing object based on the stress testing results. At this point, the entire stress testing process ends.

[0032] It should be noted that Figure 1 The system scenario diagram shown is only an example. The server and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. It is known to those skilled in the art that with the evolution of the system and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems. The following are detailed descriptions. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0033] See also Figure 2 , Figure 2 This is a flow chart of the stress testing method provided in the embodiment of the present application. Figure 3 , Figure 3 is a schematic diagram of the overall architecture of the stress testing method provided in the embodiment of the present application, combined with Figure 2 and Figure 3, the method specifically comprises:

[0034] S1: Obtain the stress testing environment configuration information and stress testing plug-in configuration information in the stress testing template.

[0035] In the embodiment of the present application, stress testing refers to stress testing, which is to simulate a large number of online requests in a stress testing environment and send them to a target stress testing object based on a certain stress testing task, so that the target stress testing object runs for a long time or with an extremely large load, so as to test the performance, reliability, stability, etc. of the target stress testing object under stress. Among them, the stress testing environment is provided by a physical machine, and the simulation and sending of online requests in the stress testing environment are implemented by a stress testing plug-in installed in the physical machine, and the target stress testing object is a middleware, storage or application service running on the server.

[0036] Before S1, you need to provide N candidate physical machines and install a stress test plug-in in each candidate physical machine. N is a positive integer, and at least one stress test plug-in is installed in each candidate physical machine. The attributes of the candidate physical machine include network bandwidth (100M, 1000M, etc.), number of CPU cores (4 cores, 8 cores, etc.), disk type (HDD, SSD, etc.), number of memories (1, 2, etc.), kernel parameters (Windows kernel, Linux kernel, etc.), etc. The attributes of different candidate physical machines are not exactly the same, so different stress test environments can be provided. The attributes of the stress test plug-in include the plug-in type (NAS plug-in, JMeter plug-in, JuiceFS plug-in, etc.). Different stress test plug-ins have different functions, so different stress test tasks can be completed.

[0037] Since the requirements for stress testing environment and stress testing plug-in are different in different stress testing scenarios, in this step, first configure the required stress testing environment and stress testing plug-in related information in the stress testing template according to the current scenario to obtain stress testing environment configuration information and stress testing plug-in configuration information, wherein the stress testing environment configuration information may specifically include the number of physical machines, physical machine network bandwidth, physical machine CPU core number, physical machine disk type, physical machine memory number, physical machine kernel parameters, whether the physical machine is exclusive, and other configuration information, and the stress testing plug-in configuration information may specifically include plug-in type, plug-in loading mode, and other configuration information. After the stress tester completes the configuration in the stress testing template, it is input into the control device so that the control device can obtain these configuration information.

[0038] S2: Obtain first attribute information of N candidate physical machines and second attribute information of the stress testing plug-in installed in each candidate physical machine, where N is a positive integer.

[0039] The control device includes a meta-collector service (label collection service), which can collect the attribute labels of each candidate physical machine to obtain first attribute information. At the same time, the service can collect the attribute labels of the pressure testing plug-in installed in each candidate physical machine to obtain second attribute information. When collecting, it can be read directly from each candidate physical machine, or it can be indirectly obtained with the help of certain third-party management software in each candidate physical machine. Among them, the first attribute information includes labels such as network bandwidth, number of CPU cores, disk type, number of memories, kernel parameters, whether idle, etc. of each candidate physical machine, and the second attribute information includes the plug-in type label of the pressure testing plug-in installed in each candidate physical machine.

[0040] S3: According to the stress testing environment configuration information, the stress testing plug-in configuration information, the first attribute information and the second attribute information, n target physical machines are determined from the N candidate physical machines, and the target stress testing plug-in in each target physical machine is determined, and n stress testing threads are created in the n target physical machines respectively, and the corresponding target stress testing plug-in is loaded through each stress testing thread respectively, where n is a positive integer.

[0041] The control device also includes a dispatcher service, which can obtain the above-mentioned stress testing environment configuration information, stress testing plug-in configuration information, first attribute information and second attribute information, and then use the stress testing environment configuration information and stress testing plug-in configuration information as a reference to determine n target physical machines from all candidate physical machines based on the first attribute information and the second attribute information, and determine the target stress testing plug-in in each target physical machine.

[0042] For example, if the stress test has a high requirement for network bandwidth, you can configure the stress test environment configuration information to require 1G network bandwidth. If the first attribute information of candidate physical machine 1 indicates that it has 1G network bandwidth, and the first attribute information of candidate physical machine 2 indicates that it only has 100M network bandwidth, then the service will prioritize candidate physical machine 1 as the target physical machine. At the same time, if the stress test plug-in configuration information indicates that the jmeter plug-in needs to be loaded, and the second attribute information of the installed stress test plug-in in candidate physical machine 1 indicates that there are jmeter plug-ins and nas plug-ins, then the service will determine the jmeter plug-in in candidate physical machine 1 as the target stress test plug-in.

[0043] For another example, if the content of the stress testing environment configuration information includes exclusive physical machines, the first attribute information of candidate physical machine 3 indicates that the physical machine is currently not idle, and the first attribute information of candidate physical machine 4 indicates that the physical machine is currently idle, then the service will prioritize candidate physical machine 4 as the target physical machine. At the same time, if the content of the stress testing plug-in configuration information indicates that a nas plug-in needs to be loaded, and the second attribute information of the installed stress testing plug-in in candidate physical machine 4 indicates that a nas plug-in exists, then the service will determine the nas plug-in in candidate physical machine 4 as the target stress testing plug-in.

[0044] If the first attribute information of a candidate physical machine satisfies the stress testing environment configuration information, but the second attribute information of the stress testing plug-in in the candidate physical machine does not satisfy the stress testing plug-in configuration information, the candidate physical machine will not be determined as the target physical machine, and there will be no corresponding target stress testing plug-in.

[0045] After determining n target physical machines and the corresponding target stress testing plug-ins, each target physical machine is used as a physical node, that is, Figure 3 The dispatcher service includes a thread creation interface. By calling this interface, a stress test thread can be created in each physical node. Each stress test thread corresponds to a worker service, that is, Figure 3 In worker-1 to worker-n, the worker service can load each target stress testing plug-in in each target physical machine, and the dispatcher service will mount the file system where the target stress testing plug-in is located to the system path specified by the user to prepare for the subsequent execution of the stress testing task.

[0046] In one embodiment, S3 specifically includes: obtaining loading mode configuration information in the stress testing plug-in configuration information, the loading mode of the stress testing plug-in including container mode or process mode; determining the target loading mode of the target stress testing plug-in in each target physical machine according to the loading mode configuration information; creating n stress testing threads in n target physical machines respectively, and loading the corresponding target stress testing plug-in with each target loading mode through each stress testing thread.

[0047] The stress testing plug-in configuration information in the stress testing template includes the plug-in loading mode configuration information. There are two loading modes, namely container mode and process mode. Furthermore, the process mode can be a Linux process or a Windows process, etc., and the container mode can be a Docker container or a K8s container, etc. According to the loading mode configuration information, the target loading mode of the target stress testing plug-in in each target physical machine can be determined, such as the Linux process mode, the Windows process mode, the Docker container mode, the K8s container mode, etc. The thread creation interface of the dispatcher service is called to create n stress testing threads in n target physical machines respectively, and each stress testing thread loads the corresponding target stress testing plug-in in its own determined target loading mode.

[0048] Through the above method, it is realized that only the loading mode needs to be configured in the stress testing template, and the target stress testing plug-in can be automatically loaded in this mode later. There is no need to install the stress testing plug-in before each stress testing, which saves time and improves the stress testing efficiency.

[0049] In one embodiment, the steps of loading the corresponding target stress testing plug-in in each target loading mode through each stress testing thread specifically include: when the target loading mode of the first target stress testing plug-in is the process mode, the first target stress testing plug-in is embedded in the startup file of the corresponding stress testing thread in the form of a command line, and the first target stress testing plug-in is loaded from the startup file through the corresponding stress testing thread; when the target loading mode of the second target stress testing plug-in is the container mode, the second target stress testing plug-in is embedded in the configuration file of the container startup, and the second target stress testing plug-in is loaded from the configuration file through the corresponding stress testing thread.

[0050] If the target loading mode of a target stress testing plug-in is process mode, the target stress testing plug-in is used as the first target stress testing plug-in. When creating a stress testing thread, the first target stress testing plug-in is embedded in the startup file of the stress testing thread in the form of a command line. When the stress testing thread is started, the information of the first target stress testing plug-in can be directly obtained from the startup file and loaded. If the target loading mode of a target stress testing plug-in is container mode, the target stress testing plug-in is used as the second target stress testing plug-in. When creating a stress testing thread, the second target stress testing plug-in is embedded in the configuration file of the container startup. When the stress testing thread is started, the information of the second target stress testing plug-in can be directly obtained from the configuration file and loaded.

[0051] Through the above method, the target stress testing plug-in can be quickly loaded in various loading modes, thereby improving the loading efficiency.

[0052] S4: Get the stress testing task for the target stress testing object.

[0053] The above three steps complete the preparation work before the stress test. When preparing for the stress test, the stress test personnel input the stress test task for the target stress test object to the control device, and then issue a start stress test instruction. The control device responds to the start stress test instruction and obtains the stress test task. The stress test task includes a stress test command set and stress test execution configuration information. The stress test command set contains multiple stress test commands. The stress test command is used to describe various information such as the stress test object, stress test function, and stress test indicators of this time. The stress test object is used to indicate what the target of this stress test is, such as application service A or middleware B, etc. The stress test function is used to indicate what function of the target needs to be stress tested this time, such as access function, interception function, etc. The stress test indicator is used to indicate which indicators need to be used to measure the performance of the target this time, such as average latency, resource consumption, maximum concurrency, etc. The stress test execution configuration information is used to specify the specific execution method of this stress test, such as how to distribute the stress test commands, how many times the stress test commands are executed, and whether each stress test command is executed serially or in parallel.

[0054] S5: The target stress testing plug-in loaded by n stress testing threads executes the stress testing task and obtains the stress testing result.

[0055] The dispatcher service also includes a task distribution interface. After receiving the stress test task, this interface can be called to distribute the stress test task to each stress test thread. Each stress test thread can execute the stress test task for the target stress test object through the target stress test plug-in loaded in the above steps, and record the relevant data generated by the target stress test object during the execution of the stress test task. Finally, the data is summarized to the dispatcher service and the stress test results are output. The dispatcher service also includes a result viewing interface. This interface can be called to view the stress test results. The stress test results can be viewed in pre-configured dimensions such as taking all, taking the average, taking the best, and taking the worst, so as to meet different user stress test strategies.

[0056] Stress testing may include ordinary stress testing and distributed stress testing. Ordinary stress testing is to generate stress on the target stress testing object through a single physical machine, which is usually used to simulate concurrent access by dozens to hundreds of users. Distributed stress testing is to use multiple physical machines to generate stress on the target stress testing object at the same time, which can simulate concurrent access by tens of thousands to hundreds of millions of users. In the above embodiments, when the value of n is 1, ordinary stress testing can be implemented, and when the value of n is greater than 1, distributed stress testing can be implemented, that is, the stress testing method in the embodiments of the present application can meet the requirements of both stress testing modes at the same time.

[0057] In the prior art, for some types of stress testing plug-ins, if they do not have the function of being called simultaneously in multiple physical machines, distributed stress testing cannot be implemented for this type of stress testing plug-in, which limits the stress testing scenario. In the embodiment of the present application, by developing a thread creation interface and a stress testing distribution interface in the dispatcher service, when stress testing is required on multiple physical nodes, it is only necessary to call the thread creation interface to create multiple stress testing threads respectively, and then call the stress testing distribution interface to distribute the stress testing task, and each stress testing thread can execute the stress testing task. The implementation of this function is completed by calling the relevant interface of the dispatcher service, rather than directly by calling the stress testing plug-in itself. Therefore, it is not limited by the function of the stress testing plug-in itself, and distributed stress testing can be implemented for any type of stress testing plug-in, which broadens the stress testing scenario.

[0058] In one embodiment, S5 specifically includes: distributing the stress testing task to n stress testing threads; starting the loaded target stress testing plug-in through each stress testing thread, each target stress testing plug-in generates and sends a test request to the target stress testing object based on the distributed stress testing task, and receives a test response returned by the target stress testing object; and obtaining the stress testing result according to each test response.

[0059] After the stress test task is distributed to n stress test threads, each stress test thread can determine the target stress test object, stress test function, stress test index, etc. according to the stress test task distributed by itself, and then generate test requests through the loaded target stress test plug-in, and send these test requests to the target stress test object to implement the stress test. During the process of receiving the stress test, the target stress test object will generate and return stress test responses to each physical machine. These stress test responses are received by each target stress test plug-in, and each target stress test plug-in processes these stress test responses to obtain stress test data corresponding to each stress test index. The dispatcher service summarizes these stress test data and outputs the final stress test results.

[0060] In one embodiment, S5 specifically includes: according to the stress testing task, m stress testing commands are obtained, and distribution information, execution number information and execution mode information of the m stress testing commands are obtained, where m is a positive integer; according to the distribution information, the m stress testing commands are distributed to n stress testing threads, and according to the execution number information and the execution mode information, the target execution mode and target execution number of the n stress testing threads are determined; the target stress testing plug-ins loaded by the n stress testing threads respectively execute the distributed stress testing commands in the target execution mode, and when the execution number reaches the target execution number, the stress testing result is obtained.

[0061] In the above embodiment, it is mentioned that the stress testing task includes a stress testing command set and stress testing execution configuration information. The stress testing command set includes m stress testing commands. These stress testing commands are used to indicate various information such as stress testing objects, stress testing functions, and stress testing indicators. The stress testing execution configuration information is used to indicate the specific execution method of this stress testing, including distribution information, execution count information, and execution mode information of the m stress testing commands. The distribution information is used to explain how to distribute the m stress testing commands and n physical nodes. The execution count information is used to explain the execution count of the stress testing commands in the entire stress testing process. The execution mode information is used to explain whether the m stress testing commands adopt a serial execution mode or a parallel execution mode.

[0062] After obtaining the stress test task, the control device can obtain the stress test command set and the stress test execution configuration information. It first calls the task distribution interface of the dispatcher service to distribute m stress test commands to n stress test threads based on the distribution information. At the same time, according to the execution number information and execution mode information, it determines whether the target execution mode of the n stress test threads is serial or parallel, and determines the target execution number. Then, each stress test thread starts the target stress test plug-in to execute the stress test commands distributed by each, generate a test request, and obtain the stress test results. During execution, serial or parallel execution is selected according to the target execution mode, and the execution number needs to reach the target execution number before the stress test ends.

[0063] In one embodiment, S5 specifically includes: obtaining status information of the status interface of each stress testing thread, the status information including an idle state or a non-idle state; when the status information of the target stress testing thread is an idle state, calling the working interface of the target stress testing thread to execute the stress testing task and obtain the stress testing result.

[0064] Each stress testing thread corresponds to a worker service. Each worker service provides two interfaces, one is the status interface and the other is the working interface. The working interface is used to be called by the dispatcher service to execute the stress testing task. The status interface is used to prompt the current status information of the stress testing thread. The status information includes idle state or non-idle state. The stress testing task can only be executed when a stress testing thread is in the idle state. Therefore, the dispatcher service needs to first obtain the status information of the status interface of each stress testing thread, determine the target stress testing thread in the idle state, and then call the working interface of the target stress testing thread to execute the stress testing task and obtain the stress testing result. If the status information of a stress testing thread is in the non-idle state, it cannot be called at present, and it needs to wait until the stress testing thread is in the idle state again before it can be called.

[0065] By setting the status interface and the working interface, the dispatcher service can promptly learn the current working status of each stress testing thread, so as to select the stress testing thread that is currently in an idle state from all stress testing threads to execute the stress testing task, thereby avoiding the accumulation of stress testing tasks of some stress testing threads that cannot be processed in time, while other stress testing threads have no stress testing tasks, resulting in resource waste. This realizes the rational use of stress testing thread resources and further improves the stress testing efficiency.

[0066] In one embodiment, after S5, the process further includes: receiving a stress testing end signal for a target stress testing thread; and destroying the target stress testing thread in response to the stress testing end signal.

[0067] The dispatcher service also includes a stress test end interface. The target stress test thread can be any one of the n stress test threads. After the stress test task that the target stress test thread needs to execute is completed, the stress tester can input stress test end information to the execution device, or the execution device automatically generates a stress test end signal. The execution device responds to the stress test end signal and calls the stress test end interface to destroy the target stress test thread. After the destruction, the environment in the physical machine where the target stress test thread is located will be restored to the state before the target stress test thread was created, that is, the original state of the physical machine.

[0068] In the prior art, if the stress test environment is built manually, it is necessary to manually restore the stress test environment after the stress test is completed to facilitate other stress test personnel to perform other stress test tasks. This process will also make the stress test efficiency low. In the embodiment of the present application, when stress testing is required, a stress test thread is automatically created to perform the stress test task. After the stress test is completed, the stress test environment can be restored by destroying the stress test thread. The entire process does not need to be performed manually, thereby improving the efficiency of stress testing.

[0069] It can be seen from the above embodiments that the stress testing method provided by the present application first provides multiple candidate physical machines and installs a stress testing plug-in in each candidate physical machine in advance. Subsequently, only the relevant information of the stress testing environment and the stress testing plug-in needs to be configured in the stress testing template, and the first attribute information of each candidate physical machine and the second attribute information of each stress testing software can be automatically obtained, and these attribute information are matched with the configuration information in the stress testing template to determine the target physical machines and the corresponding target stress testing plug-ins that meet the stress testing requirements, and then automatically create stress testing threads in these target physical machines to load these target stress testing plug-ins, and finally perform stress testing tasks through these stress testing threads. Since the above process does not require manual preparation of the stress testing environment, installation of the stress testing plug-in, etc., it can greatly reduce time and labor costs, and improve the efficiency of stress testing.

[0070] Based on the method described in the above embodiment, this embodiment will be further described from the perspective of the pressure measurement device. Figure 4, the pressure measuring device may include:

[0071] The first acquisition module 10 is used to acquire the stress testing environment configuration information and the stress testing plug-in configuration information in the stress testing template;

[0072] The second acquisition module 20 is used to acquire first attribute information of N candidate physical machines and second attribute information of the stress testing plug-in installed in each of the candidate physical machines, where N is a positive integer;

[0073] A creation module 30 is used to determine n target physical machines from the N candidate physical machines according to the stress testing environment configuration information, the stress testing plug-in configuration information, the first attribute information and the second attribute information, and determine a target stress testing plug-in in each of the target physical machines, respectively create n stress testing threads in the n target physical machines, and respectively load the corresponding target stress testing plug-in through each of the stress testing threads, where n is a positive integer;

[0074] The third acquisition module 40 is used to acquire a stress testing task for a target stress testing object;

[0075] The execution module 50 is used to execute the stress testing task through the target stress testing plug-in loaded by the n stress testing threads and obtain the stress testing result.

[0076] In one embodiment, the creation module 30 includes:

[0077] A first acquisition submodule is used to acquire loading mode configuration information in the stress testing plug-in configuration information, where the loading mode of the stress testing plug-in includes a container mode or a process mode;

[0078] A determination submodule, used to determine a target loading mode of a target stress testing plug-in in each of the target physical machines according to the loading mode configuration information;

[0079] The loading submodule is used to create n stress testing threads in the n target physical machines respectively, and load the corresponding target stress testing plug-in in each target loading mode through each stress testing thread.

[0080] In one embodiment, loading a submodule includes:

[0081] A first loading unit is configured to embed the first target stress testing plug-in in a startup file of a corresponding stress testing thread in a command line manner when a target loading mode of the first target stress testing plug-in is a process mode, and load the first target stress testing plug-in from the startup file through the corresponding stress testing thread;

[0082] The second loading unit is used to embed the second target pressure measurement plug-in in the configuration file started by the container when the target loading mode of the second target pressure measurement plug-in is the container mode, and load the second target pressure measurement plug-in from the configuration file through the corresponding pressure measurement thread.

[0083] In one embodiment, the execution module 50 includes:

[0084] A first distribution submodule, used to distribute the stress testing task to the n stress testing threads;

[0085] A startup submodule, used to start the loaded target stress testing plug-in through each stress testing thread, each target stress testing plug-in generates and sends a test request to the target stress testing object based on the distributed stress testing task, and receives a test response returned by the target stress testing object;

[0086] The first obtaining submodule is used to obtain stress testing results according to each of the test responses.

[0087] In one embodiment, the execution module 50 includes:

[0088] The second obtaining submodule is used to obtain m stress testing commands according to the stress testing task, and obtain distribution information, execution number information and execution mode information of the m stress testing commands, where m is a positive integer;

[0089] A second distribution submodule is used to distribute the m stress testing commands to the n stress testing threads according to the distribution information, and determine the target execution mode and target execution number of the n stress testing threads according to the execution number information and the execution mode information;

[0090] The third submodule is used to execute the distributed stress testing commands in the target execution mode respectively through the target stress testing plug-in loaded by the n stress testing threads, and obtain the stress testing result when the execution times reach the target execution times.

[0091] In one embodiment, the execution module 50 includes:

[0092] A second acquisition submodule is used to obtain status information of the status interface of each stress testing thread, where the status information includes an idle state or a non-idle state;

[0093] The calling submodule is used to call the working interface of the target stress testing thread to execute the stress testing task and obtain the stress testing result when the state information of the target stress testing thread is in an idle state.

[0094] In one embodiment, the pressure measuring device further includes:

[0095] A receiving module is used to receive a stress test end signal for a target stress test thread;

[0096] A destroying module is used to destroy the target stress testing thread in response to the stress testing end signal.

[0097] Different from the prior art, the stress testing device provided in the present application first installs a stress testing plug-in in each candidate physical machine in advance, and then only needs to configure the relevant information of the stress testing environment and the stress testing plug-in in the stress testing template, so as to automatically obtain the first attribute information of each candidate physical machine and the second attribute information of each stress testing software, and match these attribute information with the configuration information in the stress testing template to determine the target physical machines and corresponding target stress testing plug-ins that meet the stress testing requirements, and then automatically create stress testing threads in these target physical machines to load these target stress testing plug-ins, and finally perform the stress testing tasks through these stress testing threads. Since the above process does not require manual preparation of the stress testing environment, installation of the stress testing plug-in, etc., it can greatly reduce time and labor costs, and improve the efficiency of stress testing.

[0098] Accordingly, the present application also provides an electronic device, such as Figure 5 As shown, the electronic device may include a radio frequency (RF) circuit 101, a memory 102 including one or more computer-readable storage media, an input unit 103, a display unit 104, a sensor 105, an audio circuit 106, a WiFi module 107, a processor 108 including one or more processing cores, and a power supply 109. Those skilled in the art will appreciate that Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0099] The radio frequency circuit 101 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 108 for processing; in addition, the data related to the uplink is sent to the base station. The memory 102 can be used to store plug-in programs and modules. The processor 108 executes various functional applications and stress tests by running the plug-in programs and modules stored in the memory 102. The input unit 103 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to customer settings and function control.

[0100] The display unit 104 may be used to display information input by a client or information provided to a client and various graphical client interfaces of the server. These graphical client interfaces may be composed of graphics, texts, icons, videos and any combination thereof.

[0101] The electronic device may also include at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. The audio circuit 106 includes a speaker, which may provide an audio interface between the user and the electronic device.

[0102] WiFi is a short-range wireless transmission technology. Electronic devices can help customers send and receive emails, browse web pages, and follow streaming media through WiFi modules 107. It provides customers with wireless broadband Internet follow-up. Figure 5 A WiFi module 107 is shown, but it is understandable that it is not an essential component of the electronic device and can be omitted as needed without changing the essence of the application.

[0103] The processor 108 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes various functions of the electronic device and processes data by running or executing plug-ins and / or modules stored in the memory 102, and calling data stored in the memory 102, thereby monitoring the mobile phone as a whole.

[0104] The electronic device also includes a power source 109 (such as a battery) for supplying power to each component. Preferably, the power source can be logically connected to the processor 108 through a power management system, so that the power management system can manage charging, discharging, power consumption and other functions.

[0105] Although not shown, the electronic device may also include a camera, a Bluetooth module, etc., which will not be described in detail here. Specifically in this embodiment, the processor 108 in the server will load the executable files corresponding to the processes of one or more applications into the memory 102 according to the following instructions, and the processor 108 will run the application stored in the memory 102, thereby realizing the following functions:

[0106] Get the stress testing environment configuration information and stress testing plug-in configuration information in the stress testing template;

[0107] Obtain first attribute information of N candidate physical machines and second attribute information of a stress testing plug-in installed in each of the candidate physical machines, where N is a positive integer;

[0108] According to the stress testing environment configuration information, the stress testing plug-in configuration information, the first attribute information, and the second attribute information, n target physical machines are determined from the N candidate physical machines, and a target stress testing plug-in in each of the target physical machines is determined, n stress testing threads are created in the n target physical machines respectively, and corresponding target stress testing plug-ins are loaded through each stress testing thread respectively, where n is a positive integer;

[0109] Get the stress testing task for the target stress testing object;

[0110] The target stress testing plug-in loaded by the n stress testing threads executes the stress testing task and obtains the stress testing result.

[0111] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description above and will not be repeated here.

[0112] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0113] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to implement the following functions:

[0114] Get the stress testing environment configuration information and stress testing plug-in configuration information in the stress testing template;

[0115] Obtain first attribute information of N candidate physical machines and second attribute information of a stress testing plug-in installed in each of the candidate physical machines, where N is a positive integer;

[0116] According to the stress testing environment configuration information, the stress testing plug-in configuration information, the first attribute information, and the second attribute information, n target physical machines are determined from the N candidate physical machines, and a target stress testing plug-in in each of the target physical machines is determined, n stress testing threads are created in the n target physical machines respectively, and corresponding target stress testing plug-ins are loaded through each stress testing thread respectively, where n is a positive integer;

[0117] Get the stress testing task for the target stress testing object;

[0118] The target stress testing plug-in loaded by the n stress testing threads executes the stress testing task and obtains the stress testing result.

[0119] The above is a detailed introduction to a stress testing method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the technical solution and its core idea of ​​the present application. Ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some of the technical features therein with equivalents; and these modifications or replacements do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present application.

Claims

1. A stress testing method, characterized in that: include: Get the stress testing environment configuration information and stress testing plug-in configuration information in the stress testing template; Obtain first attribute information of N candidate physical machines and second attribute information of a stress testing plug-in installed in each of the candidate physical machines, where N is a positive integer; According to the stress testing environment configuration information, the stress testing plug-in configuration information, the first attribute information, and the second attribute information, n target physical machines are determined from the N candidate physical machines, and a target stress testing plug-in in each of the target physical machines is determined, n stress testing threads are created in the n target physical machines respectively, and corresponding target stress testing plug-ins are loaded through each stress testing thread respectively, where n is a positive integer; Get the stress testing task for the target stress testing object; The target stress testing plug-in loaded by the n stress testing threads executes the stress testing task and obtains the stress testing result.

2. The stress testing method according to claim 1, characterized in that: The steps of creating n stress testing threads in the n target physical machines respectively and loading the corresponding target stress testing plug-in through each stress testing thread respectively include: Obtaining loading mode configuration information in the stress testing plug-in configuration information, where the loading mode of the stress testing plug-in includes a container mode or a process mode; Determine, according to the loading mode configuration information, a target loading mode of a target stress testing plug-in in each of the target physical machines; N stress testing threads are respectively created in the n target physical machines, and corresponding target stress testing plug-ins are loaded in respective target loading modes through each stress testing thread.

3. The stress testing method according to claim 2, characterized in that: The steps of loading the corresponding target stress testing plug-in in each target loading mode through each stress testing thread respectively include: When the target loading mode of the first target stress testing plug-in is the process mode, the first target stress testing plug-in is embedded in the startup file of the corresponding stress testing thread in the form of a command line, and the first target stress testing plug-in is loaded from the startup file through the corresponding stress testing thread; When there is a second target pressure measurement plug-in whose target loading mode is container mode, the second target pressure measurement plug-in is embedded in a configuration file started by the container, and the second target pressure measurement plug-in is loaded from the configuration file through a corresponding pressure measurement thread.

4. According to the stress testing method of claim 1, the step of executing the stress testing task through the target stress testing plug-in loaded by the n stress testing threads and obtaining the stress testing result comprises: Distribute the stress testing task to the n stress testing threads; Starting the loaded target stress testing plug-in through each stress testing thread, each target stress testing plug-in generates and sends a test request to the target stress testing object based on the distributed stress testing task, and receives a test response returned by the target stress testing object; The stress test results are obtained according to the test responses.

5. The stress testing method according to claim 1, characterized in that: The step of executing the stress testing task through the target stress testing plug-in loaded by the n stress testing threads and obtaining the stress testing result includes: According to the stress testing task, m stress testing commands are obtained, and distribution information, execution number information, and execution mode information of the m stress testing commands are obtained, where m is a positive integer; Distribute the m stress testing commands to the n stress testing threads according to the distribution information, and determine the target execution mode and target execution number of the n stress testing threads according to the execution number information and the execution mode information; The target stress testing plug-in loaded by the n stress testing threads respectively executes the distributed stress testing commands in the target execution mode, and obtains the stress testing result when the number of executions reaches the target number of executions.

6. The stress testing method according to claim 1, characterized in that: Each of the stress testing threads includes a state interface and a working interface. The step of executing the stress testing task through the target stress testing plug-in loaded by the n stress testing threads and obtaining the stress testing result includes: Obtaining status information of a status interface of each stress testing thread, wherein the status information includes an idle state or a non-idle state; When the state information of the target stress testing thread is in an idle state, the working interface of the target stress testing thread is called to execute the stress testing task and obtain the stress testing result.

7. The stress testing method according to claim 1, characterized in that: After obtaining the stress test results, the following steps are also included: Receive the stress test end signal for the target stress test thread; In response to the stress testing end signal, the target stress testing thread is destroyed.

8. A pressure measurement device, characterized in that: include: The first acquisition module is used to obtain the stress testing environment configuration information and the stress testing plug-in configuration information in the stress testing template; A second acquisition module is used to acquire first attribute information of N candidate physical machines and second attribute information of the stress testing plug-in installed in each of the candidate physical machines, where N is a positive integer; A creation module, configured to determine n target physical machines from the N candidate physical machines according to the stress testing environment configuration information, the stress testing plug-in configuration information, the first attribute information, and the second attribute information, and determine a target stress testing plug-in in each of the target physical machines, respectively create n stress testing threads in the n target physical machines, and respectively load a corresponding target stress testing plug-in through each of the stress testing threads, where n is a positive integer; The third acquisition module is used to obtain the stress testing task for the target stress testing object; An execution module is used to execute the stress testing task through the target stress testing plug-in loaded by the n stress testing threads and obtain the stress testing result.

9. An electronic device, characterized in that: It comprises a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to execute the steps in the stress testing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps in the stress testing method according to any one of claims 1 to 7.