Performance stress testing method, device, server, and computer-readable storage medium

By obtaining the target files of different protocol type services and deploying a pressure measurement environment on the target equipment, the problem of poor applicability of the performance pressure measurement process in the prior art is solved, efficient pressure measurement for different protocol type services is achieved, and the accuracy of performance problem positioning is improved.

CN111966556BActive Publication Date: 2025-06-10TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010831666.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-18
Publication Date
2025-06-10
Estimated Expiration
2040-08-18

AI Technical Summary

Technical Problem

In the prior art, the server performance pressure measurement process is poorly applicable and cannot be applied to services of different protocol types.

Method used

By determining the protocol type of the pressure measurement object and obtaining the corresponding target file, the target file describes the data structure of the packet that complies with the protocol type, generates data packets compliant with the protocol type based on the target file, and deploys the pressure measurement environment separately on the target device for pressure measurement.

Benefits of technology

The applicability of the performance pressure measurement process is improved, making it suitable for stress measurement of services of different protocol types, and the deployment of the pressure measurement environment separately helps position specific services for performance problems, improving the accuracy of problem positioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111966556B_ABST
    Figure CN111966556B_ABST
Patent Text Reader

Abstract

The present application discloses a performance stress testing method, apparatus, a server, and a computer-readable storage medium. The method includes: determining a stress testing object and a protocol type corresponding to the stress testing object, and obtaining a target file corresponding to the protocol type; wherein the target file is used to describe the data structure of data packets conforming to the protocol type; deploying a stress testing environment on a target device based on the access service of the stress testing object, and allocating a process for the stress testing object; using the process to generate data packets conforming to the protocol type based on the target file, and sending the data packets to the target device, so as to obtain the stress testing result of the stress testing object by stress testing the stress testing environment. It can be seen that the performance stress testing method provided by the present application improves the applicability of the performance stress testing process, enabling it to be applicable to the stress testing of services with different protocol types.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of servers, and more specifically, to a performance stress testing method, apparatus, server, and computer-readable storage medium. Background Art

[0002] Since different servers use different types of protocols for data transmission, and different services within the same server may also use different types of protocols for data transmission, for the performance stress testing of servers, in the related art, testers need to package different stress testing codes for different protocol types and require relatively high coding capabilities and background protocol analysis capabilities. The applicability of the stress testing scripts is poor.

[0003] It can be seen that in the process of implementing the performance stress testing of servers, the applicant found that there are at least the following problems in the related art: the applicability of the stress testing process is poor and it cannot be applied to services of different protocol types. Summary of the Invention

[0004] The purpose of the present application is to provide a performance stress testing method, apparatus, server, and computer-readable storage medium, which improve the applicability of the performance stress testing process and enable it to be applied to the stress testing of services of different protocol types.

[0005] To achieve the above purpose, the first aspect of the present application provides a performance stress testing method, including:

[0006] Determine the stress testing object and the protocol type corresponding to the stress testing object, and obtain the target file corresponding to the protocol type; wherein, the target file is used to describe the data structure of the data packet conforming to the protocol type;

[0007] Deploy a stress testing environment on a target device based on the access service of the stress testing object, and allocate a process for the stress testing object;

[0008] Use the process to generate data packets conforming to the protocol type based on the target file, and send the data packets to the target device, so as to obtain the stress testing result of the stress testing object by stress testing the stress testing environment.

[0009] To achieve the above purpose, the second aspect of the present application provides a stress testing apparatus, including:

[0010] A determination module, configured to determine the stress testing object and the protocol type corresponding to the stress testing object, and obtain the target file corresponding to the protocol type; wherein, the target file is used to describe the data structure of the data packet conforming to the protocol type;

[0011] A deployment module, configured to deploy a stress testing environment on a target device based on the access service of the stress testing object, and allocate a process for the stress testing object;

[0012] A stress testing module, configured to generate data packets conforming to the protocol type based on the target file by using the process, and send the data packets to the target device, so as to obtain the stress testing result of the stress testing object by stress testing the stress testing environment.

[0013] To achieve the above object, a third aspect of the present application provides a server, including:

[0014] A memory, configured to store a computer program;

[0015] A processor, configured to implement the steps of the performance stress testing method as described above when executing the computer program.

[0016] To achieve the above object, a fourth aspect of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the performance stress testing method as described above are implemented.

