[go: up one dir, main page]

CN111290942A - Pressure testing method, device and computer readable medium - Google Patents

Pressure testing method, device and computer readable medium Download PDF

Info

Publication number
CN111290942A
CN111290942A CN201811505464.2A CN201811505464A CN111290942A CN 111290942 A CN111290942 A CN 111290942A CN 201811505464 A CN201811505464 A CN 201811505464A CN 111290942 A CN111290942 A CN 111290942A
Authority
CN
China
Prior art keywords
test
threads
shared memory
testing method
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811505464.2A
Other languages
Chinese (zh)
Inventor
陈晓丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201811505464.2A priority Critical patent/CN111290942A/en
Publication of CN111290942A publication Critical patent/CN111290942A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明实施例提供一种压力测试方法和压力测试装置,所述压力测试方法包括:步骤1,从测试文件中读取测试用例,并写入到第一共享内存中;步骤2,从所述第一共享内存中读取所述测试用例,根据所述测试用例生成多个线程,控制所述多个线程向被测服务器发送请求,并记录所述多个线程的请求发送时间到第二共享内存中;步骤3,从所述第二共享内存中读取请求发送时间并从所述被测服务器接收请求回应,并整理成测试结果数据,其中,所述步骤1至3分别在一个线程或进程中执行。所述压力测试方法异步处理发送请求和接收请求响应,能够规避部署服务器的性能瓶颈,从而避免由于部署服务器的性能瓶颈而影响到性能测试。

Figure 201811505464

Embodiments of the present invention provide a stress testing method and a stress testing device. The stress testing method includes: step 1, reading a test case from a test file, and writing it into a first shared memory; step 2, reading a test case from the Read the test case in the first shared memory, generate multiple threads according to the test case, control the multiple threads to send requests to the server under test, and record the request sending time of the multiple threads to the second shared memory In the memory; Step 3, read the request sending time from the second shared memory and receive the request response from the server under test, and organize it into test result data, wherein the steps 1 to 3 are respectively in a thread or execute in the process. The stress testing method asynchronously processes the sending request and the receiving request response, which can avoid the performance bottleneck of the deployment server, thereby avoiding the performance test being affected by the performance bottleneck of the deployment server.

Figure 201811505464

Description

压力测试方法、装置以及计算机可读介质Stress testing method, apparatus and computer readable medium

技术领域technical field

本发明涉及计算机领域,具体涉及压力测试方法、装置以及计算机可读介质。The present invention relates to the field of computers, and in particular to a stress testing method, device and computer-readable medium.

背景技术Background technique

目前主流压力测试工具主要是Loadrunner,Jmeter两种,这两种工具使用流程为先选择压力测试脚本,然后配置并发线程的数量,在点击运行执行性能测试场景实现对被测服务的性能测试。测试过程中,每个并发线程都操作以下四个步骤:1.和被测服务建立连接2.发送请求包3.接受请求回应包4.不断循环步骤1,2,3。从中可以看出,这两种工具采用的是同步发送请求和接收请求的方式,故压力测试工具的性能可能会受到压力测试工具部署在其上的部署服务器的性能限制,从而可能导致压力测试工具的性能不如预期。进一步地,当压力测试工具反馈性能问题时,由于部署服务器的性能瓶颈,可能导致无法准确定位性能问题来自被测服务自身,还是来自部署服务器。At present, the mainstream stress testing tools are mainly Loadrunner and Jmeter. The process of using these two tools is to first select the stress test script, then configure the number of concurrent threads, and then click to run the performance test scenario to implement the performance test of the service under test. During the test, each concurrent thread operates the following four steps: 1. Establishing a connection with the service under test 2. Sending request packets 3. Accepting request response packets 4. Repeating steps 1, 2, and 3 continuously. It can be seen from this that these two tools use the method of sending and receiving requests synchronously, so the performance of the stress testing tool may be limited by the performance of the deployment server on which the stress testing tool is deployed, which may cause the stress testing tool performance is not as expected. Further, when the stress testing tool reports performance problems, due to the performance bottleneck of the deployment server, it may be impossible to accurately locate whether the performance problem comes from the service under test itself or from the deployment server.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明实施例提供一种压力测试方法,将发送请求和接收请求放在各自独立的进程或线程中执行,已解决部署服务器的性能瓶颈。In view of this, the embodiment of the present invention provides a stress testing method, which executes the sending request and the receiving request in separate processes or threads, which has solved the performance bottleneck of the deployment server.

根据本发明的第一方面,提供一种压力测试方法,包括:According to a first aspect of the present invention, a stress testing method is provided, comprising:

