Database load file playback method, medium, product and equipment

By using a database load file playback method and leveraging a thinking time deviation compensation and rate control mechanism, the thinking time is dynamically adjusted and corrected, solving the problem of insufficient time processing in existing technologies. This achieves efficient, realistic, and controllable database playback, improving the applicability and operability of database playback.

CN121070977AActive Publication Date: 2025-12-05CETC JINCANG (BEIJING) TECH CO LTD

Patent Information

Application Number
CN202511614859.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2025-12-05
Estimated Expiration
2045-11-06

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. This fails to meet users' needs for self-selection and affects the accuracy and effectiveness of testing.

Method used

A method for replaying database workload files is provided. By obtaining the original execution time and think time of the workload file to be replayed, and using the think time deviation compensation and rate control mechanism, the think time is dynamically adjusted and corrected to ensure time control and efficiency during the replay process.

Benefits of technology

It enables efficient and controllable database replay under different performance scenarios, meets users' needs for autonomous selection of execution time and interval, and improves the applicability and operability of replay.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121070977A_ABST
    Figure CN121070977A_ABST
Patent Text Reader

Abstract

The invention provides a playback method of a database load file, a medium, a product and equipment. The method comprises the following steps: in response to a playback instruction, obtaining a to-be-played-back load file; determining the original execution time of each to-be-played-back instruction and the original thinking time after the to-be-played-back instruction is executed according to the to-be-played-back load file, wherein the original thinking time is the interval time from the end of execution of the previous database instruction to the start of execution of the next database instruction; determining a target playback mode through the playback instruction; and in the playback process of the to-be-played-back load file, adjusting the original thinking time based on the target playback mode to obtain corrected thinking time, and performing playback according to the corrected thinking time. Through the method, a flexible time processing mechanism is realized, so that balance between execution time consumption and thinking time is optimized through a selectable playback strategy, and it is ensured that an original load can be played back efficiently, truly and controllably in different performance scenes.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of database, in particular to a database load file playback method, medium, product and equipment. BACKGROUND

[0002] In the current market, there are some limitations in the same type of database playback function. Among them, they are more mature in the order control of the database operation statements in the session, such as structured query language (SQL). Usually strictly follow the logic when capturing, but the time processing is seriously insufficient, some schemes completely ignore the SQL execution time and thinking time; some others mechanically maintain the interval when capturing, and fail to adapt to the change of execution time, resulting in significant extension of playback time when the performance is low. However, in the actual customer business scene, users often have strong demand for autonomous selection of SQL execution time and interval time in the database playback process. They not only hope to flexibly select highly customized traffic pressure control and simulation playback time as much as possible to adjust the playback strategy according to different business needs, so as to ensure the accuracy and effectiveness of the test. SUMMARY

[0003] In view of the above problems, the present application provides a database load file playback method, medium, product and equipment which can overcome the above problems or at least partially solve the above problems.

[0004] One object of the present application is to realize the control processing between the execution time and the thinking time of the playback instruction.

[0005] A further object of the present application is to optimize the balance between the execution time and the thinking time; Another further object of the present application is to ensure the efficiency and authenticity of the load file playback; In particular, the present application provides a database load file playback method, comprising: In response to the playback instruction, a load file to be played back is obtained, and the load file is used to record the instruction execution history of the database in sequence; According to the load file to be played back, the original execution time of each instruction to be played back and the original thinking time after the execution of the instruction to be played back are determined, and the original thinking time is the interval time from the completion of the execution of the previous database instruction to the start of the execution of the next database instruction; The target playback mode is determined through the playback instruction; In the playback process of the load file to be played back, the original thinking time is adjusted based on the target playback mode to obtain a modified thinking time, and the playback is performed according to the modified thinking time.

[0006] Optionally, the target playback mode comprises thinking time deviation compensation. The step of adjusting the original thinking time based on the target playback mode to obtain a modified thinking time, and playing back according to the modified thinking time comprises: In the case that the target playback mode is thinking time deviation compensation, determining a target database instruction currently to be played back; Playing back the target database instruction, and obtaining an actual execution time of the target database instruction; Judging whether the actual execution time is greater than an original execution time of the target database instruction; If yes, calculating an execution deviation value of the target database instruction through the actual execution time; Adjusting an original thinking time corresponding to the target database instruction according to the execution deviation value to obtain a modified thinking time, the original thinking time being an interval time between the target database instruction and a next database instruction; After waiting for the modified thinking time, starting to execute the next database instruction.

[0007] Optionally, the calculation manner of the execution deviation value is: ΔT=Tae-Toe Wherein, ΔT represents the execution deviation value, Tae represents the actual execution time, and Toe represents the original execution time.