[0017] As can be seen from the above solutions, a performance stress testing method provided by the present application includes: determining a stress testing object and the protocol type corresponding to the stress testing object, and obtaining a target file corresponding to the protocol type; wherein, the target file is used to describe the data structure of data packets conforming to the protocol type; deploying a stress testing environment on a target device based on the access service of the stress testing object, and allocating a process for the stress testing object; generating data packets conforming to the protocol type based on the target file by using the process, and sending the data packets to the target device, so as to obtain the stress testing result of the stress testing object by stress testing the stress testing environment.

[0018] For the performance stress testing of the stress testing object, the performance stress testing method provided by the present application needs to determine the protocol type it uses. Different protocol types correspond to different target files, and the target file is used to describe the data structure of data packets conforming to the corresponding protocol type, that is, data packets conforming to the corresponding protocol type can be generated based on the target file. Obtaining the target file corresponding to the protocol type of the stress testing object, so as to generate data packets conforming to the protocol type based on the target file, thereby performing performance stress testing on the stress testing object. It can be seen that the above stress testing process is applicable to stress testing objects of different protocol types, and the applicability of the stress testing process is relatively high. In addition, for the performance stress testing method provided by the present application, the environment of the stress testing object is separately deployed on the target device, and the data packets are sent to the target device to implement the stress testing of the stress testing object. Separately deploying the stress testing environment is beneficial to locating the specific service, that is, beneficial to locating the service that generates performance problems, and improves the accuracy of determining the point where the performance problem occurs. The present application also discloses a stress testing device, a server, and a computer-readable storage medium, which can also achieve the above technical effects.

[0019] It should be understood that the above general description and the following detailed description are merely exemplary and do not limit the present application. Description of the Drawings

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. The drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification, and are used together with the following specific embodiments to explain the present disclosure, but do not constitute a limitation to the present disclosure. In the drawings:

[0021] Figure 1 It is an architecture diagram of a performance stress testing system provided by an embodiment of the present application;

[0022] Figure 2 It is a flowchart of the first performance stress testing method provided by an embodiment of the present application;

[0023] Figure 3 It is a flowchart of the second performance stress testing method provided by an embodiment of the present application;

[0024] Figure 4 It is a flowchart of the third performance stress testing method provided by an embodiment of the present application;

[0025] Figure 5 It is a flowchart of a process allocation provided by an embodiment of the present application;

[0026] Figure 6 It is a flowchart of the fourth performance stress testing method provided by an embodiment of the present application;

[0027] Figure 7 It is a schematic diagram of displaying performance test results provided by an embodiment of the present application;

[0028] Figure 8 It is a flowchart of a performance stress testing method in an application embodiment provided by the present application;

[0029] Figure 9 It is a display diagram of a client when a user selects a stress testing object provided by an embodiment of the present application;

[0030] Figure 10 It is a display diagram of a data structure provided by an embodiment of the present application;

[0031] Figure 11 It is a display diagram of a client when a user modifies test data provided by an embodiment of the present application;

[0032] Figure 12 Structural diagram of a performance stress testing device provided by an embodiment of the present application;

[0033] Figure 13 Structural diagram of a server provided by an embodiment of the present application. Detailed implementation manners

[0034] The applicant of the present application has found through research that different servers use different types of protocols for data transmission, and different services within the same server may also use different types of protocols for data transmission. For stress testing objects of different protocol types, testers need to package different stress testing codes, and the applicability of the stress testing process is poor. Therefore, in the present application, a target file corresponding to the protocol type of the stress testing object is obtained, and the target file is used to describe the data structure of data packets conforming to the corresponding protocol type, that is, data packets conforming to the corresponding protocol type can be generated based on the target file, so as to perform performance stress testing on the stress testing object. It can be seen that the stress testing process improved in the present application is applicable to stress testing objects of different protocol types, that is, the applicability of the stress testing process is relatively high.

[0035] In addition, the applicant of the present application has also found through research that for stress testing objects of mesh-deployed services, their service call links are complex. When stress testing is shared with other environments, they will affect each other, and it is impossible to accurately locate the service that causes performance problems. Therefore, in the present application, the environment of the stress testing object is separately deployed on the target device, which is beneficial to locating the service that causes performance problems and improves the accuracy of determining the point where the performance problem occurs.

[0036] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.

[0037] To facilitate the understanding of the performance stress testing method provided by the present application, the system used thereby will be introduced below. Refer to Figure 1 , which shows an architecture diagram of a stress testing system provided by an embodiment of the present application. As Figure 1 shown, it includes a client 100, a server 200, a target device 300, and a stress testing object 400. The client 100 and the server 200, the server 200 and the target device 300, and the server 200 and the stress testing object 400 are connected through a network.

