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

Method and device for simulating online pressure test Download PDF

Info

Publication number
CN107220165B
CN107220165B CN201610161942.7A CN201610161942A CN107220165B CN 107220165 B CN107220165 B CN 107220165B CN 201610161942 A CN201610161942 A CN 201610161942A CN 107220165 B CN107220165 B CN 107220165B
Authority
CN
China
Prior art keywords
requests
request times
time
task queue
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.)
Active
Application number
CN201610161942.7A
Other languages
Chinese (zh)
Other versions
CN107220165A (en
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610161942.7A priority Critical patent/CN107220165B/en
Priority to TW106104939A priority patent/TWI734746B/en
Priority to PCT/CN2017/075949 priority patent/WO2017162028A1/en
Publication of CN107220165A publication Critical patent/CN107220165A/en
Application granted granted Critical
Publication of CN107220165B publication Critical patent/CN107220165B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

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

Abstract

The embodiment of the application provides a method and a device for simulating online pressure test, wherein the method comprises the following steps: obtaining the total number of requests generated in unit time; dividing the unit time into a plurality of time slices; respectively determining the number of request times corresponding to the plurality of time slices according to the total number of request times, and executing the request of the corresponding time slice according to the number of request times, so that the real number of request times on a request time line generated in the process of simulating the on-line pressure test can be kept consistent; meanwhile, the mode of determining the request times of each time slice according to the total request times also enables the pressure generated during the pressure test on the simulation line to be controllable.

Description

Method and device for simulating online pressure test
Technical Field
The present application relates to the field of information technology, and in particular, to a method and an apparatus for simulating online pressure testing.
Background
The stress test is a test for continuously applying stress to a tested system, and is a test for obtaining the maximum service level which can be provided by the system by determining the bottleneck or unacceptable performance point of the system. For example, a Web site is tested for when the response of the system will degrade or fail under a large number of access requests. Typically, pressure testing is performed by simulating in-line pressure.
The principle of the pressure test tool is as follows: the client simulates virtual user access through multiple threads or multiple processes, applies pressure to the server, and then monitors and collects performance data in the process. At present, the pressure is generally realized by a pressure device. The pressure generation module of the pressure device can generate the actual load according to the script content, namely, according to the setting of the user, the pressure generation module can perform self-copying to generate a plurality of clients to send the requests to the server.
A conventional method of simulating inline pressure is to create multiple threads from the pressure generation module of the press, each thread being tested at a threshold pressure during the test. Extreme pressure means that each thread initiates a new access request immediately after initiating an access request, or simply by pausing for a period of time to reduce the stress. However, the conventional method has the following drawbacks:
1) a plurality of threads are created by the forcer so that the number and frequency of generated pressures cannot be consistent with the number and frequency of real pressures on the line, so that the pressure test cannot obtain a desired result.
2) The pressure generated by the pressure device is greatly influenced by software and hardware environments, and the pressure difference generated by the pressure devices of different types or different models is larger.
3) The multiple threads created by the pressure device are independent of each other, and each independent thread has no association, so that the pressure cannot be uniformly controlled according to the actual requirement of the test.
Disclosure of Invention
In view of the above, embodiments of the present application are proposed to provide a method of simulating an inline pressure test and a corresponding apparatus for simulating an inline pressure test that overcome or at least partially solve the above problems.
In order to solve the above problem, the present application discloses a method for simulating an online pressure test, comprising:
obtaining the total number of requests generated in unit time;
dividing the unit time into a plurality of time slices;
and respectively determining the request times corresponding to the plurality of time slices according to the total request times, and executing the requests of the corresponding time slices according to the request times.
Optionally, the step of respectively determining the number of requests corresponding to the plurality of time slices according to the total number of requests, and executing the requests of the corresponding time slices according to the number of requests includes:
traversing the plurality of time slices;
and determining the request times corresponding to the plurality of time slices by adopting the total request times.
Adding the request times to a task queue when the current time slice is executed;
and calling a preset test thread, reading the current request times from the task queue, and then initiating the requests of corresponding times.
Optionally, the step of invoking a preset test thread, and after reading the current number of times of requests from the task queue, initiating a corresponding number of requests includes:
calling a preset test thread, and judging whether the current request frequency in the task queue is zero or not;
if not, adopting the preset test thread, initiating a corresponding request after reading the current request times from the task queue, and decreasing the current request times;
and if so, returning to the substep of judging whether the current request times in the task queue is zero or not.
Optionally, the step of obtaining the total number of requests generated in a unit time includes:
the total number of requests generated per unit time is sampled from the access log of the device.
Optionally, the step of dividing the unit time into a plurality of time slices includes:
the unit time average is divided into a plurality of time slices.
In order to solve the above problem, the present application further discloses a device for simulating an online pressure test, including:
the acquisition module is used for acquiring the total times of requests generated in unit time;
a dividing module for dividing the unit time into a plurality of time slices;
and the execution module is used for respectively determining the request times corresponding to the plurality of time slices according to the total request times and executing the requests of the corresponding time slices according to the request times.
Optionally, the execution module includes:
a traversal submodule for traversing the plurality of timeslices;
and the determining submodule is used for determining the request times corresponding to the plurality of time slices by adopting the total request times.
The adding submodule is used for adding the request times to a task queue when the current time slice is executed;
and the execution submodule is used for calling a preset test thread, reading the current request times from the task queue and then initiating the requests of corresponding times.
Optionally, the execution submodule includes:
the judging unit is used for calling a preset test thread and judging whether the current request frequency in the task queue is zero or not;
the execution unit is used for adopting the preset test thread when judging that the current request times in the task queue are not zero, initiating a corresponding request after reading the current request times from the task queue, and decreasing the current request times;
and the return unit is used for returning to the judging unit when judging that the current request times in the task queue is zero.
Optionally, the obtaining module includes:
and the obtaining submodule is used for sampling and extracting the total times of requests generated in unit time from the access log of the equipment.
Optionally, the dividing module includes:
and the dividing submodule is used for averagely dividing the unit time into a plurality of time slices.
Compared with the background art, the embodiment of the application has the following advantages:
according to the embodiment of the application, the unit time is divided into a plurality of time slices, the number of times of requests corresponding to each time slice is respectively determined according to the total number of times of requests obtained in the unit time, and the requests of the corresponding time slices are executed according to the number of times of requests, so that the real number of times of requests on a request number line generated in the process of pressure test on a simulation line can be kept consistent; meanwhile, the mode of determining the request times of each time slice according to the total request times also enables the pressure generated during the pressure test on the simulation line to be controllable.
Secondly, because the task queue in the embodiment of the application is designed to be an int type value, the consumption of the memory is extremely low, the requirement on the memory cannot be increased due to the increase of the request times, and the current request times in the task queue are only decreased progressively when the corresponding access request is initiated, so that the dispatching of the test thread is further efficient and simple.
Drawings
FIG. 1 is a flow chart of the steps of a first embodiment of a method of simulating an inline pressure test according to the present application;
FIG. 2 is a flowchart illustrating steps of a second embodiment of a method for simulating an inline pressure test according to the present application;
FIG. 3 is a block diagram of an embodiment of an apparatus for simulating an inline pressure test according to the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.
Referring to fig. 1, a flowchart illustrating steps of a first embodiment of a method for simulating an online pressure test according to the present application is shown, which may specifically include the following steps:
step 101, obtaining the total times of requests generated in unit time;
in the embodiment of the present application, 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 magnitude of the pressure received by the system per unit time, that is, the total number of requests generated per unit time can be obtained by sampling, so as to obtain the total number of requests that should be generated per time period when the pressure test on the line is simulated.
The unit time may be a period of time set according to sampling requirements, and may be, for example, 1s, 5s, 10s, or 60s, and so on. The skilled person can set the length of the unit time according to the actual situation that the system is requested on the line, and the application is not limited in this respect.
In a preferred embodiment of the present application, the step of obtaining the total number of requests generated per unit time may include the sub-steps of:
in sub-step 1011, the total number of requests generated per unit time is sampled from the access log of the device.
In general, the access log of the device may record the requests received by the system in real time, and in a specific implementation, the total number of requests generated in a unit time may be obtained by sampling and extracting information in the access log of the device, for example, the total number of requests received by the system in 1s is 10000.
Step 102, dividing the unit time into a plurality of time slices;
in the embodiment of the present application, in order to more accurately control the pressure generated when the in-line pressure test is simulated, the unit time may be divided into smaller time slices.
In a specific implementation, the unit time may be divided into a plurality of time slices on average, for example, the unit time 1s is divided into 100 time slices with a length of 10ms on average, or the unit time 1s is divided into 1000 time slices with a length of 1ms on average. The length of each time slice can be determined by one skilled in the art according to the specific length of the unit time selected by the sampling, which is not specifically limited in this application.
And 103, respectively determining the request times corresponding to the plurality of time slices according to the total request times, and executing the requests of the corresponding time slices according to the request times.
In the embodiment of the present application, when determining the number of requests corresponding to the plurality of time slices, the requests may be evenly distributed to each time slice in an evenly distributed manner, that is, the total number of requests obtained in step 101. For example, if the total number of requests received by the system in 1s is 10000, and the unit time 1s is divided into 100 time slices with a length of 10ms in the manner of step 102, it may be determined that the number of requests allocated to each time slice is 10000/100-100.
Of course, those skilled in the art may determine the number of requests corresponding to the plurality of times in a randomly distributed manner, which is not specifically limited in this application. It should be noted, however, that regardless of the manner in which the number of requests per time slice is determined, it should be ensured that the sum of the number of requests for a plurality of time slices is the same as the total number of requests obtained per unit time.
Furthermore, when the on-line pressure test is simulated, a test thread can be called, and the request of the corresponding time slice is executed according to the request times.
In a specific implementation, when the pressure is replayed for each unit time, the test thread may initiate a corresponding number of requests to the system according to the number of requests of the current time slice.
In a preferred embodiment of the present application, the step of respectively determining the number of requests corresponding to the plurality of 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 include the following sub-steps:
substep 1031, traversing the plurality of time slices;
sub-step 1032 determines a number of requests corresponding to the plurality of time slices using the total number of requests.
Substep 1033 of adding said number of requests to a task queue upon execution of the current time slice;
substep 1034, calling a preset test thread, reading the current request times from the task queue, and then initiating the request of corresponding times.
In a specific implementation, the plurality of time slices may be traversed, the number of requests corresponding to each time slice is determined according to the sequence of the time slices, then when the current time slice is executed, the number of requests corresponding to the current time slice is added to a task queue, a preset test thread is called, and after the number of current requests is read from the task queue, a request with a corresponding number of times is initiated.
In a specific implementation, when time slice 1 is executed, adding the number of times of requests corresponding to time slice 1 to a task queue, for example, 10 times, then calling a test thread, reading the current number of times of requests from the task queue for 10 times, and initiating 10 access requests to a system; then, according to the time sequence, executing the time slice 2, adding the request times corresponding to the time slice 2 to a task queue, for example, 8 times, calling a test thread, reading the current request times from the task queue for 8 times, and initiating 8 access requests to the system; and when all the time slices are executed, ending the test.
In the embodiment of the application, the unit time is divided into a plurality of time slices, the request times corresponding to each time slice are respectively determined according to the total request times obtained in the unit time, and the requests of the corresponding time slices are executed according to the request times, so that the real request times on a request time line generated in the process of pressure test on a simulation line can be kept consistent; meanwhile, the mode of determining the request times of each time slice according to the total request times also enables the pressure generated during the pressure test on the simulation line to be controllable.
Referring to fig. 2, a flowchart illustrating steps of a second embodiment of the method for simulating an online pressure test according to the present application is shown, and specifically, the method may include the following steps:
step 201, sampling and extracting the total number of requests generated in unit time from an access log of the equipment;
in the embodiment of the present application, 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 magnitude of the pressure received by the system per unit time, that is, the total number of requests generated per unit time, may be obtained by sampling, so as to obtain the total number of requests that should be generated per time period when the pressure test on the line is simulated.
Typically, the access log of the device may record in real time the requests received by the system. Therefore, the total number of requests generated in the unit time can be obtained by accessing the information in the log through the sampling extraction device, for example, the total number of requests received by the system in 1s in the unit time is 10000 times obtained through sampling.
Step 202, dividing the unit time into a plurality of time slices on average;
in particular implementations, to more accurately control the pressure generated during the analog in-line pressure test, the unit time average may be divided into smaller time slices. For example, the unit time 1s is divided into 100 time slices of 10ms in length on average, or the unit time 1s is divided into 1000 time slices of 1ms in length on average.
Step 203, determining the request times corresponding to the plurality of time slices by using the total request times;
in this embodiment of the present application, after the number of requests corresponding to the plurality of time slices is determined, the obtained total number of requests may be averagely allocated to each time slice in an averagely allocated manner. For example, if the total number of requests received by the system in a unit time of 1s is 10000, and the length of each time slice is 10ms, the unit time of 1s may be divided into 100 time slices on average, and it may be determined that the number of requests allocated to each time slice is 10000/100 times, which is 100 times.
Step 204, adding the request times to a task queue when the current time slice is executed;
in this embodiment of the present application, according to the time sequence of the plurality of time slices, first, when the time slice 1 is executed, the number of times of requests corresponding to the time slice 1, for example, 10 times, may be added to the task queue.
In a specific implementation, in order to ensure efficient execution of the pressure test on the simulation line, the task pair column may be designed to be a value of int type, and only how many times of requests need to be initiated in the current time slice are recorded.
Step 205, calling a preset test thread, and judging whether the current request times in the task queue are zero or not;
generally, there may be a plurality of preset test threads, and the plurality of test threads jointly form a thread pool, and when performing pressure test on the simulation line, the plurality of test threads in the thread pool are executed respectively.
In the embodiment of the application, after a preset test thread is called, the test thread can read the current request times from the task queue and then initiate the request with corresponding times.
In a specific implementation, a preset test thread may be called, the current request frequency is read from the task queue, whether the current request frequency is zero is determined, and if not, step 206 is executed.
And step 206, adopting the preset test thread, initiating a corresponding request after reading the current request times from the task queue, and decreasing the current request times.
In a specific implementation, when the test thread determines that the number of current requests in the task queue is not zero, one access request may be initiated, and the number of current requests is decremented. For example, if the test thread determines that the current request number in the task queue is 10 when starting to execute slot 1, it may initiate an access request to the system once, and then decrease the current request number in the task queue once, that is, after the test thread initiates an access request, the current request number in the task queue is recorded as 9.
In the embodiment of the application, after initiating an access request, the testing thread may return to continue to judge the current request times in the task queue until the current request times is zero, and stop the testing or continue to wait for the corresponding request times to be executed in the next time slice. For example, if the test thread makes the current request number recorded in the task queue zero after executing slot 1 and initiating 10 access requests to the system, it is necessary to initiate a corresponding access request in the time slot corresponding to the next slot, i.e., slot 2.
In the embodiment of the application, because the task queue is designed to be an int type value, the consumption of the memory is extremely low, the requirement on the memory cannot be increased due to the increase of the request times, and the current request times in the task queue are only decreased progressively when the corresponding access request is initiated, so that the scheduling of the test thread is further efficient and simple.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the embodiments. Further, those skilled in the art will also appreciate that the embodiments described in the specification are presently preferred and that no particular act is required of the embodiments of the application.
Referring to fig. 3, a block diagram of a structure of an embodiment of the apparatus for simulating an online pressure test according to the present application is shown, and the apparatus specifically includes the following modules:
an obtaining module 301, configured to obtain a total number of requests generated in a unit time;
a dividing module 302, configured to divide the unit time into a plurality of time slices;
an executing module 303, configured to determine the number of request times corresponding to the multiple time slices according to the total number of request times, and execute the request of the corresponding time slice according to the number of request times.
In this embodiment of the application, the executing module 303 may specifically include the following sub-modules:
a traversal submodule 3031 configured to traverse the plurality of time slices;
a determining submodule 3032, configured to determine the number of requests corresponding to the plurality of time slices by using the total number of requests.
An adding submodule 3033, configured to add the number of requests to a task queue when a current time slice is executed;
and the execution submodule 3034 is configured to invoke a preset test thread, and initiate a request with a corresponding number of times after the current number of times of requests is read from the task queue.
In this embodiment of the application, the execution submodule 3034 may specifically include the following units:
a determining unit 341, configured to invoke a preset test thread, and determine whether the current request number in the task queue is zero;
the execution unit 342 is configured to, when it is determined that the current request frequency in the task queue is not zero, initiate a corresponding request after reading the current request frequency from the task queue by using the preset test thread, and decrement the current request frequency;
the returning unit 343 is configured to return to the determining unit when it is determined that the current number of requests in the task queue is zero.
In this embodiment of the application, the obtaining module 301 may specifically include the following sub-modules:
the obtaining sub-module 3011 is configured to sample and extract the total number of requests generated in a unit time from the access log of the device.
In this embodiment, the dividing module 302 may specifically include the following sub-modules:
a dividing sub-module 3021 configured to divide the unit time average into a plurality of time slices.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one of skill in the art, embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
In a typical configuration, the computer device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory. The memory may include forms of volatile memory in a computer readable medium, 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 a computer-readable medium. Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (fransitory media), such as modulated data signals and carrier waves.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the true scope of the embodiments of the application.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The method for simulating the on-line pressure test and the device for simulating the on-line pressure test provided by the application are introduced in detail, specific examples are applied in the method for explaining the principle and the implementation mode of the application, and the description of the above examples is only used for helping to understand the method and the core idea of the application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method of simulating an in-line pressure test, comprising:
obtaining the total number of requests generated in unit time from the device access log;
dividing the unit time into a plurality of time slices;
respectively determining the request times corresponding to the plurality of time slices according to the total request times, and executing the requests of the corresponding time slices according to the request times;
and adding the request times corresponding to the plurality of time slices into a task queue when the request times are executed, wherein the task queue is an int type value.
2. The method of claim 1, wherein the step of determining the number of requests corresponding to the plurality of time slices respectively according to the total number of requests, and executing the requests of the corresponding time slices according to the number of requests comprises:
traversing the plurality of time slices;
and determining the request times corresponding to the plurality of time slices by adopting the total request times.
Adding the request times to a task queue when the current time slice is executed;
and calling a preset test thread, reading the current request times from the task queue, and then initiating the requests of corresponding times.
3. The method according to claim 2, wherein the step of calling a preset test thread, reading the current number of requests from the task queue, and then initiating the corresponding number of requests comprises:
calling a preset test thread, and judging whether the current request frequency in the task queue is zero or not;
if not, adopting the preset test thread, initiating a corresponding request after reading the current request times from the task queue, and decreasing the current request times;
and if so, returning to the substep of judging whether the current request times in the task queue is zero or not.
4. A method according to any of claims 1-3, wherein the step of obtaining the total number of requests made per unit of time comprises:
the total number of requests generated per unit time is sampled from the access log of the device.
5. The method of claim 4, wherein the step of dividing the unit time into a plurality of time slices comprises:
the unit time average is divided into a plurality of time slices.
6. An apparatus for simulating an in-line pressure test, comprising:
the obtaining module is used for obtaining the total times of requests generated in unit time from the equipment access log;
a dividing module for dividing the unit time into a plurality of time slices;
the execution module is used for respectively determining the request times corresponding to the plurality of time slices according to the total request times and executing the requests of the corresponding time slices according to the request times;
and adding the request times corresponding to the plurality of time slices into a task queue when the request times are executed, wherein the task queue is an int type value.
7. The apparatus of claim 6, wherein the execution module comprises:
a traversal submodule for traversing the plurality of timeslices;
and the determining submodule is used for determining the request times corresponding to the plurality of time slices by adopting the total request times.
The adding submodule is used for adding the request times to a task queue when the current time slice is executed;
and the execution submodule is used for calling a preset test thread, reading the current request times from the task queue and then initiating the requests of corresponding times.
8. The apparatus of claim 7, wherein the execution submodule comprises:
the judging unit is used for calling a preset test thread and judging whether the current request frequency in the task queue is zero or not;
the execution unit is used for adopting the preset test thread when judging that the current request times in the task queue are not zero, initiating a corresponding request after reading the current request times from the task queue, and decreasing the current request times;
and the return unit is used for returning to the judging unit when judging that the current request times in the task queue is zero.
9. The apparatus of any of claims 6-8, wherein the means for obtaining comprises:
and the obtaining submodule is used for sampling and extracting the total times of requests generated in unit time from the access log of the equipment.
10. The apparatus of claim 9, wherein the partitioning module comprises:
and the dividing submodule is used for averagely dividing the unit time into a plurality of time slices.
CN201610161942.7A 2016-03-21 2016-03-21 Method and device for simulating online pressure test Active CN107220165B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201610161942.7A CN107220165B (en) 2016-03-21 2016-03-21 Method and device for simulating online pressure test
TW106104939A TWI734746B (en) 2016-03-21 2017-02-15 Method and device for simulating online pressure test
PCT/CN2017/075949 WO2017162028A1 (en) 2016-03-21 2017-03-08 Method and device for simulating on-line pressure test

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN107220165A CN107220165A (en) 2017-09-29
CN107220165B true CN107220165B (en) 2020-08-04