[0008] Optionally, the calculation formula of the modified thinking time is: Tct=max(0, Tot-ΔT) Wherein, Tct represents the modified thinking time, Tot represents the original thinking time, ΔT represents the execution deviation value, and max represents taking a larger value between 0 and a calculation result of the original thinking time minus the execution deviation value.

[0009] Optionally, the target playback mode comprises thinking time rate regulation. The step of adjusting the original thinking time based on the target playback mode to obtain a modified thinking time, and playing back according to the modified thinking time comprises: In the case that the target playback mode is thinking time rate regulation, obtaining a scaling factor through a playback instruction; Scaling the original thinking time between adjacent two database instructions in a load file to be played back according to the scaling factor to obtain a modified thinking time; Playing back the load file to be played back according to the modified thinking time.

[0010] Optionally, the step of scaling the original thinking time between adjacent two database instructions in the load file to be played back according to the scaling factor comprises: According to the scaling factor, a scaling percentage is calculated. According to the scaling percentage, the original thinking time is scaled to obtain a corrected thinking time.

[0011] Optionally, the calculation formula of 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.

[0012] According to another aspect of the present application, there is also provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of any of the above playback methods of a database load file.

[0013] According to still another aspect of the present application, there is also provided a computer program product comprising a computer program which, when executed by a processor, implements the steps of any of the above playback methods of a database load file.

[0014] According to yet another aspect of the present application, there is also provided a computer device comprising a memory, a processor, and a machine executable program stored on the memory and running on the processor, and the processor implements the steps of any of the above playback methods of a database load file when executing the machine executable program.

[0015] The playback method of the database load file of the present application, in response to a playback instruction, acquires a load file to be played back, and the load file is used to record the execution history of the database instructions in sequence; according to the load file to be played back, the original execution time of each instruction to be played back and the original thinking time after the execution of the instruction to be played back are determined, the original thinking time is the interval time from the completion of the execution of the previous database instruction to the start of the execution of the next database instruction; the target playback mode is determined through the playback instruction; in the playback process of the load file to be played back, the original thinking time is adjusted based on the target playback mode to obtain a corrected thinking time, and the playback is performed according to the corrected thinking time. Through this method, a flexible time processing mechanism is realized, so that through the selectable playback strategy, the balance between the execution time and the thinking time is optimized, and it is ensured that the playback can be efficiently and truly controllable in different performance scenarios.

[0016] The above and other objects, advantages and features of the present application will become more apparent from the following detailed description of specific embodiments thereof, when taken in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS

[0017] Some specific embodiments of the present application will be described in detail below with reference to the attached drawings. The same or similar components or parts are designated by the same or similar reference numerals in the drawings. It should be understood by those skilled in the art that the drawings are not necessarily drawn to scale. In the drawings: Figure 1 is a flowchart of a playback method of a database load file according to an embodiment of the present application; Figure 2 is a flowchart of a playback method of a database load file according to another embodiment of the present application; Figure 3 is a flowchart of a playback method of a database load file according to yet another embodiment of the present application; Figure 4 is a schematic diagram of a computer program product according to an embodiment of the present application; Figure 5 is a schematic diagram of a computer readable storage medium according to an embodiment of the present application; and Figure 6 is a schematic diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION

[0018] It should be understood by those skilled in the art that the embodiments described below are only a part of the embodiments of the present application, rather than all the embodiments of the present application, and are intended to explain the technical principles of the present application, rather than limit the protection scope of the present application. Based on the embodiments provided by the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort shall fall within the protection scope of the present application.

[0019] It should be noted that the logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as an ordered listing of executable instructions for implementing logical functions, and can be specifically embodied in any computer readable medium for use by an instruction execution system, apparatus or device, such as a computer-based system, a system including a processor or other system that can fetch the instructions from the instruction execution system, apparatus or device and execute the instructions, or in conjunction with such an instruction execution system, apparatus or device.

[0020] In the current database field, the commercial database market is generally dominated by Oracle, SQL Server and MySQL, especially in the financial and communication fields, Oracle is widely used, and developers have strong dependence on its SQL syntax, programming interface and components. Under the background of China's information creation, customers hope to achieve seamless replacement of domestic databases by changing only the database driver and connection string, in order to reduce cost and technical risk. However, database changes (such as type change, version upgrade, etc.) often face challenges such as SQL performance degradation, compatibility problems, and test load deviation from reality. Traditional migration relies on manual SQL and PLSQL inventory, which is time-consuming and prone to repetition. Database playback technology captures and reproduces production environment workloads, simulates testing, generates analysis reports, identifies performance differences and problems, and effectively reduces migration risks.