[0038] Among them, the client 100 can be a mobile terminal such as a mobile phone or a fixed terminal such as a PC (Chinese full name: Personal Computer, English full name: personal computer) terminal, which is used to interact with users. Users can select a stress test object through the input interface of the client 100, input the protocol type used by the stress test object, and upload the target file corresponding to the protocol type. The server 200 can display the stress test data of this performance stress test to the user through the client 100. The user can adjust the stress test data on the display module of the client 100, and the client 100 can also display the performance stress test results of the stress test object 400 to the user.

[0039] The server 200 is the execution entity of the stress test process. First, it obtains the target file corresponding to the protocol type used by the stress test object 400. This target file is a data structure that describes the data packets conforming to the protocol type, which can be manually uploaded by the user through the client 100, or the target files corresponding to common protocol types can be stored in its own memory and automatically obtained during testing. Secondly, the server 200 obtains all the access services of the stress test object 400, and separately deploys a stress test environment on the target device 300 based on all the access services, that is, deploys the services that need to be stress tested in the stress test object 400 on the target device 300. Finally, the server 200 generates and sends a request, that is, a data packet, to the target device 400 based on the target file, so as to achieve the performance stress test of the stress test object. It should be noted that the server 200 can encapsulate the above stress test process into a stress test script, such as a python script, that is, when receiving the stress test command of the stress test object 400, it encapsulates the corresponding stress test script for it based on the protocol type used by the stress test object 400, and executes the stress test script to perform the performance stress test on the stress test object 400.

[0040] The target device 300 is used to separately deploy a stress test environment, that is, to deploy the services that need to be stress tested in the stress test object 400 on the target device 300. The server 200 can obtain the performance stress test results of the stress test object 400 by stress testing the stress test environment on the target device 300.

[0041] The stress test object 400 can be the background server of an application, or one or more services provided by the background server, and the present application does not make specific limitations.

[0042] The embodiment of the present application discloses a performance stress test method, which improves the applicability of the performance stress test process and enables it to be applicable to the stress test of services of different protocol types.

[0043] See Figure 2 For the flowchart of a performance stress test method provided by the embodiment of the present application, as Figure 2 shown, it includes:

[0044] S101: The client sends the stress test object to the server;

[0045] In a specific implementation, the user fills in the name of the stress test plan for this stress test at the client and selects the stress test object for this stress test. The stress test object can be the background server of a certain application or one or more services provided by the background server. This embodiment does not make specific limitations. The client sends the name of the stress test object to the server.

[0046] S102: The server determines the protocol type corresponding to the stress test object and obtains the target file corresponding to the protocol type; wherein, the target file is used to describe the data structure of the data packet conforming to the protocol type;

[0047] It can be understood that different stress test objects use different protocol types. Therefore, for the performance stress test of the stress test object, it is necessary to determine the protocol type it uses. The protocol type here can include TCP (full Chinese name: Transmission Control Protocol, full English name: Transmission Control Protocol), UDP (full Chinese name: User Datagram Protocol, full English name: User Datagram Protocol), HTTP (full Chinese name: Hyper Text Transfer Protocol, full English name: Hyper TextTransfer Protocol), and RPC (full Chinese name: Remote Procedure Call, full English name: Remote Procedure Call), etc. This embodiment does not make specific limitations. In a specific implementation, the user can input the protocol type of the stress test object at the client and transmit it to the server, or the server can automatically determine the protocol type it uses according to the name of the stress test object. This is not specifically limited here.

[0048] Data packets of different protocol types have specific different data structures, and this data structure can be described using the target file. That is, different protocol types correspond to different target files. The target file is used to describe the data structure of the data packet conforming to the corresponding protocol type. Based on the target file, the server can generate data packets conforming to the corresponding protocol type. The target file can be manually uploaded by the user through the client, or the target files corresponding to common protocol types can be stored in the memory of the server and automatically obtained during the test. This embodiment does not make specific limitations. After the server automatically obtains the target file, it can display the data structure through the client so that the user can modify the test data therein. In order to clearly display the data structure, it can be displayed in a tree form.

[0049] S103: The server deploys a stress test environment on the target device based on the access service of the stress test object;

[0050] In this step, the server obtains all the access services of the object to be stress-tested, and separately deploys a stress-testing environment on the target device based on all the access services, that is, deploys the services to be stress-tested in the object to be stress-tested 400 on the target device, including all the access services and the invoked services of each access service. It can be seen that this step realizes the isolation of the stress-testing environment from other service environments, which is conducive to locating the generation point of performance problems in the subsequent steps.

[0051] S104: The server allocates a process for the object to be stress-tested;

[0052] S105: The server uses the process to generate data packets conforming to the protocol type based on the target file;

