CN111078418A - Operation synchronization method and device, electronic equipment and computer readable storage medium - Google Patents

Operation synchronization method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN111078418A
CN111078418A CN201911341196.XA CN201911341196A CN111078418A CN 111078418 A CN111078418 A CN 111078418A CN 201911341196 A CN201911341196 A CN 201911341196A CN 111078418 A CN111078418 A CN 111078418A
Authority
CN
China
Prior art keywords
progress
executed
task
server
executing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911341196.XA
Other languages
Chinese (zh)
Other versions
CN111078418B (en
Inventor
俞晓婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201911341196.XA priority Critical patent/CN111078418B/en
Publication of CN111078418A publication Critical patent/CN111078418A/en
Application granted granted Critical
Publication of CN111078418B publication Critical patent/CN111078418B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

Abstract

The embodiment of the invention provides an operation synchronization method and device, electronic equipment and a computer readable storage medium, and belongs to the technical field of computers. According to the method, under the condition that the operation amount of the tasks to be executed is larger than a preset threshold value, the executed tasks to be executed are executed, the generated operation log file is sent to the slave server in the process of executing the tasks to be executed, the master server judges the progress difference between the first progress of the master server and the second progress of the slave server after executing a preset number of operations, and when the progress difference is larger than the preset progress difference threshold value, the execution speed of the master server is reduced, so that the slave server can be prevented from executing the same operation within a long time after the master server executes all the operations to a certain extent after the master server executes all the operations, the delay of operation synchronization is further reduced, and the efficiency of operation synchronization is improved.

Description

Operation synchronization method and device, electronic equipment and computer readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an operation synchronization method and apparatus, an electronic device, and a computer-readable storage medium.
Background
In order to improve the network use experience of good quality for users, providers often set a server cluster to provide services for users.
When a client used by a user interacts, a task to be executed submitted by the client is often submitted to the master server, the master server directly executes the task to be executed, and after the execution is completed, an operation log file generated by executing the task to be executed is sent to the slave server, and accordingly, the slave server executes the same operation as the master server according to the operation log file, and further, the data of the master server and the data of the slave server are ensured to be consistent.
However, in such a synchronization method, when the operation amount of the task to be executed is large, the slave server can complete the task after the master server has executed the task for a long time, and the synchronization delay between the slave server and the master server is large, and the synchronization effect is poor.
Disclosure of Invention
The invention provides an operation synchronization method, an operation synchronization device, electronic equipment and a computer readable storage medium, which are used for solving the problems of large synchronization delay and poor synchronization effect.
In a first aspect of the present invention, there is provided an operation synchronization method applied to a primary server, the method including:
executing the task to be executed under the condition that the operation amount of the task to be executed is larger than a preset threshold value, and sending the generated operation log file to the slave server in the process of executing the task to be executed; the task to be executed comprises a plurality of operations, and the operation log file is used for indicating the slave server to execute the same operation as the master server;
determining a progress difference between the first progress and the second progress after each execution of a preset number of operations; the first progress is the progress of the main server executing the preset number of operations, and the second progress is the progress of the slave server executing the preset number of operations;
and when the progress difference is larger than a preset progress difference threshold value, reducing the execution speed of the main server.
In a second aspect of the present invention, there is also provided an operation synchronization apparatus applied to a primary server, the apparatus including:
the sending module is used for executing the task to be executed under the condition that the operation amount of the task to be executed is larger than a preset threshold value, and sending the generated operation log file to the slave server in the process of executing the task to be executed; the task to be executed comprises a plurality of operations, and the operation log file is used for indicating the slave server to execute the same operation as the master server;
the first determining module is used for determining a progress difference between the first progress and the second progress after executing each preset number of operations; the first progress is the progress of the main server executing the preset number of operations, and the second progress is the progress of the slave server executing the preset number of operations;
and the reducing module is used for reducing the execution speed of the main server when the progress difference is larger than a preset progress difference threshold value.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when executed on a computer, cause the computer to perform any of the operation synchronization methods described above.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the operation synchronization methods described above.
The operation synchronization method provided by the embodiment of the invention executes the task to be executed when the operation amount of the task to be executed is larger than the preset threshold value, and sends the generated operation log file to the slave server in the process of executing the task to be executed, wherein the operation log file is used for indicating the slave server to execute the same operation as the master server, so that the slave server does not need to wait until the master server executes the task to be executed to start operation synchronization, and further the delay degree of the operation synchronization can be reduced to a certain extent, further, after executing each preset number of operations, the master server judges the progress difference between the first progress of the master server and the second progress of the slave server, and when the progress difference is larger than the preset progress difference threshold value, the execution speed of the master server is reduced, so that by reducing the execution speed of the master server, the method and the system can avoid that the slave server executes the same operation within a longer time after the master server executes all the operations to a certain extent, thereby reducing the delay of operation synchronization and improving the efficiency of operation synchronization.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a flow chart illustrating steps of a method for operation synchronization according to an embodiment of the present invention;
FIG. 2-1 is a flow chart illustrating steps of another method for synchronizing operations according to an embodiment of the present invention;
FIG. 2-2 is a schematic diagram of a system according to an embodiment of the present invention;
FIG. 3 is a block diagram of an operation synchronization apparatus according to an embodiment of the present invention;
fig. 4 is a structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
Fig. 1 is a flowchart of steps of an operation synchronization method provided in an embodiment of the present invention, which is applied to a master server, and as shown in fig. 1, the method may include:
step 101, executing the task to be executed under the condition that the operation amount of the task to be executed is larger than a preset threshold value, and sending the generated operation log file to the slave server in the process of executing the task to be executed. The task to be executed includes a plurality of operations.
In the embodiment of the present invention, the plurality of operations included in the task to be executed may be operations of adding, deleting, and modifying data stored in the main server. The plurality of operations may be represented in SQL statements defined based on Structured Query Language (SQL), which is a Language that operates on a database in a server. The sql statement may be of the DDL/DML language type.
Further, the operation amount of the task to be executed may be the number of operations included in the task to be executed, that is, the number of sql statements, or may be the data size of the sql statements corresponding to the operations included in the task to be executed, which is not limited in the embodiment of the present invention. The preset threshold may be set according to actual requirements, and specifically, the preset threshold may be set according to a data amount that may cause a large time difference between time points at which the master server and the slave server complete the task. For example, the number of the preset threshold may be 1000, which is not limited in the embodiment of the present invention.
Further, if the operation amount of the task to be executed is greater than the preset threshold, it may be considered that a large delay may be generated when the master server and the slave server synchronize the operation in the task to be executed. Therefore, in this step, the generated operation log file may be transmitted to the slave server in the process of executing the task to be executed, and accordingly, after receiving the operation log file from the slave server, the same operation as that executed by the master server may be executed according to the operation log file. Therefore, the slave server does not need to wait until the master server executes the task to be executed, and then starts to perform operation synchronization, so that the delay degree of operation synchronization can be reduced to a certain extent.
Step 102, determining a progress difference between a first progress and a second progress after executing a preset number of operations; the first progress is the progress of the main server executing the preset number of operations, and the second progress is the progress of the slave server executing the preset number of operations.
In the embodiment of the present invention, the preset number may be set according to actual requirements, for example, the preset number may be 100, which is not limited in the embodiment of the present invention. Specifically, the main server may set a counter, and after each operation is performed, control the numerical value recorded by the calculator to add one, and after the numerical value recorded by the calculator reaches the preset number, perform an operation of determining a difference in progress, and set the numerical value recorded by the calculator to 0, so that the calculator is continuously used for counting in a subsequent process.
Further, due to external influences, since the execution speeds of the master server and the slave server may be different, if it is detected that a preset number of operations are executed, the master server may determine a progress difference between a first progress of the master server and a second progress of the slave server to determine current operation delays of the master server and the slave server. Specifically, the first progress may be an operand that has been executed by the master server, the second progress may be an operand that has been executed by the slave server, and accordingly, an absolute value of a difference value between the operand that has been executed by the master server and the operand that has been executed by the slave server may be calculated, and the absolute value may be determined as a progress difference.
And 103, reducing the execution speed of the main server when the progress difference is larger than a preset progress difference threshold value.
In this embodiment of the present invention, the preset progress difference threshold may be set according to a progress difference value that may cause a large time difference between time points at which the master server and the slave server complete the task, which is not limited in this embodiment of the present invention. If the progress difference is greater than the preset progress difference threshold, it may be considered that if the operation continues to be performed according to the current progress, the slave server may perform the task to be performed for a long time after the master server performs the task to be performed. Therefore, in this case, the main server can reduce the execution speed of the main server, further reduce the difference in the progress between the two, reduce the difference in time between the time point when the main server completes the task and the time point when the main server completes the task, and reduce the delay in operation synchronization.
In summary, the operation synchronization method provided by the embodiments of the present invention executes a task to be executed when an operation amount of the task to be executed is greater than a preset threshold, and sends a generated operation log file to a slave server during the execution of the task to be executed, wherein the operation log file is used to instruct the slave server to execute the same operation as that of a master server, so that the slave server does not need to wait until the master server executes the task to be executed, and thus the delay degree of the operation synchronization can be reduced to a certain extent, further, after executing a preset number of operations, the master server determines a progress difference between a first progress of the master server and a second progress of the slave server, and when the progress difference is greater than the preset progress difference threshold, the execution speed of the master server is reduced, so that by reducing the execution speed of the master server, the method and the system can avoid that the slave server executes the same operation within a longer time after the master server executes all the operations to a certain extent, thereby reducing the delay of operation synchronization and improving the efficiency of operation synchronization.
Fig. 2 is a flowchart of steps of another operation synchronization method provided by an embodiment of the present invention, which is applied to a master server, and as shown in fig. 2, the method may include:
step 201, dividing the task to be executed into a plurality of subtasks according to the preset number; and each subtask comprises operands of the preset number.
In this step, a plurality of operations included in the task to be executed may be sequentially divided according to a preset number, so as to obtain a plurality of subtasks. For example, assuming that the task to be executed includes 1000 operations, and the preset number is 100, each 100 operations may be divided into one sub-task, so as to obtain 10 sub-tasks. For example, when partitioning is possible, a specific partitioning tool, which may be denoted as "Oak-chunk-update", may be used to partition, wherein the specific partitioning tool may be a specific component (openark-kit) from an open-source MySQL tool set, which may implement a subtask by partitioning a field, wherein the field may be a primary key index field, a unique index field, or a specified field.
Step 202, executing the subtasks, and sending the operation log files corresponding to the subtasks to the slave server in the process of executing the subtasks.
In this step, the operation log file may be a file specified by a configuration file log-bin, and a log in the operation log file may be a binary log (binary log). When the main server performs the operation, changes to data in the internal database may be recorded into the binary logs, and the binary logs recorded with the data changes belong to binary log events (binary log events). Accordingly, the master server transmits the operation log file to the slave server, the slave server reads the binary log events in the operation log file through the I/O thread after receiving the operation log file, writes the binary log events into the relay log (relay log) of the slave server, and executes the event information in the relay log once locally one by one, that is, "data replay", so as to implement the same operation as that performed by the master server, and further implement the reflection of the recorded change to the data of the slave server itself. In the embodiment of the invention, the master server executes the operation first, generates the operation log file according to the execution process and sends the operation log file to the slave server for operation synchronization, so that the slave server can realize operation synchronization by replaying data based on the operation log file, and the efficiency of operation synchronization is improved to a certain extent.
Step 203, after each execution of a subtask, determining a progress difference between the first progress and the second progress.
Specifically, the specific implementation manner of determining the progress difference may refer to the description in step 102, and is not described herein again in this embodiment of the present invention. In the embodiment of the invention, the tasks to be executed are divided into the subtasks according to the preset number, and after one subtask is executed, the operation with the preset number can be directly confirmed to be executed, so that the progress difference judgment operation can be executed. Therefore, the number of the currently executed operations does not need to be counted, and the required processing resources can be saved to a certain extent. Meanwhile, the task to be executed with large data volume is divided into a plurality of subtasks, and the main server executes the task to be executed by executing the plurality of subtasks, so that the operation execution pressure of the main server can be reduced, and the influence on a database deployed in the main server when the task to be executed is further reduced.
And 204, when the progress difference is larger than a preset progress difference threshold value, reducing the execution speed of the main server.
Specifically, the main server may reduce the execution speed to 0, i.e., stop executing the task to be executed. By reducing the execution speed to 0, the progress difference can be reduced with maximum efficiency, and the overall progress of operation execution is accelerated.
And step 205, determining the progress difference between the first progress and the second progress once every preset time interval.
In this step, the preset duration may be preset, for example, the preset duration may be 5 seconds, which is not limited in the embodiment of the present invention, and since the execution speed of the master server is reduced, the progress difference between the master server and the slave server may be determined at intervals of the preset duration, so that the progress of the master server may be timely recovered in the subsequent step when the progress difference between the master server and the slave server is reduced to be not greater than the preset progress difference threshold. Meanwhile, compared with the real-time detection of the progress difference between the two servers, the real-time detection of the progress difference between the two servers consumes a large amount of processing resources.
And step 206, when the progress difference is not larger than the preset progress difference threshold value, restoring the execution speed to a target speed, and executing the next subtask.
In this step, the target speed may be a default execution speed set in advance, or may be a speed before the execution speed is reduced. If the progress difference is not larger than the preset progress difference threshold, it can be considered that if the operation is continuously executed at this time, a large delay is not generated between the master server and the slave server, and accordingly, the execution speed can be restored to the target speed, and the next subtask is executed. For example, fig. 2-2 is a system schematic diagram provided by an embodiment of the present invention, as shown in fig. 2-2, CHUNK-1, CHUNK-2, and CHUNK-3 respectively represent three subtasks, after each subtask is executed, an operation of "checking progress difference" may be performed, and in a case that the progress difference is not greater than a preset progress difference threshold, the next subtask is continuously executed.
It should be noted that, before executing the task, the host server may receive a modification instruction, where the modification instruction may be sent to the host server by the user through the used terminal. The main server may then add the progress difference detection function carried in the modification instruction to the main server. The progress difference detection function is a function for detecting a first progress and a second progress and calculating a progress difference between the first progress and the second progress. The main server may be deployed with a default preset execution tool, and the operation synchronization method may use the default preset execution tool as an implementation basis. Specifically, the modification instruction may be an instruction for modifying a tool, and the main server may add a progress difference detection function carried in the modification instruction to the tool, so as to add detection logic in the tool. In the embodiment of the invention, the function of detecting the progress difference after each part of tasks is executed can be realized by adding the progress difference detection function in the tool, and the scheme has lower realization cost. The realization difficulty is lower.
Further, the main server may extract an update value in the parameter update instruction and a parameter to be updated corresponding to the update value, in the case that the parameter update instruction is received. The parameters to be updated are one or more of a preset progress difference threshold, a preset number and a preset duration, and the parameters may be predefined in a preset task execution tool. The parameter update instruction may be sent by the user to the main server through the terminal used. For example, a parameter update interface may be displayed, and the user may input a corresponding update value for one or more of a preset progress difference threshold, a preset number and/or a preset duration according to a requirement, and then click a send button to implement sending of the parameter modification instruction. Then, the main server may set the value of the parameter to be updated corresponding to the update value as the update value. For example, assume that the parameter update instruction includes an update value: 110, updating the parameter to be updated corresponding to the value: a preset number, the host server may modify the value of the preset number to 110. In the embodiment of the invention, the parameters can be updated according to the parameter updating instruction, so that a user can conveniently and flexibly adjust the parameters according to the actual execution condition.
Further, a progress difference detection control interface may be defined in the main server, and accordingly, the main server may execute, when receiving the start instruction, an operation of executing the task to be executed when the operation amount of the task to be executed is greater than a preset threshold. Wherein the start instruction is sent through the progress difference detection control interface. In this step, a control interface is reserved for the user, so that the user can flexibly control whether to use the operation synchronization method in the embodiment of the present invention for operation synchronization according to the requirement.
Further, when the master server completes the task to be executed and the slave server does not complete the task to be executed, that is, the master server completes the last sub-task, but the slave server does not complete the last sub-task, the master server may first close the access right of the slave server. Specifically, an access right closing instruction may be sent to the slave server, and after receiving the closing instruction from the slave server, the access right may be closed to suspend interaction with other devices. In an actual application scenario, the master server and the slave server may be read and written separately, for example, the master server is used to provide a write service, the slave server is used to provide a read service, that is, the storage device writes new data into the master server, and the online device reads the new data from the server when the new data needs to be read. If the master server and the slave server have delay, the on-line equipment cannot normally read data from the slave server, and the on-line fault is caused. Therefore, in the embodiment of the invention, the master server closes the access right of the slave server under the condition that the task to be executed is executed and the slave server does not execute the task to be executed, so as to avoid the problem that the master server and the slave server have delay to cause online faults.
For example, taking the case that the task to be executed is to delete 3 billion data, in the case that the master server first performs an operation of deleting 3 billion data and then sends the generated operation log file to the slave server, and the slave server performs the same operation through these operation log files, it takes a day for the master server to perform deletion, and the slave server can complete the entire deletion operation after 8 hours from the completion of the deletion by the master server. By adopting the operation synchronization method provided by the embodiment of the invention, the time of 8 days is consumed for the main server to delete, but the whole deletion operation can be completed within 1 second of the deletion completion of the main server by the slave server.
In summary, according to the operation synchronization method provided in the embodiment of the present invention, the task to be executed is divided into the plurality of sub-tasks according to the preset number, so that the task to be executed is divided into the sub-tasks according to the preset number, and after one sub-task is executed, it can be directly determined that the preset number of operations have been executed, so that the required processing resources can be saved to a certain extent. Then, the subtask can be executed, and the operation log file corresponding to the subtask is sent to the slave server in the process of executing the subtask. The operation log file is used for indicating the slave server to execute the same operation as the master server, so that the slave server does not need to wait until the master server executes the task to be executed to start operation synchronization, the delay degree of the operation synchronization can be reduced to a certain extent, and further, after each sub-task is executed by the master server, the progress difference between the first progress and the second progress can be judged. When the progress difference is larger than the preset progress difference threshold value, the execution speed of the main server is reduced, so that the situation that after the main server executes all operations, the slave server executes the same operations within a long time after the main server executes all the operations can be avoided to a certain extent by reducing the execution speed of the main server, the delay of operation synchronization is reduced, and the efficiency of operation synchronization is improved.
Fig. 3 is a block diagram of an operation synchronization apparatus provided in an embodiment of the present invention, and the apparatus 30, as shown in fig. 3, may include:
a sending module 301, configured to execute the task to be executed when the operation amount of the task to be executed is greater than a preset threshold, and send the generated operation log file to the slave server in the process of executing the task to be executed; the task to be executed comprises a plurality of operations, and the operation log file is used for indicating the slave server to execute the same operation as the master server.
A first determining module 302, configured to determine a progress difference between a first progress and a second progress after each execution of a preset number of operations; the first progress is the progress of the main server executing the preset number of operations, and the second progress is the progress of the slave server executing the preset number of operations.
A reducing module 303, configured to reduce the execution speed of the main server when the progress difference is greater than a preset progress difference threshold.
Optionally, the sending module 301 is specifically configured to:
dividing the tasks to be executed into a plurality of subtasks according to the preset number; and each subtask comprises operands of the preset number.
And executing the subtasks, and sending the operation log files corresponding to the subtasks to the slave server in the process of executing the subtasks.
The first determining module is specifically configured to:
after each sub-task is executed, the progress difference between the first progress and the second progress is judged.
Optionally, the reducing module 303 is specifically configured to:
the execution speed is set to 0.
Accordingly, the apparatus 30 further comprises:
and the second determining module is used for determining the progress difference between the first progress and the second progress once every preset time interval.
And the reply module is used for recovering the execution speed to the target speed and executing the next subtask when the progress difference is not larger than the preset progress difference threshold value.
Optionally, the apparatus 30 further includes:
and the receiving module is used for receiving the modification instruction.
An adding module, configured to add the progress difference detection function carried in the modification instruction to the main server; the progress difference detection function is used for detecting the first progress and the second progress and calculating the progress difference between the first progress and the second progress.
Optionally, the apparatus 30 further includes:
the extraction module is used for extracting an update value in a parameter update instruction and a parameter to be updated corresponding to the update value under the condition of receiving the parameter update instruction; the parameter to be updated is one or more of the preset progress difference threshold, the preset number and the preset duration.
And the setting module is used for setting the value of the parameter to be updated corresponding to the updated value as the updated value.
Optionally, the apparatus 30 further includes:
and the closing module is used for closing the access right of the slave server under the condition that the task to be executed is executed and the slave server does not execute the task to be executed.
In summary, the operation synchronization apparatus according to the embodiment of the present invention executes a task to be executed when an operation amount of the task to be executed is greater than a preset threshold, and sends a generated operation log file to a slave server during the execution of the task to be executed, where the operation log file is used to instruct the slave server to execute the same operation as that of a master server, so that the slave server does not need to wait until the master server executes the task to be executed, and thus a delay degree of operation synchronization can be reduced to a certain extent, further, the master server determines a progress difference between a first progress of the master server and a second progress of the slave server after executing a preset number of operations, and reduces an execution speed of the master server when the progress difference is greater than the preset progress difference threshold, so that by reducing the execution speed of the master server, the method and the system can avoid that the slave server executes the same operation within a longer time after the master server executes all the operations to a certain extent, thereby reducing the delay of operation synchronization and improving the efficiency of operation synchronization.
For the above device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
An embodiment of the present invention further provides an electronic device, as shown in fig. 4, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404,
a memory 403 for storing a computer program;
the processor 401, when executing the program stored in the memory 403, implements the following steps:
executing the task to be executed under the condition that the operation amount of the task to be executed is larger than a preset threshold value, and sending the generated operation log file to the slave server in the process of executing the task to be executed; the task to be executed comprises a plurality of operations, and the operation log file is used for indicating the slave server to execute the same operation as the master server;
determining a progress difference between the first progress and the second progress after each execution of a preset number of operations; the first progress is the progress of the main server executing the preset number of operations, and the second progress is the progress of the slave server executing the preset number of operations;
and when the progress difference is larger than a preset progress difference threshold value, reducing the execution speed of the main server. The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus. The communication interface is used for communication between the electronic equipment and other equipment.
Further, the Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
Further, the Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
Further, in another embodiment provided by the present invention, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform the steps of the operation synchronization method described in any of the above embodiments.
Further, in another embodiment provided by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the steps of the operation synchronization method described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. Further, the computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wirelessly (e.g., infrared, wireless, microwave, etc.). Alternatively, the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. An operation synchronization method applied to a main server, the method comprising:
executing the task to be executed under the condition that the operation amount of the task to be executed is larger than a preset threshold value, and sending the generated operation log file to the slave server in the process of executing the task to be executed; the task to be executed comprises a plurality of operations, and the operation log file is used for indicating the slave server to execute the same operation as the master server;
determining a progress difference between the first progress and the second progress after each execution of a preset number of operations; the first progress is the progress of the main server executing the preset number of operations, and the second progress is the progress of the slave server executing the preset number of operations;
and when the progress difference is larger than a preset progress difference threshold value, reducing the execution speed of the main server.
2. The method according to claim 1, wherein in the case that the operation amount of the task to be executed is greater than a preset threshold, executing the task to be executed, and in the process of executing the task to be executed, sending the generated operation log file to the slave server, comprises:
dividing the tasks to be executed into a plurality of subtasks according to the preset number; wherein each subtask includes an operand of the preset number;
executing the subtasks, and sending operation log files corresponding to the subtasks to the slave server in the process of executing the subtasks;
determining a progress difference between the first progress and the second progress after each execution of a preset number of operations, including:
after each sub-task is executed, the progress difference between the first progress and the second progress is judged.
3. The method of claim 2, wherein reducing the execution speed of the primary server comprises:
setting the execution speed to 0;
accordingly, after the reducing the execution speed of the main server, the method further comprises:
determining the progress difference between the first progress and the second progress every preset time interval;
and when the progress difference is not larger than the preset progress difference threshold value, restoring the execution speed to a target speed, and executing the next subtask.
4. The method according to claim 1, wherein in the case that the operation amount of the task to be executed is greater than the preset threshold, before the task to be executed is executed, the method further comprises:
receiving a modification instruction;
adding a progress difference detection function carried in the modification instruction to the main server; the progress difference detection function is used for detecting the first progress and the second progress and calculating the progress difference between the first progress and the second progress.
5. The method of claim 1, further comprising:
under the condition of receiving a parameter updating instruction, extracting an updating value in the parameter updating instruction and a parameter to be updated corresponding to the updating value; the parameter to be updated is one or more of the preset progress difference threshold, the preset number and the preset duration;
and setting the value of the parameter to be updated corresponding to the updated value as the updated value.
6. The method of claim 1, further comprising:
and closing the access right of the slave server under the condition that the task to be executed is executed and the slave server does not execute the task to be executed.
7. An operation synchronization apparatus applied to a main server, the apparatus comprising:
the sending module is used for executing the task to be executed under the condition that the operation amount of the task to be executed is larger than a preset threshold value, and sending the generated operation log file to the slave server in the process of executing the task to be executed; the task to be executed comprises a plurality of operations, and the operation log file is used for indicating the slave server to execute the same operation as the master server;
the first determining module is used for determining a progress difference between the first progress and the second progress after executing each preset number of operations; the first progress is the progress of the main server executing the preset number of operations, and the second progress is the progress of the slave server executing the preset number of operations;
and the reducing module is used for reducing the execution speed of the main server when the progress difference is larger than a preset progress difference threshold value.
8. The apparatus of claim 7, wherein the sending module is specifically configured to:
dividing the tasks to be executed into a plurality of subtasks according to the preset number; wherein each subtask includes an operand of the preset number;
executing the subtasks, and sending operation log files corresponding to the subtasks to the slave server in the process of executing the subtasks;
the first determining module is specifically configured to:
after each sub-task is executed, the progress difference between the first progress and the second progress is judged.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-6 when executing a program stored in the memory.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN201911341196.XA 2019-12-23 2019-12-23 Operation synchronization method, device, electronic equipment and computer readable storage medium Active CN111078418B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911341196.XA CN111078418B (en) 2019-12-23 2019-12-23 Operation synchronization method, device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911341196.XA CN111078418B (en) 2019-12-23 2019-12-23 Operation synchronization method, device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111078418A true CN111078418A (en) 2020-04-28
CN111078418B CN111078418B (en) 2024-04-16

Family

ID=70316975

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911341196.XA Active CN111078418B (en) 2019-12-23 2019-12-23 Operation synchronization method, device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111078418B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328529A (en) * 2020-11-03 2021-02-05 北京奇艺世纪科技有限公司 Method and device for determining reading progress of electronic book, terminal and storage medium
CN114553895A (en) * 2022-04-24 2022-05-27 浙江中控技术股份有限公司 Data synchronization method, system, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100235326A1 (en) * 2009-03-11 2010-09-16 International Business Machines Corporation Method for mirroring a log file by threshold driven synchronization
US20180329630A1 (en) * 2016-09-13 2018-11-15 Tencent Technology (Shenzhen) Company Limited Data synchronization method and system, and synchronization obtaining method and apparatus
CN108958922A (en) * 2017-05-17 2018-12-07 北京京东尚科信息技术有限公司 Method and apparatus for executing task
CN109905457A (en) * 2019-01-09 2019-06-18 广州视源电子科技股份有限公司 Principal and subordinate's server data synchronous method, device, computer equipment and storage medium
CN110019502A (en) * 2017-08-29 2019-07-16 阿里巴巴集团控股有限公司 Synchronous method, Database Systems and equipment between primary database and standby database

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100235326A1 (en) * 2009-03-11 2010-09-16 International Business Machines Corporation Method for mirroring a log file by threshold driven synchronization
US20180329630A1 (en) * 2016-09-13 2018-11-15 Tencent Technology (Shenzhen) Company Limited Data synchronization method and system, and synchronization obtaining method and apparatus
CN108958922A (en) * 2017-05-17 2018-12-07 北京京东尚科信息技术有限公司 Method and apparatus for executing task
CN110019502A (en) * 2017-08-29 2019-07-16 阿里巴巴集团控股有限公司 Synchronous method, Database Systems and equipment between primary database and standby database
CN109905457A (en) * 2019-01-09 2019-06-18 广州视源电子科技股份有限公司 Principal and subordinate's server data synchronous method, device, computer equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328529A (en) * 2020-11-03 2021-02-05 北京奇艺世纪科技有限公司 Method and device for determining reading progress of electronic book, terminal and storage medium
CN112328529B (en) * 2020-11-03 2023-09-05 北京奇艺世纪科技有限公司 Method, device, terminal and storage medium for determining reading progress of electronic book
CN114553895A (en) * 2022-04-24 2022-05-27 浙江中控技术股份有限公司 Data synchronization method, system, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN111078418B (en) 2024-04-16

Similar Documents

Publication Publication Date Title
WO2021180025A1 (en) Message processing method and apparatus, electronic device and medium
US9684534B2 (en) Monitoring and modifying allocated computing resources
CN108255620B (en) Service logic processing method, device, service server and system
WO2022063284A1 (en) Data synchronization method and apparatus, device, and computer-readable medium
CN111177165B (en) Method, device and equipment for detecting data consistency
US10031948B1 (en) Idempotence service
CN112434043B (en) Data synchronization method, device, electronic equipment and medium
US20140365833A1 (en) Capturing trace information using annotated trace output
CN110659256A (en) Multi-computer room synchronization method, computing device and computer storage medium
CN110515795A (en) A kind of monitoring method of big data component, device, electronic equipment
CN109359092B (en) File management method, desktop display method, device, terminal and medium
CN111078418B (en) Operation synchronization method, device, electronic equipment and computer readable storage medium
CN110990365A (en) Data synchronization method, device, server and storage medium
CN114218193A (en) Data migration method and device, computer equipment and readable storage medium
CN110569157B (en) Storage testing method, device, server and storage medium
JP2012089049A (en) Computer system and server
CN111046007B (en) Method, apparatus and computer program product for managing a storage system
CN107958414B (en) Method and system for eliminating long transactions of CICS (common integrated circuit chip) system
EP4160421A1 (en) Method and apparatus for obtaining browser running data, and storage medium
CN111159160A (en) Version rollback method and device, electronic equipment and storage medium
CN115640280A (en) Data migration method and device
WO2018200167A1 (en) Managing asynchronous analytics operation based on communication exchange
WO2019062087A1 (en) Attendance check data testing method, terminal and device, and computer readable storage medium
CN112699129A (en) Data processing system, method and device
CN112231290A (en) Method, device and equipment for processing local log and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant