Playback method, medium, product and device for database load files

By adjusting the replay method of the database load file, utilizing think time deviation compensation and rate control, and optimizing the balance between execution time and think time, the problem of inconsistent replay duration in existing technologies is solved, achieving an efficient and realistic database replay process that adapts to different business needs.

CN121070977BActive Publication Date: 2026-04-17CETC JINCANG (BEIJING) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CETC JINCANG (BEIJING) TECH CO LTD
Filing Date
2025-11-06
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

The existing database replay function has shortcomings in time processing, and cannot flexibly control the SQL execution time and interval time, resulting in inconsistent replay durations, which cannot adapt to different business needs and affect the accuracy and effectiveness of testing.

Method used

A method for replaying database workload files is provided. By obtaining the instruction execution history in the workload file to be replayed, the original execution time and think time are determined, and the think time is adjusted and corrected by the target replay method, including think time deviation compensation and rate control, to optimize the balance between execution time and think time.

Benefits of technology

It enables efficient and controllable database replay under different performance scenarios, ensuring that the replay process meets actual business needs, improving the applicability and operability of replay, and supporting flexible time processing mechanisms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121070977B_ABST
    Figure CN121070977B_ABST
Patent Text Reader

Abstract

This invention provides a method, medium, product, and device for replaying database workload files. The method includes: in response to a replay command, acquiring the workload file to be replayed; determining the original execution time and the original think time after the execution of each command based on the workload file, wherein the original think time is the interval between the completion of the previous database command and the start of the next database command; determining a target replay mode based on the replay command; during the replay of the workload file, adjusting the original think time based on the target replay mode to obtain a corrected think time, and performing replay based on the corrected think time. This method achieves a flexible time processing mechanism, thereby optimizing the balance between execution time and think time through selectable replay strategies, ensuring efficient, realistic, and controllable replay of the original workload under different performance scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of database technology, and in particular to a method, medium, product, and device for replaying database payload files. Background Technology

[0002] Currently available database replay functions generally suffer from several limitations. While they are relatively mature in controlling the order of database operation statements within a session, such as those using Structured Query Language (SQL), they typically strictly adhere to the logic at the time of capture. However, they suffer from significant deficiencies in time management; some solutions completely ignore SQL execution time and processing time, while others mechanically maintain the capture intervals, failing to adapt to changes in execution time, resulting in significantly longer replay durations when performance is low. In actual customer business scenarios, however, users often have a strong need for autonomy in choosing the SQL execution time and intervals during database replay. They not only want the flexibility to select highly customizable traffic pressure control and replay durations that are as consistent as possible with the simulation, but also to adjust the replay strategy according to different business needs, ensuring the accuracy and effectiveness of the test. Summary of the Invention

[0003] In view of the above problems, the present invention proposes a method, medium, product and device for replaying database load files to overcome the above problems or at least partially solve the above problems.

[0004] One objective of this invention is to achieve control processing between the execution time of the playback instruction and the thinking time.

[0005] A further objective of this invention is to optimize the balance between execution time and thinking time;

[0006] Another further objective of this invention is to ensure the efficiency and authenticity of payload file playback;

[0007] Specifically, the present invention provides a method for replaying a database payload file, comprising:

[0008] In response to a replay command, the payload file to be replayed is obtained. The payload file is used to record the database command execution history in sequence.

[0009] The original execution time of each instruction to be replayed and the original think time after the execution of the instruction to be replayed are determined based on the load file to be replayed. The original think time is the interval between the completion of the previous database instruction and the start of the next database instruction.

[0010] The target playback method is determined by the playback command;

[0011] During the playback of the load file to be played back, the original thinking time is adjusted based on the target playback method to obtain the corrected thinking time, and the playback is performed according to the corrected thinking time.

[0012] Optionally, the target playback method includes thinking time deviation compensation;

[0013] The steps of adjusting the original thinking time based on the target playback method to obtain the corrected thinking time, and then playing back based on the corrected thinking time, include:

[0014] When the target playback method is thinking time deviation compensation, determine the target database instruction to be played back.

[0015] Replay the target database commands and obtain the actual execution time of the target database commands;

[0016] Determine whether the actual execution time is greater than the original execution time of the target database instruction;

[0017] If so, the execution deviation value of the target database instruction is calculated based on the actual execution time;

[0018] The original thinking time corresponding to the target database instruction is adjusted based on the execution deviation value to obtain the corrected thinking time. The original thinking time is the interval between the target database instruction and the next database instruction.

[0019] After waiting for the correction and consideration time, the next database instruction will be executed.