[0053] S106: The server sends the data packets to the target device;

[0054] S107: The server obtains the stress-test result of the object to be stress-tested by stress-testing the stress-testing environment.

[0055] In specific implementation, the server allocates a process for the object to be stress-tested based on the number of users required by the object to be stress-tested and its own resource usage. Each process separately generates and sends requests to the target device based on the target file, that is, data packets conforming to the protocol type corresponding to the object to be stress-tested, and realizes the performance stress-test of the object to be stress-tested through the performance stress-test of the stress-testing environment deployed in the target device. The above number of users can be manually set by the user through the client, or automatically set by the server according to preset rules. For example, the server presets a basic number of users, first sets the number of users to the basic number of users, allocates processes according to the basic number of users, obtains the performance stress-test result corresponding to the basic number of users, then increments the number of users, and obtains the performance stress-test result at this time, that is, increases the number of users according to the preset increment number to obtain the performance stress-test results corresponding to different numbers of users, and accordingly determines the number of users that causes a performance bottleneck and determines the maximum load number of the object to be stress-tested.

[0056] It should be noted that if the request sent to the stress test object needs to construct a login state, the steps of generating a data packet conforming to the protocol type based on the target file by the process may include: determining a target account pool and generating a login state corresponding to each account information in the target account pool; if the data packet needs a login state, the process selects a target login state from all the login states and generates a data packet conforming to the protocol type based on the target file and the target login state. In a specific implementation, the server stores at least one account pool, and each account pool includes multiple account information, which is used to construct a login state for the request sent to the target device. For the stress test object selected by the user, if the request sent to the stress test object needs to construct a login state, the server determines the target account pool corresponding to the stress test object and generates a login state for each account information in the target account pool. It can be understood that the target account pool can be manually selected by the user on the client side or automatically set by the server, and no specific limitation is made here. When constructing a data packet sent to the target device, the process in the server selects a target login state from all the login states and generates a data packet conforming to the corresponding protocol type based on the target file and the target login state. No specific rule for selecting the target login state is limited here. The process can randomly select from all the login states each time a data packet is constructed, or the server can specify the target login state within a preset time period, and all processes select the target login state specified by the server when constructing data packets within this preset time period, and the server updates the target login state regularly.

[0057] For the performance stress test of the stress test object, the performance stress test method provided in the embodiment of the present application needs to determine the protocol type it uses. Different protocol types correspond to different target files, and the target file is used to describe the data structure of the data packet conforming to the corresponding protocol type, that is, a data packet conforming to the corresponding protocol type can be generated based on the target file. Obtain the target file corresponding to the protocol type of the stress test object, so as to generate a data packet conforming to the protocol type based on the target file, thereby performing a performance stress test on the stress test object. It can be seen that the above stress test process is applicable to stress test objects of different protocol types, and the applicability of the stress test process is relatively high. In addition, for the performance stress test method provided in the embodiment of the present application, the environment of the stress test object is separately deployed on the target device, and the data packet is sent to the target device to implement the stress test of the stress test object. Separately deploying the stress test environment is beneficial to locating the specific service, that is, it is beneficial to locate the service that generates performance problems, and improves the accuracy of determining the point where the performance problem occurs.

[0058] The embodiment of the present application discloses a performance stress test method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. The embodiment of the present application is introduced with the server as the execution subject. Specifically:

[0059] See Figure 3, the flowchart of the second performance stress testing method provided by the embodiments of the present application is as Figure 3 shown, including:

[0060] S201: Determine the stress testing object and the protocol type corresponding to the stress testing object, and obtain the target file corresponding to the protocol type; wherein, the target file is used to describe the data structure of the data packet conforming to the protocol type;

[0061] S202: Deploy all access services of the stress testing object on the target device;

[0062] S203: Obtain the configuration file corresponding to each deployed service on the target device, and determine the calling service corresponding to each deployed service according to the load balancing parameters in the configuration file;

[0063] S204: Deploy all the calling services on the target device;

[0064] In this embodiment, the server first obtains and deploys all access services of the stress testing object on the target device, and then deploys the associated services of all access services. In a specific implementation, the server sends a request to the access services deployed on the target device to obtain the configuration file of the access service. The configuration file includes load balancing parameters, which record all other services called by the access service, that is, the calling services corresponding to the access service, and deploys the calling services corresponding to the access service on the target device. For the newly deployed services on the target device, requests need to be sent to them, their corresponding configuration files need to be obtained, and their corresponding calling services need to be deployed, so as to deploy the associated services of all access services on the target device. That is, the associated services of the access service include other services called by the access service and the calling services corresponding to all other services.

