CN113419972A - Throughput control method, device, equipment and storage medium - Google Patents

Throughput control method, device, equipment and storage medium Download PDF

Info

Publication number
CN113419972A
CN113419972A CN202110979972.XA CN202110979972A CN113419972A CN 113419972 A CN113419972 A CN 113419972A CN 202110979972 A CN202110979972 A CN 202110979972A CN 113419972 A CN113419972 A CN 113419972A
Authority
CN
China
Prior art keywords
sending
current
time
log
period
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.)
Granted
Application number
CN202110979972.XA
Other languages
Chinese (zh)
Other versions
CN113419972B (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.)
Chengfang Financial Technology Co ltd
Original Assignee
Chengfang Financial Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengfang Financial Technology Co ltd filed Critical Chengfang Financial Technology Co ltd
Priority to CN202110979972.XA priority Critical patent/CN113419972B/en
Publication of CN113419972A publication Critical patent/CN113419972A/en
Application granted granted Critical
Publication of CN113419972B publication Critical patent/CN113419972B/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/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Power Sources (AREA)

Abstract

The invention discloses a throughput control method, a throughput control device, throughput control equipment and a storage medium. The method comprises the following steps: obtaining the current log sending start-stop time of a target thread of the press in the current sending period, and determining the current log sending duration according to the current log sending start-stop time; determining the current overtime condition of the current sending period according to the sending duration of the current log and by combining the accumulated overtime value of the last sending period; and determining next log sending time of a next sending period according to the current overtime condition, and controlling the target thread to send a next application log at the next log sending time. The invention realizes the stable maintenance of the throughput of the press machine in the test system in a wider time requirement by setting the accumulated overtime variable to record the accumulated sending overtime time before the current sending period and adjusting the actual sleeping time of the local sending period, thereby solving the problem that the throughput of the press machine can not be stably controlled due to the size difference of application logs in flow playback.

Description