步骤1,从测试文件中读取测试用例,并写入到第一共享内存中;Step 1, read the test case from the test file and write it into the first shared memory;

步骤2,从所述第一共享内存中读取所述测试用例,根据所述测试用例生成多个线程,控制所述多个线程向被测服务器发送请求,并记录所述多个线程的请求发送时间到第二共享内存中;Step 2: Read the test case from the first shared memory, generate multiple threads according to the test case, control the multiple threads to send requests to the server under test, and record the requests of the multiple threads send time to the second shared memory;

步骤3,从所述第二共享内存中读取请求发送时间并从所述被测服务器接收请求回应,并整理成测试结果数据,Step 3, read the request sending time from the second shared memory and receive the request response from the server under test, and organize it into test result data,

其中,所述步骤1至3分别在各自独立的线程或进程中执行。Wherein, the steps 1 to 3 are respectively executed in respective independent threads or processes.

优选地,所述压力测试方法还包括:在生成多个线程之前,向所述被测服务器发送多个请求并接受请求回应,据此计算所述多个线程的生成数量和所述多个线程发送请求的时间间隔。Preferably, the stress testing method further includes: before generating multiple threads, sending multiple requests to the server under test and receiving request responses, and calculating the number of generated threads and the multiple threads The interval at which requests are sent.

优选地,所述压力测试方法还包括:将所述测试结果数据写入到第三共享内存中,Preferably, the stress test method further includes: writing the test result data into a third shared memory,

所述压力测试方法还包括:第四线程从第三共享内存中读取测试结果数据,并写入到监控系统的内存中。The stress testing method further includes: the fourth thread reads the test result data from the third shared memory and writes it into the memory of the monitoring system.

优选地,所述压力测试方法还包括:所述监控系统读取内存中的测试结果数据并显示到客户端界面上。Preferably, the stress testing method further includes: the monitoring system reads the test result data in the memory and displays it on the client interface.

优选地,所述多个线程为异步线程。Preferably, the multiple threads are asynchronous threads.

优选地,所述压力测试方法还包括:实时打印测试结果数据。Preferably, the stress testing method further comprises: printing test result data in real time.

优选地,所述压力测试方法还包括:根据测试结果数据计算性能指标,并生成测试报告。Preferably, the stress testing method further includes: calculating performance indicators according to the test result data, and generating a test report.

根据本发明实施例的第二方面,提供一种压力测试装置,包括:According to a second aspect of the embodiments of the present invention, a pressure testing device is provided, including:

用例处理模块,用于从测试文件中读取测试用例,并写入到第一共享内存中;The use case processing module is used to read the test case from the test file and write it into the first shared memory;

测试执行模块,用于从所述第一共享内存中读取所述测试用例,根据所述测试用例生成多个线程,并控制所述多个线程向被测服务器发送请求,并记录请求发送时间到第二共享内存中;A test execution module, configured to read the test case from the first shared memory, generate multiple threads according to the test case, and control the multiple threads to send requests to the server under test, and record the request sending time into the second shared memory;

结果整理模块,用于从所述第二共享内存中读取请求发送时间并从所述被测服务器接收请求回应,并整理成测试结果数据,A result sorting module, configured to read the request sending time from the second shared memory and receive a request response from the tested server, and sort it into test result data,

其中,所述用例处理模块、所述测试执行模块和所述结果整理模块分别在各自独立的线程或进程中执行。Wherein, the use case processing module, the test execution module and the result sorting module are respectively executed in independent threads or processes.

优选地,所述测试执行模块还包括:生成多个线程之前,向所述被测服务器发送多个请求并接受请求回应,据此计算所述多个线程的生成数量和所述多个线程发送请求的时间间隔。Preferably, the test execution module further includes: before generating multiple threads, sending multiple requests to the server under test and accepting the request responses, and calculating the generated number of the multiple threads and the sending of the multiple threads accordingly. The time interval for the request.

优选地,所述多个线程为异步线程。Preferably, the multiple threads are asynchronous threads.

根据本发明实施例的第三方面,提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机指令,所述计算机指令被执行时实现上述任一项的压力测试方法。According to a third aspect of the embodiments of the present invention, a computer-readable storage medium is provided, where the computer-readable storage medium stores computer instructions, and when the computer instructions are executed, any one of the above stress testing methods is implemented.

根据本发明实施例的第四方面,提供一种压力测试装置,包括:According to a fourth aspect of the embodiments of the present invention, a pressure testing device is provided, including:

存储器,用于存储计算机指令;memory for storing computer instructions;