[0020] Optionally, the deviation value can be calculated as follows:

[0021] ΔT=Tae-Toe

[0022] Where ΔT represents the execution deviation value, Tae represents the actual execution time, and Toe represents the original execution time.

[0023] Optionally, the formula for calculating thinking time can be revised as follows:

[0024] Tct = max(0, Tot - ΔT)

[0025] Where Tct represents the corrected thinking time, Tot represents the original thinking time, ΔT represents the execution deviation value, and max represents the larger value between 0 and the original thinking time minus the execution deviation value.

[0026] Optionally, the target playback method includes adjustment of the thinking time rate;

[0027] The steps of adjusting the original thinking time based on the target playback method to obtain the corrected thinking time, and then playing back based on the corrected thinking time, include:

[0028] When the target playback method is thought time rate control, the scaling factor is obtained through playback commands;

[0029] The original think time between two adjacent database instructions in the load file to be replayed is scaled according to the scaling factor to obtain the corrected think time.

[0030] Playback of the load file to be replayed is performed based on the revised thinking time.

[0031] Optionally, scaling the raw think time between two adjacent database commands in the load file to be replayed, based on a scaling factor, includes:

[0032] The scaling percentage is calculated based on the scaling factor.

[0033] The original thinking time is scaled according to the scaling percentage to obtain the corrected thinking time.

[0034] Optionally, the formula for calculating thinking time can be revised as follows:

[0035] Tct = Tot × (S / 100)

[0036] Where Tct represents the corrected thinking time, Tot represents the original thinking time, and S represents the scaling factor.

[0037] According to another aspect of the present invention, a computer-readable storage medium is also provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the database payload file playback method described above.

[0038] According to another aspect of the present invention, a computer program product is also provided, comprising a computer program that, when executed by a processor, implements the steps of the database load file playback method described above.

[0039] According to another aspect of the present invention, a computer device is also provided, including a memory, a processor, and a machine-executable program stored in the memory and running on the processor, wherein the processor executes the machine-executable program to implement the steps of the above-described method for playing back a database load file.

[0040] The database load file replay method of the present invention, in response to a replay command, acquires a load file to be replayed, the load file being used to sequentially record the database command execution history; determines the original execution time of each command to be replayed and the original think time after the execution of the command based on the load file to be replayed, the original think time being the interval between the completion of the previous database command and the start of the next database command; determines the target replay mode through the replay command; during the replay of the load file to be replayed, adjusts the original think time based on the target replay mode to obtain a corrected think time, and performs replay according to the corrected think time. This method achieves a flexible time processing mechanism, thereby optimizing the balance between execution time and think time through selectable replay strategies, ensuring efficient, realistic, and controllable replay of the original load under different performance scenarios.

[0041] The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments of the invention in conjunction with the accompanying drawings. Attached Figure Description

[0042] The following sections will describe some specific embodiments of the invention in detail by way of example and not limitation, with reference to the accompanying drawings. The same reference numerals in the drawings denote the same or similar parts or portions. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings:

[0043] Figure 1 This is a flowchart illustrating a method for replaying a database load file according to an embodiment of the present invention;

[0044] Figure 2 This is a flowchart illustrating a method for replaying a database load file according to another embodiment of the present invention;

[0045] Figure 3 This is a flowchart illustrating a method for replaying a database load file according to yet another embodiment of the present invention;

[0046] Figure 4 This is a schematic diagram of a computer program product according to an embodiment of the present invention;

[0047] Figure 5 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; and

[0048] Figure 6 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation

[0049] Those skilled in the art should understand that the embodiments described below are merely a part of the embodiments of the present invention, and not all of the embodiments of the present invention. These partial embodiments are intended to explain the technical principles of the present invention and are not intended to limit the scope of protection of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by those skilled in the art without creative effort should still fall within the scope of protection of the present invention.

[0050] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-included system or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).

[0051] In the current database landscape, the commercial database market is typically dominated by Oracle, SQL Server, and MySQL. Oracle is widely used, especially in the financial and telecommunications sectors, where developers have a strong reliance on its SQL syntax, programming interfaces, and components. Under the backdrop of domestic IT innovation, customers hope to achieve seamless replacement with domestic databases by simply changing the database driver and connection strings, thereby reducing costs and technical risks. However, database changes (such as type changes and version upgrades) often face challenges such as SQL performance degradation, compatibility issues, and discrepancies between test loads and actual performance. Traditional migration methods rely on manual inventorying of SQL and PL / SQL, which is time-consuming and prone to repetitive iterations. Database replay technology captures and reproduces production environment workloads, realistically simulating tests, generating analysis reports, identifying performance differences and problems, and effectively reducing migration risks.