[0021] In the database playback process, the execution order and time control of SQL in the load are the key indicators for evaluating the playback test effect, because the main instructions are basically SQL statements, so subsequent examples are given with SQL, and the execution method of other types of instructions and SQL statements is the same. Within the same session, the logical order of SQL statements, the dependency relationship, and the dynamic balance between thinking time and execution time of continuous calls are crucial to achieving high-fidelity application simulation. The coordination of SQL execution time and thinking time not only directly affects the accuracy and efficiency of playback, but also determines the performance of the overall playback result. Therefore, the design and implementation of a flexible time processing mechanism become a core requirement of the database playback function. This mechanism needs to support accurate control of the execution order of SQL within the session, and through selectable time scheduling strategies, it optimizes the balance between execution time and thinking time to ensure that the original load can be efficiently and realistically controlled in different performance scenarios.

[0022] In the same type of database playback function on the market, there are some limitations. Among them, they are more mature in controlling the order of SQL within the session, usually strictly following the logic at the time of capture, but the time processing has serious shortcomings: some schemes completely ignore the SQL execution time and thinking time; others mechanically maintain the interval at the time of capture, and cannot adapt to the change of execution time, resulting in a significant extension of the playback time when the performance is low. However, in actual customer business scenarios, users often have strong demand for autonomous selection of SQL execution time and interval time during database playback. They not only want to be able to flexibly choose highly customized traffic pressure control and as consistent as possible playback time in simulation, but also want to adjust the playback strategy according to different business needs to ensure the accuracy and effectiveness of the test.

[0023] Based on the above needs, the present application provides a playback method of a database load file, Figure 1is a flowchart of a database load file playback method according to an embodiment of the present application, as shown in Figure 1 The database load file playback method comprises at least the following steps S101-S106.

[0024] Step S101, in response to a playback instruction, a load file to be played back is obtained. The load file is used to record the instruction execution history of the database in sequence. The playback instruction is generally an instruction initiated by a test system to trigger the load playback process, which contains preset playback parameters (such as target playback mode, scaling factor, etc.). The load file to be played back is a file that records the real workload of the database, which is captured and stored in advance in the production environment. Its core role is to replicate the instruction execution scenario of the production environment.

[0025] Step S102, according to the load file to be played back, the original execution time of each instruction to be played back and the original thinking time after the execution of the instruction to be played back are determined. The original execution time generally refers to the time consumed from the start of execution to the completion of execution of a single database instruction in the production environment. For example, a query instruction in the production environment is initiated at 10:00:00 and completed at 10:04:00, and its original execution time is 4 minutes. The original thinking time is the interval from the completion of the execution of the previous database instruction to the start of the execution of the next database instruction. For example, instruction A is completed at 10:04:00 in the production environment, and instruction B is initiated at 10:20:00, and the original thinking time between instructions A and B is 16 minutes. The original execution time and the original thinking time can be automatically extracted and calculated by the playback system by analyzing the timestamp information in the load file. Those skilled in the art can determine the acquisition method according to the actual situation.

[0026] Step S103, the target playback mode is determined by the playback instruction. The target playback mode generally refers to the strategy selected by the user according to the test requirements for adjusting the original thinking time. In the present application, there are mainly two core modes: thinking time deviation compensation and thinking time rate control.

[0027] Thinking time deviation compensation: mainly applicable to the scenario where the performance of the test environment and the production environment are different (especially the test environment executes slower), and the thinking time is dynamically adjusted to offset the impact of the longer execution time on the total playback time.

[0028] Thinking time rate control: applicable to scenarios where the playback rhythm needs to be actively controlled (such as stress testing, deceleration verification, etc.), and the original thinking time is adjusted in proportion by a preset scaling factor to change the playback rate.

[0029] Step S104, in the playback process of the to-be-playback load file, the original thinking time is adjusted based on the target playback mode to obtain a modified thinking time, and the playback is performed according to the modified thinking time.

[0030] Through this method, the ability to support the control processing mechanism between the to-be-playback instruction execution time and the thinking time in the database playback process can be realized. The scheme can effectively support the design according to the needs and provide flexible customization options, ensuring that the playback process is more in line with the needs of the actual business scenario, thereby improving the applicability and operability of the database playback.

[0031] In some optional embodiments, in the case where the target playback mode is thinking time deviation compensation, step S104 can generally include: determining the target database instruction currently to be played back; playing back the target database instruction and obtaining the actual execution time of the target database instruction; judging 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 through the actual execution time; adjusting the original thinking time corresponding to the target database instruction according to the execution deviation value to obtain a modified thinking time, the original thinking time being the interval time between the target database instruction and the next database instruction; after waiting for the modified thinking time, starting to execute the next database instruction.