处理器,耦合到所述存储器,所述处理器被配置为基于所述存储器存储的计算机指令执行实现上述任一项的压力测试方法。A processor, coupled to the memory, configured to execute a stress testing method implementing any of the foregoing based on computer instructions stored in the memory.

本发明一实施例具有以下优点或有益效果:将发送请求和接收请求响应放在不同的线程或进程中处理,能够规避部署服务器的性能瓶颈,从而避免由于部署服务器的性能瓶颈而影响到性能测试。进一步地,通过多个线程发送请求,有助于满足高频发送请求的需求。An embodiment of the present invention has the following advantages or beneficial effects: the sending request and the receiving request response are processed in different threads or processes, which can avoid the performance bottleneck of the deployment server, thereby avoiding the performance test being affected by the performance bottleneck of the deployment server. . Further, sending requests through multiple threads helps to meet the requirement of sending requests at high frequency.

进一步地,将文件中的测试用例写入到共享内存中,当发送请求时,从共享内存中读取测试用例,避免文件I/O操作,有助于满足发送请求时的性能要求。Further, the test cases in the file are written into the shared memory, and when a request is sent, the test cases are read from the shared memory, avoiding file I/O operations, and helping to meet the performance requirements when sending requests.

附图说明Description of drawings

通过参照以下附图对本发明实施例的描述,本发明的上述以及其它目的、特征和优点将更为清楚,在附图中:The above and other objects, features and advantages of the present invention will become more apparent from the description of embodiments of the present invention with reference to the following drawings, in which:

图1是本发明第一实施例的压力测试方法的流程图;1 is a flowchart of a stress testing method according to a first embodiment of the present invention;

图2是本发明第二实施例的压力测试方法的示意图;2 is a schematic diagram of a stress testing method according to a second embodiment of the present invention;

图3是本发明第三实施例的压力测试装置的示意图;3 is a schematic diagram of a pressure testing device according to a third embodiment of the present invention;

图4是本发明第四实施例的压力测试装置的示意图。FIG. 4 is a schematic diagram of a stress testing device according to a fourth embodiment of the present invention.

具体实施方式Detailed ways

以下基于实施例对本发明进行描述,但是本发明并不仅仅限于这些实施例。在下文对本发明的细节描述中,详尽描述了一些特定的细节部分。对本领域技术人员来说没有这些细节部分的描述也可以完全理解本发明。为了避免混淆本发明的实质,公知的方法、过程、流程没有详细叙述。另外附图不一定是按比例绘制的。The present invention is described below based on examples, but the present invention is not limited to these examples only. In the following detailed description of the invention, some specific details are described in detail. The present invention can be fully understood by those skilled in the art without the description of these detailed parts. In order to avoid obscuring the essence of the present invention, well-known methods, procedures and processes are not described in detail. Additionally, the drawings are not necessarily to scale.

图1是本发明第一实施例的压力测试方法的流程图。具体包括以下步骤S101-S103,其中,步骤S101-S103分别在三个线程或进程中执行。具体如下。FIG. 1 is a flowchart of a stress testing method according to a first embodiment of the present invention. Specifically, the following steps S101-S103 are included, wherein the steps S101-S103 are respectively executed in three threads or processes. details as follows.

在步骤S101中,从测试文件中读取测试用例,并写入到第一共享内存中。In step S101, the test case is read from the test file and written into the first shared memory.

在步骤S102中,从第一共享内存中读取测试用例,根据测试用例生成多个线程,控制多个线程向被测服务器发送请求,并记录多个线程的请求发送时间到第二共享内存中。In step S102, read the test case from the first shared memory, generate multiple threads according to the test case, control the multiple threads to send requests to the server under test, and record the request sending time of the multiple threads to the second shared memory .

在步骤S103中,从第二共享内存中读取请求发送时间并从被测服务器接收请求回应,并整理成测试结果数据。In step S103, the request sending time is read from the second shared memory and the request response is received from the server under test, and is organized into test result data.

在本实施例中,测试文件包括多个测试用例。每个测试用例例如包括设定时间、请求数量、请求内容等信息,即通过在设定时间发送设定数量的请求并根据请求结果判定被测服务的性能指标。In this embodiment, the test file includes multiple test cases. Each test case includes, for example, information such as the set time, the number of requests, and the content of the request, that is, by sending a set number of requests at the set time and determining the performance indicators of the service under test according to the request results.

