TWI734746B - Method and device for simulating online pressure test - Google Patents

Method and device for simulating online pressure test Download PDF

Info

Publication number
TWI734746B
TWI734746B TW106104939A TW106104939A TWI734746B TW I734746 B TWI734746 B TW I734746B TW 106104939 A TW106104939 A TW 106104939A TW 106104939 A TW106104939 A TW 106104939A TW I734746 B TWI734746 B TW I734746B
Authority
TW
Taiwan
Prior art keywords
requests
task queue
current
module
time
Prior art date
Application number
TW106104939A
Other languages
Chinese (zh)
Other versions
TW201734785A (en
Inventor
林江彬
徐彪
Original Assignee
香港商阿里巴巴集團服務有限公司
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 香港商阿里巴巴集團服務有限公司 filed Critical 香港商阿里巴巴集團服務有限公司
Publication of TW201734785A publication Critical patent/TW201734785A/en
Application granted granted Critical
Publication of TWI734746B publication Critical patent/TWI734746B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • G06F11/3414Workload generation, e.g. scripts, playback
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment

Abstract

本發明實施例提供了一種模擬線上壓力測試的方法和裝置,所述方法包括:獲得單位時間內產生的請求總次數;將所述單位時間劃分為多個時間片;根據所述請求總次數,分別確定與所述多個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求,從而能夠保證在模擬線上壓力測試時產生的請求次數線上真實的請求次數保持一致;同時,採用根據請求總次數確定每個時間片的請求次數的方式,也使得在模擬線上壓力測試時產生的壓力是可控的。 The embodiment of the present invention provides a method and device for simulating online stress testing. The method includes: obtaining the total number of requests generated in a unit time; dividing the unit time into multiple time slices; and according to the total number of requests, Respectively determine the number of requests corresponding to the multiple time slices, and execute the requests of the corresponding time slices according to the number of requests, so as to ensure that the number of requests generated during the simulated online stress test is consistent with the actual number of requests on the line; at the same time, The method of determining the number of requests for each time slice according to the total number of requests also makes the pressure generated during the simulated online stress test controllable.

Description

模擬線上壓力測試的方法和裝置 Method and device for simulating online pressure test

本發明關於資訊技術領域,特別是關於一種模擬線上壓力測試的方法和一種模擬線上壓力測試的裝置。 The present invention relates to the field of information technology, in particular to a method for simulating online pressure testing and a device for simulating online pressure testing.

壓力測試是指對被測系統不斷施加壓力的測試,是透過確定一個系統的瓶頸或者不能接收的性能點,來獲得系統所能提供的最大服務級別的測試。例如,測試一個Web網站在大量的訪問請求下,系統的回應何時會退化或失敗。通常,壓力測試都是透過模擬線上壓力來進行的。 Stress testing refers to a test that continuously exerts pressure on the system under test. It is a test to obtain the maximum service level that the system can provide by determining the bottleneck or unacceptable performance points of a system. For example, to test when a Web site will degrade or fail in response to a large number of access requests. Usually, stress tests are performed by simulating online pressure.

壓力測試工具的原理是:用戶端透過多執行緒或多進程模擬虛擬使用者訪問,對伺服器端施加壓力,然後在過程中監控和收集性能資料。目前,一般採用壓力器來實現。壓力器的壓力產生模組可以根據腳本內容產生實際的負載,也就是根據使用者的設定,進行自我複製來產生多個用戶端向伺服器發送請求。 The principle of the stress test tool is: the client side simulates virtual user access through multiple threads or processes, exerts pressure on the server side, and then monitors and collects performance data in the process. At present, it is generally realized by using a pressure device. The pressure generating module of the pressure device can generate the actual load according to the content of the script, that is, according to the user's setting, self-replicating to generate multiple clients to send requests to the server.

傳統的模擬線上壓力的方法是由壓力器的壓力產生模組建立多個執行緒,在測試中,每個執行緒都按照極限壓力來進行測試。極限壓力的意思是,每個執行緒在發起一 次訪問請求後,又立即發起一次新的訪問請求,或者只是透過簡單的暫停一段時間來減少壓力的產生。但是,傳統的方法存在如下缺陷: The traditional method of simulating online pressure is to create multiple threads by the pressure generating module of the pressure device. In the test, each thread is tested according to the ultimate pressure. The ultimate pressure means that each thread initiates a After this visit request, immediately initiate a new visit request, or simply pause for a period of time to reduce stress. However, the traditional method has the following shortcomings:

1)透過壓力器建立多個執行緒,從而產生的壓力的次數和頻率無法和線上真實壓力的次數和頻率一致,使得壓力測試不能獲得理想的結果。 1) Multiple threads are established through the pressure device, and the number and frequency of the pressure generated cannot be consistent with the number and frequency of the real pressure on the line, making the pressure test unable to obtain the desired result.

2)透過壓力器產生的壓力,受軟硬體環境影響較大,不同類型或者不同型號的壓力器產生的壓力差異較大。 2) The pressure generated by the pressure device is greatly affected by the soft and hard environment, and the pressure generated by different types or types of pressure devices varies greatly.

3)壓力器建立的多個執行緒相互之間是獨立的,每個獨立的執行緒之間沒有任何關聯,無法按照測試的實際需求去統一地對壓力的大小進行控制。 3) The multiple threads established by the pressure device are independent of each other, and there is no correlation between each independent thread, and it is impossible to uniformly control the size of the pressure according to the actual needs of the test.

鑒於上述問題,提出了本發明實施例以便提供一種克服上述問題或者至少部分地解決上述問題的一種模擬線上壓力測試的方法和相應的一種模擬線上壓力測試的裝置。 In view of the foregoing problems, embodiments of the present invention are proposed to provide a method for simulating online stress testing and a corresponding device for simulating online stress testing that overcomes or at least partially solves the foregoing problems.

為了解決上述問題,本發明揭示了一種模擬線上壓力測試的方法,包括:獲得單位時間內產生的請求總次數;將所述單位時間劃分為多個時間片;根據所述請求總次數,分別確定與所述多個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求。 In order to solve the above-mentioned problems, the present invention discloses a method for simulating online stress testing, including: obtaining the total number of requests generated in a unit time; dividing the unit time into multiple time slices; respectively determining the number of times according to the total number of requests The number of requests corresponding to the multiple time slices, and the request of the corresponding time slice is executed according to the number of requests.