[0052] In database replay, the execution order and timing control of SQL statements within the load are key metrics for evaluating the replay test results. Since the main instructions are primarily SQL statements, this section will use SQL as an example; other types of instructions follow the same execution method. Within the same session, the logical order of SQL statements, their dependencies, and the dynamic balance between think time and execution time between consecutive calls are crucial for achieving high-fidelity application simulation. The coordination of SQL execution time and think time directly impacts not only the accuracy and efficiency of replay but also determines the overall performance of the replay results. Therefore, designing and implementing a flexible time processing mechanism is a core requirement of the database replay function. This mechanism needs to support precise control of the SQL execution order within a session and optimize the balance between execution time and think time through selectable time scheduling strategies, ensuring efficient, realistic, and controllable replay of the original load under different performance scenarios.

[0053] Currently available database replay functions generally suffer from several limitations. While they are relatively mature in controlling the SQL order within a session, typically strictly adhering to the logic at the time of capture, they suffer from serious deficiencies in time management: some solutions completely ignore SQL execution time and processing time; others mechanically maintain the capture interval, failing to adapt to changes in execution time, resulting in significantly longer replay durations when performance is low. However, in actual customer business scenarios, users often have a strong demand for autonomy in choosing the SQL execution time and intervals during database replay. They not only want the flexibility to select highly customizable traffic pressure control and replay durations that are as consistent as possible in simulation, but also to adjust replay strategies according to different business needs, ensuring the accuracy and effectiveness of testing.

[0054] Based on the above requirements, this invention provides a method for replaying database load files. Figure 1 This is a flowchart illustrating a method for replaying database load files according to an embodiment of the present invention, as shown below. Figure 1 As shown, the method for replaying the database load file includes at least the following steps S101 to S106.

[0055] Step S101: In response to the replay command, obtain the workload file to be replayed. The workload file is used to record the database command execution history in sequence. The replay command is generally initiated by the test system to trigger the workload replay process, and it contains preset replay parameters (such as target replay method, scaling factor, etc.). The workload file to be replayed is a file that is captured and stored in the production environment in advance, recording the actual database workload. Its core function is to replicate the command execution scenario of the production environment.

[0056] Step S102: Determine the original execution time and the original think time after execution of each instruction to be replayed based on the payload file to be replayed. The original execution time generally refers to the time consumed from initiation to completion of a single database instruction in a production environment. For example, if a query instruction in a production environment is initiated at 10:00:00 and completed at 10:04:00, its original execution time is 4 minutes. The original think time is the interval between the completion of one database instruction and the start of the next. For example, if instruction A completes at 10:04:00 and instruction B is initiated at 10:20:00 in a production environment, the original think time between instructions A and B is 16 minutes. The original execution time and original think time can generally be determined automatically by the replay system by parsing the timestamp information in the payload file. Those skilled in the art can determine the acquisition method according to the actual situation.

[0057] Step S103: Determine the target playback method through the playback command. The target playback method generally refers to the strategy selected by the user based on testing requirements to adjust the original thinking time. This invention mainly includes two core methods: thinking time deviation compensation and thinking time rate control.

[0058] Think time deviation compensation: It is mainly applicable to scenarios where there are differences between the performance of the test environment and the production environment (especially the test environment is slower). By dynamically adjusting the think time, it offsets the impact of the longer execution time on the total replay time.

[0059] Thinking time rate adjustment: Suitable for scenarios that require active control of the playback pace (such as stress testing, deceleration verification, etc.). The original thinking time is adjusted proportionally by a preset scaling factor to change the playback rate.

[0060] Step S104: During the playback of the load file to be played back, the original thinking time is adjusted based on the target playback method to obtain the corrected thinking time, and the playback is performed according to the corrected thinking time.

[0061] This method enables the implementation of a control mechanism between the execution time of the instruction to be replayed and the thinking time during database playback. The solution effectively supports customized design based on specific needs and provides flexible customization options, ensuring that the playback process better meets the requirements of actual business scenarios, thereby improving the applicability and operability of database playback.

[0062] In some optional embodiments, when the target playback method is think time deviation compensation, step S104 generally includes: determining the target database instruction to be played back; playing back the target database instruction and obtaining the actual execution time of the target database instruction; determining whether the actual execution time is greater than the original execution time of the target database instruction; if so, calculating the execution deviation value of the target database instruction based on the actual execution time; adjusting the original think time corresponding to the target database instruction according to the execution deviation value to obtain the corrected think time, where the original think time is the interval between the target database instruction and the next database instruction; and starting to execute the next database instruction after waiting for the corrected think time.