[0032] Generally, load file playback needs the system to mark the "next to be executed" instruction as the "target database instruction" in the order of the instruction execution recorded in the load file (such as sorting by the timestamp within the session), to ensure that the playback order is consistent with the production environment. In the case where the target playback mode is thinking time deviation compensation, whenever a database instruction is played back, it is necessary to compare the "test environment actual execution time" with the "production environment original execution time" to determine whether the thinking time needs to be adjusted. When the test environment executes slower (i.e., the actual execution time > the original execution time), it is necessary to compensate for it, i.e., to adjust the original thinking time after the target database instruction, so as to ensure that the overall playback rate is basically consistent with the production environment.

[0033] Optionally, the calculation method of the execution deviation value can generally be as shown in formula (1): ΔT=Tae-Toe Formula (1) Wherein, Δ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.

[0034] Correspondingly, the calculation formula of the modified thinking time can generally be as shown in formula (2): Tct=max(0, Tot-ΔT) Formula (2) Wherein, Tct represents the modified thinking time, Tot represents the original thinking time, AT 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. That is, the modified thinking time = max (0, original thinking time - execution deviation value).

[0035] This way can ensure that the thinking time will not be modified to a negative number, avoiding the logical error of "the next instruction is initiated before the previous instruction is completed", that is, in the case where the execution deviation value is greater than the original thinking time, the modified thinking time will eventually be set to 0, and the next database instruction will be executed immediately after the target database instruction is completed.

[0036] The playback mode compensated by the thinking time deviation can achieve the effect of shortening the compensation execution delay by the thinking time (for example, reducing the 2-minute thinking time to 0, thereby offsetting the 3-minute delay), so that the total time length is only increased by 1 minute, thereby significantly reducing the influence of environmental differences on the playback authenticity. In this way, whether the test environment is better or worse than the production environment, the scheme of this embodiment can adaptively handle: actively compensate when the performance is poor (the actual execution time is longer), and do not adjust (keep the original thinking time) when the performance is good (the actual execution time is shorter), to ensure that the playback effect can be close to the time characteristics of the production load in various environments.

[0037] In other optional embodiments, in the case where the target playback mode is the thinking time rate control, step S104 can generally include: obtaining a scaling factor through the playback instruction; scaling the original thinking time between adjacent two database instructions in the load file to be played back according to the scaling factor to obtain a modified thinking time; and playing back the load file to be played back according to the modified thinking time. The thinking time rate control refers to the instruction issued by the user to control the playback of the load file at a multiple speed. The scaling factor is a number used to define the scaling ratio of the original thinking time, which is generally a non-negative integer, to avoid logical abnormalities caused by negative thinking time.

[0038] Optionally, the step of scaling the original thinking time between adjacent two database instructions in the load file to be played back according to the scaling factor can generally include: calculating a scaling percentage according to the scaling factor; and scaling the original thinking time according to the scaling percentage to obtain the modified thinking time. The method of the present application only targets the thinking time (the interval after the execution of the instruction), does not change the execution order of the instructions in the load file (still strictly according to the timestamp of the production environment), and the scaling factor is positive (to ensure that the modified thinking time is non-negative), which fundamentally avoids the problem of disorder of the execution order of the instructions and ensures the logical correctness of the playback process.

[0039] The calculation formula of the modified thinking time can generally be as shown in formula (3): Tct = Tot x (S / 100) Equation (3) Wherein, Tct represents the modified thinking time, Tot represents the original thinking time, and S represents the scaling factor. That is, the modified thinking time = the original thinking time x (the scaling factor / 100).

[0040] Through this method, when it is necessary to verify the performance limit of the database under high concurrency and high pressure (such as "stress testing"), the user can set a small scaling factor (such as 50, 30), shorten the thinking time, increase the instruction execution density, and simulate the peak load of the production environment; when it is necessary to accurately observe the instruction execution details and locate the SQL performance problem (such as "slow debugging"), the user can set a large scaling factor (such as 200, 300), prolong the thinking time, and facilitate the tracking of the execution log and resource occupation of each instruction; when it is necessary to simulate the rhythm completely consistent with the production environment, only the scaling factor "100" needs to be set, or the playback mode is directly set to normal playback. The person skilled in the art can set the corresponding relationship between different values of the scaling factor and the scaling ratio according to the actual situation.

[0041] Figure 2 is a flowchart of a database load file playback method according to another embodiment of the application, as shown in Figure 2 The database load file playback method at least includes the following steps S201 to S211.