可選地,所述根據所述請求總次數,分別確定與所述多個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求的步驟包括:遍歷所述多個時間片;採用所述請求總次數確定與所述多個時間片對應的請求次數。 Optionally, the step of respectively determining the number of requests corresponding to the multiple time slices according to the total number of requests, and executing the request of the corresponding time slice according to the number of requests includes: traversing the multiple time slices ; Using the total number of requests to determine the number of requests corresponding to the multiple time slices.

在執行目前時間片時,將所述請求次數添加到任務佇列;調用預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應次數的請求。 When the current time slice is executed, the number of requests is added to the task queue; the preset test thread is invoked, and the current number of requests is read from the task queue, and then requests for the corresponding number of times are initiated.

可選地,所述調用預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應次數的請求的步驟包括:調用預設的測試執行緒,判斷所述任務佇列中的目前請求次數是否為零;若否,則採用所述預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應的請求,並對所述目前請求次數遞減;若是,則返回所述判斷所述任務佇列中的目前請求次數是否為零的子步驟。 Optionally, the step of invoking a preset test thread, after reading the current number of requests from the task queue, initiating a corresponding number of requests includes: invoking a preset test thread, and judging the task queue Whether the current number of requests in the column is zero; if not, the preset test thread is used, after reading the current number of requests from the task queue, the corresponding request is initiated, and the current number of requests is Decrease; if yes, return to the sub-step of judging whether the current number of requests in the task queue is zero.

可選地,所述獲得單位時間內產生的請求總次數的步驟包括:從設備的訪問日誌中抽樣提取單位時間內產生的請求總次數。 Optionally, the step of obtaining the total number of requests generated per unit time includes: extracting a sample of the total number of requests generated per unit time from the access log of the device.

可選地,所述將所述單位時間劃分為多個時間片的步驟包括:將所述單位時間平均劃分為多個時間片。 Optionally, the step of dividing the unit time into multiple time slices includes: dividing the unit time into multiple time slices on average.

為了解決上述問題,本發明還揭示了一種模擬線上壓力測試的裝置,包括:獲得模組,用於獲得單位時間內產生的請求總次數;劃分模組,用於將所述單位時間劃分為多個時間片;執行模組,用於根據所述請求總次數,分別確定與所述多個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求。 In order to solve the above-mentioned problems, the present invention also discloses a device for simulating online stress testing, which includes: an obtaining module, which is used to obtain the total number of requests generated in a unit time; and a division module, which is used to divide the unit time into multiple The execution module is used to determine the number of requests corresponding to the multiple time slices according to the total number of requests, and execute the request of the corresponding time slice according to the number of requests.

可選地,所述執行模組包括:遍歷子模組,用於遍歷所述多個時間片;確定子模組,用於採用所述請求總次數確定與所述多個時間片對應的請求次數。 Optionally, the execution module includes: a traversal sub-module for traversing the multiple time slices; a determining sub-module for determining a request corresponding to the multiple time slices using the total number of requests frequency.

添加子模組,用於在執行目前時間片時,將所述請求次數添加到任務佇列;執行子模組,用於調用預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應次數的請求。 The add sub-module is used to add the number of requests to the task queue when the current time slice is executed; the execution sub-module is used to call the preset test thread and read the current time from the task queue After the number of requests, initiate the corresponding number of requests.

可選地,所述執行子模組包括:判斷單元,用於調用預設的測試執行緒,判斷所述任務佇列中的目前請求次數是否為零;執行單元,用於在判斷所述任務佇列中的目前請求次數不為零時,採用所述預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應的請求,並對所述目 前請求次數遞減;返回單元,用於在判斷所述任務佇列中的目前請求次數為零時,返回所述判斷單元。 Optionally, the execution sub-module includes: a judging unit for calling a preset test thread to judge whether the current number of requests in the task queue is zero; an execution unit for judging the task When the current number of requests in the queue is not zero, the preset test thread is used, after reading the current number of requests from the task queue, a corresponding request is initiated, and the target The number of previous requests decreases; the returning unit is used to return to the judging unit when judging that the current number of requests in the task queue is zero.

可選地,所述獲得模組包括:獲得子模組,用於從設備的訪問日誌中抽樣提取單位時間內產生的請求總次數。 Optionally, the obtaining module includes: an obtaining sub-module configured to sample and extract the total number of requests generated per unit time from the access log of the device.

可選地,所述劃分模組包括:劃分子模組,用於將所述單位時間平均劃分為多個時間片。 Optionally, the division module includes: a division sub-module configured to divide the unit time into multiple time slices on average.

與背景技術相比,本發明實施例包括以下優點:本發明實施例,透過將單位時間劃分為多個時間片,並根據在所述單位時間內獲得的請求總次數,分別確定出與每個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求,能夠保證在模擬線上壓力測試時產生的請求次數線上真實的請求次數保持一致;同時,採用根據請求總次數確定每個時間片的請求次數的方式,也使得在模擬線上壓力測試時產生的壓力是可控的。 Compared with the background art, the embodiments of the present invention include the following advantages: In the embodiments of the present invention, the unit time is divided into multiple time slices, and the total number of requests obtained in the unit time is determined to correspond to each The number of requests corresponding to the time slice, and the request of the corresponding time slice is executed according to the number of requests, which can ensure that the number of requests generated during the simulated online stress test remains the same as the actual number of requests; at the same time, the total number of requests is used to determine each The number of requests for time slices also makes the stress generated during the simulated online stress test controllable.

其次,由於本發明實施例中的任務佇列被設計為int類型的值,對記憶體的消耗極低,不會因為請求次數的增多而增大對記憶體的要求,而且,透過在發起相應的訪問請求時,僅僅是對任務佇列中的目前請求次數遞減,進一步使得對測試執行緒的調度高效和簡便。 Secondly, because the task queue in the embodiment of the present invention is designed as an int type value, the memory consumption is extremely low, and the memory requirements will not increase due to the increase in the number of requests. Moreover, by initiating the corresponding When the access request is made, only the current number of requests in the task queue is decremented, which further makes the scheduling of test threads more efficient and simple.

101、102、103‧‧‧方法步驟 101, 102, 103‧‧‧Method steps

201、202、203、204、205、206‧‧‧方法步驟 201, 202, 203, 204, 205, 206‧‧‧Method steps

301‧‧‧獲得模組 301‧‧‧Get the mod

302‧‧‧劃分模組 302‧‧‧Division Module

303‧‧‧執行模組 303‧‧‧Execution Module