在本实施例中,先采用第一线程或进程将测试文件中的测试用例都写入到第一共享内容中,然后采用第二线程或进程从第一共享内存中读取测试用例,并生成多个线程,每个线程发送若干个请求,并将每个线程的请求日志记录到第二共享内存中,请求日志包含请求发送时间、发送请求的线程ID,接着采用第三线程或进程从被测服务器接收请求回应,并从第二共享内存中读取请求日志,将请求日志和请求回应信息整理成测试结果数据。从而,请求发送和接收请求实现异步处理,规避了由于部署服务器的性能瓶颈导致的处理不及时的问题,从而避免由于部署服务器的性能瓶颈影响到被测服务的性能测试。进一步地,将测试用例写入到共享内存中,当发送请求时,从共享内存中读取测试用例,避免文件I/O操作,有助于达到发送请求的性能要求。同时,通过多个线程发送请求,有助于满足高频发送请求的需求。In this embodiment, the first thread or process is used to write all the test cases in the test file into the first shared content, and then the second thread or process is used to read the test cases from the first shared memory, and generate Multiple threads, each thread sends several requests, and records the request log of each thread in the second shared memory. The request log contains the request sending time and the thread ID that sent the request. The test server receives the request response, reads the request log from the second shared memory, and organizes the request log and the request response information into test result data. Therefore, asynchronous processing of request sending and receiving requests is implemented, which avoids the problem of untimely processing caused by the performance bottleneck of the deployment server, thereby avoiding the performance test of the service under test from being affected by the performance bottleneck of the deployment server. Further, writing the test case to the shared memory, and reading the test case from the shared memory when a request is sent, avoids file I/O operations, which helps to meet the performance requirements of the request. At the same time, sending requests through multiple threads helps to meet the needs of high-frequency sending requests.

图2是本发明第二实施例的压力测试方法的示意图。FIG. 2 is a schematic diagram of a stress testing method according to a second embodiment of the present invention.

参见图2,在模块201中,创建线程1-1,线程1-1顺序执行步骤S301和S302。S301从测试文件2011中读取数据,步骤S302将数据写入到共享内存2012中。在模块202中,首先执行步骤S401,步骤S401从共享内存2012中读取数据,然后执行步骤S402,步骤S402根据读取到的数据和设定的规则计算生成线程的数量和时间间隔,生成的N个线程。再分别执行步骤S403和S404,即向服务器300上的被测服务发送请求,并记录请求发送时间到共享内存2021。在模块203中,创建线程1-2,线程1-2执行步骤S405,即从共享内存2012中读取数据,并执行步骤S406和S407,即接收请求返回,并记录请求回应时间,将整理好的测试结果数据并写入到共享内存2022。在模块204中,创建线程1-3,线程1-3执行步骤S408,即定时从共享内存2022读取数据,并执行步骤S409,即将数据写入到内存2023,监控系统205从内存2023中读取数据,并在客户端界面上显示。应该指出,为了达到本发明实施例的压力测试效果,模块201、202、203优选为在各自独立的线程或进程中执行。Referring to FIG. 2, in module 201, thread 1-1 is created, and thread 1-1 executes steps S301 and S302 in sequence. S301 reads data from the test file 2011 , and step S302 writes the data into the shared memory 2012 . In module 202, step S401 is first performed, and step S401 reads data from the shared memory 2012, and then step S402 is performed. Step S402 calculates the number and time interval of generating threads according to the read data and the set rules. N threads. Steps S403 and S404 are then executed respectively, that is, a request is sent to the service under test on the server 300 , and the request sending time is recorded to the shared memory 2021 . In module 203, thread 1-2 is created, and thread 1-2 executes step S405, that is, reads data from the shared memory 2012, and executes steps S406 and S407, that is, receives the request and returns, and records the request response time, which will be sorted out The test result data is written to the shared memory 2022. In module 204, thread 1-3 is created, thread 1-3 executes step S408, that is, reads data from the shared memory 2022 regularly, and executes step S409, that is, writes the data to the memory 2023, and the monitoring system 205 reads it from the memory 2023 Get the data and display it on the client interface. It should be noted that, in order to achieve the effect of the stress test in the embodiment of the present invention, the modules 201, 202, and 203 are preferably executed in respective independent threads or processes.

上述实施例中采用共享内存2022存储测试结果数据。可选地,模块203还可以将测试结果数据生成测试报告。可选地,模块203还可以采集诸如AVG,TP50,TP90,TP99,TP999,调用次数,错误数等性能指标作为测试结果数据的一部分。AVG为内存或CPU平均使用情况。TP50指在一个时间段内(如5分钟),统计该方法每次调用所消耗的时间,并将这些时间按从小到大的顺序进行排序,取第50%的那个值作为TP50值;配置此监控指标对应的报警阀值后,需要保证在这个时间段内该方法所有调用的消耗时间至少有50%的值要小于此阀值,否则系统将会报警。TP90,TP99,TP999与TP50值计算方式一致,它们分别代表着对方法的不同性能要求,TP50相对较低,TP90则比较高,TP99,TP999则对方法性能要求很高。In the above embodiment, the shared memory 2022 is used to store the test result data. Optionally, the module 203 can also generate a test report from the test result data. Optionally, the module 203 can also collect performance indicators such as AVG, TP50, TP90, TP99, TP999, the number of calls, and the number of errors as part of the test result data. AVG is the average memory or CPU usage. TP50 refers to counting the time consumed by each invocation of the method in a period of time (such as 5 minutes), sorting these times in ascending order, and taking the 50th percentile value as the TP50 value; configure this After monitoring the alarm threshold corresponding to the indicator, it is necessary to ensure that at least 50% of the consumption time of all calls of the method within this time period is less than this threshold, otherwise the system will alarm. TP90, TP99, TP999 and TP50 are calculated in the same way. They represent different performance requirements of the method. TP50 is relatively low, TP90 is relatively high, and TP99 and TP999 have high requirements for method performance.

模块201、202和203组成测试工具,通常部署在同一台服务器上。该服务器即背景技术中所述的部署服务器。被测服务通常部署在另一台服务器上。根据本发明实施例,只需要定期更新测试文件,不需要编写压力测试脚本,就可以完成压力测试,从而减轻了测试人员的工作压力。Modules 201, 202 and 203 make up the test tool and are usually deployed on the same server. The server is the deployment server described in the background art. The service under test is usually deployed on another server. According to the embodiment of the present invention, the stress test can be completed only by regularly updating the test file without writing a stress test script, thereby reducing the work pressure of the tester.

图3是本发明第三实施例的压力测试装置的示意图。压力测试装置300包括用例处理模块301、测试执行模块302、结果整理模块303和创建模块304。创建模块304用于创建三个线程或进程,使得其他模块分别在一个独立的线程或进程中执行。当然创建模块304本身既可以是一个单线程或单进程,也可以是一个多线程或多进程。当创建模块304是一个单线程或单进程时,负责整个流程的控制工作,还可以负责读取一些配置信息和资源回收工作。当创建模块304是一个多进程或多线程时,则将其负责的工作分配到不同的进程或线程中进行。FIG. 3 is a schematic diagram of a stress testing device according to a third embodiment of the present invention. The stress testing apparatus 300 includes a use case processing module 301 , a test execution module 302 , a result sorting module 303 and a creation module 304 . The creation module 304 is used to create three threads or processes, so that other modules are executed in an independent thread or process respectively. Of course, the creation module 304 itself can be either a single thread or a single process, or a multi-thread or multi-process. When the creation module 304 is a single thread or a single process, it is responsible for the control of the entire process, and may also be responsible for reading some configuration information and resource recycling. When the creation module 304 is a multi-process or multi-thread, the work it is responsible for is allocated to different processes or threads.

用例处理模块301用于从测试文件中读取测试用例,并写入到第一共享内存中。The use case processing module 301 is configured to read the test case from the test file and write it into the first shared memory.

测试执行模块302用于从第一共享内存中读取测试用例,根据测试用例生成多个线程,并控制所述多个线程向被测服务器发送请求,并记录请求发送时间到第二共享内存中。The test execution module 302 is configured to read test cases from the first shared memory, generate multiple threads according to the test cases, and control the multiple threads to send requests to the server under test, and record the request sending time to the second shared memory .

结果整理模块303用于从第二共享内存中读取请求发送时间并从被测服务器接收请求回应,并整理成测试结果数据。The result sorting module 303 is configured to read the request sending time from the second shared memory, receive the request response from the server under test, and sort it into test result data.

在一个实施例中,上述压力测试装置300还包括:计算模块,用于向被测服务发送多个请求并接受请求回应,据此计算所述多个线程的生成数量和多个线程发送请求的时间间隔。计算模块可以在测试执行模块302所在的线程或进程中执行,也可以在创建模块304所在的线程或进程中执行。In one embodiment, the above-mentioned stress testing apparatus 300 further includes: a computing module, configured to send multiple requests to the service under test and receive request responses, and calculate the number of generated threads and the number of threads sent by multiple threads accordingly. time interval. The calculation module can be executed in the thread or process where the test execution module 302 is located, or can be executed in the thread or process where the creation module 304 is located.

在一个实施例中,测试执行模块302创建的多个线程为异步线程。异步线程在发送请求后,不必等待请求回应,从而能够在不同的线程或进程中发送请求和接收请求回应。In one embodiment, the multiple threads created by the test execution module 302 are asynchronous threads. After an asynchronous thread sends a request, it does not have to wait for the request response, so it can send the request and receive the request response in different threads or processes.

图4是本发明第四实施例的压力测试装置的示意图。图4示出的设备仅仅是一个示例,不应对本发明实施例的功能和使用范围构成任何限制。FIG. 4 is a schematic diagram of a stress testing device according to a fourth embodiment of the present invention. The device shown in FIG. 4 is only an example, and should not constitute any limitation on the function and scope of use of the embodiments of the present invention.

参考图4,该装置包括通过总线连接的处理器401、存储器402和输入输出设备403。存储器402包括只读存储器(ROM)和随机访问存储器(RAM),存储器402内存储有执行系统功能所需的各种计算机指令和数据,处理器401从存储器402中读取各种计算机指令以执行各种适当的动作和处理。输入输出设备包括键盘、鼠标等的输入部分;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分;包括硬盘等的存储部分;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分。存储器402还存储有以下的计算机指令以完成本发明实施例的装置规定的操作:步骤1,从测试文件中读取测试用例,并写入到第一共享内存中;步骤2,从所述第一共享内存中读取所述测试用例,根据所述测试用例生成多个线程,控制所述多个线程向被测服务器发送请求,并记录所述多个线程的请求发送时间到第二共享内存中;步骤3,从所述第二共享内存中读取请求发送时间并从所述被测服务器接收请求回应,并整理成测试结果数据,其中,所述步骤1至3分别在各自独立的线程或进程中执行。Referring to FIG. 4 , the apparatus includes a processor 401 , a memory 402 and an input and output device 403 connected by a bus. The memory 402 includes read-only memory (ROM) and random access memory (RAM). Various computer instructions and data required to perform system functions are stored in the memory 402. The processor 401 reads various computer instructions from the memory 402 to execute. Various appropriate actions and handling. Input and output devices include input sections such as keyboards, mice, etc.; output sections such as cathode ray tubes (CRTs), liquid crystal displays (LCDs), etc. and speakers, etc.; storage sections including hard disks, etc.; The communication part of the network interface card. The memory 402 also stores the following computer instructions to complete the operations specified by the device of the embodiment of the present invention: Step 1, read the test case from the test file, and write it into the first shared memory; Step 2, read the test case from the first shared memory; Read the test case in a shared memory, generate multiple threads according to the test case, control the multiple threads to send requests to the server under test, and record the request sending time of the multiple threads to the second shared memory in; Step 3, read the request sending time from the second shared memory and receive the request response from the server under test, and organize it into test result data, wherein the steps 1 to 3 are respectively in the respective independent threads or in-process execution.

相应地,本发明实施例提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机指令,所述计算机指令被执行时实现上述方法所规定的操作。Correspondingly, an embodiment of the present invention provides a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are executed, the operations specified in the foregoing method are implemented.

附图中的流程图、框图图示了本发明实施例的系统、方法、装置的可能的体系框架、功能和操作,流程图和框图上的方框可以代表一个模块、程序段或仅仅是一段代码,所述模块、程序段和代码都是用来实现规定逻辑功能的可执行指令。也应当注意,所述实现规定逻辑功能的可执行指令可以重新组合,从而生成新的模块和程序段。因此附图的方框以及方框顺序只是用来更好的图示实施例的过程和步骤,而不应以此作为对发明本身的限制。The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions, and operations of the systems, methods, and devices of the embodiments of the present invention, and the blocks on the flowcharts and block diagrams may represent a module, a program segment, or just a segment. Code, the modules, program segments and codes are all executable instructions for implementing specified logical functions. It should also be noted that the executable instructions implementing the specified logical functions may be recombined to create new modules and program segments. Therefore, the blocks and the block sequence of the drawings are only used to better illustrate the process and steps of the embodiment, and should not be taken as a limitation on the invention itself.

系统的各个模块或单元可以通过硬件、固件或软件实现。软件例如包括采用JAVA、C/C++/C#、SQL等各种编程语言形成的编码程序。虽然在方法以及方法图例中给出本发明实施例的步骤以及步骤的顺序,但是所述步骤实现规定的逻辑功能的可执行指令可以重新组合,从而生成新的步骤。所述步骤的顺序也不应该仅仅局限于所述方法以及方法图例中的步骤顺序,可以根据功能的需要随时进行调整。例如将其特征在于的某些步骤并行或按照相反顺序执行。Each module or unit of the system can be implemented by hardware, firmware or software. The software includes, for example, coding programs formed in various programming languages such as JAVA, C/C++/C#, and SQL. Although the steps and sequence of the steps in the embodiments of the present invention are given in the method and the method illustration, the executable instructions for implementing the specified logical functions of the steps may be recombined to generate new steps. The sequence of the steps should not be limited only to the sequence of steps in the method and the method legend, and can be adjusted at any time according to functional requirements. For example, certain steps characterized by are performed in parallel or in reverse order.

根据本发明的系统和方法可以部署在单个或多个服务器上。例如,可以将不同的模块分别部署在不同的服务器上,形成专用服务器。或者,可以在多个服务器上分布式部署相同的功能单元、模块或系统,以减轻负载压力。所述服务器包括但不限于在同一个局域网以及通过Internet连接的多个PC机、PC服务器、刀片机、超级计算机等。Systems and methods according to the present invention may be deployed on a single or multiple servers. For example, different modules can be deployed on different servers to form dedicated servers. Alternatively, the same functional unit, module or system can be deployed distributed across multiple servers to reduce load pressure. The servers include, but are not limited to, multiple PCs, PC servers, blade machines, supercomputers, etc. connected in the same local area network and through the Internet.

以上所述仅为本发明的优选实施例,并不用于限制本发明,对于本领域技术人员而言,本发明可以有各种改动和变化。凡在本发明的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims (12)

1. A pressure testing method, comprising:
step 1, reading a test case from a test file, and writing the test case into a first shared memory;
step 2, reading the test case from the first shared memory, generating a plurality of threads according to the test case, controlling the plurality of threads to send requests to a tested server, and recording sending logs to a second shared memory;
step 3, reading the sending log from the second shared memory, receiving a request response from the tested server, and arranging the request response into test result data,
wherein, the steps 1 to 3 are executed in one thread or one process respectively.
2. The pressure testing method of claim 1, further comprising:
before generating a plurality of threads, sending a plurality of requests to the tested server and receiving request responses, and accordingly determining the generation quantity of the plurality of threads and the time intervals of sending the requests by the plurality of threads.
3. The pressure testing method of claim 1, further comprising:
writing the test result data into a third shared memory; and
and reading the test result data from the third shared memory and writing the test result data into the memory of the monitoring system.
4. The pressure testing method of claim 3, further comprising:
and the monitoring system reads the test result data in the memory and displays the test result data on a client interface.
5. The stress testing method of claim 1, wherein the plurality of threads are all asynchronous threads.
6. The pressure testing method of claim 1, further comprising: and printing the test result data in real time.
7. The pressure testing method of claim 1, further comprising: and calculating the performance index according to the test result data and generating a test report.
8. A pressure testing device comprising:
the creating module is used for creating three threads or processes and enabling the use case processing module, the test execution module and the result sorting module to be executed in one thread or process respectively;
the case processing module is used for reading the test cases from the test files and writing the test cases into the first shared memory;
the test execution module is used for reading the test case from the first shared memory, generating a plurality of threads according to the test case, controlling the plurality of threads to send requests to a tested server, and recording request sending time to a second shared memory;
and the result sorting module is used for reading the request sending time from the second shared memory, receiving a request response from the tested server and sorting the request sending time into test result data.
9. The pressure testing apparatus of claim 8, further comprising: and the calculation module is used for sending a plurality of requests to the tested server and receiving the request responses, and calculating the generation quantity of the plurality of threads and the time interval of sending the requests by the plurality of threads according to the request responses.
10. The pressure test apparatus of claim 8, wherein the plurality of threads are asynchronous threads.
11. A computer readable storage medium storing computer instructions which, when executed, implement the pressure testing method of any one of claims 1 to 7.
12. A pressure testing device, comprising:
a memory for storing computer instructions;
a processor coupled to the memory, the processor configured to perform implementing the stress testing method of any of claims 1-7 based on computer instructions stored by the memory.
CN201811505464.2A 2018-12-10 2018-12-10 Pressure testing method, device and computer readable medium Pending CN111290942A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811505464.2A CN111290942A (en) 2018-12-10 2018-12-10 Pressure testing method, device and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811505464.2A CN111290942A (en) 2018-12-10 2018-12-10 Pressure testing method, device and computer readable medium

Publications (1)

Publication Number Publication Date
CN111290942A true CN111290942A (en) 2020-06-16

Family

ID=71021340

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811505464.2A Pending CN111290942A (en) 2018-12-10 2018-12-10 Pressure testing method, device and computer readable medium