[0042] Step S201, in response to a playback instruction, a load file to be played back is acquired. As the "start and data input link" of the whole playback process, the system loads the load file previously captured in the production environment by responding to the playback instruction initiated by the user, and provides original data support for subsequent time parameter extraction and instruction playback.

[0043] Step S202, the original execution time of each instruction to be played back and the original thinking time after the execution of the instruction to be played back are determined according to the load file to be played back. The load file is parsed, and two reference time parameters necessary for "deviation compensation" are extracted, thereby providing a reference standard for subsequent "judgment of whether compensation is needed" and "calculation of compensation amplitude".

[0044] Step S203, the target playback mode is determined through the playback instruction. The time adjustment strategy adopted in the current playback is determined, and the target playback mode in the flowchart of the embodiment is "thinking time deviation compensation". The core logic is that when the test environment executes instructions slower than the production, the subsequent thinking time is shortened to offset the delay, so as to ensure that the playback time is close to the reality.

[0045] Step S204, in the case of the target playback mode is the thinking time deviation compensation, determine the target database instruction to be played back. From the instruction sequence of the load file, locate the instruction that needs to be executed currently, ensure that the playback strictly follows the instruction sequence of the production environment, avoid execution confusion.

[0046] Step S205, play back the target database instruction and obtain the actual execution time of the target database instruction. Simulate the execution of the target instruction in the production scene in the test environment, and record the actual time consumption, to provide measured data for the subsequent "judgment of whether compensation is needed".

[0047] Step S206, determine whether the target database instruction is the last instruction to be played back. That is, determine whether the current instruction is the last instruction of the load file. If it is the last instruction, no subsequent thinking time adjustment is needed (no "next instruction"), and the process is directly ended; if it is not, continue to execute the compensation logic to avoid invalid calculation.

[0048] Step S207, in the case of no in step S206, determine whether the actual execution time is greater than the original execution time of the target database instruction. This step is used to compare the test environment measured time consumption with the production environment benchmark time consumption. Only when the test environment executes "slower" (actual execution time > original execution time), is it necessary to compensate for the delay by shortening the thinking time; if it executes "faster" or "flat", no adjustment is needed, and the original thinking time is directly used. In this way, overcompensation can be avoided. If the test environment executes faster (e.g. actual execution time 3 seconds < original 4 seconds), it means that the current environment performance is better than the production, and there is no need to shorten the thinking time.

[0049] Step S208, in the case of yes in step S207, calculate the execution deviation value of the target database instruction through the actual execution time. The execution deviation value is used to quantify the execution efficiency difference between the test environment and the production environment. This difference value is the basis for subsequent adjustment of the thinking time compensation range. Optionally, the calculation method of the execution deviation value can be: execution deviation value = actual execution time - original execution time. The execution deviation value calculated in this way is positive if the test environment is slower than the production; if the execution deviation value is negative or zero, it means that the test environment is faster or flat (no compensation needed).

[0050] Step S209, adjust the original thinking time corresponding to the target database instruction according to the execution deviation value, to obtain a modified thinking time. The execution deviation value is converted into an adjustment amount of thinking time, the original thinking time is shortened to offset the influence of execution delay on the total playback time, while ensuring that the adjusted thinking time is non-negative (avoiding logical errors). Optionally, the calculation method of the modified thinking time can be: modified thinking time = max(0, original thinking time - execution deviation value). The function of max(0,...) is to ensure that the thinking time will not be negative (i.e. avoid the logical error of "the previous instruction is not completed, the next instruction is initiated"). If the calculation result is negative, take 0 (representing the previous instruction is completed immediately after the next instruction is executed).

[0051] Step S210, after waiting for the modified thinking time, start executing the next database instruction. In the case of step S210 being executed, continue to execute step S204 with the next database instruction as the target database instruction. Wait according to the adjusted thinking time, execute the next instruction again, and update the "target database instruction" to realize the continuous playback loop of multiple instructions.

[0052] Step S211, in the case of step S206 being yes, end the playback.

[0053] In order to more clearly illustrate the effect of thinking time deviation compensation, a real production load capture is provided for illustration: 20:00: User zhangsan establishes a connection 20:10: First user call issued (10mins after completion of prevcall) 20:14: First user call completes in 4mins 20:30: Second user call issued (16mins after completion of prevcall) 20:40: Second user call completes in 10mins 20:42: Third user call issued (2mins after completion of prevcall) 20:50: Third user call completes in 8mins For the above session: its think time in real production environment is 28 minutes, and its execution time is 22 minutes.