圖1是本發明的一種模擬線上壓力測試的方法實施例一的步驟流程圖;圖2是本發明的一種模擬線上壓力測試的方法實施例二的步驟流程圖;圖3是本發明的一種模擬線上壓力測試的裝置實施例的結構方塊圖。 Fig. 1 is a step flow chart of Embodiment 1 of a method of simulating online stress testing of the present invention; Fig. 2 is a step flow chart of Embodiment 2 of a method of simulating online stress testing of the present invention; Fig. 3 is a simulation of the present invention A structural block diagram of an embodiment of an online pressure test device.

為使本發明的上述目的、特徵和優點能夠更加明顯易懂,下面結合附圖和具體實施方式對本發明作進一步詳細的說明。 In order to make the above-mentioned objects, features and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

參照圖1,示出了本發明的一種模擬線上壓力測試的方法實施例一的步驟流程圖,具體可以包括如下步驟: 1, there is shown a step flow chart of Embodiment 1 of a method for simulating online stress testing of the present invention, which may specifically include the following steps:

步驟101,獲得單位時間內產生的請求總次數;在本發明實施例中,為了盡可能地保證壓力測試中產生的壓力與線上真實的壓力相一致,可以透過抽樣獲得單位時間內系統所接收到的壓力的大小情況,即單位時間內產生的請求總次數,從而獲得在模擬線上壓力測試時,每個時間段應該產生的請求總次數。 Step 101: Obtain the total number of requests generated in a unit time; in the embodiment of the present invention, in order to ensure that the pressure generated in the stress test is consistent with the real pressure on the line as much as possible, the system received by the system can be obtained through sampling. The size of the pressure, that is, the total number of requests generated per unit time, so as to obtain the total number of requests that should be generated in each time period during the simulated online stress test.

單位時間可以是根據抽樣的需要所設定的一段時間,例如,可以是1s,5s,10s或者60s等等。本領域技術人員可以根據系統線上上被請求的實際情況設定單位時間的長短,本發明對此不作具體限定。 The unit time can be a period of time set according to the needs of sampling, for example, it can be 1s, 5s, 10s, 60s, and so on. Those skilled in the art can set the length of the unit time according to the actual situation of the request on the system line, which is not specifically limited in the present invention.

在本發明的一種較佳實施例中,所述獲得單位時間內 產生的請求總次數的步驟可以包括如下子步驟: 子步驟1011,從設備的訪問日誌中抽樣提取單位時間內產生的請求總次數。 In a preferred embodiment of the present invention, the acquisition unit time The step of generating the total number of requests may include the following sub-steps: Sub-step 1011, sampling and extracting the total number of requests generated per unit time from the access log of the device.

通常,設備的訪問日誌可以即時地記錄下系統所接收到的請求,在具體實現中,可以透過抽樣提取設備訪問日誌中的資訊,獲得單位時間內產生的請求總次數,例如,系統在1s內所接收到的請求總次數為10000次。 Generally, the access log of the device can record the requests received by the system in real time. In specific implementation, the information in the access log of the device can be sampled to obtain the total number of requests generated per unit time, for example, the system is within 1s The total number of requests received is 10,000.

步驟102,將所述單位時間劃分為多個時間片;在本發明實施例中,為了更準確地對模擬線上壓力測試時產生的壓力進行控制,可以將單位時間劃分為更小的時間片。 Step 102: Divide the unit time into multiple time slices; in the embodiment of the present invention, in order to more accurately control the pressure generated during the simulated online stress test, the unit time can be divided into smaller time slices.

在具體實現中,可以將所述單位時間平均劃分為多個時間片,例如,將單位時間1s平均劃分為100個長度為10ms的時間片,或者將單位時間1s平均劃分為1000個長度為1ms的時間片。本領域技術人員可以根據抽樣所選擇的單位時間的具體長度,確定每個時間片的長度,本發明對此不作具體限定。 In a specific implementation, the unit time can be divided into multiple time slices on average, for example, the unit time 1s can be divided into 100 time slices with a length of 10ms on average, or the unit time 1s can be divided into 1000 time slices with a length of 1ms on average. Time slice. Those skilled in the art can determine the length of each time slice according to the specific length of the unit time selected for sampling, which is not specifically limited in the present invention.

步驟103,根據所述請求總次數,分別確定與所述多個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求。 Step 103: Determine the number of requests corresponding to the multiple time slices respectively according to the total number of requests, and execute the request of the corresponding time slice according to the number of requests.

在本發明實施例中,在確定與所述多個時間片對應的請求次數時,可以按照平均分配的方式,即將在步驟101中獲得的請求總次數,平均分配給每個時間片。例如,對於系統在1s內所接收到的請求總次數為10000次,若按 照步驟102中的方式,將單位時間1s平均劃分成了100個長度為10ms的時間片,則可以確定每個時間片被分配的請求次數為10000/100=100次。 In the embodiment of the present invention, when determining the number of requests corresponding to the multiple time slices, an even distribution method may be used, that is, the total number of requests obtained in step 101 is evenly distributed to each time slice. For example, if the total number of requests received by the system within 1s is 10,000, if you press According to the method in step 102, the unit time 1s is divided into 100 time slices with a length of 10ms on average, and it can be determined that the number of requests allocated for each time slice is 10000/100=100 times.

當然,本領域技術人員還可以按照隨機分配的方式,確定出與所述多個時間對應的請求次數,本發明對此不作具體限定。但需要注意的是,無論按照何種方式確定每個時間片的請求次數,都應該保證多個時間片的請求次數之和與單位時間獲得的請求總次數相同。 Of course, those skilled in the art can also determine the number of requests corresponding to the multiple times in a random allocation manner, which is not specifically limited in the present invention. However, it should be noted that no matter what method is used to determine the number of requests for each time slice, it should be ensured that the sum of the number of requests for multiple time slices is the same as the total number of requests obtained per unit time.

進而,在模擬線上壓力測試時,可以調用測試執行緒,按照所述請求次數執行相應時間片的請求。 Furthermore, when simulating an online stress test, the test execution thread can be called to execute the request of the corresponding time slice according to the number of requests.

在具體實現中,在對每個單位時間重放壓力的時,測試執行緒可以按照目前時間片的請求次數,對系統發起相應次數請求。 In a specific implementation, when the pressure is replayed for each unit of time, the test thread can initiate a corresponding number of requests to the system according to the number of requests for the current time slice.

在本發明的一種較佳實施例中,所述根據所述請求總次數,分別確定與所述多個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求的步驟具體可以包括如下子步驟:子步驟1031,遍歷所述多個時間片;子步驟1032,採用所述請求總次數確定與所述多個時間片對應的請求次數。 In a preferred embodiment of the present invention, the step of respectively determining the number of requests corresponding to the multiple time slices according to the total number of requests, and executing the request of the corresponding time slice according to the number of requests may specifically be It includes the following sub-steps: sub-step 1031, traverse the multiple time slices; sub-step 1032, use the total number of requests to determine the number of requests corresponding to the multiple time slices.