[0063] Typically, load file replay requires the system to mark the "next to be executed" instruction as the "target database instruction" according to the instruction execution order recorded in the load file (e.g., sorted by timestamps within the session), ensuring the replay order is consistent with the production environment. When the target replay method uses think time skew compensation, after each database instruction is replayed, the "actual execution time in the test environment" needs to be compared with the "original execution time in the production environment" to determine if think time adjustment is necessary. When the test environment executes slower (i.e., actual execution time > original execution time), compensation is required, which means adjusting the original think time after the target database instruction to ensure the overall replay speed is basically consistent with the production environment.

[0064] Alternatively, the calculation method for the execution deviation value can generally be as shown in equation (1):

[0065] ΔT=Tae-Toe Formula (1)

[0066] Where ΔT represents the execution deviation value, Tae represents the actual execution time, and Toe represents the original execution time. That is: Execution deviation value = actual execution time - original execution time.

[0067] Accordingly, the formula for calculating the corrected thinking time can generally be shown in equation (2):

[0068] Tct = max(0, Tot - ΔT) Equation (2)

[0069] Where Tct represents the corrected thinking time, Tot represents the original thinking time, ΔT represents the execution deviation value, and max represents the larger value between 0 and the original thinking time minus the execution deviation value. That is: Corrected thinking time = max(0, original thinking time - execution deviation value).

[0070] This method ensures that the thinking time will not be modified to a negative number, avoiding the logical error of "the next instruction being initiated before the previous instruction is completed". In other words, if the execution deviation value is greater than the original thinking time, the corrected thinking time will eventually be set to 0, and the next database instruction will be executed immediately after the target database instruction is completed.

[0071] By using a replay method that compensates for think time deviation, the execution delay can be reduced by shortening the think time (for example, reducing a 2-minute think time to 0, thus offsetting a 3-minute delay), resulting in a total duration increase of only 1 minute. This significantly reduces the impact of environmental differences on the realism of the replay. Thus, regardless of whether the test environment's performance is better or worse than the production environment, this embodiment can adaptively handle the situation: actively compensating when performance is poor (actual execution time is longer), and not adjusting when performance is good (actual execution time is shorter) (maintaining the original think time), ensuring that the replay effect closely matches the time characteristics of the production workload under various environments.

[0072] In some alternative embodiments, when the target playback method is think time rate control, step S104 generally includes: obtaining a scaling factor through a playback command; scaling the original think time between two adjacent database commands in the load file to be played back according to the scaling factor to obtain a corrected think time; and playing back the load file to be played back according to the corrected think time. Think time rate control refers to the command issued by the user to control the playback speed of the load file. The scaling factor is a number used to define the scaling ratio of the original think time; it is generally a non-negative integer to avoid logical anomalies caused by negative think times.

[0073] Optionally, scaling the original think time between two adjacent database instructions in the load file to be replayed, based on the scaling factor, generally includes: calculating a scaling percentage based on the scaling factor; scaling the original think time according to the scaling percentage to obtain the corrected think time. The method of this invention only targets the think time (the interval after instruction execution), does not change the execution order of instructions in the load file (it still strictly follows the timestamps of the production environment), and the scaling factor is positive (ensuring the corrected think time is non-negative), fundamentally avoiding the problem of disordered instruction execution order and ensuring the logical correctness of the replay process.

[0074] The formula for calculating the corrected thinking time can generally be shown in equation (3):

[0075] Tct = Tot × (S / 100) Equation (3)

[0076] Where Tct represents the corrected thinking time, Tot represents the original thinking time, and S represents the scaling factor. That is: Corrected thinking time = Original thinking time × (Scaling factor / 100).

[0077] This method allows users to set small scaling factors (e.g., 50, 30) to shorten the think time and increase the instruction execution density when verifying the database's performance limits under high concurrency and high pressure (e.g., "stress testing"), simulating peak loads in a production environment. When precise observation of instruction execution details and pinpointing SQL performance issues is needed (e.g., "slow debugging"), users can set large scaling factors (e.g., 200, 300) to extend the think time and facilitate tracking the execution logs and resource usage of each instruction. When simulating a rhythm completely consistent with the production environment, simply set the scaling factor to "100" or directly set the playback mode to normal playback. Those skilled in the art can customize the correspondence between different scaling factor values ​​and scaling ratios according to their specific needs.