[0054] The record after normal playback of the above load file is as follows: 10:00: User zhangsan establishes connection 10:10: First user call issued 10 mins (100% of 10mins) after the completion of previous call 10:15: First user call completes in 5mins (takes a minute longer) 10:31: Second user call issued 16 mins (100% of 16mins) after the completion of prevcall 10:44: Second user call completes in 13m (takes 3 minutes longer) 10:46: Third user call issued 2 min (100% of 2m) after the completion of prev call 10:55: Third user call completes in 9m (takes a minute longer) It can be seen from the playback record that, in the normal playback state, the think time of the load file playback is maintained at 28 minutes, and the execution time is 27 minutes, which causes the entire playback time to be extended by 5 minutes.

[0055] In the face of the situation that the database instructions to be played back need longer time to complete during playback than during source-side capture, the method of the present application will automatically compensate for the think time between invocations to achieve a more realistic load. This is the role of the think time deviation compensation option: After applying the method of the present application, the playback record is as follows: 10:00: User zhangsan establishes connection 10:10: First user call issued 10 mins (100% of 10mins) after the completion of previous call 10:15: First user call completes in 5mins (takes a minute longer) 10:30: Second user call issued 15 mins (100% of 16mins - 1min) after the completion of prev call 10:43: Second user call completes in 13mins (takes 3 minutes longer) 10:43: Third user call issued 0 min (100% of 2mins - 2mins) after the completion of prev call 10:52: Third user call completes in 9m (takes a minute longer) From the above records, it can be seen that after the thinking time deviation compensation method of the application is applied, the thinking time will be dynamically adjusted to 25 minutes to compensate for the impact caused by the execution extension.

[0056] By this method, the correct interval time for sleep can be calculated according to the set thinking time rate control, and when the user calls take longer to complete during playback than during original capture, the thinking time between calls is automatically corrected to achieve the purpose of catching up.

[0057] Figure 3 is a flowchart of a database load file playback method according to another embodiment of the application, as shown in Figure 3 The database load file playback method comprises at least the following steps S301 to S307.

[0058] Step S301, in response to a playback instruction, a load file to be played back is acquired. As the "start and data input link" of the whole playback process, the system loads the load file previously captured in the production environment by responding to the playback instruction initiated by the user, and provides original data support for subsequent time parameter extraction and instruction playback.

[0059] Step S302, according to the to-be-playback load file, determine the original execution time of each to-be-playback instruction and the original thinking time after the execution of the to-be-playback instruction. The load file is parsed, and two reference time parameters necessary for realizing "deviation compensation" are extracted, providing a reference standard for subsequent "judging whether compensation is needed" and "calculating compensation amplitude". The core logic is: through a preset scaling factor, the original thinking time is scaled by a fixed ratio, so that the playback rate is adapted to the test target (such as acceleration for stress testing, and deceleration for debugging).

[0060] Step S303, determine the target playback mode through the playback instruction. The time adjustment strategy currently adopted by the playback is determined, and in the embodiment, the target mode is "thinking time rate control", that is, the original thinking time is adjusted by a preset scaling ratio to actively control the playback rhythm (such as acceleration, deceleration, or maintaining the original speed).

[0061] Step S304, in the case where the target playback mode is thinking time rate control, obtain the scaling factor through the playback instruction. The scaling factor is a non-negative integer (in actual application, it needs to be greater than 0 to avoid the thinking time being 0 or negative after scaling) that is preset to represent the scaling ratio of the original thinking time, and its value corresponds to the "numerator of the scaling percentage". For example, the scaling factor "50" means that the original thinking time is scaled to 50% (acceleration), the scaling factor "200" means that it is enlarged to 200% (deceleration), and the scaling factor "100" means that it is kept at the original ratio (original speed), and the like. Those skilled in the art can set the corresponding relationship between different values of the scaling factor and the scaling ratio according to the actual situation.

[0062] Step S305, calculate the scaling percentage according to the scaling factor. This step is to convert the scaling factor (integer) input by the user into a scaling percentage (decimal) convenient for calculation, providing a unified calculation basis for the subsequent scaling of the thinking time, that is, scaling percentage = scaling factor / 100.

[0063] Step S306, scale the original thinking time according to the scaling percentage, thereby obtaining the corrected thinking time. After the original thinking time is adjusted by the scaling percentage, the actual interval time for the playback of the test environment is obtained, and the calculation formula is: corrected thinking time = original thinking time x scaling percentage Step S307, according to the corrected thinking time, play back the to-be-playback load file.