子步驟1033,在執行目前時間片時,將所述請求次數添加到任務佇列;子步驟1034,調用預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應次數的請求。 Sub-step 1033, when executing the current time slice, add the number of requests to the task queue; sub-step 1034, call a preset test thread, read the current number of requests from the task queue, and initiate a corresponding The number of requests.

在具體實現中,可以遍歷所述多個時間片,按照時間片的先後順序,分別確定出每個時間片對應的請求次數,然後在執行目前時間片時,將目前時間片對應的請求次數添加到任務佇列,調用預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應次數的請求。 In a specific implementation, you can traverse the multiple time slices, determine the number of requests corresponding to each time slice according to the sequence of the time slices, and then add the number of requests corresponding to the current time slice when the current time slice is executed Go to the task queue, call the preset test thread, read the current number of requests from the task queue, and initiate the corresponding number of requests.

在具體實現中,可以在執行時間片1時,將時間片1對應的請求次數添加到任務佇列,例如10次,然後調用測試執行緒,從任務佇列中讀取目前請求次數10次,並對系統發起10次訪問請求;然後按照時間先後順序,執行時間片2,將時間片2對應的請求次數添加到任務佇列,例如8次,調用測試執行緒,從任務佇列中讀取目前請求次數8次,並對系統發起8次訪問請求;當全部時間片均被執行完後,結束所述測試。 In a specific implementation, when time slice 1 is executed, the number of requests corresponding to time slice 1 can be added to the task queue, for example, 10 times, and then the test thread can be called to read the current number of requests from the task queue 10 times. Initiate 10 access requests to the system; then execute time slice 2 in chronological order, and add the number of requests corresponding to time slice 2 to the task queue, for example, 8 times, call the test thread, and read from the task queue The current number of requests is 8 times, and 8 access requests are initiated to the system; when all time slices have been executed, the test ends.

在本發明實施例中,透過將單位時間劃分為多個時間片,並根據在所述單位時間內獲得的請求總次數,分別確定出與每個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求,能夠保證在模擬線上壓力測試時產生的請求次數線上真實的請求次數保持一致;同時,採用根據請求總次數確定每個時間片的請求次數的方式,也使得在模擬線上壓力測試時產生的壓力是可控。 In the embodiment of the present invention, the unit time is divided into multiple time slices, and the number of requests corresponding to each time slice is determined according to the total number of requests obtained in the unit time, and the number of requests corresponding to each time slice is determined according to the request. The number of times to execute the request of the corresponding time slice can ensure that the number of requests generated during the simulated online stress test is consistent with the real number of requests on the line; at the same time, the method of determining the number of requests for each time slice according to the total number of requests also makes the simulation The pressure generated during the online pressure test is controllable.

參照圖2,示出了本發明的一種模擬線上壓力測試的方法實施例二的步驟流程圖,具體可以包括如下步驟: Referring to Fig. 2, there is shown a flow chart of the second embodiment of a method for simulating online stress testing of the present invention, which may specifically include the following steps:

步驟201,從設備的訪問日誌中抽樣提取單位時間內產生的請求總次數; 在本發明實施例中,為了盡可能地保證壓力測試中產生的壓力與線上真實的壓力相一致,可以首先透過抽樣獲得單位時間內系統所接收到的壓力的大小情況,即單位時間內產生的請求總次數,從而獲得在模擬線上壓力測試時,每個時間段應該產生的請求總次數。 Step 201: Extract a sample of the total number of requests generated per unit time from the access log of the device; In the embodiment of the present invention, in order to ensure that the pressure generated in the pressure test is consistent with the real pressure on the line as much as possible, the size of the pressure received by the system per unit time can be obtained through sampling first, that is, the pressure generated per unit time The total number of requests, so as to obtain the total number of requests that should be generated in each time period during the simulated online stress test.

通常,設備的訪問日誌可以即時地記錄下系統所接收到的請求。因此,可以透過抽樣提取設備訪問日誌中的資訊,獲得單位時間內產生的請求總次數,例如,透過抽樣,獲得系統在單位時間1s內所接收到的請求總次數為10000次。 Usually, the access log of the device can record the requests received by the system in real time. Therefore, the information in the device access log can be sampled to obtain the total number of requests generated per unit time. For example, by sampling, the total number of requests received by the system in 1 second per unit time is 10,000.

步驟202,將所述單位時間平均劃分為多個時間片;在具體實現中,為了更準確地對模擬線上壓力測試時產生的壓力進行控制,可以將單位時間平均劃分為更小的時間片。例如,將單位時間1s平均劃分為100個長度為10ms的時間片,或者將單位時間1s平均劃分為1000個長度為1ms的時間片。 Step 202: Divide the unit time into multiple time slices on average; in specific implementation, in order to more accurately control the pressure generated during the simulated online stress test, the unit time can be divided into smaller time slices on average. For example, divide the unit time 1s into 100 time slices with a length of 10ms on average, or divide the unit time 1s into 1000 time slices with a length of 1ms on average.

步驟203,採用所述請求總次數確定與所述多個時間片對應的請求次數;在本發明實施例中,在確定出與所述多個時間片對應的請求次數後,可以按照平均分配的方式,將獲得的請求總次數,平均分配給每個時間片。例如,對於系統在單位時間1s內所接收到的請求總次數為10000次,若每個時間片的長度為10ms,則單位時間1s可以被平均劃分成100個時間片,進而可以確定每個時間片被分配的請求次 數為10000/100=100次。 In step 203, the total number of requests is used to determine the number of requests corresponding to the multiple time slices; in the embodiment of the present invention, after the number of requests corresponding to the multiple time slices is determined, the number of requests corresponding to the multiple time slices may be evenly distributed. In this way, the total number of requests obtained is evenly distributed to each time slice. For example, for the total number of requests received by the system in a unit time of 1s is 10,000, if the length of each time slice is 10ms, the unit time 1s can be divided into 100 time slices on average, and then each time can be determined Number of requests for which the slice was allocated The number is 10000/100=100 times.

步驟204,在執行目前時間片時,將所述請求次數添加到任務佇列;在本發明實施例中,可以按照多個時間片的時間先後順序,首先在執行時間片1時,將時間片1對應的請求次數,例如10次,添加到任務佇列。 In step 204, when the current time slice is executed, the number of requests is added to the task queue; in the embodiment of the present invention, the time sequence of multiple time slices may be followed. First, when time slice 1 is executed, the time slice The number of requests corresponding to 1, for example, 10 times, is added to the task queue.

