Software process live migration method and system
By pre-configuring migration information in the software's executable file, the problem of low migration efficiency caused by communication issues between the migration implementer and the software developer is solved, and efficient hot migration of the software process is achieved.
Patent Information
- Application Number
- CN202411867344.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2044-12-17
AI Technical Summary
In the existing technology, the hot migration of software processes cannot be carried out efficiently, mainly because the migration implementer cannot obtain communication with the target hardware device, resulting in low efficiency in obtaining migration configuration information through the command line configuration of the CRIU tool.
By pre-configuring migration configuration information related to the business scenarios of the software process in the software's executable file, the CRIU tool can directly obtain migration configuration information from the executable file, avoiding communication between the migration implementer and the software developer and improving the efficiency of obtaining migration configuration information.
It enables accurate and efficient hot migration of software processes, improves the efficiency of obtaining migration configuration information, and ensures the normal operation of software processes in both source and target hardware devices.
Smart Images

Figure CN119806635B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer software, and particularly relates to a software process live migration method, a software process live migration system, a computer readable storage medium and a computer program product. BACKGROUND
[0002] When a hardware device needs to be maintained, software in the hardware device needs to be upgraded, or network load balancing needs to be performed between multiple hardware devices, live migration can be used to make the software process in the current hardware device run in another hardware device, so that the maintenance of the hardware device, the upgrade of the software and the network load balancing are performed without the awareness of the software user.
[0003] Currently, the live migration of a software process is mainly implemented by using a checkpoint and restore in userspace (CRIU) tool. Specifically, when a software process in a source hardware device needs to be live migrated to a target hardware device, the CRIU tool needs to be installed in the target hardware device first. In order to ensure the effective live migration, the CRIU tool introduces command line options. In the command line options, in addition to general options, there are also options related to the specific business scenario of the software process to be migrated. After the CRIU tool is installed in the target hardware device, a migration implementer needs to configure the command line related to the business scenario of the software process to be migrated in the command line options of the CRIU tool. At the same time, an agent program of the CRIU tool also needs to be installed in the source hardware device. Next, the CRIU tool controls the agent to freeze the software process to be migrated in the source hardware device according to the command line configured in the command line options, saves all states of the software process to be migrated as an image file, and then sends the image file to the target hardware device. The CRIU tool of the target hardware device uses a new process to run from the frozen point in the source hardware device based on the command line and the image file, thereby realizing the live migration of the corresponding software process.
[0004] However, in the case where the migration implementer is not the developer of the software process to be migrated, the migration implementer needs to communicate with the developer of the software process to be migrated to obtain the specific business scenario of the software process to be migrated before configuring the command line options of the CRIU tool, so as to edit the corresponding command line based on the specific business scenario and configure the command line in the command line options of the CRIU tool. Since the communication between the migration implementer and the developer of the software process to be migrated needs time, the configuration of the command line options in the CRIU tool is delayed, and the efficiency of the live migration of the software process is reduced. SUMMARY
[0005] The purpose of the embodiments of the present application is to provide a software process live migration method, a software process live migration system, a computer readable storage medium and a computer program product, so as to improve the live migration efficiency of the software process.
[0006] To solve the above technical problems, the embodiments of the present application provide the following technical solutions:
[0007] The first aspect of the present application provides a software process live migration method, the method is applied to a software process live migration system, the system includes a source hardware device, a target hardware device, a CRIU tool and an Agent program, the CRIU tool is installed in the target hardware device, and the Agent program is installed in the source hardware device, the source hardware device includes a process and an executable file of a software to be migrated, the executable file includes migration configuration information related to the business scenario of the process in the command line options of the CRIU tool, and the migration configuration information is provided by the developer of the software to be migrated, the method includes: the CRIU tool controls the Agent program to send the executable file in the source hardware device to the target hardware device; the CRIU tool obtains the migration configuration information from the executable file; the CRIU tool controls the Agent program to freeze the process in the source hardware device according to the migration configuration information, and controls the Agent program to transmit the state data of the process at the freezing time to the target hardware device; and the CRIU tool controls a new process in the target hardware device to start running from the freezing point of the source hardware device based on the state data and the migration configuration information, so as to realize the live migration of the process of the software to be migrated from the source hardware device to the target hardware device.
[0008] Compared with the prior art, the software process live migration method provided by the first aspect of the present application pre-configures the migration configuration information related to the business scenario of the software process for the CRIU tool in the executable file of the software. In this way, when the software process in the source hardware device needs to be live migrated to the target hardware device, the CRIU tool in the target hardware device can control the Agent program in the source hardware device to obtain the executable file of the software to be migrated from the source hardware device, so as to obtain the migration configuration information in the executable file. Then, the target hardware device performs normal live migration on the corresponding software process in the source hardware device based on the obtained migration configuration information. The live migration process does not need the migration implementer to configure the command line related to the business scenario of the process in the CRIU tool, and further does not need the migration implementer to communicate with the software developer. The CRIU tool can directly obtain the migration configuration information from the executable file of the software, improves the acquisition efficiency of the migration configuration information, and further improves the efficiency of the live migration of the software process.
[0009] In some implementation forms of the first aspect of the application, the migration configuration information is stored in a custom section of the executable file, a header of the custom section is provided with a custom name, and the CRIU tool is stored with the custom name; the CRIU tool acquires the migration configuration information from the executable file, including: the CRIU tool matches the stored custom name with a name of a header of each section of the executable file; the CRIU tool determines a section corresponding to the matched name as the custom section, and acquires all data from the custom section, and determines the all data as the migration configuration information.
[0010] By storing the migration configuration information in the custom section of the executable file, only the CRIU tool holds the name of the custom section, which can improve the difficulty for a third party to acquire the migration configuration information from the executable file, and further improve the security of storing the migration configuration information, and further ensure the correct performance of the software live migration.
[0011] In some implementation forms of the first aspect of the application, the custom section is a first section of a plurality of sections of the executable file; the CRIU tool matches the stored custom name with a name of a header of each section of the executable file, including: the CRIU tool matches the stored custom name with a name of a header of the first section of the executable file; the CRIU tool determines whether the matching result represents a successful match; if yes, the CRIU tool determines that the matching is successful, and ends the matching.
[0012] Storing the migration configuration information in the first section of the executable file can faster match the section where the migration configuration information is located, and faster acquire the migration configuration information, and further improve the live migration efficiency of the software process, in the case of sequentially matching the sections in the executable file.
[0013] In some implementation forms of the first aspect of the application, the migration configuration information is stored in a session definition segment of the executable file, and the session definition segment is configured in a compiler to not be executed and loaded by a source hardware device, and the compiler is used to implement execution and loading of the executable file in the source hardware device.
[0014] Storing the migration configuration information in the session definition segment of the executable file, and using the compiler to not execute the feature in the session definition segment, can ensure that the migration configuration information is not loaded while the executable file is loaded in the source hardware device, and ensure normal operation of the software process in the source hardware device and the target hardware device.
[0015] In some implementation forms of the first aspect of the application, the attribute of the migration configuration information in the session definition segment is read-only.
[0016] The attribute of the migration configuration information is configured as read-only, which can further ensure that the migration configuration information is not loaded in the loading process of the executable file, and further ensure the normal operation of the software process in the source hardware device and the target hardware device.
[0017] In some modified embodiments of the first aspect of the application, the migration configuration information is in a command format of a plurality of preset command formats, and the CRIU tool stores an identifier corresponding to the command format of the migration configuration information; the CRIU tool controls the Agent program to freeze the process in the source hardware device according to the migration configuration information, including: the CRIU tool determines the command format of the migration configuration information based on the currently stored identifier, parses the migration configuration information based on the determined command format, and controls the Agent program to freeze the process in the source hardware device based on the parsed migration configuration information.
[0018] The migration configuration information can be represented in any command format, and the CRIU tool stores an identifier corresponding to the command format of the migration configuration information. In this way, the difficulty of parsing the migration configuration information by other tools can be improved, and the security of the migration configuration information is improved. Furthermore, personalized configuration of the migration configuration information can be achieved, so that the software developer can choose the command format he is good at to edit the migration configuration information, which improves the accuracy of editing the migration configuration information in the executable file, and further ensures the normal operation of the software process hot migration.
[0019] In some modified embodiments of the first aspect of the application, the command format of the migration configuration information is a string command, or the migration configuration information is data in a plurality of bits, and the CRIU tool stores a plurality of string commands corresponding to a plurality of business scenarios, and different meanings of data in a plurality of bits correspond to different combinations of string commands; the migration configuration information is parsed based on the determined command format, including: data in a plurality of bits is obtained based on the determined command format; a target string command corresponding to the meaning indicated by the data in a plurality of bits is found from the plurality of string commands stored in the CRIU tool, and the string command is parsed.
[0020] Using a string command to edit the migration configuration information can improve the readability of the CRIU tool for the migration configuration information and ensure the correct performance of the hot migration. Using bits with meanings to edit the migration configuration information can reduce the amount of data compared to using command lines, which can reduce the occupation of space in the executable file, and further reduce the occupation of storage space in the hardware device by the executable file.
[0021] The second aspect of the present application provides a software process live migration system, the system comprising a source hardware device, a target hardware device, a CRIU tool and an Agent program, the CRIU tool being installed on the target hardware device, the Agent program being installed on the source hardware device, the source hardware device comprising a process and an executable file of software to be migrated, the executable file comprising migration configuration information related to a business scenario of the process in command line options of the CRIU tool, the migration configuration information being provided by a developer of the software to be migrated, in the system, the CRIU tool is configured to control the Agent program to send the executable file in the source hardware device to the target hardware device; the CRIU tool is further configured to acquire the migration configuration information from the executable file; the CRIU tool is further configured to control the Agent program to freeze the process in the source hardware device according to the migration configuration information, and control the Agent program to transmit state data of the process at the freezing time to the target hardware device; the CRIU tool is further configured to control a new process in the target hardware device to start running from a freezing point of the source hardware device based on the state data and the migration configuration information, so as to realize live migration of the process of the software to be migrated from the source hardware device to the target hardware device.
[0022] The third aspect of the present application provides a computer readable storage medium, the storage medium comprising a stored program, the program being configured to control a source hardware device and a target hardware device to execute the method in the first aspect when the program is running.
[0023] The fourth aspect of the present application provides a computer program product, the computer program product comprising a computer program or instructions, the computer program or instructions being configured to realize the method in the first aspect when the computer program or instructions are executed by a source hardware device and a target hardware device.
[0024] The software process live migration system provided by the second aspect of the present application, the computer readable storage medium provided by the third aspect of the present application, and the computer program product provided by the fourth aspect of the present application have the same or similar beneficial effects as the software process live migration method provided by the first aspect of the present application. BRIEF DESCRIPTION OF DRAWINGS
[0025] The above and other objects, features and advantages of the present application will become more apparent from the following detailed description read in conjunction with the accompanying drawings. In the drawings, several embodiments of the present application are illustrated by way of example and not limitation in which like reference numerals refer to like elements, in which:
[0026] Figure 1 FIG. 1 is a structural schematic diagram of a software process live migration system in an embodiment of the present application;
[0027] Figure 2 FIG. 2 is a flowchart of a software process live migration method in an embodiment of the present application; Figure 1 ;
[0028] Figure 3 Flowchart of the software process live migration method in the embodiment of the present application Figure 2
[0029] Figure 4 Schematic diagram of each section in the executable file in the embodiment of the present application
[0030] Figure 5 Structural schematic diagram of the software process live migration system in the embodiment of the present application. DETAILED DESCRIPTION
[0031] Exemplary embodiments of the present application will be described herein below with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present application can be more thoroughly understood and so that the scope of the present application can be accurately conveyed to those skilled in the art.
[0032] It should be noted that, unless otherwise specified, technical terms or scientific terms used in the present application should be understood as their common meanings to those skilled in the art to which the present application pertains.
[0033] Currently, to perform live migration of a software process, a migration implementer needs to configure corresponding command lines in the command line options of the CRIU tool based on the business scenario of the software process. However, the migration implementer does not understand the specific business scenario of the software process, and thus needs to communicate with the software developer. The communication is time-consuming and reduces the efficiency of live migration of the software process.
[0034] In view of this, the embodiments of the present application provide a software process live migration method, a software process live migration system, a computer readable storage medium and a computer program product. By having the software development party pre-configure migration configuration information related to the specific business scenario of the software process in the executable file of the software, the CRIU tool can directly obtain the migration configuration information from the executable file of the software, thereby performing live migration of the software process. In this way, the migration implementer and the software development party do not need to communicate again. Since the software development party is most familiar with the specific business scenario of the software process, the migration configuration information edited by the software development party is relatively accurate, and thus accurate and efficient live migration of the software process is achieved.
[0035] Firstly, the application scenario of the software process live migration method provided by the embodiments of the present application is described.
[0036] Figure 1 Structural schematic diagram of the software process live migration system in the embodiment of the present application, see Figure 1 As shown, the system can include: a source hardware device 11, a target hardware device 12, a CRIU tool 13 and an Agent program 14.
[0037] In actual application, the source hardware device 11 and the target hardware device 12 can be any kind of hardware device capable of running software, such as terminal device, server, etc. The specific type of the source hardware device 11 and the target hardware device 12 can be the same or different, which is not limited here.
[0038] In the source hardware device 11, the software is installed, that is, the executable file of the software is stored. In the executable file, the migration configuration information related to the business scenario of the software process in the command line option of the CRIU tool pre-configured by the software developer is stored, so as to accurately and quickly perform the subsequent software process hot migration.
[0039] When the software corresponding to the executable file runs in the source hardware device 11, there will be a process of the software in the source hardware device 11. When the source hardware device 11 needs to hot migrate the software process therein for some reason, the software corresponding to the executable file is the software to be migrated, and the process of the software is the software process to be migrated.
[0040] The object to be migrated of the software process to be migrated is the target hardware device 12. In the target hardware device 12, the CRIU tool 13 is installed. The CRIU tool 13 is a conventional software process hot migration tool. The specific type of the CRIU tool 13 is not limited here. In order to hot migrate the software process in the source hardware device 11 to the target hardware device 12, some information needs to be obtained from the source hardware device 11, and the information can be obtained through the Agent program 14 installed in the source hardware device 11.
[0041] Next, the software process hot migration method provided by the embodiment of the present application is described in detail.
[0042] Figure 2 The flow of the software process hot migration method in the embodiment of the present application is shown in Figure 1 , referring to Figure 2 , the method can include:
[0043] S21: The CRIU tool controls the Agent program to send the executable file in the source hardware device to the target hardware device.
[0044] When a software process in the source hardware device needs to be hot-migrated to the target hardware device, the CRIU tool in the target hardware device is started by the migration implementer, and the CRIU tool controls the Agent program to make the Agent program obtain the executable file of the software corresponding to the software process to be migrated from the source hardware device and send the executable file to the CRIU tool.
[0045] Since the CRIU tool and the Agent program are in different hardware devices, when the CRIU tool controls the Agent program, the CRIU tool can send a preset instruction to the Agent program, which is used to instruct the Agent program to find the executable file in the hardware device where the Agent program is located and send the found executable file to the CRIU tool.
[0046] In the preset instruction, the software name and the address of the hardware device where the CRIU tool is located can be included. After the Agent program finds the corresponding executable file in the source hardware device based on the software name, the Agent program can send the executable file to the target hardware device according to the address.
[0047] Generally, the executable file of the software is stored in the disk of the hardware device, and therefore, the Agent program can find the executable file corresponding to the software to be migrated in the disk of the source hardware device based on the software name, so as to send the executable file to the target hardware device after the executable file is found.
[0048] S22: The CRIU tool obtains migration configuration information from the executable file.
[0049] After the target hardware device receives the executable file, since the command line for the CRIU tool to perform process hot migration corresponding to the specific business scenario of the software process is pre-configured in the executable file of the software, that is, the migration configuration information, the CRIU tool needs to obtain the migration configuration information from the executable file, so as to automatically implement process hot migration subsequently.
[0050] Where in the executable file the migration configuration information is configured can be previously agreed by the migration implementer and the software development party. The software development party writes the migration configuration information in the predetermined position of the executable file, and the migration implementer controls the CRIU tool to obtain the migration configuration information from the predetermined position of the executable file.
[0051] Currently, the migration implementer and the software development party can also not make prior agreement. The software development party can write the migration configuration information in any position of the executable file according to actual conditions. The migration implementer controls the CRIU tool to find information having a migration configuration information identifier from the executable file, so as to take the found information as the migration configuration information.
[0052] S23: The CRIU tool controls the Agent program to freeze the process in the source hardware device according to the migration configuration information, and controls the Agent program to transmit the state data of the frozen process to the target hardware device.
[0053] After the CRIU tool obtains the migration configuration information, it can formally start the process hot migration. On the one hand, the executable file is used to install the software corresponding to the software process to be migrated on the target hardware device. On the other hand, according to the specific process identifier indicated in the migration configuration information, the Agent program is controlled to freeze the corresponding process in the source hardware device, and the state data of the frozen process is sent to the target hardware device.
[0054] Since the process is running, the relevant data of the process will be stored in the memory of the device, so the Agent program can send all the data in the memory of the source hardware device to the target hardware device. In order to improve the data transmission efficiency, the Agent program can also delete the data in the memory that is irrelevant to the process migration this time, and then send the deleted data to the target hardware device. In this way, the amount of data transmitted to the target hardware device can be reduced. The smaller the amount of data transmitted, the faster the data transmission, thereby improving the efficiency of the hot migration of the software process.
[0055] S24: The CRIU tool controls the new process in the target hardware device to start running from the frozen point of the source hardware device based on the state data and the migration configuration information, so as to realize the hot migration of the process of the software to be migrated from the source hardware device to the target hardware device.
[0056] The migration configuration information contains the command line corresponding to the specific business scenario of the software process to be migrated. The state data contains the current specific state of the software process to be migrated. Based on the state data and the migration configuration information, the CRIU tool can start the continued running of the software process in the target hardware device, and start running from the frozen point of the software process in the source hardware device, thereby realizing the hot migration of the software process.
[0057] From the above, the software process live migration method provided by the embodiments of the present application pre-configures the migration configuration information related to the business scenario of the software process for the CRIU tool in the executable file of the software. In this way, when the software process in the source hardware device needs to be live migrated to the target hardware device, the CRIU tool in the target hardware device can control the Agent program in the source hardware device to obtain the executable file of the software to be migrated from the source hardware device, so as to obtain the migration configuration information in the executable file. Then, the target hardware device performs normal live migration on the corresponding software process in the source hardware device based on the obtained migration configuration information. The live migration process does not need the migration implementer to configure the command line related to the business scenario of the process in the CRIU tool, and further does not need the migration implementer to communicate with the software developer. The CRIU tool can directly obtain the migration configuration information from the executable file of the software, thereby improving the efficiency of obtaining the migration configuration information, and further improving the efficiency of live migration of the software process.
[0058] Further, as a refinement and extension of the method shown in Figure 3 The embodiments of the present application also provide a software process live migration method.
[0059] Figure 2 The flowchart of the software process live migration method in the embodiments of the present application is shown in Figure 3 , referring to Figure 4 The method can include:
[0060] S31: The software developer configures the migration configuration information in the executable file of the software.
[0061] In order to avoid the time-consuming caused by the migration implementer configuring the command line in the CRIU tool based on the specific business scenario of the software process to be migrated, and the need to communicate with the software developer, the software developer can pre-write the migration configuration information in the executable file of the software.
[0062] When the software developer writes the migration configuration information, the software developer can write the migration configuration information in any format at any position in the executable file according to the actual situation.
[0063] The migration configuration information here can refer to the information related to the specific business scenario of the software process, which can be applied to the command line options of the CRIU tool, such as process number, process state, etc. The migration configuration information can be directly written in the executable file of the software when the software development is completed, or the software developer can write the adjusted migration configuration information in the executable file of the software based on the actual running situation of the software after the software is installed on the hardware device and runs for a period of time.
[0064] The executable file is stored in a disk of the hardware device, and the hardware device runs the executable file in the disk to make the corresponding software run in the hardware device. However, the migration configuration information in the executable file is not a necessary condition for the software to run in the hardware device. In order to avoid the migration configuration information affecting the normal function of the software in the running of the executable file, the migration configuration information can be stored in the session definition segment in the executable file.
[0065] In the executable file, a session definition segment is configured, and the migration configuration information is stored in the session definition segment. Then, the name of the session definition segment is informed to the compiler, and the information under the name is configured in the compiler to be not executable. That is, the session definition segment is configured in the compiler to be not executed and loaded by the source hardware device. Here, the compiler is the compiler used to implement the execution and loading of the executable file in the source hardware device. In this way, the information in the executable file except the migration configuration information can be loaded by the compiler, and the corresponding software can run in the hardware device.
[0066] In some cases, the compiler may sometimes appear abnormal, or the session definition segment stored by the compiler is modified, causing the compiler to load and execute all the information in the executable file. In order to avoid this situation, ensure that the migration configuration information in the executable file is not loaded, and ensure that the software runs normally in the source hardware device, the attribute of the migration configuration information in the session definition segment can be further set to read-only.
[0067] In this way, the migration configuration information saved in the session definition segment in the executable file will no longer be loaded and executed by the compiler, thereby ensuring the normal operation of the software.
[0068] At this time, the executable file is located in the source hardware device. The executable file is executed, and the corresponding software runs in the source hardware device, that is, the software process runs.
[0069] When it is necessary to hot migrate the software process in the source hardware device to the target hardware device, it is necessary to install the CRIU tool in the target hardware device in advance, and install the Agent program of the CRIU tool in the source hardware device.
[0070] When the CRIU tool in the target hardware device is started by the migration implementer, the CRIU tool sends a migration instruction to the Agent program in the source hardware device after being started or at the instruction of the migration implementer.
[0071] S32: The CRIU tool sends a migration instruction to the Agent program.
[0072] In the migration instruction, the name of the software to be migrated or other indication information capable of enabling the agent program to obtain the executable file of the software corresponding to the software process to be migrated from the source hardware device can be included.
[0073] S33: The agent program obtains the executable file from the source hardware device according to the migration instruction, and sends the executable file to the target hardware device.
[0074] The agent program finds the file with the same name in the disk of the source hardware device according to the software name in the migration instruction, and obtains the executable file in the found file. The obtained executable file is the executable file required by the CRIU tool, that is, the executable file of the software corresponding to the software process to be migrated.
[0075] After the target hardware device obtains the executable file, the CRIU tool can extract the migration configuration information corresponding to the software process from the executable file.
[0076] The software development party generally customizes a section in the executable file, stores the migration configuration information in the customized section, sets a custom name in the header of the customized section, and then notifies the CRIU tool of the custom name, so that the CRIU tool can accurately obtain the migration configuration information from the executable file.
[0077] S34: The CRIU tool matches the stored custom name with the name in the header of each section of the executable file.
[0078] In the executable file, a plurality of sections are included. If the content of the migration configuration information is searched in each section, the searching speed is slow, which affects the migration speed of the software process. At this time, the custom name set by the software development party can be matched with the name of each section in the executable file. The section corresponding to the matched name is the custom name configured by the software development party when storing the migration configuration information in the custom section.
[0079] S35: The CRIU tool determines the section corresponding to the matched name as the custom section, obtains all data from the custom section, and determines the all data as the migration configuration information.
[0080] Generally, the information unrelated to the software running is written in the executable file by creating a section with a corresponding size and customizing the name of the section. Therefore, the data in the custom section found according to the custom name stored in the CRIU tool is the migration configuration information.
[0081] In order to match the custom section based on the custom name in the executable file as soon as possible, the first section of a plurality of sections of the executable file can be set as the custom section.
[0082] Figure 4 For the schematic diagram of each section in the executable file in the embodiments of the present application, refer to FIG. 1. Figure 5 As shown in FIG. 1, in the executable file, first, there is the header of the executable file, i.e., the ELF header. Then, there is the program header table. Next, there are the section headers. Among them, section 1 can be a custom section, which is used to store the migration configuration information, i.e.,.criu.config. Next, there is section n, and so on. Finally, there is the section header table.
[0083] In this way, the CRIU tool can match successfully when the custom name stored in the CRIU tool matches the name of the first section. Once matching is successful, the number of times of matching before obtaining the migration configuration information is reduced, and thus the migration efficiency is improved.
[0084] Specifically, the above step S35 can include:
[0085] Step A1: The CRIU tool matches the custom name stored in the CRIU tool with the name of the first section header in the executable file.
[0086] Before the sections in the executable file appear, there will be some preset information, for example, the ELF header, the program header table, and the like. The CRIU tool can skip these preset information, and then start to match the section names.
[0087] Step A2: The CRIU tool determines whether the matching result represents that the matching is successful. If yes, step A3 is performed, and if no, step A4 is performed.
[0088] If the custom name stored in the CRIU tool is consistent with the name of the first section, it is determined that the matching is successful.
[0089] If the custom name stored in the CRIU tool is not consistent with the name of the first section, or there is some difference in format, it is determined that the matching is not successful, i.e., the matching fails.
[0090] Step A3: The CRIU tool determines that the matching is successful, and ends the matching.
[0091] If the custom name stored in the CRIU tool is consistent with the name of the first section, it is determined that the information stored in the first section is the migration configuration information written by the software development party previously. At this time, the matching can be ended, and the information in the section can be taken as the migration configuration information.
[0092] Step A4: The CRIU tool determines that the matching fails, and outputs the confirmation prompt information of the custom name.
[0093] If the custom name stored in the CRIU tool is consistent with the name of the first section, it indicates that the custom name stored in the CRIU tool may be stored incorrectly or modified. At this time, a confirmation prompt information can be output to prompt the migration implementer to confirm whether the current custom name stored in the CRIU tool is correct, and after the custom name is modified correctly, the matching and subsequent migration steps are performed again to ensure that the migration of the software process always proceeds normally.
[0094] After obtaining the migration configuration information from the custom section of the executable file, since the specific expression of the migration configuration information when written into the executable file is a command format selected by the developer from a plurality of preset command formats according to the actual situation, the developer needs to inform the migration implementer of the command format used by the migration configuration information after writing the migration configuration information into the executable file, so that the migration implementer stores the identifier corresponding to the command format used by the migration configuration information in the CRIU tool, and then facilitates the CRIU tool to correctly analyze the migration configuration information, thereby ensuring the correct migration.
[0095] S36: The CRIU tool determines the command format of the migration configuration information based on the currently stored identifier, and analyzes the migration configuration information based on the determined command format.
[0096] In the CRIU tool, the identifier corresponding to the command format used by the migration configuration information is stored. The CRIU tool can obtain the command format used by the migration configuration information through the identifier.
[0097] The CRIU tool can directly determine the command format used by the migration configuration information through the data characteristics of the identifier. For example, if the identifier is “string command”, it can be determined that the command format used by the migration configuration information is the string command. The CRIU tool can also look up in the correspondence between the identifier and the command format to obtain the command format used by the migration configuration information. For example, the correspondence includes: 1-string command. The identifier stored in the CRIU tool is 1, so through the correspondence, it can be determined that the command format used by the migration configuration information is the string command.
[0098] In practical applications, the command format of the migration configuration information can be a string command. For example:
[0099] Hex dump of section‘.criu.config’:
[0100] 0x0002190 2d2d7469 6d656f75 74203630 002d2d67–timeout 60.—g
[0101] 0x000021a0 686f7374 2d666965 6d617000 host-fiemap.
[0102] Alternatively, the migration configuration information can be data in multiple bits. The CRIU tool stores a plurality of string commands corresponding to a plurality of business scenarios. Different meanings of the data in the multiple bits correspond to different combinations of string commands. For example:
[0103] The migration configuration information is 0001 and 0010. In the CRIU tool, string command 1, string command 2 and string command 3 are stored. 0001-string command 1, 0010-string command 2, 0011-string command 3. It can be seen that the CRIU tool can determine that the commands used in subsequent implementation of migration are string command 1 and string command 2 through the migration configuration information 0001.
[0104] Specifically, the above step S36 can include:
[0105] Step B1: obtaining data in multiple bits based on the determined command format.
[0106] The CRIU tool stores an identification of the command format used by the migration configuration information, through which the command format used by the migration configuration information can be determined. For example: the CRIU tool stores an identification a, the identification a corresponds to the command of the bit with special meaning, and then determines that the migration configuration information uses the representation of the bit with special meaning, and then obtains the data in the corresponding bit.
[0107] Step B2: finding the target string command corresponding to the meaning indicated by the data in the multiple bits from the plurality of string commands stored in the CRIU tool, and parsing the string command.
[0108] In the CRIU tool, the software development party pre-stores string commands and their corresponding bit data configured based on various specific business scenarios of the software process. The CRIU tool determines that the migration configuration information uses the representation of the bit with special meaning according to the identification of the command format it stores, and then the bit representation of the migration configuration information can be matched with the bit representation of each string command stored therein, and the string command corresponding to the bit representation matched successfully is determined as the string command to be used in this migration.
[0109] After the migration configuration information is parsed, the process migration can be formally started, that is, the software process in the source hardware device is frozen, and the software process is restored from the frozen point in the target hardware device.
[0110] S37: The CRIU tool sends a freeze instruction to the Agent program based on the parsed migration configuration information.
[0111] In the freeze instruction, only relevant information indicating process freezing can be included. In the case where the source hardware device currently runs multiple software or multiple processes of a certain software, the freeze instruction can also contain the software name or process identifier, so that the Agent program freezes the corresponding software or process.
[0112] S38: The Agent program freezes the processes in the source hardware device according to the freeze instruction, and controls the Agent program to transmit the state data of the processes at the freezing time to the target hardware device.
[0113] After receiving the freeze instruction, the Agent program freezes the relevant processes indicated by the freeze instruction on the one hand. The freezing method is a conventional process freezing method, which will not be described here. On the other hand, the Agent program sends the state data corresponding to the frozen processes to the target hardware device.
[0114] When the Agent program sends the state data corresponding to the frozen processes to the target hardware device, it can directly send the memory data in the source hardware device to the target hardware device, so that the CRIU tool in the target hardware device selects the state parameters of the corresponding software processes from the memory data and performs process recovery. If all the processes currently running in the source hardware device are hot migrated, then the CRIU tool performs recovery of all the processes previously running in the source hardware device in the target hardware device based on the process state parameters in the entire memory data.
[0115] The state data is used to represent the state of the software process previously running in the source hardware device. The migration configuration information is used to indicate the specific migration configuration of the software process. After the CRIU tool obtains the state data and the migration configuration information, it can restore the software process in the target hardware device according to the configuration.
[0116] S39: The CRIU tool controls the new process in the target hardware device to start running from the freezing point of the source hardware device based on the state data and the migration configuration information, so as to realize the hot migration of the process of the software to be migrated from the source hardware device to the target hardware device.
[0117] The step S39 here has the same specific implementation manner as the step S24 in the foregoing embodiment, and reference can be made to the related description in the foregoing embodiment, which will not be described here.
[0118] So far, the software process hot migration method provided by the embodiments of the present application has been fully described.
[0119] Based on the same inventive concept, as an implementation of the above method, the embodiment of the present application also provides a software process live migration system.
[0120] Figure 5 For a structural schematic diagram of the software process live migration system in the embodiment of the present application, referring to Figure 5 , the system can include: a source hardware device 11, a target hardware device 12, a CRIU tool 13 and an Agent program 14.
[0121] The CRIU tool 13 is installed in the target hardware device 12.
[0122] The Agent program 14 is installed in the source hardware device 11.
[0123] The source hardware device 11 includes processes and executable files of the software to be migrated. The executable files include migration configuration information related to the business scenario of the processes in the command line options of the CRIU tool 13. The migration configuration information is provided by the developer of the software to be migrated.
[0124] In the system:
[0125] The CRIU tool 13 is configured to control the Agent program 14 to send the executable files in the source hardware device 11 to the target hardware device 12.
[0126] The CRIU tool 13 is further configured to obtain the migration configuration information from the executable files.
[0127] The CRIU tool 13 is further configured to control the Agent program 14 to freeze the processes in the source hardware device 11 according to the migration configuration information, and control the Agent program 14 to transmit the state data of the processes at the freezing time to the target hardware device 12.
[0128] The CRIU tool 13 is further configured to control a new process in the target hardware device 12 to start running from the freezing point of the source hardware device 11 based on the state data and the migration configuration information, so as to realize the live migration of the processes of the software to be migrated from the source hardware device 11 to the target hardware device 12.
[0129] Further, as a refinement and extension of the system shown in Figure 5 , the embodiment of the present application also provides a software process live migration system.
[0130] Still referring to , the migration configuration information is stored in a session definition segment in the executable files, and the session definition segment is configured in the compiler as the content therein is not executed and loaded by the source hardware device 11, and the compiler is configured to realize the execution and loading of the executable files in the source hardware device 11.
[0131] The attribute of the migration configuration information in the session definition section is read-only.
[0132] In a case where the migration configuration information is stored in a custom section of the executable file, a header of the custom section is provided with a custom name, and the CRIU tool 13 stores the custom name, the CRIU tool 13 is specifically configured to match the stored custom name with a name in a header of each section of the executable file, determine a section corresponding to a name that is matched successfully as the custom section, acquire all data from the custom section, and determine the all data as the migration configuration information.
[0133] In a case where the custom section is a first section of a plurality of sections of the executable file, the CRIU tool 13 is specifically configured to match the stored custom name with a name in a header of the first section of the executable file, determine whether the matching result indicates that the matching is successful, and if so, determine that the matching is successful, and end the matching.
[0134] In a case where the migration configuration information is in a command format of a plurality of preset command formats, and the CRIU tool 13 stores an identifier corresponding to the command format of the migration configuration information, the CRIU tool 13 is specifically configured to determine the command format of the migration configuration information based on the currently stored identifier, parse the migration configuration information based on the determined command format, and control the Agent program 14 to freeze the process in the source hardware device 11 based on the parsed migration configuration information.
[0135] In a case where the command format of the migration configuration information is a string command, or the migration configuration information is data in a plurality of bits, and the CRIU tool 13 stores a plurality of string commands corresponding to a plurality of service scenarios, and different meanings of data in the plurality of bits correspond to different combinations of string commands, the CRIU tool 13 is specifically configured to acquire the data in the plurality of bits based on the determined command format, find a target string command corresponding to a meaning indicated by the data in the plurality of bits from the plurality of string commands stored in the CRIU tool 13, and parse the string command.
[0136] It should be noted that the description of the above system embodiments is similar to the description of the above method embodiments, and has similar beneficial effects to the method embodiments. For technical details not disclosed in the system embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0137] Based on the same inventive concept, the embodiments of the present application also provide a computer-readable storage medium, which stores a program, and when the program runs, controls the source hardware device and the target hardware device to execute the method in one or more of the above embodiments.
[0138] It should be noted that the above computer-readable storage medium embodiments are similar to the description of the above method embodiments, and have similar beneficial effects as the method embodiments. For technical details not disclosed in the computer-readable storage medium embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0139] Based on the same inventive concept, the embodiments of the present application also provide a computer program product, which includes computer programs or instructions, and when the computer programs or instructions are executed by a source hardware device and a target hardware device, the method in one or more of the above embodiments is implemented.
[0140] It should be noted that the above computer program product embodiments are similar to the description of the above method embodiments, and have similar beneficial effects as the method embodiments. For technical details not disclosed in the computer program product embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0141] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A software process live migration method, characterized by, The method is applied to a software process live migration system, the system comprising a source hardware device, a target hardware device, a user space checkpoint and recovery (CRIU) tool and an agent program, the CRIU tool being installed in the target hardware device, the agent program being installed in the source hardware device, the source hardware device comprising a process and an executable file of software to be migrated, the executable file comprising migration configuration information related to a service scenario of the process in command line options of the CRIU tool, the migration configuration information being provided by a developer of the software to be migrated, the method comprising: The CRIU tool controls the agent program to send the executable file in the source hardware device to the target hardware device; The CRIU tool obtains the migration configuration information from the executable file; The CRIU tool controls the agent program to freeze the process in the source hardware device according to the migration configuration information, and controls the agent program to transmit state data of the process at the freezing time to the target hardware device; The CRIU tool controls a new process in the target hardware device to start running from a freezing point of the source hardware device based on the state data and the migration configuration information, so as to realize live migration of the process of the software to be migrated from the source hardware device to the target hardware device; The migration configuration information is stored in a custom section of the executable file, a header of the custom section is provided with a custom name, and the CRIU tool stores the custom name; the CRIU tool obtains the migration configuration information from the executable file, comprising: The CRIU tool matches the stored custom name with a name of a header of each section of the executable file; The CRIU tool determines a section corresponding to a successfully matched name as the custom section, obtains all data in the custom section, and determines the all data as the migration configuration information.
2. The method of claim 1, wherein, The custom section is a first section of a plurality of sections of the executable file; the CRIU tool matches the stored custom name with a name of a header of each section of the executable file, comprising: The CRIU tool matches the stored custom name with a name of a header of a first section of the executable file; The CRIU tool judges whether the matching result represents a successful match; If yes, the CRIU tool determines that the matching is successful, and ends the matching.
3. The method of claim 1, wherein, The migration configuration information is stored in a session definition segment of the executable file, the session definition segment being configured in a compiler to be content thereof not executed and loaded by the source hardware device, the compiler being used to realize execution and loading of the executable file in the source hardware device.
4. The method of claim 3, wherein, An attribute of the migration configuration information in the session definition segment is read-only.
5. The method according to any one of claims 1 to 4, characterized in that, The migration configuration information is in a command format of a plurality of preset command formats, and the CRIU tool stores an identifier corresponding to the command format of the migration configuration information. The migration configuration information is stored in a session definition segment of the executable file, the session definition segment being configured in a compiler to be content thereof not executed and loaded by the source hardware device, the compiler being used to realize execution and loading of the executable file in the source hardware device. An attribute of the migration configuration information in the session definition segment is read-only. The migration configuration information is in a command format of a plurality of preset command formats, and the CRIU tool stores an identifier corresponding to the command format of the migration configuration information. The CRIU tool controls the Agent program to freeze the process in the source hardware device according to the migration configuration information, including: The CRIU tool determines the command format of the migration configuration information based on the currently stored identifier, parses the migration configuration information based on the determined command format, and controls the Agent program to freeze the process in the source hardware device based on the parsed migration configuration information.
6. The method of claim 5, wherein, The command format of the migration configuration information is a string command, or the migration configuration information is data in multiple bits, and the CRIU tool stores string commands corresponding to multiple business scenarios, and different meanings of data in multiple bits correspond to different combinations of string commands. The parsing of the migration configuration information based on the determined command format includes: Based on the determined command format, the data in the multiple bits is obtained. From the multiple string commands stored in the CRIU tool, the target string command corresponding to the meaning indicated by the data in the multiple bits is found, and the string command is parsed.
7. A software process live migration system, characterized by, The system includes a source hardware device, a target hardware device, a user space checkpoint and recovery CRIU tool, and an Agent program, the CRIU tool is installed in the target hardware device, the Agent program is installed in the source hardware device, the source hardware device includes a process of software to be migrated and an executable file, the executable file includes migration configuration information related to the business scenario of the process in the command line options of the CRIU tool, and the migration configuration information is provided by the developer of the software to be migrated, in the system, The CRIU tool is configured to control the Agent program to send the executable file in the source hardware device to the target hardware device. The CRIU tool is further configured to obtain the migration configuration information from the executable file. The CRIU tool is further configured to control the Agent program to freeze the process in the source hardware device according to the migration configuration information, and control the Agent program to transmit the state data of the process at the freezing point to the target hardware device. The CRIU tool is further configured to control a new process in the target hardware device to start running from the freezing point of the source hardware device based on the state data and the migration configuration information, so as to realize the hot migration of the process of the software to be migrated from the source hardware device to the target hardware device. In the case that the migration configuration information is stored in a custom section of the executable file, the header of the custom section is provided with a custom name, and the CRIU tool stores the custom name, the CRIU tool is specifically configured to match the stored custom name with the name of the header of each section of the executable file, determine the section corresponding to the matched name as the custom section, obtain all data from the custom section, and determine the all data as the migration configuration information.
8. A computer-readable storage medium, characterized in that, The storage medium includes a stored program that, when executed, controls the source hardware device and the target hardware device to perform the method of any of claims 1-6.
9. A computer program product, characterised in that, The computer program product includes a computer program or instructions that, when executed by the source hardware device and the target hardware device, implement the method of any of claims 1-8.
Citation Information
Patent Citations
CRIU-based Docker container heat migration method and system
CN107526626A
System for automated process substitution with connection-preserving capabilities
US20240406173A1