Throughput control method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of software testing, in particular to a throughput control method, a device, equipment and a storage medium.
Background
A technique for obtaining an application log of an information system production environment under test and playing back the application log in the test environment is called traffic playback. The traffic playback is divided into traffic playback for the purpose of functional testing and traffic playback for the purpose of performance testing. The flow playback aiming at the function test has no requirement of throughput index, and the flow playback aiming at the performance test has higher requirement on the throughput of the test system.
Initially, flow playback for performance testing purposes often played back flow at the maximum capacity of the performance testing press. With the increasing importance of the industry on the performance indexes of information systems, some core application systems need to compare the performance difference between a new version and an old version every time the version is changed. An important performance testing method for comparing new and old versions is as follows: and performing flow playback on the new version and the old version of the application system at a fixed throughput, and comparing the difference of performance indexes such as response time, resource utilization rate and the like of the application system under the condition of the same throughput.
In the throughput control technology in current traffic playback, multiple threads (or multiple virtual users) are generally used to perform traffic playback simultaneously, and each thread sends an application log at a fixed step length (paging), that is, one application log is sent at fixed time intervals. In the conventional throughput control technique for traffic playback, when the difference in the size of the application log is large, it is difficult to stably control the throughput of the traffic playback. For example, 99% of logs in an application system are 1KB, and a press only needs 5 milliseconds to send out a log when playing back a log, but 1% of logs may be between 10KB and 10MB and occur randomly in size, and the press has a very long processing time and a non-fixed processing time (for example, between 50 milliseconds and 50 seconds) when playing back a large log. With the existing throughput control technique, each thread sends an application log with a fixed step size:
1) if the flow is played back by taking 40 milliseconds as a step length, when a large log between 10KB and 10MB is encountered, the processing time of the large log may be far beyond the step length of 40 milliseconds, and the subsequent log waits for the processing of the current large log to be completed, the step length setting is invalid, so that the flow playback cannot reach the preset throughput value.
2) If the traffic is played back in 50 seconds, the number of concurrent threads (or the number of virtual users) required to achieve the same throughput index will be 1250 times that of 40 milliseconds. Not only wastes a large amount of system resources, but also is easy to have the condition of uneven flow. Therefore, this setting method is not used in actual work.
Disclosure of Invention
The invention provides a throughput control method, a throughput control device, throughput control equipment and a storage medium, and aims to stably control the throughput of a press in a test system.
In a first aspect, an embodiment of the present invention provides a throughput control method, including:
obtaining the current log sending start-stop time of a target thread of the press in the current sending period, and determining the current log sending duration according to the current log sending start-stop time;
determining the current overtime condition of the current sending period according to the sending duration of the current log and by combining the accumulated overtime value of the last sending period;
and determining next log sending time of a next sending period according to the current overtime condition, and controlling the target thread to send a next application log at the next log sending time.
Optionally, the obtaining of the current log sending start-stop time of the press target thread in the current sending period and determining the current log sending duration according to the current log sending start-stop time include:
acquiring current log sending starting time and current log sending ending time of a target thread in a current sending period;
determining a sending response time length according to the current log sending starting time and the current log sending ending time;
determining the random response time length according to the length of the time slice of the press processor and the adjusting parameter;
and determining the sum of the sending response time length and the random response time length as the current log sending time length.
Optionally, the determining, according to the current log sending duration and in combination with the accumulated timeout value of the previous sending period, the current timeout condition of the current sending period includes:
acquiring a preset sending step length, and determining the difference between the preset sending step length and the current log sending time length as the estimated sleep time length of the current sending period;
acquiring an accumulated timeout value of the last sending period, and determining the accumulated timeout value of the current sending period by combining the estimated sleep time;
when the cumulative timeout value of the current sending period is equal to zero, determining that the current timeout condition of the current sending period is not overtime sending;
and when the accumulated timeout value of the current sending period is greater than zero, determining that the current timeout condition is timeout sending.
Optionally, the obtaining an accumulated timeout value of a last sending cycle and determining the accumulated timeout value of the current sending cycle by combining the estimated sleep duration includes:
acquiring an accumulated timeout value of a last sending period, and determining that the accumulated timeout value of the current sending period is equal to zero when the estimated sleep time is greater than or equal to the accumulated timeout value of the last sending period; otherwise, determining that the accumulated timeout value of the current sending period is equal to the difference between the accumulated timeout value of the last sending period and the estimated sleep time.
Optionally, when the estimated sleep duration is greater than or equal to the accumulated timeout value of the last sending cycle, determining that the accumulated timeout value of the current sending cycle is equal to zero, and further including:
and determining the actual sleep time of the current sending period as the difference between the estimated sleep time and the accumulated timeout value of the last sending period.
Optionally, the determining, according to the current timeout condition, a next log sending time of a next sending period includes:
when the current overtime condition is non-overtime sending, determining a time period of the actual sleep duration from the current log sending end time as thread sleep time, and determining the end time of the thread sleep time as the next log sending time of the next sending period;
and when the current overtime condition is overtime transmission, determining that the current log transmission ending time is the next log transmission time.
Optionally, the method further includes:
and monitoring the throughput state of the target thread, and adjusting the adjusting parameter and/or the preset sending step length when the difference between the throughput state and the expected throughput state is greater than a preset stability difference.
In a second aspect, an embodiment of the present invention further provides a throughput control apparatus, where the apparatus includes:
the current period sending time length determining module is used for acquiring the current log sending starting and stopping time of the target thread of the press machine in the current sending period and determining the current log sending time length according to the current log sending starting and stopping time;
a current period timeout condition determining module, configured to determine, according to the current log sending duration, a current timeout condition of the current sending period in combination with an accumulated timeout value of a previous sending period;
and the next period sending time determining module is used for determining the next log sending time of the next sending period according to the current overtime condition and controlling the target thread to send the next application log at the next log sending time.
In a third aspect, an embodiment of the present invention further provides a computer device, where the computer device includes:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a throughput control method according to any embodiment of the invention.
In a fourth aspect, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the throughput control method according to any of the embodiments of the present invention.
The method comprises the steps of obtaining the current log sending start-stop time of a target thread of the press in the current sending period, determining the current log sending time according to the current log sending start-stop time, determining the current overtime condition of the current sending period according to the current log sending time by combining the accumulated overtime value of the previous sending period, determining the next log sending time of the next sending period according to the current overtime condition, and controlling the target thread to send the next application log at the next log sending time. The invention records the accumulated sending overtime time before the current sending period by setting the accumulated overtime variable, and judges whether the previous overtime time can be recovered in the current sending period by combining the current log sending time of the current sending period, thereby specifically determining the next log sending time of the next sending period and continuously controlling the sending operation of the next application log, solving the problem that the throughput of the press machine can not be stably controlled due to the size difference of the application logs in flow playback, and realizing the stable maintenance of the throughput of the press machine in the test system in a wider time requirement by adjusting the actual sleep time of a local sending period.
Drawings
Fig. 1 is a flowchart of a throughput control method according to an embodiment of the present invention;
fig. 2 is a block diagram of a throughput control apparatus according to a second embodiment of the present invention;
fig. 3 is a block diagram of a computer device according to a third embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only a part of the structures related to the present invention, not all of the structures, are shown in the drawings, and furthermore, embodiments of the present invention and features of the embodiments may be combined with each other without conflict.
Example one
Fig. 1 is a flowchart of a throughput control method according to an embodiment of the present invention, where the embodiment is applicable to a situation where throughput of a press in a test system is stably controlled, and the method may be executed by a throughput control apparatus, and the apparatus may be implemented by software and/or hardware.
As shown in fig. 1, the method specifically includes the following steps:
and step 110, obtaining the current log sending start-stop time of the target thread of the press in the current sending period, and determining the current log sending duration according to the current log sending start-stop time.
In practical application, the application log generated by the tested information system in a production environment can be obtained, the application log is sent to the tested system by using a press machine in a testing environment, flow playback is carried out, and performance testing of the tested system is achieved. The number of the press machines can be one or a plurality of, and each press machine can also be provided with a plurality of threads in parallel.
During flow playback, in order to stabilize throughput, the press machine can be controlled to periodically send the application log, and the sending step length is preset to be the time interval of one sending period. For example, the sending step may be preset to be 40 milliseconds, and in the case that the application log can be sent to completion within 40 milliseconds, one thread of the press is triggered to send one application log every 40 milliseconds.
In this embodiment, one thread of a designated press is described, and this thread may be referred to as a target thread, and it is understood that each press and any thread thereof in the test system are applicable to the throughput control method provided in this embodiment.
Specifically, when the press sends an application log, the sending start time and the sending end time for sending the application log are recorded, and the sending time length for sending the application log can be calculated according to the sending start time and the sending end time and by combining the factors such as the working performance of the press. In the sending period of the current moment, the sending start-stop time of the current log can be obtained, and the sending duration of the current log is determined according to the sending start-stop time of the current log.
Alternatively, step 110 may be determined by:
step 1101, acquiring the current log sending start time and the current log sending end time of the target thread in the current sending period.
Specifically, the current log sending start time and the current log sending end time of the playback application log of the target thread in the current sending period are obtained, the current log sending start time may be recorded as T1, and the current log sending end time may be recorded as T2.
Step 1102, determining a sending response time length according to the current log sending start time and the current log sending end time.
Specifically, the difference between the current log transmission end time and the current log transmission start time may be used as the transmission response time period, i.e., T2-T1.
Step 1103, determining the random response time length according to the length of the time slice of the press processor and the adjusting parameter.
Specifically, the length of the press processor time slice, denoted as CPUSlice, and the adjustment parameter Para are obtained, and Rand CPUSlice Para is determined as the random response time length, wherein Rand is a random number between [0,1 ]).
And 1104, determining the sum of the sending response time length and the random response time length as the current log sending time length.
Specifically, the current log sending time length may be taken as Taction, Taction = (T2-T1) + Rand CPUSlice · Para.
And step 120, determining the current timeout condition of the current sending period according to the sending duration of the current log and by combining the accumulated timeout value of the last sending period.
The current timeout condition may include non-timeout transmission and timeout transmission, among others.
In this embodiment, an accumulative timeout variable OverTime may be set for each thread on the press, a value of the accumulative timeout variable OverTime may be referred to as an accumulative timeout value, and an initial value of the accumulative timeout variable may be 0, that is, OverTime = 0. When a certain log sending time length exceeds the preset sending step length, the overtime time can be cumulatively counted into the cumulative overtime variable, and the overtime time can be continuously recovered in the following sending period, so that the recovered overtime time is eliminated from the cumulative overtime variable.
Specifically, whether the application log corresponding to the transmission period can be completely transmitted within a preset transmission step length can be judged according to the current log transmission duration, and if yes, whether the timeout time is not recovered before the current transmission period is considered, that is, whether the accumulated timeout value of the previous transmission period is greater than zero is judged, and when the accumulated timeout value is greater than zero, the timeout time is not recovered. If the application logs corresponding to the sending period can be sent completely within the preset sending step length, and the remaining time after the sending is completed can be used for completely recovering the previous overtime or the previous overtime is cleared, it can be determined that the current overtime condition of the current sending period is not overtime sending, that is, the actual throughput of the application logs sent by the press is consistent with the preset throughput until the current sending period is ended, the actual throughput calculation mode is the ratio of the total sending number of the application logs to the total sending time, and the total sending time can be obtained by subtracting the time of starting sending the first log from the time of ending the current sending period. If the sending of the application log corresponding to the sending period cannot be completed within the preset sending step length, or the remaining time after the sending of the application log corresponding to the sending period is completed cannot be completely recovered from the previous overtime time, the current overtime condition of the current sending period can be determined as overtime sending, that is, the actual throughput of the application log sent by the press is lower than the preset throughput until the current sending period is finished, the actual throughput calculation mode is the ratio of the total sending number of the application logs to the total sending time, and the total sending time can be obtained by subtracting the time of the first log from the time of the current sending period.
Optionally, step 120 may be determined by:
step 1201, acquiring a preset sending step length, and determining the difference between the preset sending step length and the current log sending time length as the estimated sleep time length of the current sending period.
Specifically, the current log sending time length may be recorded as Taction, the preset sending step length is paging, the estimated sleep time length of the current sending period is Tsleep, and Tsleep = paging-Taction. It is understood that Tsleep may be a positive number, a negative number, or zero.
And 1202, acquiring an accumulated timeout value of the last sending period, and determining the accumulated timeout value of the current sending period by combining the estimated sleep time.
Further, step 1202 may be specifically implemented by the following method:
acquiring an accumulated timeout value of a last sending period, and determining that the accumulated timeout value of the current sending period is equal to zero when the estimated sleep time is greater than or equal to the accumulated timeout value of the last sending period; otherwise, determining that the accumulated timeout value of the current sending period is equal to the difference between the accumulated timeout value of the last sending period and the estimated sleep time.
Specifically, the value of the accumulated timeout variable may be zero or positive, the estimated sleep time may be negative, zero or positive, and when the estimated sleep time is greater than or equal to the accumulated timeout value of the previous transmission cycle, the following situations may be adopted: 1) the estimated sleep time Tsleep of the current sending period is more than or equal to 0, the OverTime =0 of the previous sending period indicates that the previous timeout time is cleared, and the application log corresponding to the sending period can be sent in time in the current sending period; 2) the estimated sleep time Tsleep of the current transmission period is greater than 0, the OverTime of the previous transmission period is greater than 0, and Tsleep is greater than OverTime, which indicates that the prior timeout time exists, but the prior timeout time can be completely recovered by the residual time after the application log corresponding to the current transmission period is completely transmitted, so that the accumulated timeout value can be set to zero in the above cases.
In addition, when the estimated sleep time is greater than or equal to the accumulated timeout value of the last sending period, the fact that the actual throughput of the application log sent by the press machine can be made to accord with the preset throughput before the current sending period is ended by adjusting the actual sleep time of the current sending period is explained. At this time, after the log is sent, thread sleep is executed, and the actual sleep duration of the current sending period may be determined to be the difference between the estimated sleep duration Tsleep and the accumulated timeout value OverTime of the previous sending period.
When the estimated sleep duration is less than the accumulated timeout value of the last transmission cycle, the following situations can be used: 1) the estimated sleep time Tsleep of the current sending period is more than or equal to 0, the OverTime of the previous sending period is more than 0, and the OverTime is more than Tsleep, which indicates that the application log corresponding to the current sending period can be sent in time in the current sending period, but the previous OverTime cannot be completely recovered; 2) the estimated sleep time Tsleep of the current sending period is less than 0, the OverTime of the previous sending period is more than or equal to 0, and the situation shows that the application log corresponding to the current sending period cannot be sent in time in the current sending period, so that the difference between the accumulated timeout value of the previous sending period and the estimated sleep time can be used as the accumulated timeout value of the current sending period.
Step 1203, when the cumulative timeout value of the current sending period is equal to zero, determining that the current timeout condition of the current sending period is not timeout sending; and when the accumulated timeout value of the current transmission period is greater than zero, determining that the current timeout condition is timeout transmission.
And step 130, determining next log sending time of the next sending period according to the current overtime condition, and controlling the target thread to send the next application log at the next log sending time.
Optionally, when the current timeout condition is no timeout sending, determining a time period from the current log sending end time to the actual sleep time as the thread sleep time, and determining the end time of the thread sleep time as the next log sending time of the next sending cycle; and when the current overtime condition is overtime transmission, determining the current log transmission ending time as the next log transmission time.
Specifically, when the current timeout condition is that the application log is not sent OverTime, that is, before the current sending period is ended, the actual throughput of the application log sent by the press machine conforms to the preset throughput, at this time, thread sleep can be executed after the log is sent, and the execution time of the thread sleep is thread sleep time, that is, the estimated sleep time Tsleep of the current sending period — the accumulated timeout value OverTime of the previous sending period. When the current timeout condition is timeout sending, that is, before the current sending period is ended, the actual throughput of the press sending the application log is lower than the preset throughput, so that the next application log sending operation needs to be directly started when the sending of the application log is ended. And when the current sending period is ended, the ideal period ending time corresponding to the current sending period is calculated by taking a preset sending step length as a period duration.
For example, an accumulative timeout variable OverTime in a single thread on the press may be set with an initial value of 0, i.e., OverTime = 0.
Controlling the press to play back the first application log and recording a starting time point T1 and an ending time point T2 of playing back the application log, wherein if the first log is a larger log, the time is longer:
t1=11 points 15 minutes 12 seconds 003 milliseconds,
t2=11 points 15 minutes 12 seconds 103 milliseconds,
calculating the log sending time Tation for replaying the application log:
Taction=(T2-T1)+Rand*CPUSlice*Para,
wherein Rand is a random number between [0,1), and the assumed value is 0.5; CPUSlice is the time slice length of the press CPU, assumed to be 10 milliseconds; para is a tuning parameter, assumed to be 1; then it is determined that,
taction =100 ms +0.5 x 10 ms x 1=105 ms.
Letting the preset sending step length Pacing =40 ms, calculating the sleep time Tsleep required after the application log is played back in the current sending period according to the preset step length Pacing:
tsleep = Pacing-Taction =40 ms-105 ms = -65 ms.
Tsleep = -65 ms, the cumulative timeout value OverTime =0- (-65) ms =65 ms of the current transmission period, the cumulative timeout value OverTime > 0 of the current transmission period, and the current timeout condition is timeout transmission, so after the application log is transmitted in the current transmission period, the transmission operation of the next application log is directly started.
And then entering a second sending period, wherein the current sending period is the second sending period, and the application log corresponding to the second sending period is assumed to be a smaller log, so that the consumed time is short:
t1=11 points 15 minutes 12 seconds 103 milliseconds,
t2=11 points 15 minutes 12 seconds 108 milliseconds,
calculating the log sending time Tation for replaying the application log:
Taction=(T2-T1)+Rand*CPUSlice*Para,
wherein: rand is a random number between [0,1), and the value is assumed to be 0.1; CPUSlice of 10 milliseconds; para is 1; then it is determined that,
taction =5 ms +0.1 x 10 ms x 1=6 ms.
Calculating the sleep time Tsleep required after the corresponding application log is played back in the current sending period according to the preset sending step length Pacing:
tsleep = paging-contact = 40-6-34 ms.
Acquiring an accumulated timeout value OverTime =65 ms of the last transmission cycle, and acquiring a sleep time Tsleep =34 ms of the current transmission cycle, where the timeout deduction condition is met: since the sleep time Tsleep (34 msec) of the current transmission cycle is less than the accumulated timeout value OverTime (65 msec) of the previous transmission cycle, the accumulated timeout value of the current transmission cycle is recorded as 65 msec-34 msec =31 msec, and after the application log is transmitted in the current transmission cycle, the transmission operation of the next application log is directly started.
And then entering a third sending period, wherein the current sending period is the third sending period, if the log played back in the third sending period is a smaller log, the required log sending time duration Taction is shorter, and assuming that the log is still 6 milliseconds, the corresponding sleep time Tsleep is still 34 milliseconds, the accumulated timeout value OverTime of the last sending period is 31 milliseconds, and at this time, a deduction condition is provided, and thread sleep can be executed, and the time duration Tsleep-OverTime =34 milliseconds-31 milliseconds =3 milliseconds. After the execution thread is asleep, a fourth sending cycle may be entered to send a fourth application log.
In the above example, after the third sending cycle is finished, the problem that the number of times of playing back the log in unit time is not as expected due to failure of the paging setting caused by the large log encountered in the first sending cycle can be recovered.
According to the technical scheme of the embodiment, the current log sending start-stop time of the target thread of the press in the current sending period is obtained, the current log sending time length is determined according to the current log sending start-stop time, the current overtime condition of the current sending period is determined according to the current log sending time length by combining the accumulated overtime value of the previous sending period, the next log sending time of the next sending period is determined according to the current overtime condition, and the target thread is controlled to send the next application log at the next log sending time. The invention records the accumulated sending overtime time before the current sending period by setting the accumulated overtime variable, and judges whether the previous overtime time can be recovered in the current sending period by combining the current log sending time of the current sending period, thereby specifically determining the next log sending time of the next sending period and continuously controlling the sending operation of the next application log, solving the problem that the throughput of the press machine can not be stably controlled due to the size difference of the application logs in flow playback, and realizing the stable maintenance of the throughput of the press machine in the test system in a wider time requirement by adjusting the actual sleep time of a local sending period.
On the basis of the foregoing technical solution, the throughput control method provided in this embodiment may further include:
and monitoring the throughput state of the target thread, and adjusting the adjusting parameter and/or the preset sending step length when the difference between the throughput state and the expected throughput state is greater than the preset stability difference.
Specifically, if the stability of the target linear control throughput of the press is not good, the Pacing value may be increased according to actual conditions, and the flow playback may be performed again until the throughput can be controlled more stably, for example, after one round of playback, the overall throughput is still unstable, and if the reason is determined that there are many large logs in the log, the Pacing value may be increased, for example, changing the preset sending step length of 40 milliseconds to 100 milliseconds, and performing the flow playback again until the throughput can be controlled more stably. Adjustment of the tuning parameters may also be considered if the throughput is overall higher or lower.
In addition, if flow playback is required at a high, steady throughput, and a single press or thread is insufficient to provide the required throughput, the number of press threads and the number of presses may be increased to achieve the desired throughput. For example, in the above example, the preset sending step length Pacing is set to 40 ms, the single-thread playback expected throughput is 25 pens/sec, if the expected throughput is 500 pens/sec, 5 presses may be set, the number of threads of each press per day is 4, and the expected throughput of each thread is 25 pens/sec, so that the total expected throughput may reach 500 pens/sec.
Example two
The throughput control device provided by the embodiment of the invention can execute the throughput control method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. Fig. 2 is a block diagram of a throughput control apparatus according to a second embodiment of the present invention, and as shown in fig. 2, the apparatus includes: a current period transmission time length determining module 210, a current period timeout condition determining module 220 and a next period transmission time determining module 230.
And a current period sending duration determining module 210, configured to obtain a current log sending start-stop time of the press target thread in a current sending period, and determine a current log sending duration according to the current log sending start-stop time.
A current period timeout condition determining module 220, configured to determine, according to the current log sending duration, a current timeout condition of the current sending period in combination with an accumulated timeout value of a previous sending period.
A next cycle sending time determining module 230, configured to determine a next log sending time of a next sending cycle according to the current timeout condition, and control the target thread to send a next application log at the next log sending time.
According to the technical scheme of the embodiment, the current log sending start-stop time of the target thread of the press in the current sending period is obtained, the current log sending time length is determined according to the current log sending start-stop time, the current overtime condition of the current sending period is determined according to the current log sending time length by combining the accumulated overtime value of the previous sending period, the next log sending time of the next sending period is determined according to the current overtime condition, and the target thread is controlled to send the next application log at the next log sending time. The invention records the accumulated sending overtime time before the current sending period by setting the accumulated overtime variable, and judges whether the previous overtime time can be recovered in the current sending period by combining the current log sending time of the current sending period, thereby specifically determining the next log sending time of the next sending period and continuously controlling the sending operation of the next application log, solving the problem that the throughput of the press machine can not be stably controlled due to the size difference of the application logs in flow playback, and realizing the stable maintenance of the throughput of the press machine in the test system in a wider time requirement by adjusting the actual sleep time of a local sending period.
Optionally, the current period sending duration determining module 210 is specifically configured to:
acquiring current log sending starting time and current log sending ending time of a target thread in a current sending period;
determining a sending response time length according to the current log sending starting time and the current log sending ending time;
determining the random response time length according to the length of the time slice of the press processor and the adjusting parameter;
and determining the sum of the sending response time length and the random response time length as the current log sending time length.
Optionally, the module 220 for determining timeout condition of the current period includes:
the estimated sleep time determining unit is used for acquiring a preset sending step length, and determining the difference between the preset sending step length and the current log sending time length as the estimated sleep time length of the current sending period;
the cumulative timeout value updating unit is used for acquiring the cumulative timeout value of the last sending period and determining the cumulative timeout value of the current sending period by combining the estimated sleep time;
a first timeout condition determining unit, configured to determine that the current timeout condition of the current sending period is not timeout-sent when the cumulative timeout value of the current sending period is equal to zero;
and the second timeout condition determining unit is used for determining that the current timeout condition is timeout transmission when the accumulated timeout value of the current transmission period is greater than zero.
Optionally, the cumulative timeout value updating unit is specifically configured to:
and acquiring an accumulated timeout value of a last sending period, when the estimated sleep time is greater than or equal to the accumulated timeout value of the last sending period, determining that the accumulated timeout value of the current sending period is equal to zero, otherwise, determining that the accumulated timeout value of the current sending period is equal to the difference between the accumulated timeout value of the last sending period and the estimated sleep time.
Optionally, the module 220 for determining timeout of the current period further includes:
and the actual sleep duration determining unit is used for determining the actual sleep duration of the current sending period as the difference between the estimated sleep duration and the accumulated timeout value of the last sending period.
Optionally, the next period sending time determining module 230 is specifically configured to:
when the current overtime condition is non-overtime sending, determining a time period of the actual sleep duration from the current log sending end time as thread sleep time, and determining the end time of the thread sleep time as the next log sending time of the next sending period;
and when the current overtime condition is overtime transmission, determining that the current log transmission ending time is the next log transmission time.
Optionally, the apparatus further includes a throughput status monitoring module, where the throughput status monitoring module is configured to:
and monitoring the throughput state of the target thread, and adjusting the adjusting parameter and/or the preset sending step length when the difference between the throughput state and the expected throughput state is greater than a preset stability difference.
EXAMPLE III
Fig. 3 is a block diagram of a computer apparatus according to a third embodiment of the present invention, as shown in fig. 3, the computer apparatus includes a processor 310, a memory 320, an input device 330, and an output device 340; the number of the processors 310 in the computer device may be one or more, and one processor 310 is taken as an example in fig. 3; the processor 310, the memory 320, the input device 330 and the output device 340 in the computer apparatus may be connected by a bus or other means, and the connection by the bus is exemplified in fig. 3.
The memory 320 serves as a computer-readable storage medium for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the throughput control method in the embodiment of the present invention (for example, the current period transmission time length determination module 210, the current period timeout condition determination module 220, and the next period transmission time determination module 230 in the throughput control apparatus). The processor 310 executes various functional applications of the computer device and data processing by executing software programs, instructions, and modules stored in the memory 320, that is, implements the throughput control method described above.
The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 320 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 320 may further include memory located remotely from the processor 310, which may be connected to a computer device through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 330 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the computer apparatus. The output device 340 may include a display device such as a display screen.
Example four
A fourth embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a throughput control method, the method including:
obtaining the current log sending start-stop time of a target thread of the press in the current sending period, and determining the current log sending duration according to the current log sending start-stop time;
determining the current overtime condition of the current sending period according to the sending duration of the current log and by combining the accumulated overtime value of the last sending period;
and determining next log sending time of a next sending period according to the current overtime condition, and controlling the target thread to send a next application log at the next log sending time.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the operations of the method described above, and may also perform related operations in the throughput control method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the throughput control apparatus, the included units and modules are only divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A throughput control method, comprising:
obtaining the current log sending start-stop time of a target thread of the press in the current sending period, and determining the current log sending duration according to the current log sending start-stop time;
determining the current overtime condition of the current sending period according to the sending duration of the current log and by combining the accumulated overtime value of the last sending period;
and determining next log sending time of a next sending period according to the current overtime condition, and controlling the target thread to send a next application log at the next log sending time.
2. The throughput control method of claim 1, wherein the obtaining of the current log sending start-stop time of the press target thread in the current sending period and the determining of the current log sending duration according to the current log sending start-stop time comprise:
acquiring current log sending starting time and current log sending ending time of a target thread in a current sending period;
determining a sending response time length according to the current log sending starting time and the current log sending ending time;
determining the random response time length according to the length of the time slice of the press processor and the adjusting parameter;
and determining the sum of the sending response time length and the random response time length as the current log sending time length.
3. The throughput control method of claim 2, wherein determining the current timeout condition of the current sending period according to the current log sending duration in combination with an accumulated timeout value of a previous sending period comprises:
acquiring a preset sending step length, and determining the difference between the preset sending step length and the current log sending time length as the estimated sleep time length of the current sending period;
acquiring an accumulated timeout value of the last sending period, and determining the accumulated timeout value of the current sending period by combining the estimated sleep time;
when the cumulative timeout value of the current sending period is equal to zero, determining that the current timeout condition of the current sending period is not overtime sending;
and when the accumulated timeout value of the current sending period is greater than zero, determining that the current timeout condition is timeout sending.
4. The throughput control method of claim 3, wherein said obtaining an accumulated timeout value of a last transmission cycle and determining the accumulated timeout value of the current transmission cycle in conjunction with the estimated sleep duration comprises:
acquiring an accumulated timeout value of a last sending period, and determining that the accumulated timeout value of the current sending period is equal to zero when the estimated sleep time is greater than or equal to the accumulated timeout value of the last sending period; otherwise, determining that the accumulated timeout value of the current sending period is equal to the difference between the accumulated timeout value of the last sending period and the estimated sleep time.
5. The throughput control method of claim 4, wherein when the estimated sleep duration is greater than or equal to the cumulative timeout value of the last transmission cycle, determining that the cumulative timeout value of the current transmission cycle is equal to zero further comprises:
and determining the actual sleep time of the current sending period as the difference between the estimated sleep time and the accumulated timeout value of the last sending period.
6. The throughput control method of claim 5, wherein said determining a next log transmission time for a next transmission period based on said current timeout condition comprises:
when the current overtime condition is non-overtime sending, determining a time period of the actual sleep duration from the current log sending end time as thread sleep time, and determining the end time of the thread sleep time as the next log sending time of the next sending period;
and when the current overtime condition is overtime transmission, determining that the current log transmission ending time is the next log transmission time.
7. The throughput control method of claim 3, wherein the method further comprises:
and monitoring the throughput state of the target thread, and adjusting the adjusting parameter and/or the preset sending step length when the difference between the throughput state and the expected throughput state is greater than a preset stability difference.
8. A throughput control apparatus, comprising:
the current period sending time length determining module is used for acquiring the current log sending starting and stopping time of the target thread of the press machine in the current sending period and determining the current log sending time length according to the current log sending starting and stopping time;
a current period timeout condition determining module, configured to determine, according to the current log sending duration, a current timeout condition of the current sending period in combination with an accumulated timeout value of a previous sending period;
and the next period sending time determining module is used for determining the next log sending time of the next sending period according to the current overtime condition and controlling the target thread to send the next application log at the next log sending time.
9. A computer device, the device comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the throughput control method of any of claims 1-7.
10. A storage medium containing computer-executable instructions, which when executed by a computer processor, operate to perform the throughput control method of any of claims 1-7.
CN202110979972.XA 2021-08-25 2021-08-25 Throughput control method, device, equipment and storage medium Active CN113419972B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110979972.XA CN113419972B (en) 2021-08-25 2021-08-25 Throughput control method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110979972.XA CN113419972B (en) 2021-08-25 2021-08-25 Throughput control method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113419972A true CN113419972A (en) 2021-09-21
CN113419972B CN113419972B (en) 2021-11-16