[0065] S205: Allocate a process for the stress testing object;

[0066] S206: Use the process to generate data packets conforming to the protocol type based on the target file, and send the data packets to the target device, so as to obtain the stress testing result of the stress testing object by stress testing the stress testing environment.

[0067] It can be seen that this embodiment provides a specific method for deploying a stress testing environment. First, deploy the access services of the stress testing object on the target device, and then deploy the associated services of all access services through the call relationship between services. For stress testing objects with a mesh deployment service and a complex link, using the call relationship between services to complete the deployment of the stress testing environment can find all services in the full link.

[0068] The embodiments of the present application disclose a performance stress testing method. Compared with the first embodiment, the technical solution is further described and optimized in this embodiment. The embodiments of the present application are introduced with the server as the execution entity. Specifically:

[0069] See Figure 4 , the flowchart of the third performance stress testing method provided by the embodiments of the present application, as Figure 4 shown, includes:

[0070] S301: Determine the stress testing object and the protocol type corresponding to the stress testing object, and obtain the target file corresponding to the protocol type; wherein, the target file is used to describe the data structure of the data packet conforming to the protocol type;

[0071] S302: Deploy a stress testing environment on the target device based on the access service of the stress testing object;

[0072] S303: Obtain the number of users to be stress tested, and calculate the target main process number and the target slave process number corresponding to the stress testing object according to the number of users;

[0073] In a specific implementation, multiple processes need to be allocated for the stress testing object, and requests are sent to the target device simultaneously. Among them, the slave process is used to generate and send data packets to the target device. One master process can correspond to multiple slave processes. The master process is used to collect the data information of the corresponding slave processes. Of course, the master process can also generate and send data packets to the target device, that is, the master process collects the data information of itself and the corresponding slave processes.

[0074] As Figure 5 shown, the target main process number (masterNum) and the target slave process number (slaveNum) can be calculated according to the number of users (userNum) required by the stress testing object. For example, slaveNum = [userNum / 300] + 1, masterNum = [slaveNum / 8] + 1, where one master process is deployed on each stress testing machine, with 2400 concurrency, each slave process sends 300 requests to the target device, and 1 master process is used to collect the data information of 8 slave processes.

[0075] S304: If the target main process number is less than or equal to the number of idle master processes and the target slave process number is less than or equal to the number of idle slave processes, then allocate the master processes with the target main process number and the slave processes with the target slave process number for the stress testing object; wherein, the slave process is used to generate and send data packets to the target device, and the master process is used to collect the data information of the corresponding slave processes;

[0076] In this step, query the stress test resource allocation (streesResource) of the server. If the number of target master processes is less than or equal to the number of idle master processes (curMasterNum) and the number of target slave processes is less than or equal to the number of idle slave processes (curSslaveNum), then allocate the number of master processes equal to the number of target master processes and the number of slave processes equal to the number of target slave processes to the stress test object, update the number of idle master processes and the number of idle slave processes in streesResource, and the resourceUseRecord records the process allocation information, which can include the identifier (taskid) of this stress test, the IP (full Chinese name: Internet Protocol, English full name: Internet Protocol) address of the stress test object, etc. After the stress test, query the resources used according to its identifier, that is, the allocated master processes and slave processes, recycle the master processes and slave processes, update the number of idle master processes and the number of idle slave processes in streesResource, and update the records in resourceUseRecord.

[0077] S305: Use the process to generate data packets conforming to the protocol type based on the target file, and send the data packets to the target device, so as to obtain the stress test result of the stress test object by stress testing the stress test environment.

[0078] Thus, this embodiment discloses a specific process allocation method. The slave process is used to generate and send multiple data requests to the target device, and the number of target slave processes to be allocated can be calculated according to the number of users required by the stress test object and the number of requests sent by each master process. The master process is used to collect the data information of the corresponding slave process, and the number of target master processes to be allocated can be calculated according to the corresponding relationship between the number of master processes and the number of slave processes.

[0079] The embodiment of the present application discloses a performance stress test method. Compared with the first embodiment, this embodiment further explains and optimizes the technical solution. The embodiment of the present application is introduced with the server as the execution subject. Specifically:

[0080] See Figure 6 , the flowchart of the fourth performance stress test method provided by the embodiment of the present application is as Figure 6 shown, including:

[0081] S401: Determine the stress test object and the protocol type corresponding to the stress test object, and obtain the target file corresponding to the protocol type; wherein, the target file is used to describe the data structure of the data packet conforming to the protocol type;

[0082] S402: Deploy a stress test environment on the target device based on the access service of the stress test object, and allocate processes to the stress test object;