[0064] In order to more clearly illustrate the effect of thinking time rate control, a real production load capture is provided for illustration: 20:00: User zhangsan establishes a connection 20:10:First user call issued (10mins after completion of prevcall) 20:14:First user call completes in 4mins 20:30:Second user call issued (16mins after completion of prevcall) 20:40:Second user call completes in 10mins 20:42:Third user call issued (2mins after completion of prevcall) 20:50:Third user call completes in 8mins For the above session: its thinking time in a real production environment is 28 minutes, and its execution time is 22 minutes.

[0065] 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: 10:00: User zhangsan establishes connection 10:05:First user call issued 5 mins (50% of 10mins) after the completion of previous call 10:10:First user call completes in 5mins (takes a minute longer) 10:18:Second user call issued 8 mins (50% of 16mins) after the completion of prev call 10:31:Second user call completes in 13mins (takes 3 mins longer) 10:32: Third user call issued 1 min (50% of 2mins) after the completion of prev call 10:41: Third user call completes in 9mins (takes a minute longer) The thinking time under such selection is 14 minutes, and the execution time is 27 minutes, which is greatly improved compared with the execution speed in the normal production process, so that the pressure playback is realized.

[0066] Through this method, the playback rate can be adjusted according to actual needs, and a flexible, efficient and rigorous rate control scheme is provided for database load playback through parameterized and automated time adjustment logic, which significantly expands the applicable scenarios of load testing, especially for performance limit testing, problem positioning and multi-environment comparison analysis.

[0067] In summary, the application realizes a control processing mechanism design and implementation between the execution time and the thinking time of the database instruction (such as session SQL) in the playback process of the database load file, and the core is to accurately regulate the simulation process of the execution and thinking time of each to-be-playback instruction. The user can customize the execution progress of the database instruction, and the mechanism itself guarantees that the execution context, sequence and time characteristics of the original load are faithfully reproduced in the playback, thereby significantly improving the authenticity, controllability and adaptability to different test verification requirements of the database playback.

[0068] The flowchart provided by the embodiment is not intended to indicate that the operations of the method are performed in any particular order, or that all operations of the method are included in all cases. In addition, the method can include additional operations. Within the scope of the technical idea provided by the method of the embodiment, additional changes can be made to the above method.

[0069] It should be understood that in some embodiments, parts can be realized by hardware, software, firmware or a combination thereof. In the above described implementation, a plurality of steps or methods can be realized by software or firmware stored in a memory and executed by a suitable instruction execution system.

[0070] The embodiment also provides a computer program product 10, a computer readable storage medium 20 and a computer device 30. Figure 4 is a schematic diagram of the computer program product 10 according to an embodiment of the application, Figure 5 is a schematic diagram of the computer readable storage medium 20 according to an embodiment of the application, Figure 6is a schematic diagram of a computer device 30 according to an embodiment of the application. The computer program product 10 comprises a computer program 11 which, when executed by the processor 32, implements the steps of any of the database load file playback methods described above. The computer readable storage medium 20 has stored thereon the computer program 11 which, when executed by the processor 32, implements the steps of any of the database load file playback methods described above. The computer device 30 can comprise a memory 31, a processor 32 and the computer program 11 stored on the memory 31 and running on the processor 32.