Family

ID=77719900

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110979972.XA Active CN113419972B (en) 2021-08-25 2021-08-25 Throughput control method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113419972B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090300073A1 (en) * 2008-05-28 2009-12-03 International Business Machines Corporation System and apparatus to ensure a low-latency read of log records from a database management system ("dbms")
CN106776300A (en) * 2016-12-01 2017-05-31 北京驰波信息工程有限公司 The pressure testing system and method for a kind of intermediate system
CN108829802A (en) * 2018-06-06 2018-11-16 中国人民银行清算总中心 It is associated with log back method and device
CN110740080A (en) * 2019-10-21 2020-01-31 京东数字科技控股有限公司 Test method and device, and test agent method and device
CN111858200A (en) * 2020-06-22 2020-10-30 银清科技有限公司 Throughput control method and device in system test and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090300073A1 (en) * 2008-05-28 2009-12-03 International Business Machines Corporation System and apparatus to ensure a low-latency read of log records from a database management system ("dbms")
CN106776300A (en) * 2016-12-01 2017-05-31 北京驰波信息工程有限公司 The pressure testing system and method for a kind of intermediate system
CN108829802A (en) * 2018-06-06 2018-11-16 中国人民银行清算总中心 It is associated with log back method and device
CN110740080A (en) * 2019-10-21 2020-01-31 京东数字科技控股有限公司 Test method and device, and test agent method and device
CN111858200A (en) * 2020-06-22 2020-10-30 银清科技有限公司 Throughput control method and device in system test and electronic equipment