在具體實現中,為了保證模擬線上壓力測試的高效執行,可以把任務對列設計成一個int類型的值,只記錄在目前時間片有多少次的請求需要被發起。 In the specific implementation, in order to ensure the efficient execution of the simulated online stress test, the task queue can be designed as an int type value, which only records how many requests need to be initiated in the current time slice.

步驟205,調用預設的測試執行緒,判斷所述任務佇列中的目前請求次數是否為零;通常,預設的測試執行緒可以有多個,多個測試執行緒共同組成一個執行緒池,當在模擬線上壓力測試時,由執行緒池中的多個測試執行緒分別執行。 Step 205: Invoke a preset test thread to determine whether the current number of requests in the task queue is zero; usually, there can be multiple preset test threads, and multiple test threads together form a thread pool , When the online stress test is simulated, multiple test threads in the thread pool are executed separately.

在本發明實施例中,在調用預設的測試執行緒後,可以由所述測試執行緒從所述任務佇列中讀取目前請求次數後,發起相應次數的請求。 In the embodiment of the present invention, after the preset test thread is invoked, the test thread may read the current number of requests from the task queue and initiate a corresponding number of requests.

在具體實現中,可以調用預設的測試執行緒,從所述任務佇列中讀取出目前請求次數,判斷所述目前請求次數是否為零,若否,則執行步驟206。 In a specific implementation, a preset test execution thread can be called, the current number of requests is read from the task queue, and it is determined whether the current number of requests is zero, and if not, step 206 is executed.

步驟206,採用所述預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應的請求,並對所述目前請求次數遞減。 Step 206: Using the preset test thread, after reading the current number of requests from the task queue, initiate a corresponding request, and decrement the current number of requests.

在具體實現中,當測試執行緒判斷任務佇列中的目前 請求次數不為零時,可以發起一次訪問請求,並對所述目前請求次數遞減。例如,若在開始執行時間片1時,測試執行緒判斷任務佇列中的目前請求次數為10次,則可以對系統發起一次訪問請求,然後對任務佇列中的目前請求次數遞減一次,即,在所述測試執行緒發起一次訪問請求後,所述任務對列中的目前請求次數記錄為9次。 In specific implementation, when the test thread determines the current task queue When the number of requests is not zero, an access request can be initiated, and the current number of requests is decremented. For example, if at the beginning of time slice 1, the test thread judges that the current number of requests in the task queue is 10, it can initiate an access request to the system, and then the current number of requests in the task queue is decremented once, that is After the test thread initiates an access request, the current number of requests in the task pair is recorded as 9 times.

在本發明實施例中,測試執行緒在發起一次訪問請求後,可以返回繼續對任務佇列中的目前請求次數進行判斷,直到目前請求次數為零,則停止所述測試或繼續等待在下一個時間片時,執行相應應的請求次數。例如,若測試執行緒在執行時間片1,對系統發起10次訪問請求後,使得任務佇列中所記錄的目前請求次數為零,則需要在下一個時間片即時間片2所對應的時間段才能發起相應的訪問請求。 In the embodiment of the present invention, after the test thread initiates an access request, it can return to continue to judge the current number of requests in the task queue. Until the current number of requests is zero, stop the test or continue to wait at the next time. The number of times the corresponding request is executed during the filming time. For example, if the test thread is executing in time slice 1, after issuing 10 access requests to the system, so that the current number of requests recorded in the task queue is zero, it needs to be in the next time slice, that is, the time period corresponding to time slice 2. In order to initiate the corresponding access request.

在本發明實施例中,由於任務佇列被設計為int類型的值,對記憶體的消耗極低,不會因為請求次數的增多而增大對記憶體的要求,而且,透過在發起相應的訪問請求時,僅僅是對任務佇列中的目前請求次數遞減,進一步使得對測試執行緒的調度高效和簡便。 In the embodiment of the present invention, because the task queue is designed as an int type value, the memory consumption is extremely low, and the memory requirements will not increase due to the increase in the number of requests. Moreover, by initiating the corresponding When accessing the request, only the current number of requests in the task queue is decremented, which further makes the scheduling of test threads efficient and simple.

需要說明的是,對於方法實施例,為了簡單描述,故將其都表述為一系列的動作組合,但是本領域技術人員應該知悉,本發明實施例並不受所描述的動作順序的限制,因為依據本發明實施例,某些步驟可以採用其他順序或者同時進行。其次,本領域技術人員也應該知悉,說明書中 所描述的實施例均屬於較佳實施例,所關於的動作並不一定是本發明實施例所必須的。 It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the embodiments of the present invention are not limited by the described sequence of actions, because According to the embodiments of the present invention, certain steps may be performed in other order or simultaneously. Secondly, those skilled in the art should also be aware that in the description The described embodiments are all preferred embodiments, and the related actions are not necessarily required by the embodiments of the present invention.

參照圖3,示出了本發明的一種模擬線上壓力測試的裝置實施例的結構方塊圖,具體可以包括如下模組:獲得模組301,用於獲得單位時間內產生的請求總次數;劃分模組302,用於將所述單位時間劃分為多個時間片;執行模組303,用於根據所述請求總次數,分別確定與所述多個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求。 3, there is shown a structural block diagram of an embodiment of a device for simulating online stress testing of the present invention, which may specifically include the following modules: an obtaining module 301, which is used to obtain the total number of requests generated per unit time; The group 302 is used to divide the unit time into multiple time slices; the execution module 303 is used to determine the number of requests corresponding to the multiple time slices according to the total number of requests, and according to the request The number of times to execute the request for the corresponding time slice.

在本發明實施例中,所述執行模組303具體可以包括如下子模組:遍歷子模組3031,用於遍歷所述多個時間片;確定子模組3032,用於採用所述請求總次數確定與所述多個時間片對應的請求次數。 In the embodiment of the present invention, the execution module 303 may specifically include the following sub-modules: a traversal sub-module 3031 for traversing the multiple time slices; a determining sub-module 3032 for adopting the request total The number of times determines the number of requests corresponding to the multiple time slices.

添加子模組3033,用於在執行目前時間片時,將所述請求次數添加到任務佇列;執行子模組3034,用於調用預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應次數的請求。 The add submodule 3033 is used to add the number of requests to the task queue when the current time slice is executed; the execution submodule 3034 is used to call a preset test thread and read from the task queue After taking the current number of requests, initiate the corresponding number of requests.