[0078] Figure 2 This is a flowchart illustrating a method for replaying a database load file according to another embodiment of the present invention, as shown below. Figure 2 As shown, the method for replaying the database load file includes at least the following steps S201 to S211.

[0079] Step S201: In response to the playback command, the system acquires the payload file to be played back. As the "startup and data input stage" of the entire playback process, the system loads the payload file pre-captured in the production environment in response to the playback command initiated by the user, providing raw data support for subsequent time parameter extraction and command playback.

[0080] Step S202: Determine the original execution time of each instruction to be replayed and the original think time after the instruction is executed based on the load file to be replayed. Parse the load file to extract the two reference time parameters necessary for implementing "deviation compensation," providing a reference standard for subsequent "determining whether compensation is needed" and "calculating the compensation magnitude."

[0081] Step S203: Determine the target playback method through the playback command. Clarify the time adjustment strategy used for the current playback; in this embodiment, the target playback method is "thinking time deviation compensation." Its core logic is: when the test environment executes commands slower than production, the delay is offset by shortening the subsequent thinking time, ensuring the playback duration closely approximates reality.

[0082] Step S204: When the target playback method is think time deviation compensation, determine the target database instruction to be played back. Locate the instruction to be executed from the instruction sequence in the load file, ensuring that the playback strictly follows the instruction order of the production environment to avoid execution chaos.

[0083] Step S205: Replay the target database instruction and obtain the actual execution time of the target database instruction. Simulate the execution of the target instruction in a production scenario in the test environment, and record the actual time consumption to provide test data for subsequent "determination of whether compensation is needed".

[0084] Step S206: Determine if the target database instruction is the last instruction to be replayed. That is, determine if the current instruction is the last one in the payload file. If it is the last one, no further time adjustment is needed (there is no "next instruction"), and the process ends directly; otherwise, continue to execute the compensation logic to avoid invalid calculations.

[0085] Step S207: If the determination in step S206 is negative, determine whether the actual execution time is greater than the original execution time of the target database instruction. This step compares the measured execution time in the test environment with the baseline execution time in the production environment. Only when the test environment executes "slower" (actual execution time > original execution time) is it necessary to compensate for the delay by shortening the think time; if the execution is "faster" or "the same", no adjustment is needed, and the original think time can be used directly. This avoids overcompensation. If the test environment executes faster (e.g., actual execution time 3 seconds < original 4 seconds), it indicates that the current environment's performance is better than production, and there is no need to shorten the think time.

[0086] Step S208: If the determination in step S207 is yes, calculate the execution deviation value of the target database instruction based on the actual execution time. The execution deviation value is used to quantify the difference in execution efficiency between the test environment and the production environment. This difference value serves as the basis for subsequent adjustments to the compensation range for the time consideration period. Optionally, the execution deviation value can generally be calculated as: Execution Deviation Value = Actual Execution Time - Original Execution Time. If the calculated execution deviation value is positive, it indicates that the test environment is slower than the production environment; if the execution deviation value is negative or zero, it indicates that the test environment is faster or on par (no compensation is required).

[0087] Step S209: Adjust the original think time corresponding to the target database instruction based on the execution deviation value to obtain the corrected think time. The execution deviation value is converted into an adjustment amount for the think time. By shortening the original think time, the impact of execution delay on the total playback time is offset, while ensuring that the adjusted think time is non-negative (to avoid logical errors). Optionally, the corrected think time can generally be calculated as: Corrected Think Time = max(0, Original Think Time - Execution Deviation Value). The purpose of max(0, ...) is to ensure that the think time is not negative (i.e., to avoid the logical error of "the previous instruction has not been completed, and the next instruction has already been initiated"). If the calculation result is negative, it is set to 0 (representing that the next instruction is executed immediately after the previous one is completed).

[0088] In step S210, after waiting for the adjusted thinking time, the next database instruction is executed. After step S210 is completed, the next database instruction is used as the target database instruction to continue executing step S204. The process continues for the adjusted thinking time, then executes the next instruction, simultaneously updating the "target database instruction," thus achieving a closed loop of continuous playback of multiple instructions.

[0089] Step S211: If the determination in step S206 is yes, the playback ends.

[0090] To more clearly illustrate the effect of the thinking time skew compensation, a real production load capture is provided for explanation:

[0091] 20:00: User zhangsan establishes a connection

[0092] 20:10:First user call issued (10mins after completion of prevcall)

[0093] 20:14:First user call completes in 4mins

[0094] 20:30:Second user call issued (16mins after completion of prevcall)

[0095] 20:40:Second user call completes in 10mins