Also Published As

Publication number Publication date
CN113419972B (en) 2021-11-16

Similar Documents

Publication Publication Date Title
CN107688496B (en) Task distributed processing method and device, storage medium and server
CN111782360B (en) Distributed task scheduling method and device
US10817386B2 (en) Virtual machine recovery method and virtual machine management device
US8117415B2 (en) Storage device estimating a completion time for a storage operation
US20110295811A1 (en) Changing a number of disk agents to backup objects to a storage device
CN109857239B (en) Storage control method and device
CN112231098A (en) Task processing method, device, equipment and storage medium
CN112650575A (en) Resource scheduling method and device and cloud service system
CN112988679A (en) Log collection control method and device, storage medium and server
US7840725B2 (en) Capture of data in a computer network
CN112948169A (en) Data backup method, device, equipment and storage medium
CN109697112B (en) Distributed intensive one-stop operating system and implementation method
CN111124761A (en) Equipment restarting method, device, equipment and medium
CN113419972B (en) Throughput control method, device, equipment and storage medium
CN102137091A (en) Overload control method, device and system as well as client-side
CN105242955A (en) Virtual machine disk input and output scheduling method and system
CN111901405B (en) Multi-node monitoring method and device, electronic equipment and storage medium
CN112817719A (en) Method, device and equipment for adjusting parameters of thread pool and readable storage medium
CN112015326B (en) Cluster data processing method, device, equipment and storage medium
CN110287159B (en) File processing method and device
CN111352803A (en) Service data processing method, device, equipment and storage medium
CN111949494A (en) Task regulation and control method, device and related equipment
EP3396553B1 (en) Method and device for processing data after restart of node
CN113867734A (en) Code block interpretation execution method and device, electronic equipment and storage medium
CN108920722B (en) Parameter configuration method and device and computer storage 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