在本發明實施例中,所述執行子模組3034具體可以包括如下單元:判斷單元341,用於調用預設的測試執行緒,判斷所 述任務佇列中的目前請求次數是否為零;執行單元342,用於在判斷所述任務佇列中的目前請求次數不為零時,採用所述預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應的請求,並對所述目前請求次數遞減;返回單元343,用於在判斷所述任務佇列中的目前請求次數為零時,返回所述判斷單元。 In the embodiment of the present invention, the execution sub-module 3034 may specifically include the following units: a judging unit 341, configured to call a preset test thread and judge all Whether the current number of requests in the task queue is zero; the execution unit 342 is configured to use the preset test thread when judging that the current number of requests in the task queue is not zero. After reading the current number of requests in the queue, initiate a corresponding request and decrement the number of current requests; the returning unit 343 is configured to return to the judgment when the current number of requests in the task queue is judged to be zero unit.

在本發明實施例中,所述獲得模組301具體可以包括如下子模組:獲得子模組3011,用於從設備的訪問日誌中抽樣提取單位時間內產生的請求總次數。 In the embodiment of the present invention, the obtaining module 301 may specifically include the following sub-modules: the obtaining sub-module 3011 is used to sample and extract the total number of requests generated per unit time from the access log of the device.

在本發明實施例中,所述劃分模組302具體可以包括如下子模組:劃分子模組3021,用於將所述單位時間平均劃分為多個時間片。 In the embodiment of the present invention, the division module 302 may specifically include the following sub-modules: the division sub-module 3021 is configured to divide the unit time into multiple time slices on average.

對於裝置實施例而言,由於其與方法實施例基本相似,所以描述的比較簡單,相關之處參見方法實施例的部分說明即可。 As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.

本說明書中的各個實施例均採用遞進的方式描述,每個實施例重點說明的都是與其他實施例的不同之處,各個實施例之間相同相似的部分互相參見即可。 The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other.

本領域內的技術人員應明白,本發明實施例的實施例可提供為方法、裝置、或電腦程式產品。因此,本發明實施例可採用完全硬體實施例、完全軟體實施例、或結合軟 體和硬體方面的實施例的形式。而且,本發明實施例可採用在一個或多個其中包含有電腦可用程式碼的電腦可用儲存媒體(包括但不限於磁碟記憶體、CD-ROM、光學記憶體等)上實施的電腦程式產品的形式。 Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, devices, or computer program products. Therefore, the embodiment of the present invention may adopt a completely hardware embodiment, a completely software embodiment, or a combination of software The form of the embodiment in terms of hardware and hardware. Moreover, the embodiments of the present invention may adopt computer program products implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program codes. form.

在一個典型的配置中,所述電腦設備包括一個或多個處理器(CPU)、輸入/輸出介面、網路介面和記憶體。記憶體可能包括電腦可讀媒體中的非永久性記憶體,隨機存取記憶體(RAM)和/或非易失性記憶體等形式,如唯讀記憶體(ROM)或快閃記憶體(flash RAM)。記憶體是電腦可讀媒體的示例。電腦可讀媒體包括永久性和非永久性、可移動和非可移動媒體可以由任何方法或技術來實現資訊儲存。資訊可以是電腦可讀指令、資料結構、程式的模組或其他資料。電腦的儲存媒體的例子包括,但不限於相變記憶體(PRAM)、靜態隨機存取記憶體(SRAM)、動態隨機存取記憶體(DRAM)、其他類型的隨機存取記憶體(RAM)、唯讀記憶體(ROM)、電可擦除可程式設計唯讀記憶體(EEPROM)、快閃記憶體或其他記憶體技術、唯讀光碟唯讀記憶體(CD-ROM)、數位多功能光碟(DVD)或其他光學儲存、磁盒式磁帶,磁帶磁磁片儲存或其他磁性存放裝置或任何其他非傳輸媒體,可用於儲存可以被計算設備訪問的資訊。按照本文中的界定,電腦可讀媒體不包括暫態性的電腦可讀媒體(transitory media),如調變的資料信號和載波。 In a typical configuration, the computer device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory. Memory may include non-permanent memory in computer-readable media, random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory ( flash RAM). Memory is an example of computer-readable media. Computer-readable media include permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), and other types of random access memory (RAM) , Read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital multi-function Optical discs (DVD) or other optical storage, magnetic cassettes, magnetic tape storage or other magnetic storage devices, or any other non-transmission media, can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include transient computer-readable media (transitory media), such as modulated data signals and carrier waves.

本發明實施例是參照根據本發明實施例的方法、終端 設備(系統)、和電腦程式產品的流程圖和/或方塊圖來描述的。應理解可由電腦程式指令實現流程圖和/或方塊圖中的每一流程和/或方塊、以及流程圖和/或方塊圖中的流程和/或方塊的結合。可提供這些電腦程式指令到通用電腦、專用電腦、嵌入式處理機或其他可程式設計資料處理終端設備的處理器以產生一個機器,使得透過電腦或其他可程式設計資料處理終端設備的處理器執行的指令產生用於實現在流程圖一個流程或多個流程和/或方塊圖一個方塊或多個方塊中指定的功能的裝置。 The embodiment of the present invention refers to the method and terminal according to the embodiment of the present invention The equipment (system) and computer program products are described by flowcharts and/or block diagrams. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, dedicated computers, embedded processors or other programmable data processing terminal equipment to generate a machine, which can be executed by the processor of the computer or other programmable data processing terminal equipment The instructions generate a device for implementing the functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

這些電腦程式指令也可儲存在能引導電腦或其他可程式設計資料處理終端設備以特定方式工作的電腦可讀記憶體中,使得儲存在該電腦可讀記憶體中的指令產生包括指令裝置的製造品,該指令裝置實現在流程圖一個流程或多個流程和/或方塊圖一個方塊或多個方塊中指定的功能。 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing terminal equipment to work in a specific manner, so that the instructions stored in the computer-readable memory can be generated including the manufacturing of the instruction device The instruction device realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.

這些電腦程式指令也可裝載到電腦或其他可程式設計資料處理終端設備上,使得在電腦或其他可程式設計終端設備上執行一系列操作步驟以產生電腦實現的處理,從而在電腦或其他可程式設計終端設備上執行的指令提供用於實現在流程圖一個流程或多個流程和/或方塊圖一個方塊或多個方塊中指定的功能的步驟。 These computer program instructions can also be loaded on a computer or other programmable data processing terminal equipment, so that a series of operation steps are executed on the computer or other programmable terminal equipment to produce computer-implemented processing, so that the computer or other programmable terminal equipment The instructions executed on the design terminal device provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

儘管已描述了本發明實施例的較佳實施例,但本領域內的技術人員一旦得知了基本創造性概念,則可對這些實施例做出另外的變更和修改。所以,所附申請專利範圍意欲解釋為包括較佳實施例以及落入本發明實施例範圍的所 有變更和修改。 Although the preferred embodiments of the embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the scope of the attached patent application is intended to be interpreted as including the preferred embodiments and all that fall within the scope of the embodiments of the present invention. There are changes and modifications.

最後,還需要說明的是,在本文中,諸如第一和第二等之類的關係術語僅僅用來將一個實體或者操作與另一個實體或操作區分開來,而不一定要求或者暗示這些實體或操作之間存在任何這種實際的關係或者順序。而且,術語“包括”、“包含”或者其任何其他變體意在涵蓋非排他性的包含,從而使得包括一系列要素的過程、方法、物品或者終端設備不僅包括那些要素,而且還包括沒有明確列出的其他要素,或者是還包括為這種過程、方法、物品或者終端設備所固有的要素。在沒有更多限制的情況下,由語句“包括一個......”限定的要素,並不排除在包括所述要素的過程、方法、物品或者終端設備中還存在另外的相同要素。 Finally, it should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities. Or there is any such actual relationship or sequence between operations. Moreover, the terms "including", "including" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements not only includes those elements, but also includes those elements that are not explicitly listed. Other elements listed, or also include elements inherent to this process, method, article, or terminal device. Without more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other same elements in the process, method, article, or terminal device that includes the element.

以上對本發明所提供的一種模擬線上壓力測試的方法和一種模擬線上壓力測試的裝置,進行了詳細介紹,本文中應用了具體個例對本發明的原理及實施方式進行了闡述,以上實施例的說明只是用於幫助理解本發明的方法及其核心思想;同時,對於本領域的一般技術人員,依據本發明的思想,在具體實施方式及應用範圍上均會有改變之處,綜上所述,本說明書內容不應理解為對本發明的限制。 The method for simulating online stress testing and the device for simulating online stress testing provided by the present invention are described in detail above. In this article, specific examples are used to illustrate the principles and implementation of the present invention. The description of the above embodiments It is only used to help understand the method and the core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and the scope of application. In summary, The content of this specification should not be construed as a limitation of the present invention.

Claims (8)

一種模擬線上壓力測試的方法,其特徵在於,包括:從設備訪問日誌中獲得單位時間內產生的請求總次數;將所述單位時間劃分為多個時間片;以及根據所述請求總次數,分別確定與所述多個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求,其中,所述根據所述請求總次數,分別確定與所述多個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求的步驟包括:遍歷所述多個時間片;採用所述請求總次數確定與所述多個時間片對應的請求次數;在執行目前時間片時,將所述請求次數添加到任務佇列;以及調用預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應次數的請求。 A method for simulating an online stress test, characterized in that it comprises: obtaining the total number of requests generated in a unit time from a device access log; dividing the unit time into multiple time slices; and according to the total number of requests, respectively Determine the number of requests corresponding to the multiple time slices, and execute the request of the corresponding time slice according to the number of requests, wherein the number of requests corresponding to the multiple time slices is determined respectively according to the total number of requests , And executing a request for a corresponding time slice according to the number of requests includes: traversing the multiple time slices; using the total number of requests to determine the number of requests corresponding to the multiple time slices; when executing the current time slice , Adding the number of requests to the task queue; and invoking a preset test thread, reading the current number of requests from the task queue, and initiating a request of the corresponding number of times. 根據申請專利範圍第1項所述的方法,其中,所述調用預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應次數的請求的步驟包括:調用預設的測試執行緒,判斷所述任務佇列中的目前請求次數是否為零; 若否,則採用所述預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應的請求,並對所述目前請求次數遞減;以及若是,則返回所述判斷所述任務佇列中的目前請求次數是否為零的子步驟。 The method according to item 1 of the scope of patent application, wherein said calling a preset test thread, after reading the current number of requests from the task queue, the step of initiating a corresponding number of requests includes: calling a preset To determine whether the current number of requests in the task queue is zero; If not, use the preset test thread, read the current number of requests from the task queue, initiate a corresponding request, and decrement the number of current requests; and if yes, return to the judgment The sub-step of whether the current number of requests in the task queue is zero. 根據申請專利範圍第1或2項所述的方法,其中,所述獲得單位時間內產生的請求總次數的步驟包括:從設備的訪問日誌中抽樣提取單位時間內產生的請求總次數。 The method according to item 1 or 2 of the scope of patent application, wherein the step of obtaining the total number of requests generated per unit time includes: extracting the total number of requests generated per unit time from the access log of the device. 根據申請專利範圍第3項所述的方法,其中,所述將所述單位時間劃分為多個時間片的步驟包括:將所述單位時間平均劃分為多個時間片。 The method according to item 3 of the scope of patent application, wherein the step of dividing the unit time into multiple time slices includes: dividing the unit time into multiple time slices on average. 一種模擬線上壓力測試的裝置,其特徵在於,包括:獲得模組,用於從設備訪問日誌中獲得單位時間內產生的請求總次數;劃分模組,用於將所述單位時間劃分為多個時間片;以及執行模組,用於根據所述請求總次數,分別確定與所述多個時間片對應的請求次數,並按照所述請求次數執行相應時間片的請求,其中,所述執行模組包括:遍歷子模組,用於遍歷所述多個時間片;確定子模組,用於採用所述請求總次數確定與所述多 個時間片對應的請求次數。添加子模組,用於在執行目前時間片時,將所述請求次數添加到任務佇列;以及執行子模組,用於調用預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應次數的請求。 A device for simulating online stress testing, which is characterized by comprising: an obtaining module, which is used to obtain the total number of requests generated in a unit time from a device access log; and a dividing module, which is used to divide the unit time into multiple Time slices; and an execution module, configured to respectively determine the number of requests corresponding to the multiple time slices according to the total number of requests, and execute the request of the corresponding time slice according to the number of requests, wherein the execution module The group includes: a traversal sub-module, which is used to traverse the multiple time slices; a determining sub-module, which is used to use the total number of requests to determine the The number of requests corresponding to each time slice. Adding a sub-module is used to add the number of requests to the task queue when executing the current time slice; and an execution sub-module is used to call a preset test thread and read from the task queue After the current number of requests, initiate the corresponding number of requests. 根據申請專利範圍第5項所述的裝置,其中,所述執行子模組包括:判斷單元,用於調用預設的測試執行緒,判斷所述任務佇列中的目前請求次數是否為零;執行單元,用於在判斷所述任務佇列中的目前請求次數不為零時,採用所述預設的測試執行緒,從所述任務佇列中讀取目前請求次數後,發起相應的請求,並對所述目前請求次數遞減;以及返回單元,用於在判斷所述任務佇列中的目前請求次數為零時,返回所述判斷單元。 The device according to item 5 of the scope of patent application, wherein the execution sub-module includes: a judging unit for invoking a preset test execution thread to judge whether the current number of requests in the task queue is zero; The execution unit is configured to, when judging that the current number of requests in the task queue is not zero, use the preset test thread to read the current number of requests from the task queue and initiate a corresponding request , And decrement the number of current requests; and a returning unit for returning to the judging unit when judging that the number of current requests in the task queue is zero. 根據申請專利範圍第5或6項所述的裝置,其中,所述獲得模組包括:獲得子模組,用於從設備的訪問日誌中抽樣提取單位時間內產生的請求總次數。 The device according to item 5 or 6 of the scope of patent application, wherein the obtaining module includes: an obtaining sub-module for sampling and extracting the total number of requests generated per unit time from the access log of the device. 根據申請專利範圍第7項所述的裝置,其中,所述劃分模組包括:劃分子模組,用於將所述單位時間平均劃分為多個時間片。 The device according to item 7 of the scope of patent application, wherein the division module includes: a division sub-module for dividing the unit time into multiple time slices on average.
TW106104939A 2016-03-21 2017-02-15 Method and device for simulating online pressure test TWI734746B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610161942.7 2016-03-21
CN201610161942.7A CN107220165B (en) 2016-03-21 2016-03-21 Method and device for simulating online pressure test