[0096] 20:42:Third user call issued (2mins after completion of prevcall)

[0097] 20:50:Third user call completes in 8mins

[0098] For the above session: its thinking time in a real production environment is 28 minutes, and its execution time is 22 minutes.

[0099] The following is a record after the above payload file was played back normally:

[0100] 10:00: User zhangsan establishes connection

[0101] 10:10:First user call issued 10 mins (100% of 10mins) after the completion of previous call

[0102] 10:15:First user call completes in 5mins (takes a minute longer)

[0103] 10:31:Second user call issued 16 mins (100% of 16mins) after the completion of prevcall

[0104] 10:44:Second user call completes in 13m (takes 3 minutes longer)

[0105] 10:46:Third user call issued 2 min (100% of 2m) after the completion of prev call

[0106] 10:55:Third user call completes in 9m (takes a minute longer)

[0107] This playback record shows that, under normal playback conditions, the think time for this load file remains unchanged at 28 minutes, while the execution time of 27 minutes results in an extension of 5 minutes in the overall playback time.

[0108] When faced with situations where a database command awaiting replay takes longer to complete during replay than it does during source capture, the method of this invention automatically compensates for the think time between calls, thus more closely reflecting the actual load. This is the function of the think time deviation compensation option:

[0109] After applying the method of the present invention, the playback record is as follows:

[0110] 10:00: User zhangsan establishes connection

[0111] 10:10:First user call issued 10 mins (100% of 10mins) after the completion of previous call

[0112] 10:15:First user call completes in 5mins (takes a minute longer)

[0113] 10:30:Second user call issued 15 mins (100% of 16mins - 1min) after the completion of prev call

[0114] 10:43:Second user call completes in 13mins (takes 3 minutes longer)

[0115] 10:43:Third user call issued 0 min (100% of 2mins - 2mins) after the completion of prev call

[0116] 10:52:Third user call completes in 9m (takes a minute longer)

[0117] As can be seen from the above records, after applying the thinking time deviation compensation method of the present invention, the thinking time will be dynamically adjusted to 25 minutes to make up for the impact caused by the extended execution time.

[0118] This method allows for the calculation of the correct interval for sleep based on the set think time rate control. When a user call takes longer to complete during playback than during the original capture, the think time between calls is automatically corrected to achieve the goal of catching up.

[0119] Figure 3 This is a flowchart illustrating a method for replaying database load files according to another embodiment of the present invention, as shown below. Figure 3 As shown, the method for replaying the database load file includes at least the following steps S301 to S307.

[0120] Step S301: In response to the playback command, the system acquires the payload file to be played back. As the "startup and data input stage" of the entire playback process, the system loads the payload file pre-captured in the production environment in response to the playback command initiated by the user, providing raw data support for subsequent time parameter extraction and command playback.

[0121] Step S302: Determine the original execution time of each instruction to be replayed and the original think time after the instruction is executed based on the load file to be replayed. Parse the load file to extract the two reference time parameters necessary for "deviation compensation," providing a reference standard for subsequent "determining whether compensation is needed" and "calculating the compensation magnitude." The core logic is: using a preset scaling factor, scale the original think time by a fixed ratio to adapt the playback rate to the test target (e.g., acceleration is needed for pressure testing, deceleration is needed for debugging).

[0122] Step S303: Determine the target playback method through the playback command. Clarify the time adjustment strategy used for the current playback. In this embodiment, the target method is "thinking time rate control", that is, adjust the original thinking time by a preset scaling ratio to actively control the playback rhythm (such as speeding up, slowing down or maintaining the original speed).

[0123] Step S304: When the target playback mode is thought time rate control, obtain the scaling factor through the playback command. The scaling factor is a pre-set non-negative integer (in practical applications, it must be greater than 0 to avoid the thought time becoming 0 or negative after scaling) used to represent the scaling ratio of the original thought time. Its value corresponds to the "numerator of the scaling percentage". For example, a scaling factor "50" means scaling the original thought time to 50% (acceleration), a scaling factor "200" means scaling it to 200% (deceleration), a scaling factor "100" means maintaining the original ratio (original speed), and so on. Those skilled in the art can set the correspondence between different values ​​of the scaling factor and the scaling ratio according to the actual situation.

[0124] Step S305: Calculate the scaling percentage based on the scaling factor. This step converts the user-input scaling factor (integer) into a scaling percentage (decimal) for easier calculation, providing a unified calculation benchmark for scaling subsequent thinking time, i.e., scaling percentage = scaling factor / 100.