[0083] S403: Generate a data packet conforming to the protocol type based on the target file by using the process, and send the data packet to the target device;

[0084] S404: Calculate the stress test result items of the stress test object according to the data information collected by all the main processes; wherein, the stress test result items include any one or a combination of any several of response time, QPS (Chinese full name: Queries-per-second, English full name: Queries-per-second), error rate, and resource utilization rate of each service.

[0085] In this embodiment, the main process is used for the data information of data packet sending and response. According to the data information collected by all the main processes, the stress test result items can be calculated, which can include response time, QPS (Chinese full name: Queries-per-second, English full name: Queries-per-second), error rate, and resource utilization rate of each service, and the above stress test result items can be displayed at the client. It can be understood that the above response time is the average value of the response times of all data packets. If the error rate is greater than the first preset value, determine the failed service through the link and display it through the client. Here, the first preset value is not specifically limited, and those skilled in the art can flexibly set it according to the actual situation.

[0086] As a preferred implementation manner, this embodiment further includes: if the QPS is less than the second preset value, perform performance analysis according to the call relationship between the services and the resource utilization rate of each service to determine the service with a performance bottleneck. In specific implementation, if the QPS is less than the second preset value, it means that one or several services in the stress test environment have a performance bottleneck. Here, the second preset value is also not specifically limited, and those skilled in the art can flexibly set it according to the actual situation. In order to determine and locate the service with a performance problem, the call relationship between each service and the resource utilization rate of each service can be displayed at the client for the tester to locate. Here, the specific display method of the resource utilization rate is not limited. The value of the resource utilization rate can be directly displayed, or different ranges of the resource utilization rate can be represented by different colors. Those skilled in the art can flexibly select according to the actual situation. For example, as Figure 7 shown, service A calls service B and service C, service B calls service D, service E and service F, service C calls service G. In the figure, the double-sided shadow indicates that the resource utilization rate is greater than or equal to 90%, the single-sided shadow indicates that the resource utilization rate is less than 90% and greater than or equal to 60%, and the blank indicates that the resource utilization rate is less than 60%. It can be seen that service B is the performance bottleneck point, and the reason may be that too many services are called, or the resource utilization rate of service D is too high, that is, service D is also the performance bottleneck point. For the service with a performance problem, the resource usage situation of each operation in it can also be displayed in the form of a flame graph to facilitate development and optimization.

[0087] It can be seen that in this embodiment, the stress test result items can be calculated based on the data information collected by the main process, and performance analysis can be performed accordingly. The performance bottleneck points can be located according to the call relationship between services and the resource utilization rate of each service, which improves the accuracy of determining the point where performance problems occur.

[0088] For ease of understanding, an application scenario of this application is introduced. The process of performance stress testing is as Figure 8 shown. First, the user fills in the page at the client, fills in the stress test plan name, selects the stress test object and protocol type, and uploads a file describing the data structure of the data packet conforming to the protocol type. As Figure 9 shown, if the stress test object selected by the user is the KTV system and the protocol type is HTTP type, the data editing diagram is as Figure 10 shown, and the test data of the HTTP type is as Figure 11 shown, where the user can modify the test data.

[0089] The server generates scripts of different protocol types, which are used for the deployment of the stress test environment, process allocation, and performance analysis. During the deployment of the stress test environment, first, the access service of the stress test object is deployed, a request is sent to the deployed service, and it is judged whether there is a called service according to the L5 (a load balancing component) parameter in the response data. If so, the called service is deployed, and the step of sending a request to the deployed service is repeated until all called services are deployed. If the user selects a stress test machine, the stress test machine is deployed. If the user does not select, the server makes a dynamic allocation, and the deployed stress test machine is used for stress testing. Each stress test machine has a main process for collecting data. After the stress test is completed, if there are multiple stress test machines participating in the stress test, the data of multiple stress test machines are obtained, and the stress test result items are calculated and displayed. It is judged whether the service success rate reaches the target. If it does not reach the target, the failed service is displayed in the link and development optimization is performed. If it reaches the target, it is judged whether the QPS reaches the target. If it does not reach the target, the resource usage of the service is analyzed and displayed through a flame graph, and development optimization is performed. After development optimization, the stress test steps are performed again to verify whether the optimization takes effect.

[0090] Next, a performance stress testing device provided by an embodiment of this application is introduced. The performance stress testing device described below can be referred to in mutual reference with the performance stress testing method described above.

[0091] See Figure 12 , the structural diagram of a performance stress testing device provided by an embodiment of this application is as Figure 12 shown, including:

