Data synchronization method, device and virtualization cluster system based on master and standby virtual machines
By adopting the data synchronization method of the master and backup virtual machine in the virtual machine, the problem of long data synchronization time after virtual machine exceptions is solved, and the consistency of the state of the master and backup virtual machine and the stability of task processing is achieved.
Patent Information
- Application Number
- CN202411720398.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-04-08
AI Technical Summary
After the virtual machine is abnormal, it takes a lot of time to reconfigure the virtual machine and perform task transfer and synchronization with data, resulting in longer delays and poor experience on the user side.
The data synchronization method based on the master and standby virtual machine is adopted, and the rendering task request is received through the master virtual machine, the data packet is processed and its copy forwarded to the backup virtual machine, the processing results of the two are obtained and the data synchronization operation is performed when the match is not matched, to ensure the consistency of the status of the master and standby virtual machine.
Effectively save the processing resource consumption of backup virtual machines, ensure that the status of the main and backup virtual machines is consistent after processing rendering task requests, and improve the efficiency of main and backup switching and task processing stability.
Smart Images

Figure CN119782050A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of task processing, and in particular to a data synchronization method, device and virtualization cluster system based on primary and standby virtual machines. Background Art
[0002] With the rapid development of computing hardware, network technology, and storage technology, the traditional way of using one server for one application often results in a waste of hardware resources. Virtualization technology can effectively improve resource utilization by abstracting and transforming various physical resources of the computer, and by allocating resources reasonably and using resources in a time-sharing and multiplexing manner to achieve the purpose of improving resource utilization.
[0003] In actual applications, a virtual machine may fail to process tasks properly due to an exception. If the virtual machine is reconfigured and task transfer and data synchronization are performed after the virtual machine fails, it will take a long time, resulting in a long delay and poor experience for the user who initiated the request.
[0004] How to improve the task processing stability of the virtual machine is a technical problem to be solved by this application. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a data synchronization method, device and virtualization cluster system based on active and standby virtual machines, so as to improve the task processing stability of the virtual machines.
[0006] In a first aspect, a data synchronization method based on a primary and a standby virtual machine is provided, which is applied to a primary virtual machine and includes: Receive a rendering task request to be processed, wherein the rendering task request carries a data packet to be processed; Processing the data packet to be processed through an operating system process, and forwarding a copy of the data packet to a standby virtual machine corresponding to the primary virtual machine, so as to instruct the standby virtual machine to perform the same processing as the primary virtual machine on the copy of the data packet; Obtaining a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet; If the first processing result and the second processing result do not match, a data synchronization operation is performed on the standby virtual machine based on the first processing result.
[0007] In a second aspect, a virtualization cluster system is provided, the virtualization cluster system comprising a plurality of physical nodes, the virtualization cluster system being used for: Determine a master node and at least one standby node from the multiple physical nodes; A primary virtual machine is started in the primary node, and a standby virtual machine is started in each standby node respectively, wherein the primary virtual machine is used to execute the data synchronization method based on the primary and standby virtual machines as described in the first aspect.
[0008] In a third aspect, a data synchronization device based on a primary and a standby virtual machine is provided, which is applied to a primary virtual machine and includes: A receiving module receives a rendering task request to be processed, wherein the rendering task request carries a data packet to be processed; a processing module, which processes the data packet to be processed through an operating system process, and forwards a copy of the data packet to a standby virtual machine corresponding to the primary virtual machine, so as to instruct the standby virtual machine to perform the same processing as the primary virtual machine on the copy of the data packet; An acquisition module is used to acquire a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet; A synchronization module is configured to perform a data synchronization operation on the standby virtual machine based on the first processing result if the first processing result and the second processing result do not match.
[0009] In a fourth aspect, an electronic device is provided, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method of the first aspect when executed by the processor.
[0010] In a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method of the first aspect are implemented.
[0011] In a sixth aspect, a computer program product is provided, the computer program product comprising a non-transitory computer-readable storage medium storing a computer program, the computer program being operable to cause a computer to execute part or all of the steps of the method of the first aspect.
[0012] In an embodiment of the present application, first, the main virtual machine receives a rendering task request to be processed, which carries a data packet to be processed; then, the data packet to be processed is processed by the operating system process, and a copy of the data packet is forwarded to the standby virtual machine corresponding to the main virtual machine, so as to instruct the standby virtual machine to perform the same processing on the copy of the data packet as the main virtual machine; then, the first processing result of the main virtual machine on the data packet and the second processing result of the standby virtual machine on the copy of the data packet are obtained; if the first processing result and the second processing result do not match, the standby virtual machine is subjected to data synchronization based on the first processing result. Through the scheme provided by the embodiment of the present application, the rendering task is performed by the main virtual machine, and the standby virtual machine performs synchronization processing on the copy of the data packet according to the processing operation of the main virtual machine, which can effectively save the processing resource consumption of the standby virtual machine. Whether the status of the main and standby virtual machines is consistent is determined by the task processing results of the main and standby virtual machines. If they are inconsistent, the data synchronization operation is performed to ensure that the main and standby virtual machines are in the same state. Through this scheme, the main and standby virtual machines can be guaranteed to be consistent in state after processing the rendering task request, which is conducive to performing the main and standby switching at any time without additional synchronization operations, thereby effectively improving the efficiency of the main and standby switching and the stability of task processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1a This is one of the flow charts of a data synchronization method based on a primary and standby virtual machine according to an embodiment of the present application; Figure 1b This is a second flow chart of a data synchronization method based on a primary and standby virtual machines according to an embodiment of the present application; Figure 1c This is a flowchart of a data synchronization method based on a primary and standby virtual machines according to an embodiment of the present application; Figure 2 This is a fourth flow chart of a data synchronization method based on a primary and standby virtual machines according to an embodiment of the present application; Figure 3 This is a flowchart of a data synchronization method based on a primary and standby virtual machine according to an embodiment of the present application; Figure 4a It is a structural diagram of a virtualized cluster system according to an embodiment of the present application; Figure 4b It is a schematic diagram of the configuration process of a virtualized cluster system according to an embodiment of the present application; Figure 5 It is a structural diagram of a data synchronization device based on primary and standby virtual machines in an embodiment of the present application. DETAILED DESCRIPTION
[0014] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application. The numbering of the drawings in this application is only used to distinguish the various steps in the scheme, and is not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.
[0015] The solution provided in the embodiment of the present application can be implemented based on qemu (Quick Emulator) + kvm (Kernel-based Virtual Machine) technology, where qemu can be called a virtual operating system simulator and kvm can be called a kernel-based virtual machine.
[0016] Qemu uses full virtualization technology. The operating system can run directly without modification, which is highly convenient. Qemu runs as a common process of the operating system. A virtual machine corresponds to an operating system process, and a CPU (Central Processing Unit) in the virtual machine corresponds to a thread of the operating system. The qemu virtual machine can process tasks without the user's awareness, just like running on a real physical machine node. In this way, not only can the hardware utilization be improved, but also additional functions can be automatically obtained, such as improving data reliability by performing scheduled backups of virtual machines. Users can deploy each service in a separate virtual machine to avoid mutual influence between services.
[0017] Qemu can use dynamic binary translation technology to support multi-source and multi-target cross-platform simulation execution of heterogeneous instruction sets. For example, it can simulate and run ARM processes on the x86 platform. Considering the low efficiency of binary translation technology, this solution can be executed in the form of qemu+kvm to achieve the purpose of seamless migration of rendering tasks between virtual machines. Among them, kvm is mainly responsible for CPU virtualization and virtual interrupt processing, while qemu is mainly responsible for simulating IO (Input / Output) devices.
[0018] In a production environment, some rendering tasks need to run for a long time. During the task running process, it is an important goal to ensure the continuous and stable operation of the task. Task running can be achieved by the application itself. In actual applications, the application can split the entire task into multiple steps and make the task schedulable. When an exception occurs in the node where the virtual machine performing the rendering is located, the application schedules the task to other normal virtual machines to ensure that the task continues to be executed. It is often more complicated to implement this function at the business level, and it is necessary to solve data consistency problems, handle business service exceptions, etc., which requires high processing resource costs and time costs. The solution provided in the embodiment of the present application can realize automatic switching scheduling of work tasks at the virtual machine level, effectively improving the stability of task processing.
[0019] With the development of GPU (Graphics Processing Unit) graphics card technology, graphics card virtualization technology has gradually entered the production environment. By passing the graphics card directly to the virtual machine, the virtual machine can obtain rendering capabilities close to native hardware, thereby scheduling computing and rendering tasks through the virtual machine.
[0020] In the process of processing rendering tasks, the entire rendering task can be split into multiple steps. Each step is allowed to fail and can be retried after failure. The master control node of the rendering task can distribute each step to the virtual machine one by one and check the execution status regularly. After the distributed task is executed successfully, the next task can be issued. When the task execution is abnormal, a normal virtual machine is reselected and the retry operation is performed. Although this method can realize the processing of rendering tasks, it is highly invasive to the business. This method requires the business itself to support task splitting. If the rendering task itself is strongly coupled and each step cannot run independently, it is difficult to realize the processing of rendering tasks.
[0021] In order to solve the problems existing in the related art, the embodiment of the present application provides a data synchronization method based on the primary and standby virtual machines, such as Figure 1a As shown, it is applied to the main virtual machine and includes: S11: receiving a rendering task request to be processed, wherein the rendering task request carries a data packet to be processed.
[0022] The solution provided in the embodiment of the present application is applied to the main virtual machine, which can be configured corresponding to at least one backup virtual machine. The states of the virtual machines in the master-slave relationship are consistent to ensure that the main and backup virtual machines can synchronously execute rendering task processing and obtain the same processing results.
[0023] In this step, the rendering task request may be received through the network, specifically, the rendering task request may be received through the network card of the primary virtual machine. The rendering task request carries a data packet to be processed, and the data packet is used to perform the processing indicated by the rendering task request.
[0024] S12: Processing the data packet to be processed through the operating system process, and forwarding a copy of the data packet to the standby virtual machine corresponding to the primary virtual machine, so as to instruct the standby virtual machine to perform the same processing as the primary virtual machine on the copy of the data packet.
[0025] In this step, the data packet to be processed can be sent to the operating system process of the primary virtual machine for processing through the primary virtual machine qemu process. At the same time, the data packet is copied and the copy is forwarded to the standby virtual machine corresponding to the primary virtual machine, thereby instructing the standby virtual machine to perform the same processing operation on the data packet copy as the operating system process of the primary virtual machine.
[0026] Optional, see Figure 1b In order to improve the success rate of synchronization execution of the standby virtual machine, the data packet can be copied and the copy can be forwarded to the standby virtual machine. After ensuring the forwarding success, the data packet to be processed is provided to the operating system process of the primary virtual machine for further processing. The standby virtual machine can receive the above data packet copy through the qemu process and provide the data packet copy to the operating system process of the standby virtual machine for processing.
[0027] S13: Obtain a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet.
[0028] In this step, the first processing result can be obtained from the primary virtual machine operating system process through the primary virtual machine qemu process, and the second processing result of the backup virtual machine on the data packet copy can be obtained from the backup virtual machine qemu process.
[0029] S14: If the first processing result and the second processing result do not match, performing a data synchronization operation on the standby virtual machine based on the first processing result.
[0030] See also Figure 1c In this step, it is determined whether the first processing result matches the second processing result.
[0031] If they match, it indicates that the processing results of the data packets by the primary and backup virtual machines are the same, and the primary and backup virtual machines are in the same state. Then, the processing results can be sent through the primary virtual machine network card to respond to the rendering task request, and then subsequent task processing can continue.
[0032] If they do not match, it indicates that there is a difference in the states of the primary and standby virtual machines, and then a data synchronization operation is performed on the standby virtual machine based on the first processing result to synchronize the standby virtual machine to the same state as the primary virtual machine.
[0033] Through the solution provided by the embodiment of the present application, the rendering task is executed by the primary virtual machine, and the backup virtual machine performs synchronization processing on the data packet copy according to the processing operation of the primary virtual machine, which can effectively save the processing resource consumption of the backup virtual machine. The task processing results of the primary and backup virtual machines are used to determine whether the status of the primary and backup virtual machines are consistent. If they are inconsistent, data synchronization operations are performed to ensure that the primary and backup virtual machines are in the same state. Through this solution, it can be ensured that the status of the primary and backup virtual machines is consistent after processing the rendering task request, which is conducive to executing the primary and backup switching at any time without the need for additional synchronization operations, thereby effectively improving the efficiency of the primary and backup switching and the stability of task processing. When any of the primary virtual machines where the rendering task is located fails, the corresponding backup virtual machine can quickly take over the original virtual machine, so that the rendering task can be executed normally.
[0034] Based on the solution provided in the above embodiment, optionally, in the above step S13, obtaining a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet includes: Based on the virtual operating system simulation process, the second processing result sent by the standby virtual machine based on the redirection configuration is obtained through the listening port, wherein the redirection configuration is used to instruct the standby virtual machine to send the second processing result to the listening port of the primary virtual machine.
[0035] In the solution provided by the embodiment of the present application, the primary virtual machine obtains the second processing result sent by the backup virtual machine based on the redirection configuration through the listening port. Then, when it is determined that the processing results of the primary and backup virtual machines match, the primary virtual machine executes the external rendering task request response to avoid the requester receiving two responses from the primary and backup virtual machines.
[0036] Among them, the primary and standby virtual machines in this solution run in parallel, and the IP (Internet Protocol) addresses and other configurations of the primary and standby virtual machines are completely consistent. If the primary and standby virtual machines respond to the above rendering task request at the same time, data confusion may occur. Based on this, in the solution provided in the embodiment of the present application, the external IO devices of the primary and standby virtual machines are pre-configured, which may specifically involve network cards and disk devices.
[0037] The primary virtual machine receives the rendering task request carrying the data packet through the network card, the primary virtual machine network card performs replication and forwards the copy to the standby virtual machine, and passes the rendering task request to the operating system for execution and processing.
[0038] The backup virtual machine can receive the above-mentioned data packet copy through the network card, and perform the same processing operation on the data packet copy as the primary virtual machine, and forward the second processing result obtained by processing to the listening port of the primary virtual machine based on the redirection configuration, so that the primary virtual machine can perform a matching judgment on the first processing result obtained by its own processing and the second processing result provided by the backup virtual machine.
[0039] Through the solution provided in the embodiment of the present application, the standby virtual machine sends the second processing result to the listening port of the primary virtual machine based on the redirection configuration. On the one hand, it can facilitate the primary virtual machine to perform a matching judgment on the first processing result and the second processing result. On the other hand, it can avoid the rendering task requester from receiving repeated responses from the primary and standby virtual machines. Only after the matching judgment of the processing results is consistent, the primary virtual machine unilaterally executes the response.
[0040] Based on the solution provided in the above embodiment, optionally, Figure 2 As shown, in the above step S13, obtaining the first processing result of the primary virtual machine on the data packet and the second processing result of the backup virtual machine on the copy of the data packet includes: S21: Monitoring a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet.
[0041] In the solution provided in the embodiment of the present application, the processing results of the primary and standby virtual machines are monitored. The processing results of the primary and standby virtual machines can be periodically monitored based on a preset duration, and the monitoring parameters can specifically include the processing result data of the data packet and the status data of the virtual machine processing the data packet.
[0042] Wherein, in the above step S14, if the first processing result and the second processing result do not match, performing a data synchronization operation on the standby virtual machine based on the first processing result includes: S22: If it is monitored that the time duration during which the first processing result and the second processing result are inconsistent is longer than a preset time duration, performing a data synchronization operation on the standby virtual machine based on the first processing result.
[0043] In actual applications, if it is detected that the processing results of the primary and standby virtual machines are inconsistent, the timing is started. If the timing time is greater than the preset time, it is determined that the first processing result does not match the second processing result, and then a data synchronization operation is performed.
[0044] The solution provided by the embodiment of the present application can save resources consumed by performing data synchronization operations. In actual applications, there are often differences in the processing speeds of the primary and standby virtual machines, resulting in time differences in the processing results output by the primary and standby virtual machines. If the processing results of the primary and standby virtual machines are consistent within a preset time, it can be determined that the processing results of the primary and standby virtual machines are consistent, that is, the states of the primary and standby virtual machines are consistent, and there is no need to perform data synchronization operations. Data synchronization is performed only when the processing results of the primary and standby virtual machines are inconsistent, that is, the time length of the inconsistency of the states of the primary and standby virtual machines is greater than the preset time, thereby avoiding unnecessary data synchronization overhead.
[0045] Based on the solution provided in the above embodiment, optionally, when the first processing result matches the second processing result, or after performing a data synchronization operation on the standby virtual machine based on the first processing result, the method further includes: Execute data writing corresponding to the rendering task request based on the first processing result.
[0046] In the solution provided by the embodiment of the present application, the primary virtual machine executes the writing of data corresponding to the rendering task request after ensuring that the processing results of the primary and standby virtual machines match, that is, the states of the primary and standby virtual machines are consistent.
[0047] Optionally, the primary and standby virtual machines can share disk resources, and both the primary and standby virtual machines have read permissions, and the primary virtual machine also has write permissions. If the primary virtual machine determines that the first processing result matches the second processing result, it can be determined that the states of the primary and standby virtual machines are consistent, and then the matching processing results are written to the disk to respond to the rendering task request. If the primary virtual machine performs a data synchronization operation on the standby virtual machine, the state of the primary and standby virtual machines can also be consistent, and then the matching processing results are written to the disk to respond to the rendering task request.
[0048] Through the solution provided in the embodiment of the present application, the primary virtual machine executes the data writing corresponding to the rendering task request after determining that the status of the primary and standby virtual machines are consistent, which can effectively ensure the validity of the written data, reduce the processing result abnormalities caused by virtual machine abnormalities, and improve the overall stability of task processing.
[0049] Based on the solution provided in the above embodiment, optionally, Figure 3 As shown, before the above step S12, that is, before the data packet to be processed is processed by the operating system process, it also includes: S31: Performing a data synchronization operation on the standby virtual machine corresponding to the primary virtual machine.
[0050] In the solution provided by the embodiment of the present application, a data synchronization operation is performed on the corresponding standby virtual machine based on the state of the primary virtual machine, so that the standby virtual machine is in the same state as the primary virtual machine. Through the data synchronization operation, the environment in which the primary virtual machine subsequently processes data packets and the environment in which the standby virtual machine processes data packet copies can be made consistent, which is conducive to increasing the probability of matching the first processing result and the second processing result, thereby improving the overall processing stability of the task.
[0051] In one application scenario, the primary and standby virtual machines are deployed based on the Linux system. Since Linux is a preemptive operating system rather than a real-time operating system, inconsistencies may occur between the primary and standby virtual machines. For example, a network request sends data to the virtual machine through the network card, and the virtual machine saves the data in a file with the file name based on the current time of the CPU clock. Since the operation of the physical machine operating system process is preemptive, this may cause inconsistencies in the time points at which the primary and standby virtual machines run the operation, which in turn leads to inconsistencies in the file names.
[0052] In the solution provided in the embodiment of the present application, a data synchronization operation is performed on the standby virtual machine corresponding to the primary virtual machine, and the standby virtual machine can be synchronized to the state of the primary virtual machine to improve the consistency of data packets processed by the primary and standby virtual machines.
[0053] Based on the solution provided by the above embodiment, optionally, the data synchronization operation includes synchronizing at least one of the following data: memory data, virtual central processing unit data, graphics processor data, and disk data; The virtual central processing unit data includes state data of the virtual central processing unit and / or virtual machine control structure data of the virtual central processing unit.
[0054] In the solution provided in the embodiment of the present application, the data synchronization operation can specifically synchronize multiple data. The data synchronization operation includes a data synchronization operation performed when the first processing result and the second processing result do not match, and also includes a data synchronization operation performed before the operating system process processes the data packet to be processed.
[0055] Through data synchronization operations, multiple types of resources of the primary and standby virtual machines can be synchronized, so that the primary and standby virtual machines are in the same state environment, which is beneficial to improving the consistency of the processing results of the primary and standby virtual machines on the data packets.
[0056] In order to solve the problems existing in the related art, the embodiment of the present application provides a virtualization cluster system, such as Figure 4a As shown, the virtualization cluster system includes multiple physical nodes, and the virtualization cluster system is used to: Determine a master node and at least one standby node from the multiple physical nodes; A primary virtual machine is started in the primary node, and a standby virtual machine is started in each standby node respectively, wherein the primary virtual machine is used to execute the data synchronization method based on the primary and standby virtual machines as described in any of the above embodiments.
[0057] The Xu Ni Project cluster system provided in the embodiment of the present application includes multiple physical nodes. In practical applications, virtual machines can be configured based on multiple physical resources of the device, such as allocating CPU, memory, storage, network and other resources in sequence to multiple virtual machines, so that multiple virtual machines can be implemented in parallel in one device.
[0058] Figure 4b A schematic diagram of the configuration process of a virtualization cluster system provided based on an embodiment of the present application is shown. Before executing the rendering task processing, two virtual machines are started first, both of which are in a paused state. Then, one is selected to be configured as the main virtual machine and the other is configured as the backup virtual machine. To ensure that subsequent tasks are executed synchronously, a virtual machine data synchronization operation is performed on the backup virtual machine based on the main virtual machine to ensure that the two virtual machines maintain the same initial state. In addition, input and output IO redirection configuration is performed on the backup virtual machine to ensure that the backup virtual machine forwards the processing results to the listening port of the main virtual machine after executing the data packet processing. Subsequently, the main and backup virtual machines that have completed the above configuration are controlled to enter the running state to receive and process the same rendering task request data.
[0059] In actual applications, a virtual machine with a GPU device can include the following types of data: 1) Virtual machine configuration, including the virtual motherboard type, virtual CPU model, GPU model and other configuration parameters used by the virtual machine.
[0060] 2) vCPU data, i.e., data in the vCPU, which may include register data. The register data may include instruction pointer register, stack pointer register, control register CR3, EPT, etc.
[0061] 3) Data in the virtual machine's memory.
[0062] 4) Data in the virtual machine disk.
[0063] 5) Status data of the pass-through device, register data, etc.
[0064] In the solution provided by the embodiment of the present application, for the primary and standby virtual machines in the same state, after respectively executing the same rendering task processing operation, the data processing results obtained and the states of the primary and standby virtual machines after processing the task should be consistent. Based on this, the system provided by the embodiment of the present application can keep the primary and standby virtual machines in the same state before and after the task processing. Once an abnormality occurs in the primary virtual machine, the standby virtual machine in the completely consistent state can directly take over the task performed by the primary virtual machine, and there is no need to perform additional synchronization of the primary and standby virtual machines before the primary and standby switching, thereby effectively improving the robustness of the system and thus improving the overall processing efficiency of rendering task requests.
[0065] Optionally, in the system provided in the embodiment of the present application, the virtualization cluster is composed of multiple physical nodes, each physical node uses shared storage as a virtual machine storage resource, and the physical nodes can use a dedicated high-speed network for internal communication to efficiently synchronize memory data blocks.
[0066] Optionally, for a virtual machine with fast switching configuration enabled in a virtualization cluster, when starting the virtual machine, the system can select two physical nodes from the cluster, start the two virtual machines on the two physical nodes at the same time, and keep them in a paused state, thereby improving the efficiency of virtual machine pre-configuration.
[0067] Optionally, when the system selects a primary virtual machine and a backup virtual machine, a primary virtual machine may be determined first, and then one or more backup virtual machines may be configured according to the remaining resources, so as to improve the rationality of the configuration of the primary and backup virtual machines.
[0068] Optionally, the active and standby virtual machines in the system share disk storage resources. Before the two virtual machines enter the running state, memory data, VMCS data in the vCPU, GPU data, etc. can be synchronized without synchronizing the shared disk data.
[0069] Optionally, after selecting the standby virtual machine, redirection configuration is performed on the standby virtual machine to direct the output path of the standby virtual machine to the listening port of the primary virtual machine, so that the primary virtual machine can obtain the second processing result of the standby virtual machine on the data packet copy.
[0070] Optionally, the standby virtual machine does not need to call processing resources to perform business processing, but instead acts as a shadow virtual machine of the primary virtual machine and directly executes processing operations following the primary virtual machine, which can effectively reduce the processing resources occupied by the standby virtual machine.
[0071] Optionally, if the primary virtual machine finds that the first processing result obtained by its own processing does not match the second processing result of the backup virtual machine, while performing a data synchronization operation on the backup virtual machine according to the first processing result, synchronization is performed on various resource environments such as the memory, vCPU data, etc. of the backup virtual machine to ensure that the states of the primary and backup virtual machines are completely consistent.
[0072] Based on the solution provided in the above embodiment, optionally, the system is also used for: Monitoring the operating status of the master node and the at least one standby node; If the running state of the master node is abnormal, determining a target standby node with a normal running state from at least one standby node corresponding to the master node; The target standby node is updated to be a master node, and the master node with abnormal running status is updated to be a standby node.
[0073] In the solution provided by the embodiment of the present application, the system monitors the operating status of each node. When the system detects an abnormality in the primary virtual machine, such as when the node network is offline or the node cannot access storage, the primary virtual machine is converted to a backup virtual machine, and the backup virtual machine in a normal state corresponding to the primary virtual machine is converted to the primary virtual machine, so that the virtual machine in a normal state continues to receive external requests for business processing, thereby reducing the negative impact of node abnormalities on the overall task processing and reducing the perception of node abnormalities in the system by the requester.
[0074] Through the system provided by the embodiment of the present application, the running status of the virtual machine can be checked in real time through monitoring. Once the main virtual machine is found to be abnormal, the role of the virtual machine can be switched. During the switching process, the upper-layer application is unaware and the rendering task will not be terminated. In addition, since the data of the main and standby virtual machines are synchronized in real time, data loss will not occur during the switching of the virtual machines.
[0075] Based on the solution provided in the above embodiment, optionally, the primary virtual machine and the corresponding standby virtual machines share disk resources, wherein the primary virtual machine has at least read and write permissions to the disk resources, and the standby virtual machine has at least read permissions to the disk resources.
[0076] In the embodiment of the present application, the primary and standby virtual machines can share disk resources, and both the primary and standby virtual machines have read permissions, and the primary virtual machine also has write permissions. If the primary virtual machine determines that the first processing result matches the second processing result, it can be determined that the states of the primary and standby virtual machines are consistent, and then the matching processing results are written to the disk to respond to the rendering task request. If the primary virtual machine performs a data synchronization operation on the standby virtual machine, the result that the states of the primary and standby virtual machines are consistent can also be achieved, and then the matching processing results are written to the disk to respond to the rendering task request.
[0077] Through the solution provided in the embodiment of the present application, the primary virtual machine has write permission, and after determining that the status of the primary and standby virtual machines are consistent, the data writing corresponding to the rendering task request is executed, which can effectively ensure the validity of the written data, reduce the processing result abnormalities caused by virtual machine abnormalities, and improve the overall stability of task processing.
[0078] In order to solve the problems existing in the related art, the embodiment of the present application provides a data synchronization device 50 based on a primary and a standby virtual machine, such as Figure 5 As shown, it is applied to the main virtual machine and includes: A receiving module 51 receives a rendering task request to be processed, wherein the rendering task request carries a data packet to be processed; The processing module 52 processes the data packet to be processed through the operating system process, and forwards a copy of the data packet to the standby virtual machine corresponding to the primary virtual machine, so as to instruct the standby virtual machine to perform the same processing as the primary virtual machine on the copy of the data packet; An acquisition module 53 is configured to acquire a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet; The synchronization module 54 performs a data synchronization operation on the standby virtual machine based on the first processing result if the first processing result and the second processing result do not match.
[0079] Through the device provided by the embodiment of the present application, the main virtual machine receives a rendering task request to be processed, which carries a data packet to be processed; then, the data packet to be processed is processed by the operating system process, and a copy of the data packet is forwarded to the standby virtual machine corresponding to the main virtual machine, so as to instruct the standby virtual machine to perform the same processing on the copy of the data packet as the main virtual machine; then, the first processing result of the main virtual machine on the data packet and the second processing result of the standby virtual machine on the copy of the data packet are obtained; if the first processing result and the second processing result do not match, the standby virtual machine is subjected to data synchronization operation based on the first processing result. Through the scheme provided by the embodiment of the present application, the rendering task is performed by the main virtual machine, and the standby virtual machine performs synchronization processing on the copy of the data packet according to the processing operation of the main virtual machine, which can effectively save the processing resource consumption of the standby virtual machine. Whether the status of the main and standby virtual machines is consistent is determined by the task processing results of the main and standby virtual machines. If they are inconsistent, the data synchronization operation is performed to ensure that the main and standby virtual machines are in the same state. Through this scheme, the main and standby virtual machines can be guaranteed to be consistent in state after processing the rendering task request, which is conducive to performing the main and standby switching at any time without additional synchronization operations, thereby effectively improving the efficiency of the main and standby switching and the stability of task processing.
[0080] Among them, the above modules in the device provided by the embodiment of the present application can also implement the method steps provided by the above method embodiment. Alternatively, the device provided by the embodiment of the present application can also include other modules in addition to the above modules to implement the method steps provided by the above method embodiment. And the device provided by the embodiment of the present application can achieve the technical effects that can be achieved by the above method embodiment.
[0081] Preferably, an embodiment of the present application also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned data synchronization method embodiment based on the primary and standby virtual machines are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0082] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned data synchronization method embodiment based on the primary and standby virtual machines is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0083] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. The computer program can be operated to enable a computer to execute part or all of the steps of the above-mentioned data synchronization method embodiment based on the primary and standby virtual machines, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0084] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0085] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate a device for implementing the functions specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0086] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0087] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0088] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0089] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0090] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0091] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0092] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0093] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A data synchronization method based on a primary and a standby virtual machine, characterized in that: Applied to the master VM, including: Receive a rendering task request to be processed, wherein the rendering task request carries a data packet to be processed; Processing the data packet to be processed through an operating system process, and forwarding a copy of the data packet to a standby virtual machine corresponding to the primary virtual machine, so as to instruct the standby virtual machine to perform the same processing as the primary virtual machine on the copy of the data packet; Obtaining a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet; If the first processing result and the second processing result do not match, a data synchronization operation is performed on the standby virtual machine based on the first processing result.
2. The method according to claim 1, characterized in that Obtaining a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet, including: Based on the virtual operating system simulation process, the second processing result sent by the standby virtual machine based on the redirection configuration is obtained through the listening port, wherein the redirection configuration is used to instruct the standby virtual machine to send the second processing result to the listening port of the primary virtual machine.
3. The method according to claim 1, characterized in that Obtaining a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet, including: Monitoring a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet; If the first processing result and the second processing result do not match, performing a data synchronization operation on the standby virtual machine based on the first processing result includes: If it is monitored that the time duration during which the first processing result and the second processing result are inconsistent is greater than a preset time duration, a data synchronization operation is performed on the standby virtual machine based on the first processing result.
4. The method according to claim 1, characterized in that In a case where the first processing result matches the second processing result, or after performing a data synchronization operation on the standby virtual machine based on the first processing result, the method further includes: Execute data writing corresponding to the rendering task request based on the first processing result.
5. The method according to claim 1, characterized in that Before the to-be-processed data packet is processed by the operating system process, the method further includes: A data synchronization operation is performed on the standby virtual machine corresponding to the primary virtual machine.
6. The method according to any one of claims 1 to 5, characterized in that The data synchronization operation includes synchronizing at least one of the following data: memory data, virtual central processing unit data, graphics processor data, and disk data; The virtual central processing unit data includes state data of the virtual central processing unit and / or virtual machine control structure data of the virtual central processing unit.
7. A virtualization cluster system, characterized in that: The virtualization cluster system includes multiple physical nodes, and the virtualization cluster system is used for: Determine a master node and at least one standby node from the multiple physical nodes; A primary virtual machine is started in the primary node, and a standby virtual machine is started in each standby node respectively, wherein the primary virtual machine is used to execute the data synchronization method based on the primary and standby virtual machines as described in any one of claims 1 to 5.
8. The system according to claim 7, characterized in that The system is also used to: Monitoring the operating status of the master node and the at least one standby node; If the running state of the master node is abnormal, determining a target standby node with a normal running state from at least one standby node corresponding to the master node; The target standby node is updated to be a master node, and the master node with abnormal running status is updated to be a standby node.
9. The system according to claim 7, characterized in that The primary virtual machine and the corresponding standby virtual machines share disk resources, wherein the primary virtual machine at least has read and write permissions to the disk resources, and the standby virtual machines at least have read permissions to the disk resources.
10. A data synchronization device based on a primary and a standby virtual machine, characterized in that: Applied to the master VM, including: A receiving module receives a rendering task request to be processed, wherein the rendering task request carries a data packet to be processed; a processing module, which processes the data packet to be processed through an operating system process, and forwards a copy of the data packet to a standby virtual machine corresponding to the primary virtual machine, so as to instruct the standby virtual machine to perform the same processing as the primary virtual machine on the copy of the data packet; An acquisition module is used to acquire a first processing result of the primary virtual machine on the data packet and a second processing result of the backup virtual machine on the copy of the data packet; A synchronization module is configured to perform a data synchronization operation on the standby virtual machine based on the first processing result if the first processing result and the second processing result do not match.