[0125] Step S306: Scale the original thinking time according to the scaling percentage to obtain the corrected thinking time. The original thinking time, after scaling percentage adjustment, is used as the actual interval time for test environment playback. The calculation formula is: Corrected thinking time = Original thinking time × Scaling percentage

[0126] Step S307: Play back the load file to be played back according to the corrected thinking time.

[0127] To more clearly illustrate the effect of think time rate control, a real production load capture is provided for explanation:

[0128] 20:00: User zhangsan establishes a connection

[0129] 20:10:First user call issued (10mins after completion of prevcall)

[0130] 20:14:First user call completes in 4mins

[0131] 20:30:Second user call issued (16mins after completion of prevcall)

[0132] 20:40:Second user call completes in 10mins

[0133] 20:42:Third user call issued (2mins after completion of prevcall)

[0134] 20:50:Third user call completes in 8mins

[0135] For the above session: its thinking time in a real production environment is 28 minutes, and its execution time is 22 minutes.

[0136] For test environments with excellent performance or where customers require stress-based playback, the think time rate control option can be selected for playback control. For example, if the think time is halved, the playback record will be as follows:

[0137] 10:00: User zhangsan establishes connection

[0138] 10:05:First user call issued 5 mins (50% of 10mins) after the completion of previous call

[0139] 10:10:First user call completes in 5mins (takes a minute longer)

[0140] 10:18:Second user call issued 8 mins (50% of 16mins) after the completion of prev call

[0141] 10:31:Second user call completes in 13mins (takes 3 mins longer)

[0142] 10:32:Third user call issued 1 min (50% of 2mins) after the completion of prev call

[0143] 10:41:Third user call completes in 9mins (takes a minute longer)

[0144] With the above choice, the thinking time is 14 minutes and the execution time is 27 minutes, which is a significant improvement compared to the execution speed in the normal production process, thus enabling pressurized playback.

[0145] This method allows for adjustment of the replay rate according to actual needs. Through parameterized and automated time adjustment logic, it provides a flexible, efficient, and rigorous rate control scheme for database load replay, significantly expanding the applicable scenarios for load testing, and is especially suitable for performance limit testing, problem localization, and multi-environment comparative analysis.

[0146] In summary, this invention implements a control mechanism that supports the interaction between the execution time and think time of database commands (e.g., session SQL) during the playback of database workload files. The core of this mechanism lies in precisely controlling the simulation process of the execution and think time of each command to be played back. Users can customize the execution progress of database commands, while the mechanism itself ensures that the execution context, sequence, and timing characteristics of the original workload are faithfully reproduced during playback. This significantly improves the realism, controllability, and adaptability to different testing and verification requirements of database playback.

[0147] The flowcharts provided in this embodiment are not intended to indicate that the operations of the method will be performed in any particular order, or that all operations of the method are included in every case. Furthermore, the method may include additional operations. Within the scope of the technical concept provided by the method in this embodiment, additional variations can be made to the above method.

[0148] It should be understood that in some embodiments, the components may be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods may be implemented using software or firmware stored in memory and executed by a suitable instruction execution system.

[0149] This embodiment also provides a computer program product 10, a computer-readable storage medium 20, and a computer device 30. Figure 4 This is a schematic diagram of a computer program product 10 according to an embodiment of the present invention. Figure 5 This is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention. Figure 6 This is a schematic diagram of a computer device 30 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, which, when executed by the processor 32, implements the steps of the database payload file playback method described above. A computer-readable storage medium 20 stores the computer program 11 thereon, which, when executed by the processor 32, implements the steps of the database payload file playback method described above. The computer device 30 may include a memory 31, a processor 32, and the computer program 11 stored on the memory 31 and running on the processor 32.

[0150] The computer program 11 used to perform the operations of this invention may be assembly instructions, Instruction Set Architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, integrated circuit configuration data, or source code or object code written in any combination of one or more programming languages ​​and procedural programming languages. The computer program 11 may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network, including a Local Area Network (LAN) or Wide Area Network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, to perform aspects of this invention, electronic circuits, including, for example, programmable logic circuits, Field-Programmable Gate Arrays (FPGAs), or Programmable Logic Arrays (PLAs), may execute computer-readable program instructions to personalize the electronic circuits by utilizing state information from computer-readable program instructions.

[0151] For the purposes of this embodiment, computer program product 10 is a related product containing computer program 11. For the purposes of this embodiment, computer-readable storage medium 20 is a tangible device capable of holding and storing computer program 11, and can be any device capable of containing, storing, communicating, propagating, or transmitting program 11 for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable storage medium 20 include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable optical disc read-only memory (CD-ROM), digital versatile disc (DVD), memory stick, floppy disk, mechanical encoding device, and any suitable combination thereof.

[0152] Computer device 30 can be, for example, a server, desktop computer, laptop computer, tablet computer, or smartphone. In some examples, computer device 30 can be a cloud computing node. Computer device 30 can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., that perform specific tasks or implement specific abstract data types. Computer device 30 can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can reside on local or remote computing system storage media, including storage devices.

[0153] Computer device 30 may include a processor 32 adapted to execute stored instructions and a memory 31 that provides temporary storage space for the operation of said instructions during operation. The processor 32 may be a single-core processor, a multi-core processor, a computing cluster, or any other configuration. The memory 31 may include random access memory (RAM), read-only memory, flash memory, or any other suitable storage system.

[0154] Computer device 30 may also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows external devices that can be connected to the computer device to input and output data. The network adapter / interface provides communication between the computer device and a network, typically represented as a communication network.

[0155] Therefore, those skilled in the art should recognize that although numerous exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications conforming to the principles of the present invention can be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the invention. Thus, the scope of the present invention should be understood and construed as covering all such other variations or modifications.

Claims

1. A method of playing back a database load file, characterized by, include: In response to a playback command, a payload file to be played back is obtained, the payload file being used to record the instruction execution history of the database in sequence; The original execution time of each instruction to be replayed and the original thinking time after the execution of the instruction to be replayed are determined based on the load file to be replayed. The original thinking time is the interval between the completion of the previous database instruction and the start of the next database instruction. The target playback method is determined by the playback command; During the playback of the load file to be played back, the original thinking time is adjusted based on the target playback method to obtain a corrected thinking time, and playback is performed according to the corrected thinking time; The target playback method includes thinking time deviation compensation; The step of adjusting the original thinking time based on the target playback method to obtain a corrected thinking time, and then playing back the data based on the corrected thinking time, includes: when the target playback method is thinking time deviation compensation, determining the target database instruction to be played back; playing back the target database instruction and obtaining the actual execution time of the target database instruction; determining whether the actual execution time is greater than the original execution time of the target database instruction; if so, calculating the execution deviation value of the target database instruction based on the actual execution time; adjusting the original thinking time corresponding to the target database instruction based on the execution deviation value to obtain the corrected thinking time, wherein the original thinking time is the interval between the target database instruction and the next database instruction; and starting to execute the next database instruction after waiting for the corrected thinking time.

2. The method for replaying database payload files according to claim 1, characterized in that, The execution deviation value is calculated as follows: ΔT=Tae-Toe Wherein, ΔT represents the execution deviation value, Tae represents the actual execution time, and Toe represents the original execution time.

3. The method for replaying database payload files according to claim 1, characterized in that, The formula for calculating the corrected thinking time is: Tct = max(0, Tot - ΔT) Wherein, Tct represents the corrected thinking time, Tot represents the original thinking time, ΔT represents the execution deviation value, and max represents the larger value between 0 and the calculation result of the original thinking time minus the execution deviation value.

4. The method for replaying database payload files according to claim 1, characterized in that, The target playback method includes thinking time rate adjustment; The step of adjusting the original thinking time based on the target playback method to obtain a corrected thinking time, and then playing back the data according to the corrected thinking time, includes: When the target playback mode is the thinking time rate control, the scaling factor is obtained through the playback command; The original think time between two adjacent database instructions in the load file to be replayed is scaled according to the scaling factor to obtain the corrected think time; The load file to be replayed is replayed according to the corrected thinking time.

5. The method for replaying database load files according to claim 4, characterized in that, The step of scaling the original think time between two adjacent database instructions in the load file to be replayed according to the scaling factor includes: The scaling percentage is calculated based on the scaling factor. The original thinking time is scaled according to the stated scaling percentage to obtain the corrected thinking time.

6. The method for replaying database payload files according to claim 4, characterized in that, The formula for calculating the corrected thinking time is: Tct = Tot × (S / 100) Wherein, Tct represents the corrected thinking time, Tot represents the original thinking time, and S represents the scaling factor.

7. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method for playing back a database payload file as described in any one of claims 1 to 6.

8. A computer program product comprising a computer program that, when executed by a processor, implements the steps of the method for playing back a database payload file as described in any one of claims 1 to 6.

9. A computer device comprising a memory, a processor, and a machine-executable program stored on the memory and running on the processor, wherein the processor, when executing the machine-executable program, implements the steps of the method for playing back a database load file according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for testing load replay between heterogeneous databases

    CN118567962A