Publications (2)

Publication Number Publication Date
TW201734785A TW201734785A (en) 2017-10-01
TWI734746B true TWI734746B (en) 2021-08-01

Family

ID=59899208

Family Applications (1)

Application Number Title Priority Date Filing Date
TW106104939A TWI734746B (en) 2016-03-21 2017-02-15 Method and device for simulating online pressure test

Country Status (3)

Country Link
CN (1) CN107220165B (en)
TW (1) TWI734746B (en)
WO (1) WO2017162028A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108574610B (en) * 2018-01-30 2020-10-20 北京金山云网络技术有限公司 Pressure testing method and device, electronic equipment and medium
CN110874304A (en) * 2018-09-03 2020-03-10 广州神马移动信息科技有限公司 Pressure testing method, device, equipment and computer readable storage medium
CN110764900A (en) * 2019-09-06 2020-02-07 深圳壹账通智能科技有限公司 Data distribution test method and device under high concurrency, terminal and storage medium
CN110865913B (en) * 2019-11-05 2024-05-03 深圳前海微众银行股份有限公司 Pressure testing method and device
CN111352967B (en) * 2020-02-27 2024-02-06 携程旅游网络技术(上海)有限公司 Frequency control method, system, equipment and medium of sliding window algorithm

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200715111A (en) * 2005-10-07 2007-04-16 Inventec Corp Test method of multi-line network pressure
CN101639792A (en) * 2008-07-29 2010-02-03 阿里巴巴集团控股有限公司 Method and device for processing concurrent data and electronic accounting system
CN101848116A (en) * 2010-04-21 2010-09-29 中国海洋大学 Simple and quick automatic pressure test method of Web server
CN103312553A (en) * 2012-03-14 2013-09-18 百度在线网络技术(北京)有限公司 Website service quality testing method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101331460B (en) * 2005-12-16 2012-10-03 国际商业机器公司 Method and system for metering usage of software products based on real-time benchmarking of processing power
US9015188B2 (en) * 2011-09-28 2015-04-21 Bmc Software, Inc. Methods and apparatus for monitoring execution of a database query program
CN105094986B (en) * 2015-07-20 2019-03-22 暨南大学 A kind of prediction technique and device of the burst access behavior towards storage system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200715111A (en) * 2005-10-07 2007-04-16 Inventec Corp Test method of multi-line network pressure
CN101639792A (en) * 2008-07-29 2010-02-03 阿里巴巴集团控股有限公司 Method and device for processing concurrent data and electronic accounting system
CN101848116A (en) * 2010-04-21 2010-09-29 中国海洋大学 Simple and quick automatic pressure test method of Web server
CN103312553A (en) * 2012-03-14 2013-09-18 百度在线网络技术(北京)有限公司 Website service quality testing method and device

Also Published As

Publication number Publication date
CN107220165B (en) 2020-08-04
CN107220165A (en) 2017-09-29
WO2017162028A1 (en) 2017-09-28
TW201734785A (en) 2017-10-01

Similar Documents

Publication Publication Date Title
TWI734746B (en) Method and device for simulating online pressure test
WO2017028697A1 (en) Method and device for growing or shrinking computer cluster
CN107480039B (en) Small file read-write performance test method and device for distributed storage system
CN108319547B (en) Test case generation method, device and system
US9455881B2 (en) Method for determining system topology graph changes in a distributed computing system
US9081623B1 (en) Service resource allocation
US20220129288A1 (en) Method and apparatus for determining the capacity of an application cluster
US10686891B2 (en) Migration of applications to a computing environment
CN106648556B (en) Method and device for front-end and back-end integrated development test
CN105446846A (en) Cloud desktop based performance test method
US10796038B2 (en) Estimating think times
JP2017516230A (en) Event-based recording and playback for advanced applications
TW201816627A (en) Resource scheduling method, device, and system
Zhu et al. A bi-metric autoscaling approach for n-tier web applications on kubernetes
US11171846B1 (en) Log throttling
US11151013B2 (en) Systems and methods for performance evaluation of input/output (I/O) intensive enterprise applications
WO2023217118A1 (en) Code test method and apparatus, and test case generation method and apparatus
Jayakumar et al. INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING & TECHNOLOGY (IJCET)
CN109495531A (en) Request processing method and device
JP2018508865A (en) Application event tracking
CN111309432B (en) Fault drilling method, device and system
CN112564996A (en) Pressure test flow scheduling method, pressure test flow control device and computer readable medium
CN107766216A (en) It is a kind of to be used to obtain the method and apparatus using execution information
CN109819311B (en) Terminal video evidence obtaining method and device
TWI763650B (en) A method and apparatus for obtaining application cluster capacity