Family

ID=59899208

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610161942.7A Active CN107220165B (en) 2016-03-21 2016-03-21 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 (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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 (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
EP1960886A1 (en) * 2005-12-16 2008-08-27 International Business Machines Corporation Method, system and computer program 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 (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
WO2017162028A1 (en) 2017-09-28
CN107220165A (en) 2017-09-29
TWI734746B (en) 2021-08-01
TW201734785A (en) 2017-10-01

Similar Documents

Publication Publication Date Title
CN107220165B (en) Method and device for simulating online pressure test
CN108063784B (en) Method, device and system for distributing application cluster resources in cloud environment
CN110944231B (en) Monitoring method and device of video player
CN111625443B (en) Pressure testing method, device, equipment and storage medium
CN104298589B (en) A kind of performance test methods and equipment
CN110020074B (en) Method and device for determining webpage loss rate
CN107153601B (en) Unit performance test method and device
CN112333294A (en) Log merging method, device, medium and equipment
CN112564996A (en) Pressure test flow scheduling method, pressure test flow control device and computer readable medium
CN108804210B (en) Resource configuration method and device of cloud platform
CN111984519A (en) Test method and device for service system
CN110889065A (en) Page stay time determining method, device and equipment
CN112905449B (en) Target test method, device, equipment and storage medium
CN110968500A (en) Test case execution method and device
CN109819311B (en) Terminal video evidence obtaining method and device
CN111370049B (en) eMMC chip testing method and device
CN110865913B (en) Pressure testing method and device
CN109286510B (en) Method and device for collecting log data
KR20210144287A (en) Method for measuring performance of computing device
CN110019068B (en) Log text processing method and device
CN109067613B (en) Method for testing networking success rate of identity card identification equipment
CN111104107A (en) User interface generation method, test method and device
CN114138619A (en) Method and device for testing software concurrent operation quantity
CN110955847B (en) Information processing method, device, storage medium and processor
CN109460366A (en) A kind of software stability test method, device, equipment and medium

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
GR01 Patent grant
GR01 Patent grant