[0071] The computer program 11 for carrying out operations of the present application can be assembly code, instruction set architecture (ISA) code, machine code, machine dependent instructions, microcode, firmware instructions, state-setting data, configuration data for integrated circuits, or either source code or object code written in any combination of one or more programming languages, and process programming languages. The computer program 11 can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate array (FPGA), or programmable logic array (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present application.

[0072] For the purposes of the description of the present embodiment, the computer program product 10 is a tangible computer program product comprising the computer program 11. For the purposes of the description of the present embodiment, the computer readable storage medium 20 is a tangible device that can retain and store the computer program 11, which can be any apparatus that can contain, store, communicate, propagate or transport the program 11 for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer readable storage medium 20 include the following: portable computer diskette, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital versatile disk (DVD), memory stick, a floppy disk, a mechanical encoder device, and any suitable combination of the foregoing.

[0073] The computer device 30 can be, for example, a server, a desktop computer, a notebook computer, a tablet computer, or a smartphone. In some examples, the computer device 30 can be a cloud computing node. The computer device 30 can be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules can include routines, programs, objects, components, logic, data structures, and the like, that perform particular tasks or implement particular abstract data types. The computer device 30 can be practiced in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules can be located in local or remote computer system storage media including memory storage devices.

[0074] The computer device 30 can include a processor 32 adapted to execute instructions stored in a memory 31, which provides temporary storage for operations of the instructions during execution. The processor 32 can be a single core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 31 can include random access memory (RAM), read only memory, flash memory, or any other suitable memory systems.

[0075] The computer device 30 can also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows for input and output of data with external devices that can be connected to the computer device. The network adapter / interface can provide for communication between the computer device and a network, generally illustrated as communication network.

[0076] At this point, those skilled in the art will appreciate that although specific exemplary embodiments of the application have been described herein, the present application also encompasses many other variations or modifications in form, function, terminology and / or detail which have not been expressly described herein but which are within the scope of the present application. Accordingly, the scope of the present application should be gauged by the claims and not by the details of the description.

Claims

1. A method of playing back a database load file, characterized by, The method comprises the following steps: in response to a playback instruction, obtaining a load file to be played back, the load file being used to record the instruction execution history of the database in sequence; determining the original execution time of each instruction to be played back and the original thinking time after the execution of the instruction to be played back according to the load file to be played back, the original thinking time being the interval time from the completion of the execution of the previous database instruction to the start of the execution of the next database instruction; determining a target playback mode through the playback instruction; in the playback process of the load file to be played back, adjusting the original thinking time based on the target playback mode to obtain a modified thinking time, and playing back according to the modified thinking time.

2. The method for playing back the database load file according to claim 1, wherein the target playback mode comprises thinking time deviation compensation; and the step of adjusting the original thinking time based on the target playback mode to obtain a modified thinking time, and playing back according to the modified thinking time comprises the following steps: in the case where the target playback mode is the thinking time deviation compensation, determining a target database instruction to be played back currently; playing back the target database instruction and obtaining the actual execution time of the target database instruction; judging whether the actual execution time is greater than the original execution time of the target database instruction; if yes, calculating the execution deviation value of the target database instruction through the actual execution time; adjusting the original thinking time corresponding to the target database instruction according to the execution deviation value to obtain the modified thinking time, the original thinking time being the interval time between the target database instruction and the next database instruction; after waiting for the modified thinking time, starting to execute the next database instruction.

3. The method for playing back the database load file according to claim 2, wherein the calculation mode of the execution deviation value is: ΔT = Tae - Toe wherein the ΔT represents the execution deviation value, the Tae represents the actual execution time, and the Toe represents the original execution time.

4. The method for playing back the database load file according to claim 2, wherein the calculation formula of the modified thinking time is: Tct = max (0, Tot - ΔT) wherein the Tct represents the modified thinking time, the Tot represents the original thinking time, the ΔT represents the execution deviation value, and the max represents taking the larger value between 0 and the calculation result of the original thinking time minus the execution deviation value.

5. The method for playing back the database load file according to claim 1, wherein the target playback mode comprises thinking time rate regulation; and the step of adjusting the original thinking time based on the target playback mode to obtain a modified thinking time, and playing back according to the modified thinking time comprises the following steps: in the case where the target playback mode is the thinking time rate regulation, obtaining a scaling factor through the playback instruction; ​ ​ ​ ​ ​ ​ scaling the original thinking time between two adjacent database instructions in the to-be-playback load file according to the scaling factor, to obtain a modified thinking time; playing back the to-be-playback load file according to the modified thinking time. 6.The playback method of the database load file according to claim 5, wherein the step of scaling the original thinking time between two adjacent database instructions in the to-be-playback load file according to the scaling factor comprises: calculating a scaling percentage according to the scaling factor; and scaling the original thinking time according to the scaling percentage, to obtain the modified thinking time. 7.The playback method of the database load file according to claim 5, wherein a calculation formula of the modified thinking time is: T ct = T ot × ( S / 100 ), wherein T ct represents the modified thinking time, T ot represents the original thinking time, and S represents the scaling factor. 8.A computer readable storage medium, having stored thereon a computer program, the computer program being executed by a processor to implement the steps of the playback method of the database load file according to any one of claims 1 to 7. 9.A computer program product, comprising a computer program, the computer program being executed by a processor to implement the steps of the playback method of the database load file according to any one of claims 1 to 7. 10.A computer device, comprising a memory, a processor, and a machine executable program stored on the memory and running on the processor, and the processor implements the steps of the playback method of the database load file according to any one of claims 1 to 7 when executing the machine executable program. ​ ​ ​ ​ ​

Citation Information

Patent Citations

  • Parallel playback method and device of database standby machine, electronic equipment and medium

    CN115994053A

  • Parallel playback method and device for database logs and nonvolatile storage medium

    CN117130871A

  • Database pressure testing method and system

    CN118170639A

  • Method for playing back satellite-borne solid-state memory according to time index

    CN118535086A

  • Method and device for testing load replay between heterogeneous databases

    CN118567962A

Cited By

  • Database request playback method and equipment based on time axis

    CN122019323A