Country Status (1)

Country Link
CN (1) CN111290942A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148616A (en) * 2020-09-30 2020-12-29 中国民航信息网络股份有限公司 Performance test management platform
CN112732575A (en) * 2021-01-08 2021-04-30 北京虹信万达科技有限公司 Business system testing method based on information technology application innovation environment
CN115687153A (en) * 2022-11-17 2023-02-03 康键信息技术(深圳)有限公司 Automatic interface testing method, system, equipment and storage medium based on big data
CN116594884A (en) * 2023-05-16 2023-08-15 上海安般信息科技有限公司 A fuzz testing method and device based on using concurrency

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1728657A (en) * 2004-07-30 2006-02-01 Ut斯达康通讯有限公司 Load simulator and simulation system for stream media service
CN1953401A (en) * 2005-10-20 2007-04-25 英业达股份有限公司 A multithreaded network stress testing method
CN103138995A (en) * 2011-11-24 2013-06-05 中兴通讯股份有限公司 Method and device for server performance test
CN103544102A (en) * 2013-09-02 2014-01-29 烟台中科网络技术研究所 Method and device for test and simulation of software performance

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1728657A (en) * 2004-07-30 2006-02-01 Ut斯达康通讯有限公司 Load simulator and simulation system for stream media service
CN1953401A (en) * 2005-10-20 2007-04-25 英业达股份有限公司 A multithreaded network stress testing method
CN103138995A (en) * 2011-11-24 2013-06-05 中兴通讯股份有限公司 Method and device for server performance test
CN103544102A (en) * 2013-09-02 2014-01-29 烟台中科网络技术研究所 Method and device for test and simulation of software performance

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148616A (en) * 2020-09-30 2020-12-29 中国民航信息网络股份有限公司 Performance test management platform
CN112148616B (en) * 2020-09-30 2024-04-26 中国民航信息网络股份有限公司 Performance test management platform
CN112732575A (en) * 2021-01-08 2021-04-30 北京虹信万达科技有限公司 Business system testing method based on information technology application innovation environment
CN115687153A (en) * 2022-11-17 2023-02-03 康键信息技术(深圳)有限公司 Automatic interface testing method, system, equipment and storage medium based on big data
CN116594884A (en) * 2023-05-16 2023-08-15 上海安般信息科技有限公司 A fuzz testing method and device based on using concurrency
CN116594884B (en) * 2023-05-16 2023-10-27 上海安般信息科技有限公司 A fuzz testing method and device based on the use of concurrency

Similar Documents

Publication Publication Date Title
CN109634728B (en) Job scheduling method and device, terminal equipment and readable storage medium
JP5324958B2 (en) Method, program and apparatus for generating an integrated display of performance trends for multiple resources in a data processing system (integrated display of resource performance trends)
US10135693B2 (en) System and method for monitoring performance of applications for an entity
CN111290942A (en) Pressure testing method, device and computer readable medium
US11526413B2 (en) Distributed tracing of huge spans for application and dependent application performance monitoring
US11762720B2 (en) Information processing apparatus and non-transitory computer-readable storage medium for storing API use history display program
US11169910B2 (en) Probabilistic software testing via dynamic graphs
CN113656174A (en) Resource allocation method, system, computer device and storage medium
CN110825731A (en) Data storage method and device, electronic equipment and storage medium
CN113360368A (en) Method and device for testing software performance
CN109408361A (en) Monkey tests restored method, device, electronic equipment and computer readable storage medium
CN116149901A (en) Data verification test method and device and computer readable storage medium
CN110543413A (en) Business system testing method, device, equipment and storage medium
CN115982049A (en) Abnormal detection method, device and computer equipment in performance testing
US10382311B2 (en) Benchmarking servers based on production data
CN113254325A (en) Test case processing method and device
CN111694684A (en) Abnormal construction method and device of storage equipment, electronic equipment and storage medium
CN114780550A (en) An automatic update method, device, device and medium for element positioning path
CN119473900A (en) Comparative test methods, devices, equipment, storage media and program products
JP4928480B2 (en) Job processing system and job management method
CN113760696A (en) Program problem positioning method and device, electronic equipment and storage medium
CN115373923A (en) A 0x7c error location method, device and medium
CN116048975A (en) Database testing method and device, electronic equipment and storage medium
CN110309038B (en) Performance test method and device, electronic equipment and computer readable storage medium
CN113778851A (en) Method, apparatus, system, server and medium for stress testing

Legal Events

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200616

RJ01 Rejection of invention patent application after publication