


技术领域technical field
本申请涉及计算机技术领域,具体涉及服务器的性能测试方法、设备和计算机可读存储介质。The present application relates to the field of computer technology, and in particular, to a performance testing method, device, and computer-readable storage medium of a server.
背景技术Background technique
人工智能、大数据和云计算时代,提供算力服务的供应商越来越多,而算力是基于硬件的,用户对于生产环境采购硬件自行组装服务器或迁移到云上的需求越来越强烈。例如,生产环境在运行一段时间后,通常会遇到环境需要扩容,需要采购硬件的问题。在采购之前,通常需要评估现有服务器的性能,从而确定是否需要进行扩容,以及如何扩容等问题。In the era of artificial intelligence, big data and cloud computing, there are more and more suppliers providing computing power services, and computing power is based on hardware. Users have an increasingly strong demand for purchasing hardware for production environments to assemble servers or migrate to the cloud. . For example, after a production environment has been running for a period of time, it usually encounters problems that the environment needs to be expanded and hardware needs to be purchased. Before purchasing, it is usually necessary to evaluate the performance of existing servers to determine whether and how to expand capacity.
现有技术主要是使用压力测试工具(Jmeter或Loadrunner)对服务器进行性能测试,然而,一些项目的业务场景不满足测试条件,无法进行性能测试。The prior art mainly uses a stress testing tool (Jmeter or Loadrunner) to test the performance of the server. However, the business scenarios of some projects do not meet the test conditions, so the performance test cannot be performed.
发明内容SUMMARY OF THE INVENTION
本申请主要解决的技术问题是一些项目无法进行性能测试。The technical problem mainly solved by this application is that some projects cannot be tested for performance.
根据第一方面,一种实施例中提供一种服务器的性能测试方法,包括:According to a first aspect, an embodiment provides a performance testing method for a server, including:
根据第一初始并发线程数和第一步长设置待测试服务器的并发线程数,并以预设数量的服务请求对所述待测试服务器分别进行一次或多次性能测试,获取并发线程最高限定值;Set the number of concurrent threads of the server to be tested according to the first initial number of concurrent threads and the length of the first step, and perform one or more performance tests on the server to be tested with a preset number of service requests to obtain the maximum limit value of concurrent threads ;
根据所述并发线程最高限定值和所述第一步长,确定第二初始并发线程数,所述第二初始并发线程数比所述并发线程最高限定值小;According to the maximum limit value of the concurrent threads and the first step length, determine a second initial number of concurrent threads, where the second initial number of concurrent threads is smaller than the maximum limit value of the concurrent threads;
根据所述第二初始并发线程数和第二步长设置所述待测试服务器的并发线程数,以所述预设数量的服务请求对所述待测试服务器分别进行一次或多次性能测试,获取目标并发线程数和处理时长,所述第二步长小于所述第一步长;Set the number of concurrent threads of the server to be tested according to the second initial number of concurrent threads and the second step size, perform one or more performance tests on the server to be tested with the preset number of service requests, and obtain The target number of concurrent threads and the processing time, the second step size is smaller than the first step size;
根据所述目标并发线程数和处理时长,确定所述待测试服务器的每秒事务处理量。According to the target number of concurrent threads and the processing time, the transaction processing volume per second of the server to be tested is determined.
可选的,所述根据第一初始并发线程数和第一步长设置所述待测试服务器的并发线程数,并以预设数量的服务请求对所述待测试服务器分别进行一次或多次性能测试,获取并发线程最高限定值,包括:Optionally, the number of concurrent threads of the server to be tested is set according to the first initial number of concurrent threads and the length of the first step, and a preset number of service requests are performed on the server to be tested one or more times. Test, get the maximum limit value of concurrent threads, including:
设置所述待测试服务器的并发线程数为第一初始并发线程数,通过测试脚本向所述待测试服务器发送所述预设数量的服务请求以后,通过监听脚本监测所述待测试服务器的处理资源占用率和所述待测试服务器是否发生服务报错;Set the number of concurrent threads of the server to be tested as the first initial number of concurrent threads, after sending the preset number of service requests to the server to be tested through the test script, monitor the processing resources of the server to be tested through the monitoring script The occupancy rate and whether a service error occurs on the server to be tested;
若所述待测试服务器的处理资源占用率未达到预设阈值,且所述待测试服务器未发生服务报错,则将所述待测试服务器的并发线程数增加第一步长,返回执行所述通过测试脚本向所述待测试服务器发送所述预设数量的服务请求,直到所述待测试服务器的处理资源占用率达到所述预设阈值,或者所述待测试服务器发生服务报错,确定所述并发线程最高限定值是当前的所述待测试服务器的并发线程数;If the processing resource occupancy rate of the server to be tested does not reach the preset threshold, and no service error occurs on the server to be tested, increase the number of concurrent threads of the server to be tested by the first step, and return to executing the pass The test script sends the preset number of service requests to the server to be tested, until the processing resource occupancy rate of the server to be tested reaches the preset threshold, or the server to be tested reports a service error, determine the concurrent The maximum limit of threads is the current number of concurrent threads of the server to be tested;
若所述待测试服务器的处理资源占用率达到所述预设阈值,或者所述待测试服务器发生服务报错,则确定所述并发线程最高限定值是当前的待测试服务器的并发线程数。If the processing resource occupancy rate of the server to be tested reaches the preset threshold, or a service error occurs on the server to be tested, it is determined that the maximum limit of concurrent threads is the current number of concurrent threads of the server to be tested.
可选的,所述根据所述第二初始并发线程数和第二步长设置所述待测试服务器的并发线程数,以所述预设数量的服务请求对所述待测试服务器分别进行一次或多次性能测试,获取目标并发线程数和处理时长,包括:Optionally, the number of concurrent threads of the server to be tested is set according to the second initial number of concurrent threads and the second step size, and the server to be tested is performed once or separately with the preset number of service requests. Perform multiple performance tests to obtain the target number of concurrent threads and processing time, including:
设置所述待测试服务器的并发线程数为第二初始并发线程数,通过测试脚本向所述待测试服务器发送所述预设数量的服务请求以后,通过监听脚本监测所述待测试服务器的处理资源占用率和所述待测试服务器是否发生服务报错;Set the number of concurrent threads of the server to be tested as the second initial number of concurrent threads, after sending the preset number of service requests to the server to be tested through the test script, monitor the processing resources of the server to be tested through the monitoring script The occupancy rate and whether a service error occurs on the server to be tested;
若所述待测试服务器的处理资源占用率未达到预设阈值,且所述待测试服务器未发生服务报错,则将所述待测试服务器的并发线程数增加第二步长,返回执行所述通过测试脚本向所述待测试服务器发送所述预设数量的服务请求,直到所述待测试服务器的处理资源占用率达到所述预设阈值,或者所述待测试服务器发生服务报错,确定所述目标并发线程数是当前的所述待测试服务器的并发线程数,并获取所述处理时长;If the processing resource occupancy rate of the server to be tested does not reach the preset threshold, and no service error occurs on the server to be tested, increase the number of concurrent threads of the server to be tested by a second step, and return to executing the pass The test script sends the preset number of service requests to the server to be tested until the processing resource occupancy rate of the server to be tested reaches the preset threshold, or the server to be tested reports a service error, and the target is determined The number of concurrent threads is the current number of concurrent threads of the server to be tested, and the processing duration is obtained;
若所述待测试服务器的处理资源占用率达到所述预设阈值,或者所述待测试服务器发生服务报错,则确定所述目标并发线程数是当前的所述待测试服务器的并发线程数,并获取所述处理时长。If the processing resource occupancy rate of the server to be tested reaches the preset threshold, or a service error occurs on the server to be tested, determine that the target number of concurrent threads is the current number of concurrent threads of the server to be tested, and Get the processing duration.
可选的,所述根据所述并发线程最高限定值和所述第一步长,确定第二初始并发线程数,包括:Optionally, determining the second initial number of concurrent threads according to the maximum limit value of the concurrent threads and the first step length, including:
获取所述并发线程最高限定值与所述第一步长的差值,得到所述第二初始并发线程数。The difference between the maximum limit value of the concurrent threads and the first length is obtained to obtain the second initial number of concurrent threads.
可选的,所述根据所述并发线程最高限定值和所述第一步长,确定第二初始并发线程数之后,还包括:Optionally, after determining the second initial number of concurrent threads according to the maximum limit value of the concurrent threads and the first step length, the method further includes:
将所述第一初始并发线程数更新为所述第二初始并发线程数;updating the first initial number of concurrent threads to the second initial number of concurrent threads;
将所述第一步长更新为第二步长。The first step size is updated to the second step size.
可选的,所述将所述第一步长更新为第二步长之前,还包括:Optionally, before updating the first step size to the second step size, the method further includes:
在所述待测试服务器执行完所述服务请求以后,等待预设睡眠时长。After the server to be tested finishes executing the service request, wait for a preset sleep duration.
可选的,所述根据所述目标并发线程数和处理时长,确定所述待测试服务器的每秒事务处理量之后,还包括:Optionally, after determining the transaction volume per second of the server to be tested according to the target number of concurrent threads and the processing duration, the method further includes:
根据所述待测试服务器的每秒事务处理量和单位时间内的请求总数量,得到所需的待测试服务器的数量;Obtain the required number of servers to be tested according to the transaction processing volume per second of the servers to be tested and the total number of requests per unit time;
生成所述待测试服务器的性能和容量评估报告,其中所述性能和容量评估报告中包含:所述待测试服务器的每秒事务处理量和所述所需的待测试服务器的数量;Generating a performance and capacity evaluation report of the server to be tested, wherein the performance and capacity evaluation report includes: the transaction volume per second of the server to be tested and the required number of servers to be tested;
可选的,所述性能和容量评估报告中还包含:性能测试过程记录以及所述目标并发线程数。Optionally, the performance and capacity evaluation report further includes: a performance test process record and the target number of concurrent threads.
根据第二方面,一种实施例中提供一种服务器的性能测试设备,包括:According to a second aspect, an embodiment provides a performance testing device for a server, including:
存储器,用于存储程序;memory for storing programs;
处理器,用于通过执行所述存储器存储的程序以实现如第一方面中任一项所述的方法。A processor configured to implement the method according to any one of the first aspects by executing a program stored in the memory.
根据第三方面,一种服务器的性能测试系统,包括:待测试服务器和如第二方面的服务器的性能测试设备。According to a third aspect, a performance testing system for a server includes: a server to be tested and a performance testing device for the server according to the second aspect.
根据第四方面,一种实施例中提供一种计算机可读存储介质,所述介质上存储有程序,所述程序能够被处理器执行以实现如第一方面中任一项所述的方法。According to a fourth aspect, an embodiment provides a computer-readable storage medium on which a program is stored, and the program can be executed by a processor to implement the method according to any one of the first aspects.
依据上述实施例的服务器的性能测试方法、设备和计算机可读存储介质,根据第一初始并发线程数和第一步长设置待测试服务器的并发线程数,并以预设数量的服务请求对待测试服务器分别进行一次或多次性能测试,获取并发线程最高限定值;根据并发线程最高限定值和第一步长,确定第二初始并发线程数,第二初始并发线程数比并发线程最高限定值小,从而通过第一轮性能测试确定待测试服务器的并发线程数所属的区间,根据第二初始并发线程数和第二步长设置待测试服务器的并发线程数,以预设数量的服务请求对待测试服务器分别进行一次或多次性能测试,获取目标并发线程数和处理时长,第二步长小于第一步长,从而通过第二轮性能测试通过对步长和并发线程数的调整,确定目标并发线程数和处理时长,根据目标并发线程数和处理时长,确定待测试服务器的每秒事务处理量,使得本方案可以应用于多种场景,用户仅需进行简单设置即可实现自动调参,测试过程是完全自动化的,非专业人员也可以快速上手,针对现场服务器的测试结果更有价值,使得本方案可以脱离实验室环境以及对专业测试人员的依赖,并获得想要的服务器性能指标,节省了大量压测的时间。实现如项目迁移到云资源、采购服务器等预估场景下的服务器性能自动化、快速分析,节约人力成本,提高了测试效率。According to the performance testing method, device and computer-readable storage medium of the server according to the above-mentioned embodiment, the number of concurrent threads of the server to be tested is set according to the first initial number of concurrent threads and the first step length, and the number of service requests to be tested is to be tested with a preset number of The server performs one or more performance tests respectively to obtain the maximum limit of concurrent threads; according to the maximum limit of concurrent threads and the length of the first step, the second initial number of concurrent threads is determined, and the second initial number of concurrent threads is smaller than the maximum limit of concurrent threads , so that the interval to which the number of concurrent threads of the server to be tested belongs is determined through the first round of performance testing, the number of concurrent threads of the server to be tested is set according to the second initial number of concurrent threads and the second step size, and the number of concurrent threads of the server to be tested is set with a preset number of service requests. The server performs one or more performance tests respectively to obtain the target number of concurrent threads and processing time. The second step size is smaller than the first step, so that the target concurrency is determined by adjusting the step size and the number of concurrent threads through the second round of performance tests. The number of threads and processing time. According to the target number of concurrent threads and processing time, the transaction processing volume per second of the server to be tested is determined, so that this solution can be applied to various scenarios. Users only need to make simple settings to realize automatic parameter adjustment and test. The process is fully automated, and non-professionals can quickly get started. The test results for on-site servers are more valuable, so that this solution can be separated from the laboratory environment and the dependence on professional testers, and obtain the desired server performance indicators, saving A lot of stress testing time. It realizes automatic and rapid analysis of server performance in estimated scenarios such as project migration to cloud resources and procurement of servers, saving labor costs and improving test efficiency.
附图说明Description of drawings
图1为本申请实施例提供的一种服务器的性能测试方法的流程示意图;1 is a schematic flowchart of a method for testing performance of a server according to an embodiment of the present application;
图2为本申请实施例提供的另一种服务器的性能测试方法的流程示意图;2 is a schematic flowchart of another performance testing method of a server provided by an embodiment of the present application;
图3为本申请实施例提供的一种服务器的性能测试系统的结构示意图。FIG. 3 is a schematic structural diagram of a performance testing system for a server according to an embodiment of the present application.
具体实施方式Detailed ways
下面通过具体实施方式结合附图对本申请作进一步详细说明。其中不同实施方式中类似元件采用了相关联的类似的元件标号。在以下的实施方式中,很多细节描述是为了使得本申请能被更好的理解。然而,本领域技术人员可以毫不费力的认识到,其中部分特征在不同情况下是可以省略的,或者可以由其他元件、材料、方法所替代。在某些情况下,本申请相关的一些操作并没有在说明书中显示或者描述,这是为了避免本申请的核心部分被过多的描述所淹没,而对于本领域技术人员而言,详细描述这些相关操作并不是必要的,他们根据说明书中的描述以及本领域的一般技术知识即可完整了解相关操作。The present application will be further described in detail below through specific embodiments in conjunction with the accompanying drawings. Wherein similar elements in different embodiments have used associated similar element numbers. In the following embodiments, many details are described so that the present application can be better understood. However, those skilled in the art will readily recognize that some of the features may be omitted under different circumstances, or may be replaced by other elements, materials, and methods. In some cases, some operations related to the present application are not shown or described in the specification, in order to avoid the core part of the present application from being overwhelmed by excessive description, and for those skilled in the art, these are described in detail. The relevant operations are not necessary, and they can fully understand the relevant operations according to the descriptions in the specification and general technical knowledge in the field.
另外,说明书中所描述的特点、操作或者特征可以以任意适当的方式结合形成各种实施方式。同时,方法描述中的各步骤或者动作也可以按照本领域技术人员所能显而易见的方式进行顺序调换或调整。因此,说明书和附图中的各种顺序只是为了清楚描述某一个实施例,并不意味着是必须的顺序,除非另有说明其中某个顺序是必须遵循的。Additionally, the features, acts, or characteristics described in the specification may be combined in any suitable manner to form various embodiments. At the same time, the steps or actions in the method description can also be exchanged or adjusted in order in a manner obvious to those skilled in the art. Therefore, the various sequences in the specification and drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a necessary order unless otherwise stated, a certain order must be followed.
本文中为部件所编序号本身,例如“第一”、“第二”等,仅用于区分所描述的对象,不具有任何顺序或技术含义。而本申请所说“连接”、“联接”,如无特别说明,均包括直接和间接连接(联接)。The serial numbers themselves, such as "first", "second", etc., for the components herein are only used to distinguish the described objects, and do not have any order or technical meaning. The "connection" and "connection" mentioned in this application, unless otherwise specified, include both direct and indirect connections (connections).
人工智能、大数据和云计算时代,提供算力服务的供应商越来越多,而算力是基于硬件的,用户对于生产环境采购硬件自行组装服务器或迁移到云上的需求越来越强烈。例如,生产环境在运行一段时间后,通常会遇到环境需要扩容,需要采购硬件的问题。在采购之前,通常需要评估现有服务器的性能,从而确定是否需要进行扩容,以及如何扩容等问题。In the era of artificial intelligence, big data and cloud computing, there are more and more suppliers providing computing power services, and computing power is based on hardware. Users have an increasingly strong demand for purchasing hardware for production environments to assemble servers or migrate to the cloud. . For example, after a production environment has been running for a period of time, it usually encounters problems that the environment needs to be expanded and hardware needs to be purchased. Before purchasing, it is usually necessary to evaluate the performance of existing servers to determine whether and how to expand capacity.
现有技术主要是使用压力测试工具(Jmeter或Loadrunner)对服务器进行性能测试,然而,一些项目的业务场景不满足测试条件,无法进行性能测试。还有些项目现场缺少专业测试人员,很难开展容量评估。另外,针对标配服务器的性能测试结果仅代表实验室,无法代表生产环境服务器性能和容量。因此,现有实验室的测试方式并不能满足当前对服务器进行性能测试评估的需求。The prior art mainly uses a stress testing tool (Jmeter or Loadrunner) to test the performance of the server. However, the business scenarios of some projects do not meet the test conditions, so the performance test cannot be performed. There are also some project sites that lack professional testers, making it difficult to carry out capacity assessments. In addition, the performance test results for the standard servers only represent the laboratory and cannot represent the server performance and capacity of the production environment. Therefore, the testing methods of the existing laboratories cannot meet the current demand for performance testing and evaluation of servers.
本申请实施例提供一种服务器的性能测试方法、设备和计算机可读存储介质,通过第一轮性能测试确定待测试服务器的并发线程数所属的区间,第二轮性能测试通过对步长和并发线程数的调整,确定目标并发线程数和处理时长,使得本方案可以脱离实验室环境以及对专业测试人员的依赖,实现如项目迁移到云资源、采购服务器等预估场景下的服务器性能自动化、快速分析,节约人力成本,提高了测试效率。Embodiments of the present application provide a performance testing method, device, and computer-readable storage medium for a server. The interval to which the number of concurrent threads of the server to be tested belongs is determined through the first round of performance testing, and the second round of performance testing Adjust the number of threads, determine the target number of concurrent threads and processing time, so that this solution can be separated from the laboratory environment and the dependence on professional testers, and realize the automation of server performance in estimated scenarios such as project migration to cloud resources, procurement of servers, etc. Rapid analysis saves labor costs and improves test efficiency.
下面以具体的实施例进行详细说明。The following describes in detail with specific embodiments.
请参考图1,图1为本申请实施例提供的一种服务器的性能测试方法的流程示意图,本实施例的方法由待测试服务器或者与待测试服务器连接的设备执行,其中,本实施例是通过自动化测试脚本实现的。本实施例提供的方法包括:Please refer to FIG. 1. FIG. 1 is a schematic flowchart of a method for testing performance of a server according to an embodiment of the present application. The method in this embodiment is executed by the server to be tested or a device connected to the server to be tested. Implemented through automated test scripts. The method provided by this embodiment includes:
步骤11:根据第一初始并发线程数和第一步长设置待测试服务器的并发线程数,并以对待测试服务器分别进行一次或多次性能测试,获取并发线程最高限定值。Step 11: Set the number of concurrent threads of the server to be tested according to the first initial number of concurrent threads and the first step length, and perform one or more performance tests on the server to be tested to obtain the maximum limit of concurrent threads.
其中,第一初始并发线程数为预先设置的大于0的整数,可以根据待测试服务器可以处理的实际并发线程数进行设置,需要说明的是第一初始并发线程数不宜设置的过小,第一初始并发线程数设置过小将使得测试时间增加,第一初始并发线程数设置过大,可能给测试准确性带来影响,示例性的,第一初始并发线程数可以为10或者20,本申请对此不做限定。The first initial number of concurrent threads is a preset integer greater than 0, which can be set according to the actual number of concurrent threads that can be handled by the server to be tested. It should be noted that the first initial number of concurrent threads should not be set too small. If the initial number of concurrent threads is set too small, the test time will increase. If the first initial number of concurrent threads is set too large, it may affect the test accuracy. Exemplarily, the first initial number of concurrent threads may be 10 or 20. This is not limited.
其中,第一步长为预先设置的大于0的整数,示例性的,第一步长可以为10。The first step length is a preset integer greater than 0. Exemplarily, the first step length may be 10.
其中,预设数量为预先设置的服务请求的数量,可以是根据服务器实际处理的服务请求进行设置的,例如,可以设置为10000或者20000等,对此本申请不做限制。The preset number is the preset number of service requests, which may be set according to the service requests actually processed by the server, for example, may be set to 10,000 or 20,000, which is not limited in this application.
其中,性能测试即为向待测试服务器同时发送预设数量的服务请求,并测试待测试服务器的处理性能情况。本申请中,性能测试也可以称为压力测试,或者简称为压测。The performance test is to send a preset number of service requests to the server to be tested at the same time, and to test the processing performance of the server to be tested. In this application, the performance test may also be referred to as a stress test, or simply referred to as a stress test.
其中,并发线程最高限定值大于等于待测试服务器的最大并发线程数。The maximum limit of concurrent threads is greater than or equal to the maximum number of concurrent threads of the server to be tested.
本步骤11中为进行的第一轮性能测试,该轮性能测试中可以包括一次或者多次性能测试过程,每次进行性能测试前,需要根据第一初始并发线程数和第一步长设置待测试服务器的并发线程数。其中,第一次性能测试,可以将待测试服务器的并发线程数设置为第一初始并发线程数,在之后的每次性能测试前,均将并发线程数增加第一步长。This
每次性能测试均向待测试服务器发送预设数量的服务请求,并监测待测试服务器的处理性能情况,直到得到并发线程最高限定值。In each performance test, a preset number of service requests are sent to the server to be tested, and the processing performance of the server to be tested is monitored until the maximum limit of concurrent threads is obtained.
步骤12:根据并发线程最高限定值和第一步长,确定第二初始并发线程数。Step 12: Determine the second initial number of concurrent threads according to the maximum limit value of concurrent threads and the length of the first step.
其中,第二初始并发线程数比并发线程最高限定值小。Wherein, the second initial number of concurrent threads is smaller than the maximum limit value of concurrent threads.
步骤13:根据第二初始并发线程数和第二步长设置待测试服务器的并发线程数,以预设数量的服务请求对待测试服务器分别进行一次或多次性能测试,获取目标并发线程数和处理时长。Step 13: Set the number of concurrent threads of the server to be tested according to the second initial number of concurrent threads and the second step size, perform one or more performance tests on the server to be tested with a preset number of service requests, and obtain the target number of concurrent threads and processing duration.
其中,目标并发线程数用于指示待测试服务器的最大并发线程数。The target number of concurrent threads is used to indicate the maximum number of concurrent threads of the server to be tested.
其中,处理时长为最后一次进行性能测试所用的总时长,即获取到目标并发线程数的性能测试所用的总时长,该总时长是指待测试服务器从该次性能测试开始直到服务器处理完该次性能测试的预设数量的服务请求之间的时长。Among them, the processing time is the total time used for the last performance test, that is, the total time used for the performance test to obtain the target number of concurrent threads. The time period between a preset number of service requests for a performance test.
其中,本轮性能测试需要确定目标并发线程数,因此第二步长小于第一步长。例如,第二步长可以为1。Among them, this round of performance testing needs to determine the target number of concurrent threads, so the second step size is smaller than the first step size. For example, the second step size can be 1.
步骤14:根据目标并发线程数和处理时长,确定待测试服务器的每秒事务处理量(Transaction Per Second,简称TPS)。Step 14: Determine the transaction per second (Transaction Per Second, TPS for short) of the server to be tested according to the target number of concurrent threads and the processing time.
将目标并发线程数除以处理时长,得到待测试服务器的每秒事务处理量。其中,待测试服务器的每秒事务处理量为目标并发线程数与处理时长之间的商。Divide the target number of concurrent threads by the processing time to get the number of transactions per second for the server under test. The transaction processing volume per second of the server to be tested is the quotient between the target number of concurrent threads and the processing time.
其中,每秒事务处理量也可以称为每秒吞吐量,是指单位时间内处理实务的数量。Among them, the transaction volume per second can also be called the throughput per second, which refers to the number of transactions processed per unit time.
可选的,每秒事务处理量的单位可以是事务数/秒。Optionally, the unit of transactions per second may be transactions per second.
本实施例,根据第一初始并发线程数和第一步长设置待测试服务器的并发线程数,并以预设数量的服务请求对待测试服务器分别进行一次或多次性能测试,获取并发线程最高限定值;根据并发线程最高限定值和第一步长,确定第二初始并发线程数,第二初始并发线程数比并发线程最高限定值小,从而通过第一轮性能测试确定待测试服务器的并发线程数所属的区间,根据第二初始并发线程数和第二步长设置待测试服务器的并发线程数,以预设数量的服务请求对待测试服务器分别进行一次或多次性能测试,获取目标并发线程数和处理时长,第二步长小于第一步长,从而通过第二轮性能测试通过对步长和并发线程数的调整,确定目标并发线程数和处理时长,根据目标并发线程数和处理时长,确定待测试服务器的每秒事务处理量,使得本方案可以应用于多种场景,用户仅需进行简单设置即可实现自动调参,测试过程是完全自动化的,非专业人员也可以快速上手,针对现场服务器的测试结果更有价值,使得本方案可以脱离实验室环境以及对专业测试人员的依赖,并获得想要的服务器性能指标,节省了大量压测的时间。实现如项目迁移到云资源、采购服务器等预估场景下的服务器性能自动化、快速分析,节约人力成本,提高了测试效率。In this embodiment, the number of concurrent threads of the server to be tested is set according to the first initial number of concurrent threads and the length of the first step, and one or more performance tests are performed on the server to be tested with a preset number of service requests, and the maximum limit of concurrent threads is obtained. value; according to the maximum limit value of concurrent threads and the length of the first step, determine the second initial number of concurrent threads, and the second initial number of concurrent threads is smaller than the maximum limit value of concurrent threads, so as to determine the concurrent threads of the server to be tested through the first round of performance testing Set the number of concurrent threads of the server to be tested according to the second initial number of concurrent threads and the second step size, perform one or more performance tests on the server to be tested with a preset number of service requests, and obtain the target number of concurrent threads and processing time, the second step length is smaller than the first step length, so through the second round of performance testing, the target concurrent thread number and processing time are determined by adjusting the step size and the number of concurrent threads. According to the target number of concurrent threads and processing time, Determine the transaction processing volume per second of the server to be tested, so that this solution can be applied to a variety of scenarios. Users only need to perform simple settings to achieve automatic parameter adjustment. The test process is completely automated, and non-professionals can quickly get started. The test results of the on-site server are more valuable, so that this solution can be separated from the laboratory environment and the dependence on professional testers, and obtain the desired server performance indicators, saving a lot of stress testing time. It realizes automatic and rapid analysis of server performance in estimated scenarios such as project migration to cloud resources and procurement of servers, saving labor costs and improving test efficiency.
在一些场景中,通常压测是在测试环境中开展,需要1-4周完成。本申请实施例提供的方法可以直接在生产环境中进行压测,可以通过脚本部署及测试执行就可完成测试,可以尽快向客户提供硬件性能参数评估报告或者已有服务器的性能参数报告,可以省掉测试计划(当天就可以完成任务),测试设计、输出专业的压测报告等步骤。下面具体说明。In some scenarios, stress testing is usually carried out in a test environment and takes 1-4 weeks to complete. The method provided by the embodiment of the present application can directly perform pressure testing in a production environment, and can complete the test through script deployment and test execution, and can provide customers with a hardware performance parameter evaluation report or a performance parameter report of an existing server as soon as possible. Drop the test plan (the task can be completed on the same day), test design, output professional stress test report and other steps. The specific description is given below.
在上述实施例的基础上,进一步地,上述对待测试服务器的测试过程可以通过至少一个脚本实现。自动化运行脚本即可自动化完成性能测试。On the basis of the above-mentioned embodiment, further, the above-mentioned testing process of the server to be tested can be implemented by at least one script. Automatically run scripts to automate performance testing.
示例性的,脚本可以包括但不限于:压测工具的面向对象的(python)脚本1和python脚本2,其中,python脚本1用于超文本传输协议(Hyper Text Transfer Protocol,简称HTTP)的并发请求,python脚本2可以包含监听程序,用于检测每轮服务请求何时完成。Exemplarily, the scripts may include, but are not limited to: an object-oriented (python) script 1 and a python script 2 of the stress testing tool, where the python script 1 is used for the concurrency of the Hyper Text Transfer Protocol (Hyper Text Transfer Protocol, HTTP for short). requests, the python script 2 can contain listeners to detect when each round of service requests is complete.
脚本还可以包括但不限于:开发压测工具的计算机壳(shell)脚本1、shell脚本2和shell脚本3。其中,shell脚本1可以用于初始化参数设置、新建设备,shell脚本2可以用于调用命令执行python脚本1和python脚本2,shell脚本3可以用于定时任务统计日志中每轮解析的图片时间、张数。The scripts may also include, but are not limited to: a computer shell (shell) script 1 , a shell script 2 and a shell script 3 for developing a pressure measurement tool. Among them, shell script 1 can be used to initialize parameter settings and create new devices, shell script 2 can be used to invoke commands to execute python script 1 and python script 2, and shell script 3 can be used to count the image time, number of sheets.
进一步地,本实施例提供的方法,在执行步骤11之前还可以包括步骤10:Further, before performing
步骤10:将开发脚本部署在生产环境中。Step 10: Deploy the development script in the production environment.
进一步地,本实施例提供的方法,在执行步骤10之前还可以包括步骤:开发脚本。Further, before performing step 10, the method provided in this embodiment may further include the step of: developing a script.
在图1所示实施例的基础上,进一步地,步骤11可以通过如下步骤111-步骤116实现:On the basis of the embodiment shown in FIG. 1, further, step 11 can be implemented by the following steps 111-116:
步骤111:设置待测试服务器的并发线程数为第一初始并发线程数。Step 111: Set the number of concurrent threads of the server to be tested as the first initial number of concurrent threads.
步骤112:通过测试脚本向待测试服务器发送预设数量的服务请求。Step 112: Send a preset number of service requests to the server to be tested through the test script.
步骤113:通过监听脚本监测待测试服务器的处理资源占用率和待测试服务器是否发生服务报错。Step 113: Monitor the processing resource occupancy rate of the server to be tested and whether a service error occurs in the server to be tested through the monitoring script.
其中,处理资源是指服务器的用于算力服务的处理资源,也可以称为计算资源,处理资源可以是指待测试服务器中的处理器资源,例如,可以为中央处理器(centralprocessing unit,简称CPU)或者图形处理器(graphics processing unit,简称GPU)等。The processing resources refer to the processing resources of the server used for computing power services, which may also be referred to as computing resources, and the processing resources may refer to the processor resources in the server to be tested, for example, may be a central processing unit (central processing unit, referred to as abbreviated as the central processing unit). CPU) or graphics processing unit (graphics processing unit, GPU for short).
需要说明的是,通常发送预设数量的服务请求给待测试服务器,可能对待测试服务器形成浪涌请求,因此,待测试服务器可能会发生服务报错。It should be noted that a preset number of service requests are usually sent to the server to be tested, which may form a surge request to the server to be tested. Therefore, the server to be tested may report a service error.
可选的,待测试服务器是否发生服务报错可以通过对待测试服务器的当前页面、后台或者日志中获取到。例如,可以通过nmon对待测试服务器测试其处理资源占用率,nmon可以进行图形化分析,对每次性能测试的结果进行阶梯状变化的呈现。Optionally, whether a service error occurs on the server to be tested can be obtained from the current page, background or log of the server to be tested. For example, the processing resource occupancy rate of the server to be tested can be tested by nmon, and nmon can perform graphical analysis to present the results of each performance test in a step-like manner.
步骤114:判断待测试服务器的处理资源占用率是否达到预设阈值,或者,待测试服务器是否发生服务报错。Step 114: Determine whether the processing resource occupancy rate of the server to be tested reaches a preset threshold, or whether a service error occurs on the server to be tested.
其中,预设阈值为预先设置的,可以为大于等于90%且小于等于100%的值。待测试服务器的处理资源占用率达到预设阈值,可以认为待测试服务器压满。The preset threshold is a preset value, which may be a value greater than or equal to 90% and less than or equal to 100%. When the processing resource occupancy rate of the server to be tested reaches a preset threshold, it can be considered that the server to be tested is full.
若是,则继续执行步骤115;若否,则继续执行步骤116。If yes, go to step 115; if not, go to step 116.
步骤115:确定并发线程最高限定值是当前的待测试服务器的并发线程数。Step 115: Determine that the maximum limit of concurrent threads is the current number of concurrent threads of the server to be tested.
其中,并发线程最高限定值大于等于并发线程的最大值。Among them, the maximum limit value of concurrent threads is greater than or equal to the maximum value of concurrent threads.
步骤116:将待测试服务器的并发线程数增加第一步长。Step 116: Increase the number of concurrent threads of the server to be tested by a first step.
返回执行步骤112。Return to step 112.
本实施例中,将待测试服务器的并发线程数设置为第一初始并发线程数,想待测试服务器发送预设数量的服务请求,服务器在处理该预设数量的服务请求时,会根据当前设置的第一初始并发线程数来启动线程进行处理。此时可以实时或者以预设周期检测待测试服务器的处理资源占用率,并且查看待测试服务器是否报错,从而确定待测试服务器是否达到压满状态。如果没有达到压满状态,则将待测试服务器的并发线程数增加第一步长,再对待测试服务器发送预设数量的服务请求,直到待测试服务器的处理资源占用率达到预设阈值或者,待测试服务器发生服务报错。In this embodiment, the number of concurrent threads of the server to be tested is set as the first initial number of concurrent threads. If the server to be tested sends a preset number of service requests, the server will process the preset number of service requests according to the current settings. The first initial number of concurrent threads to start threads for processing. At this time, the processing resource occupancy rate of the server to be tested can be detected in real time or at a preset period, and it is checked whether the server to be tested reports an error, so as to determine whether the server to be tested has reached a full state. If it does not reach the full state, increase the number of concurrent threads of the server to be tested by the first step, and then send a preset number of service requests to the server to be tested until the processing resource occupancy rate of the server to be tested reaches the preset threshold or A service error occurred on the test server.
下面举例说明本实施例的方法,性能测试前开启nmon定时抓取日志,从压测脚本配置并发线程数为20,并发线程数的第一步长设置为10个,每次以10000个服务请求发送给待测试服务器从而进行性能测试,并发线程数在执行一段时间后再增加到30、40、50……,继续加压,直到并发线程数为60时,CPU资源占用趋于稳定,即CPU资源占用率达到90%,则并发线程最高限定值为60。The following example illustrates the method of this embodiment. Before the performance test, nmon is enabled to periodically capture logs, the number of concurrent threads is configured from the stress test script to 20, the first step of the number of concurrent threads is set to 10, and 10,000 service requests are made each time. Send it to the server to be tested for performance testing. The number of concurrent threads will be increased to 30, 40, 50 after a period of execution, and continue to pressurize until the number of concurrent threads reaches 60, and the CPU resource usage tends to stabilize, that is, the CPU When the resource occupancy rate reaches 90%, the maximum limit of concurrent threads is 60.
在上述实施例的基础上,进一步地,步骤13可以通过如下步骤131-步骤136实现:On the basis of the above embodiment, further, step 13 can be implemented by the following steps 131-136:
步骤131:设置待测试服务器的并发线程数为第二初始并发线程数。Step 131: Set the number of concurrent threads of the server to be tested as the second initial number of concurrent threads.
步骤132:通过测试脚本向待测试服务器发送预设数量的服务请求。Step 132: Send a preset number of service requests to the server to be tested through the test script.
步骤133:通过监听脚本监测待测试服务器的处理资源占用率和待测试服务器是否发生服务报错.Step 133: Monitor the processing resource occupancy rate of the server to be tested and whether a service error occurs on the server to be tested through the monitoring script.
步骤134:判断待测试服务器的处理资源占用率是否达到预设阈值,或者,待测试服务器是否发生服务报错。Step 134: Determine whether the processing resource occupancy rate of the server to be tested reaches a preset threshold, or whether a service error occurs on the server to be tested.
若是,则继续执行步骤135;若否,则继续执行步骤136。If yes, go to step 135; if not, go to step 136.
步骤135:确定目标并发线程数是当前的待测试服务器的并发线程数,并获取处理时长。Step 135: Determine that the target number of concurrent threads is the current number of concurrent threads of the server to be tested, and obtain the processing time.
步骤136:将待测试服务器的并发线程数增加第二步长。Step 136: Increase the number of concurrent threads of the server to be tested by a second step.
返回执行步骤132。Return to step 132.
本实施例的步骤131-步骤136与上述步骤111-步骤116的实现原理和效果类似,此处不再赘述。The implementation principles and effects of steps 131 to 136 in this embodiment are similar to those of the foregoing steps 111 to 116 , and details are not repeated here.
下面举例说明本实施例的方法,第二次执行脚本工具获得峰值,具体的,并发线程数是每次进行性能测试前增加第二步长,假设第二步长为1,执行并发线程数51、52、53……继续加压,假设直到55个压满,CPU资源占用趋于稳定,则目标并发线程数是55,并发线程数设置为55时的执行完发送给待测试服务器的10000个服务请求的时长即为处理时长。The method of this embodiment is illustrated below. The peak value is obtained by executing the script tool for the second time. Specifically, the number of concurrent threads is increased by a second step size before each performance test. Assume that the second step size is 1, and the number of concurrent threads is 51. , 52, 53... Continue to pressurize, assuming that until 55 are full, the CPU resource usage tends to be stable, then the target number of concurrent threads is 55, and when the number of concurrent threads is set to 55, the 10,000 sent to the server to be tested are executed after execution. The duration of the service request is the processing duration.
在上述实施例的基础上,步骤12可以通过如下步骤121实现:On the basis of the above embodiment, step 12 can be implemented by the following step 121:
步骤121:获取并发线程最高限定值与第一步长的差值,得到第二初始并发线程数。Step 121: Obtain the difference between the maximum limit value of concurrent threads and the length of the first step to obtain the second initial number of concurrent threads.
由步骤11的执行过程可知,目标并发线程数所属的数值区间范围是大于等于在步骤11中的性能测试过程中并发线程最高限定值的上一个并发线程数,且小于等于并发线程最高限定值。由于每次测试前均将并发线程数增加了第一步长,因此,该并发线程最高限定值的上一个并发线程数是并发线程最高限定值与第一步长的差值。可以将该差值确定为第二初始并发线程数,也就是将该差值作为步骤13中进行性能测试的并发线程数的初始值,从而进行步骤13中的第二轮性能测试。It can be seen from the execution process of
在一些实施例中,步骤11和步骤13通过不同的脚本实现,在另外一些实施例中,步骤11和步骤13可以通过相同的脚本实现。In some embodiments,
如果步骤11和步骤13由相同的脚本实现,则在执行完步骤11以后,也就是在执行完第一轮性能测试以后,需要对脚本中的参数进行调整,从而执行步骤13,也就是执行第二轮性能测试。下面以具体的实施例进行详细说明。If
在上述任一实施例的基础上,进一步地,在步骤12之后还可以包括如下步骤12a和步骤12b:On the basis of any of the above embodiments, further, after
步骤12a:将第一初始并发线程数更新为第二初始并发线程数。Step 12a: Update the first initial number of concurrent threads to the second initial number of concurrent threads.
步骤12b:将第一步长更新为第二步长。Step 12b: Update the first step size to the second step size.
可以理解,步骤12a和步骤12b的执行没有先后顺序。It can be understood that there is no sequence in the execution of step 12a and step 12b.
本实施例,通过将脚本中的参数进行调整,从而使用相同的脚本可以完成性能测试,提高了测试开发的效率。In this embodiment, by adjusting the parameters in the script, the performance test can be completed by using the same script, which improves the efficiency of test development.
进一步地,在步骤12b之前还可以包括如下步骤:Further, before step 12b, the following steps may also be included:
在待测试服务器执行完服务请求以后,等待预设睡眠时长。After the server to be tested finishes executing the service request, wait for the preset sleep duration.
其中,预设睡眠时长为预先设定的时长,可以通过脚本执行,例如,可以为6000微秒,设置为6000微秒通常可以使得处理资源完全空闲。The preset sleep duration is a preset duration, which can be executed through a script, for example, it can be 6000 microseconds, and setting to 6000 microseconds can generally make the processing resources completely idle.
本实施例中,检测待测试服务器是否执行完成第一轮性能测试中发送的预设数量的服务请求,如果检测到已经完成了相应的预设数量的服务请求,则等待预设睡眠时长,得到已经完全空闲的处理资源,此时可以进行第二轮性能测试了,提高了测试结果的准确性。In this embodiment, it is detected whether the server to be tested has completed the preset number of service requests sent in the first round of performance testing, and if it is detected that the corresponding preset number of service requests have been completed, wait for the preset sleep duration to obtain The processing resources have been completely idle, and the second round of performance testing can be performed at this time, which improves the accuracy of the test results.
在一些场景中,生产环境在运行一段时间后,通常会遇到环境需要扩容,需要采购硬件的问题。在采购之前,用户通常会咨询提供算法的厂商,如何评估服务器的性能够不够。提供算力服务的供应商会被客户要求尽快提供硬件性能参数评估报告或者已有服务器的性能测试报告。现场缺少专业测试人员,也就无法完成输出性能测试报告方面的工作。即使有专业测试人员,也需要花费较长的时间(通常中等规模的项目1人需要1~4周)进行压力测试和输出测试报告,测试效率低,耗费人力成本。In some scenarios, after the production environment runs for a period of time, it usually encounters the problem that the environment needs to be expanded and hardware needs to be purchased. Before purchasing, users usually consult the vendor that provides the algorithm, how to evaluate the performance of the server. Providers of computing power services will be requested by customers to provide hardware performance parameter evaluation reports or performance test reports of existing servers as soon as possible. The lack of professional testers on site makes it impossible to complete the work of outputting performance test reports. Even if there are professional testers, it takes a long time (usually one person for a medium-scale project takes 1 to 4 weeks) to perform stress testing and output test reports, which results in low testing efficiency and labor costs.
本申请中将性能测试报告也称为性能和容量评估报告。为解决上述问题,本实施例提供的方法能够生成性能和容量评估报告。下面以具体的实施例进行详细说明。The performance test report is also referred to as a performance and capacity evaluation report in this application. To solve the above problem, the method provided in this embodiment can generate a performance and capacity evaluation report. The following describes in detail with specific embodiments.
在上述任一实施例的基础上,进一步地,步骤14之后还可以包括如下步骤15-步骤16:On the basis of any of the above embodiments, further, after
步骤15:根据待测试服务器的每秒事务处理量和单位时间内的请求总数量,得到所需的待测试服务器的数量。Step 15: Obtain the required number of servers to be tested according to the transaction processing volume per second of the servers to be tested and the total number of requests per unit time.
可选的,单位时间内的请求总数量除以待测试服务器的每秒事务处理量,可以得到所需的待测试服务器的数量。Optionally, the required number of servers to be tested can be obtained by dividing the total number of requests per unit time by the transaction processing volume per second of the server to be tested.
下面以服务请求为图片分析处理服务来举例说明。一方面测试接入不同TPS(事务数/秒)下智能发现分析引擎对图片分析处理性能,另一方面记录最高性能时系统资源占用情况。根据获得的并发线程数峰值,对应每轮平均TPS,假设现场每天2000万数据解析(在不打折的情况下),同时至少需要多少台服务器进行解析。假如当前项目所使用的型号的服务器(待测试服务器)的TPS=50个/秒,假设1个请求包含3张图片,则每天同型号服务器的图片解析数量在3*50*14400=2160,000(张),假设扩容后每天的处理事务的总数量是2000万个,则不考虑热备机、最大负载打70%等情况下,需要20,000,000/2160,000=10台(9.26向上取整为10)同型号服务器。从而根据现有的同型号服务器数量,可以推算出需要采购的服务器或者要新增的云节点数量。The following takes the service request as an image analysis and processing service as an example to illustrate. On the one hand, it tests the image analysis and processing performance of the intelligent discovery analysis engine under different TPS (transactions per second), and on the other hand, records the system resource occupancy at the highest performance. According to the peak number of concurrent threads obtained, corresponding to the average TPS of each round, it is assumed that 20 million data are parsed on-site per day (without discounts), and at least how many servers are required for parsing at the same time. Assuming that the TPS of the server of the current project (the server to be tested) is 50 per second, and assuming that one request contains 3 images, the number of images parsed by the same type of server every day is 3*50*14400=2160,000 (Zhang), assuming that the total number of transactions processed per day after the expansion is 20 million, 20,000,000/2160,000 = 10 units (9.26 Round up to 10) Servers of the same model. Therefore, according to the existing number of servers of the same type, it is possible to calculate the number of servers to be purchased or the number of new cloud nodes to be added.
步骤16:生成待测试服务器的性能和容量评估报告。Step 16: Generate a performance and capacity evaluation report of the server to be tested.
其中,性能和容量评估报告中可以包含但不限于:待测试服务器的每秒事务处理量和所需的待测试服务器的数量。The performance and capacity evaluation report may include, but is not limited to, the transaction processing volume per second of the server to be tested and the required number of servers to be tested.
可选的,性能和容量评估报告中还可以包含:性能测试过程记录以及目标并发线程数。Optionally, the performance and capacity evaluation report may also include: the performance test process record and the target number of concurrent threads.
进一步地,在步骤16之后还可以执行如下步骤17。Further, after step 16, the following step 17 may also be performed.
步骤17:输出待测试服务器的性能和容量评估报告。Step 17: Output the performance and capacity evaluation report of the server to be tested.
本实施例中,输出待测试服务器的性能和容量评估报告,从而用户可以根据该性能和容量评估报告进行采购服务器,开展招投标工作等。In this embodiment, the performance and capacity evaluation report of the server to be tested is output, so that the user can purchase the server according to the performance and capacity evaluation report, and carry out bidding work.
下面以一种对图片进行处理的具体的示例对上述实施例的方法进行说明。The method of the above embodiment will be described below with a specific example of processing a picture.
请参见图2,图2为本申请实施例提供的另一种服务器的性能测试方法的流程示意图,如图2所示,本示例包括如下步骤:Please refer to FIG. 2, which is a schematic flowchart of another server performance testing method provided by an embodiment of the present application. As shown in FIG. 2, this example includes the following steps:
步骤21:用户根据测试需求,修改需要安全外壳协议(Secure Shell,简称SSH)的待测试服务器的网际互连协议(Internet Protocol,简称IP)地址、SSH账号和密码(或者直接将压测工具部署到对应的待测试服务器)。Step 21: According to the test requirements, the user modifies the Internet Protocol (Internet Protocol, IP) address, SSH account and password of the server to be tested that requires Secure Shell (SSH) (or directly deploy the stress test tool) to the corresponding server to be tested).
步骤22:执行压测脚本工具,并判断是否为智能发现分析引擎项目。Step 22: Execute the stress test script tool, and determine whether it is an intelligent discovery analysis engine project.
如否,执行步骤23,如是,跳至执行步骤24。If no, go to step 23, if yes, go to go to step 24.
步骤23:修改接口相关参数。接口相关参数包括请求的服务器IP地址、端口号、接口名称、请求参数等。Step 23: Modify the parameters related to the interface. Interface-related parameters include the requested server IP address, port number, interface name, and request parameters.
步骤24:自动执行第1次压力测试,循环中每轮发起10000次服务请求。Step 24: The first stress test is automatically executed, and 10,000 service requests are initiated in each round of the cycle.
该第1次压力测试对应上述实施例的第一轮性能测试。The first stress test corresponds to the first round of performance tests in the above embodiment.
步骤25:每轮定时任务判断CPU占用率是否大于等于90%。Step 25: Determine whether the CPU occupancy rate is greater than or equal to 90% for each round of scheduled tasks.
如是,执行步骤26;如否,输出每轮并发线程数,最后一轮额外输出建议:当前服务器性能满足要求。If yes, go to step 26; if no, output the number of concurrent threads in each round, and output an additional suggestion in the last round: the current server performance meets the requirements.
步骤26:输出本次压测第1次CPU达到90%以上时的最大并发线程数及处理时长,通过监听脚本输出每轮1万次请求处理时长;另外一个脚本自动修改初始化配置文件中最大并发线程数和最小并发线程数,最大并发线程数用Max表示,最小并发线程数用Min表示,Min=Max-10,步长设置为1。Step 26: Output the maximum number of concurrent threads and processing time when the CPU reaches more than 90% in the first stress test, and output the processing time of 10,000 requests per round through the monitoring script; another script automatically modifies the maximum concurrent thread in the initialization configuration file The number of threads and the minimum number of concurrent threads. The maximum number of concurrent threads is represented by Max, and the minimum number of concurrent threads is represented by Min. Min=Max-10, and the step size is set to 1.
其中,上述最大并发线程数相当于上述实施例中的并发线程最高限定值;上述最小并发线程数相当于上述实施例中的第二初始并发线程数;上述步长相当于上述实施例中的第二步长。The above-mentioned maximum number of concurrent threads is equivalent to the maximum limit value of concurrent threads in the above-mentioned embodiment; the above-mentioned minimum number of concurrent threads is equivalent to the second initial number of concurrent threads in the above-mentioned embodiment; the above-mentioned step size is equivalent to the above-mentioned two steps.
步骤27:判断定时任务检测是否完成。Step 27: Determine whether the timing task detection is completed.
若完成,自动执行第二次压力测试。若未完成,判断有无数据积压。若数据有积压,则等待每轮10000个请求被处理完成,即数据无积压,然后继续监测,直到执行完成,继续执行步骤28。若数据无积压,则继续监测,直到执行完成,继续执行步骤28。If completed, a second stress test is automatically performed. If it is not completed, determine whether there is a backlog of data. If there is a backlog of data, wait for each round of 10,000 requests to be processed to complete, that is, there is no backlog of data, and then continue to monitor until the execution is completed, and continue to perform step 28 . If there is no backlog of data, continue monitoring until the execution is completed, and continue to execute step 28 .
步骤28:自动执行第2次压力测试,循环中每轮发起10000次请求。判断定时和任务监测是否执行完成。Step 28: Automatically execute the second stress test, and initiate 10,000 requests per round in the loop. Determine whether timing and task monitoring are completed.
若未完成,判断有无数据积压。若数据有积压,则等待每轮10000个请求被处理完成,即数据无积压,然后继续监测,直到执行完成,继续执行步骤29。若数据无积压,则继续监测,直到执行完成,继续执行步骤29。If it is not completed, determine whether there is a backlog of data. If there is a backlog of data, wait for each round of 10,000 requests to be processed to be completed, that is, there is no backlog of data, and then continue monitoring until the execution is completed, and continue to perform step 29 . If there is no backlog of data, continue monitoring until the execution is completed, and continue to execute step 29 .
步骤29:统计脚本进行计算CPU占用率大于90%时的TPS。自动计算并输出测试结果。(按照当前TPS,估算每天处理2000万张图片需要多少台同配置服务器)Step 29: The statistics script calculates the TPS when the CPU usage is greater than 90%. Automatic calculation and output of test results. (According to the current TPS, it is estimated how many servers with the same configuration are required to process 20 million images per day)
计算结果可以是服务器图片分析接口的GPU的利用率、CPU的I/O(读写速率)、存储空间等。The calculation result may be the utilization rate of the GPU of the server image analysis interface, the I/O (read and write rate) of the CPU, the storage space, and the like.
在一些实施例中,本申请实施例提供一种服务器的性能测试设备,包括:In some embodiments, the embodiments of the present application provide a performance testing device for a server, including:
存储器,用于存储程序;memory for storing programs;
处理器,用于通过执行存储器存储的程序以实现如上述任一项的服务器的性能测试方法。The processor is configured to implement the performance testing method of the server according to any one of the above by executing the program stored in the memory.
在一些实施例中,本申请实施例提供一种服务器的性能测试系统。请参见图3,图3为本申请实施例提供的一种服务器的性能测试系统的结构示意图,本实施例提供的系统包括:待测试服务器31和上述实施例提供的服务器的性能测试设备32。待测试服务器31与服务器的性能测试设备32通信连接。In some embodiments, the embodiments of the present application provide a performance testing system for a server. Please refer to FIG. 3 , which is a schematic structural diagram of a server performance testing system provided by an embodiment of the present application. The system provided by this embodiment includes a server to be tested 31 and a
在一些实施例中,本申请实施例提供一种计算机可读存储介质,介质上存储有程序,程序能够被处理器执行以实现如上述任一实施例中的服务器的性能测试方法。In some embodiments, the embodiments of the present application provide a computer-readable storage medium on which a program is stored, and the program can be executed by a processor to implement the performance testing method for a server in any of the foregoing embodiments.
本领域技术人员可以理解,上述实施方式中各种方法的全部或部分功能可以通过硬件的方式实现,也可以通过计算机程序的方式实现。当上述实施方式中全部或部分功能通过计算机程序的方式实现时,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:只读存储器、随机存储器、磁盘、光盘、硬盘等,通过计算机执行该程序以实现上述功能。例如,将程序存储在设备的存储器中,当通过处理器执行存储器中程序,即可实现上述全部或部分功能。另外,当上述实施方式中全部或部分功能通过计算机程序的方式实现时,该程序也可以存储在服务器、另一计算机、磁盘、光盘、闪存盘或移动硬盘等存储介质中,通过下载或复制保存到本地设备的存储器中,或对本地设备的系统进行版本更新,当通过处理器执行存储器中的程序时,即可实现上述实施方式中全部或部分功能。Those skilled in the art can understand that all or part of the functions of the various methods in the foregoing embodiments may be implemented by means of hardware or by means of computer programs. When all or part of the functions in the above embodiments are implemented by means of a computer program, the program may be stored in a computer-readable storage medium, and the storage medium may include: read-only memory, random access memory, magnetic disk, optical disk, hard disk, etc. The computer executes the program to realize the above-mentioned functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above functions can be realized. In addition, when all or part of the functions in the above-mentioned embodiments are realized by means of a computer program, the program can also be stored in a server, another computer, a magnetic disk, an optical disk, a flash disk or a mobile hard disk and other storage media, and saved by downloading or copying All or part of the functions in the above embodiments can be implemented when the program in the memory is executed by the processor.
以上应用了具体个例对本申请进行阐述,只是用于帮助理解本申请,并不用以限制本申请。对于本申请所属技术领域的技术人员,依据本申请的思想,还可以做出若干简单推演、变形或替换。The above uses specific examples to illustrate the present application, which is only used to help the understanding of the present application, and is not intended to limit the present application. For those skilled in the art to which this application belongs, based on the idea of this application, some simple deductions, modifications or substitutions can also be made.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210423825.9ACN115017018A (en) | 2022-04-21 | 2022-04-21 | Performance testing method, device and computer-readable storage medium for server |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210423825.9ACN115017018A (en) | 2022-04-21 | 2022-04-21 | Performance testing method, device and computer-readable storage medium for server |
| Publication Number | Publication Date |
|---|---|
| CN115017018Atrue CN115017018A (en) | 2022-09-06 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210423825.9APendingCN115017018A (en) | 2022-04-21 | 2022-04-21 | Performance testing method, device and computer-readable storage medium for server |
| Country | Link |
|---|---|
| CN (1) | CN115017018A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116341991A (en)* | 2023-05-29 | 2023-06-27 | 江苏智慧优视电子科技有限公司 | Heavy-duty truck power conversion cloud service system and method based on cloud computing |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116341991A (en)* | 2023-05-29 | 2023-06-27 | 江苏智慧优视电子科技有限公司 | Heavy-duty truck power conversion cloud service system and method based on cloud computing |
| CN116341991B (en)* | 2023-05-29 | 2023-08-18 | 江苏智慧优视电子科技有限公司 | Heavy-duty truck power conversion cloud service system and method based on cloud computing |
| Publication | Publication Date | Title |
|---|---|---|
| US10462029B2 (en) | Device cloud monitoring and stability | |
| US20140331209A1 (en) | Program Testing Service | |
| WO2019223142A1 (en) | Application program testing method, apparatus, computer device and storage medium | |
| JP5689400B2 (en) | Computer program verification of unexpected responses to access requests | |
| CN104123184A (en) | A method and system for allocating resources to tasks in a build process | |
| CN109684228A (en) | A kind of performance test methods, device, system and storage medium | |
| CN111258913A (en) | Automatic algorithm testing method and device, computer system and readable storage medium | |
| CN106095688A (en) | A kind of software performance testing method and device | |
| US11635982B2 (en) | Information processing apparatus, program, and information processing system | |
| CN107908512A (en) | Disk performance test method and test device | |
| CN116974874A (en) | Database testing method and device, electronic equipment and readable storage medium | |
| CN112905445B (en) | A log-based testing method, device and computer system | |
| US20140331205A1 (en) | Program Testing Service | |
| CN114003442A (en) | A stress testing method, device, equipment and medium for an ARM server | |
| CA2910977A1 (en) | Program testing service | |
| CN115017018A (en) | Performance testing method, device and computer-readable storage medium for server | |
| CN110888800A (en) | Test method, device, storage medium and test system for service interaction function | |
| CN114328196B (en) | Data leakage prevention system testing method, device, equipment and storage medium | |
| JP4208493B2 (en) | Load test system for network server | |
| CN111949504A (en) | Pressure testing method, device and medium | |
| WO2024139538A1 (en) | Script generation method and apparatus, and computing device, system and readable storage medium | |
| CN113535590B (en) | Program testing method and device | |
| CN111444008A (en) | Inter-cluster service migration method and device | |
| CN103455408B (en) | A kind of method and device of assessing file system input and output Treatment Stability | |
| CN114090357A (en) | A hard disk performance testing method, device, electronic device and storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information | ||
| CB02 | Change of applicant information | Country or region after:China Address after:Building 7, 5th Floor, Zijin R&D Entrepreneurship Center, No. 89 Shengli Road, Moling Street, Jiangning District, Nanjing City, Jiangsu Province, 210000 (Jiangning Development Zone) Applicant after:Nanjing Liwei Zhilian Technology Co.,Ltd. Applicant after:SHENZHEN ZNV TECHNOLOGY Co.,Ltd. Address before:No. 888 Zhengfang Middle Road, Jiangning Economic and Technological Development Zone, Nanjing City, Jiangsu Province Applicant before:NANJING ZNV SOFTWARE Co.,Ltd. Country or region before:China Applicant before:SHENZHEN ZNV TECHNOLOGY Co.,Ltd. |