[0092] Determination module 100, configured to determine a stress testing object and a protocol type corresponding to the stress testing object, and obtain a target file corresponding to the protocol type; wherein, the target file is used to describe a data structure of a data packet conforming to the protocol type;

[0093] Deployment module 200, configured to deploy a stress testing environment on a target device based on an access service of the stress testing object, and allocate processes for the stress testing object;

[0094] Stress testing module 300, configured to generate data packets conforming to the protocol type based on the target file by using the process, and send the data packets to the target device, so as to obtain a stress testing result of the stress testing object by stress testing the stress testing environment.

[0095] For the performance stress testing of a stress testing object, the performance stress testing device provided by the embodiments of the present application needs to determine the protocol type used by it. Different protocol types correspond to different target files, and the target file is used to describe the data structure of data packets conforming to the corresponding protocol types, that is, data packets conforming to the corresponding protocol types can be generated based on the target file. Obtain the target file corresponding to the protocol type of the stress testing object, so as to generate data packets conforming to the protocol type based on the target file, thereby performing performance stress testing on the stress testing object. It can be seen that the above stress testing process is applicable to stress testing objects of different protocol types, and the applicability of the stress testing process is relatively high. In addition, for the performance stress testing device provided by the embodiments of the present application, the environment of the stress testing object is separately deployed on the target device, and data packets are sent to the target device to implement stress testing on the stress testing object. Separately deploying the stress testing environment is beneficial to locating specific services, that is, beneficial to locating the services that cause performance problems, and improves the accuracy of determining the point where performance problems occur.

[0096] Based on the above embodiments, as a preferred implementation manner, the deployment module 200 includes:

[0097] Deployment unit, configured to deploy a stress testing environment on a target device based on an access service of the stress testing object;

[0098] Calculation unit, configured to obtain the number of users to be stress tested, and calculate a target main process number and a target slave process number corresponding to the stress testing object according to the number of users;

[0099] Allocation unit, configured to, if the target main process number is less than or equal to the number of idle main processes and the target slave process number is less than or equal to the number of idle slave processes, allocate main processes with the target main process number and slave processes with the target slave process number for the stress testing object; wherein, the slave processes are used to generate and send data packets to the target device, and the main processes are used to collect data information of the corresponding slave processes.

[0100] Based on the above embodiments, as a preferred implementation manner, the deployment unit includes:

[0101] A first deployment subunit, configured to deploy all access services of the stress test object on the target device;

[0102] An acquisition subunit, configured to acquire a configuration file corresponding to each deployed service on the target device, and determine a called service corresponding to each deployed service according to the load balancing parameters in the configuration file;

[0103] A second deployment subunit, configured to deploy all the called services on the target device.

[0104] Based on the above embodiments, as a preferred implementation manner, the stress test module 300 includes:

[0105] A determination unit, configured to determine a target account pool and generate a login state corresponding to each account information in the target account pool;

[0106] A generation unit, configured to, if the data packet requires a login state, select a target login state from all the login states by using the process, and generate a data packet conforming to the protocol type based on the target file and the target login state;

[0107] A sending unit, configured to send the data packet to the target device, so as to obtain a stress test result of the stress test object by stress testing the stress test environment.

[0108] Based on the above embodiments, as a preferred implementation manner, the sending unit includes:

[0109] A sending subunit, configured to send the data packet to the target device;

[0110] A calculation subunit, configured to calculate a stress test result item of the stress test object according to the data information collected by all the main processes; wherein, the stress test result item includes any one or any combination of response time, QPS, error rate, and resource utilization rate of each service.

[0111] Based on the above embodiments, as a preferred implementation manner, the sending unit further includes:

[0112] An analysis subunit, configured to, if the QPS is less than a second preset value, perform performance analysis according to the call relationship between the services and the resource utilization rate of each service, so as to determine the service with a performance bottleneck.

[0113] Based on the above embodiments, as a preferred implementation manner, the sending unit further includes:

[0114] A determination subunit, configured to determine, via a link, a failed service if the error rate is greater than a first preset value.

[0115] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.

[0116] This application also provides a server. Refer to Figure 13 , a structural diagram of a server 200 provided by an embodiment of this application, as Figure 13 shown, which may include a processor 21 and a memory 22.

[0117] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 may be implemented in at least one of the following hardware forms: DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may further include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.

[0118] The memory 22 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 22 may further include a high-speed random access memory and a non-volatile memory, such as one or more disk storage devices and flash storage devices. In this embodiment, the memory 22 is at least used to store the following computer program 221. After the computer program is loaded and executed by the processor 21, it can implement the relevant steps in the performance stress testing method executed by the server side disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 22 may further include an operating system 222 and data 223, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 222 may include Windows, Unix, Linux, etc.

[0119] In some embodiments, the server 200 may further include a display screen 23, an input / output interface 24, a communication interface 25, a sensor 26, a power supply 27, and a communication bus 28.

[0120] Of course, Figure 13 the structure of the server shown does not constitute a limitation on the server in the embodiments of the present application. In practical applications, the server may include more or fewer components than Figure 13 those shown, or combine certain components.

[0121] In another exemplary embodiment, there is also provided a computer-readable storage medium including program instructions that, when executed by a processor, implement the steps of the performance stress testing method performed by the server in any of the above embodiments.

[0122] The various embodiments in the specification are described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method part. It should be noted that for those of ordinary skill in the art in the technical field of the present application, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.

[0123] It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of another identical element in the process, method, article or device including the said element.

Claims

1. A performance stress testing method, characterized in that, applied to a server, the method includes: Determine the stress testing object and the protocol type corresponding to the stress testing object, and obtain the target file corresponding to the protocol type; wherein, the target file is used to describe the data structure of the data packet conforming to the protocol type; Based on the access service of the stress testing object, separately deploy a stress testing environment on the target device, and allocate processes for the stress testing object; wherein, the stress testing environment includes the access service and the calling service of the access service; Use the process to generate data packets conforming to the protocol type based on the target file, and send the data packets to the target device, so that the server can obtain the stress testing result of the stress testing object by stress testing the stress testing environment on the target device.

2. The performance stress testing method according to claim 1, characterized in that, Allocating processes for the stress testing object includes: Obtain the number of users to be stress tested, and calculate the target main process number and target slave process number corresponding to the stress testing object according to the number of users; If the target main process number is less than or equal to the number of idle main processes and the target slave process number is less than or equal to the number of idle slave processes, then allocate the main process of the target main process number and the slave process of the target slave process number for the stress testing object; wherein, the slave process is used to generate and send data packets to the target device, and the main process is used to collect the data information of the corresponding slave process.

3. The performance stress testing method according to claim 1, characterized in that, The separately deploying a stress testing environment on the target device based on the access service of the stress testing object includes: Deploy all access services of the stress testing object on the target device; Obtain the configuration file corresponding to each deployed service on the target device, and determine the calling service corresponding to each deployed service according to the load balancing parameters in the configuration file; Deploy all the calling services on the target device.

4. The performance stress testing method according to claim 1, characterized in that, The using the process to generate data packets conforming to the protocol type based on the target file includes: Determine the target account pool, and generate the login states corresponding to each account information in the target account pool; If the data packet requires a login state, then use the process to select a target login state from all the login states, and generate a data packet conforming to the protocol type based on the target file and the target login state.

5. The performance stress testing method according to claim 2, characterized in that, The obtaining the stress testing result of the stress testing object by stress testing the stress testing environment includes: Calculate the stress testing result items of the stress testing object according to the data information collected by all the main processes; wherein, the stress testing result items include any one or a combination of any several of response time, QPS, error rate, and resource utilization rate of each service.

6. The performance stress testing method according to claim 5, characterized in that, After calculating the stress testing result items of the stress testing object according to the data information collected by all the main processes, it further includes: If the QPS is less than a second preset value, perform performance analysis based on the call relationship between the services and the resource utilization rate of each service to determine the service with a performance bottleneck.

7. The performance stress testing method according to claim 5, characterized in that, after calculating the stress testing result item of the stress testing object according to the data information collected by all the main processes, further comprising: if the error rate is greater than a first preset value, determine the failed service through the link.

8. A performance stress testing device, characterized in that, applied to a server, the device includes: a determination module, configured to determine a stress testing object and a protocol type corresponding to the stress testing object, and obtain a target file corresponding to the protocol type; wherein, the target file is used to describe the data structure of a data packet conforming to the protocol type; a deployment module, configured to separately deploy a stress testing environment on a target device based on the access service of the stress testing object and allocate a process to the stress testing object; wherein, the stress testing environment includes the access service and the calling service of the access service; a stress testing module, configured to generate a data packet conforming to the protocol type based on the target file by using the process, and send the data packet to the target device, so that the server obtains the stress testing result of the stress testing object by stress testing the stress testing environment on the target device.

9. A server, characterized in that, comprising: a memory, configured to store a computer program; a processor, configured to implement the steps of the performance stress testing method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the performance stress testing method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Message generation method and device

    CN105915529A

  • Auxiliary system and method for carrying out pressure testing on server

    CN111078527A