Efficient image pulling method, device, computer equipment and storage medium
By synchronizing and adjusting the image pulling method, the problem of long remote pulling time for large images is solved, efficient transmission and synchronization of image information is achieved, and the efficiency of image pulling is improved.
Patent Information
- Application Number
- CN202410461697.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-17
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2044-04-17
AI Technical Summary
Remotely pulling large images takes a long time, resulting in container startup delays and image pull failures. Existing methods for improving transmission efficiency are costly and ineffective.
By obtaining the image change information of different host machines, synchronizing the image information in the local storage, and when the target image information is not synchronized, identifying the corresponding second host machine, regularly collecting the transmission rate and untransmitted memory, calculating the remaining pulling time, and adjusting the pulling method to improve efficiency.
Improves image transmission efficiency, avoids direct local pull problems when image information is not synchronized, ensures the latest image information, and improves the overall efficiency of image pull.
Smart Images

Figure CN118295673B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of artificial intelligence and image pulling technology, and in particular to an efficient image pulling method, apparatus, computer equipment, and storage medium. Background Art
[0002] Remotely pulling large images requires a long transmission time, resulting in longer delays. If the image doesn't exist or hasn't been pulled completely, the container startup will report an error similar to "ImagePullBackOff," indicating image pull failure. While retrying the container through retry mechanisms like Kubernetes is possible, this operation still requires the image pull to complete. Otherwise, repeated restart attempts will occur, and the increased number of container restarts directly reduces the availability of the platform's application environment.
[0003] The fundamental solution to these problems is to improve image pull efficiency and reduce image pull time. A common approach to reducing image pull time is for image maintainers to increase network bandwidth and upgrade server hardware and software to improve image transmission efficiency. However, this approach is costly and, based on experiments, has shown that it only marginally improves image transmission efficiency, resulting in lower image transmission efficiency. Summary of the Invention
[0004] Based on this, it is necessary to provide an efficient image pulling method, apparatus, computer equipment, computer-readable storage medium and computer program product to address the above technical problems.
[0005] In a first aspect, the present application provides an efficient image pulling method. The method comprises:
[0006] Obtaining image change information of different host machines and target image requirement information of the first host machine, and synchronizing the image information of the local storage corresponding to each host machine based on the image change information of each host machine;
[0007] identifying target image information corresponding to the target image requirement information, and identifying a second host machine corresponding to the target image information when synchronization of the target image information is not completed in a local memory corresponding to the first host machine;
[0008] Pulling the target image information to the first host through the second host, and regularly collecting the current untransmitted memory of the target image information and the current remote transmission rate of the target image information;
[0009] After each acquisition, and when synchronization of the target image information in the local memory corresponding to the first host machine is completed, a remaining remote pull time of the target image information and a remaining local pull time of the target image information are calculated based on the currently untransmitted memory and the current remote transmission rate. Based on the remaining remote pull time and the remaining local pull time, a pull mode of the first host machine is adjusted until the transmission of the target image information is completed.
[0010] Optionally, synchronizing the mirror information of the local storage corresponding to each host machine based on the mirror change information of each host machine includes:
[0011] Querying the changed host machine with mirror changes, and sending the mirror change information of the changed host machine to the local storage of other host machines through the mirror synchronization program;
[0012] For each other host machine, in the local memory, the sub-memory corresponding to the changed host machine and the original mirror information corresponding to the mirror change information are identified, and in the sub-memory, based on the mirror change information, the original mirror information is updated to obtain updated mirror information.
[0013] Optionally, when the target image information is not synchronized in the local memory corresponding to the first host machine, identifying the second host machine corresponding to the target image information includes:
[0014] Querying the current status of the target image information in a local memory corresponding to the first host machine;
[0015] When the current state is synchronization completed, pulling the target image information from the local memory corresponding to the first host machine;
[0016] When the current state is in synchronization or the target mirror information does not exist in the local memory, a second host machine corresponding to the target mirror information is identified.
[0017] Optionally, when the target image information is not synchronized in the local memory corresponding to the first host machine, after identifying the second host machine corresponding to the target image information, the method further includes:
[0018] When the target mirror information does not exist in the local memory, the mirror information in the local memory corresponding to the first host is synchronized through a mirror synchronization program based on the target mirror information in the local memory corresponding to the second host.
[0019] Optionally, the calculating, based on the currently untransmitted memory and the current remote transmission rate, a remaining remote pull duration of the target image information and a remaining local pull duration of the target image information includes:
[0020] Calculating the remaining remote pull time of the target image information based on the currently untransmitted memory and the current remote transmission rate, and collecting a preset local image transmission rate;
[0021] Based on the preset local image transmission rate and the currently untransmitted memory, a remaining local pull time of the target image information is calculated.
[0022] Optionally, adjusting the pull mode of the first host machine based on the remaining remote pull time and the remaining local pull time until the target image information is completely transmitted includes:
[0023] When the remaining remote pull time is not greater than the remaining local pull time, maintaining the current pull mode and returning to the step of periodically collecting the currently untransmitted memory of the target image information and the current remote transmission rate of the target image information;
[0024] When the remaining remote pull time is greater than the remaining local pull time, querying, based on the currently untransmitted memory, target transmission content corresponding to the currently untransmitted memory in target image information in the local storage corresponding to the first host machine;
[0025] Pause the process of pulling the target image information from the second host to the first host, and pull the target transmission content to the first host through the local storage corresponding to the first host;
[0026] The step of periodically collecting the currently untransmitted memory of the target mirror information and the current remote transmission rate of the target mirror information is suspended.
[0027] In a second aspect, the present application also provides an efficient mirror image pulling device. The device comprises:
[0028] An acquisition module, configured to acquire image change information of different host machines and target image requirement information of the first host machine, and synchronize the image information of the local storage corresponding to each host machine based on the image change information of each host machine;
[0029] an identification module, configured to identify target image information corresponding to the target image requirement information, and, when synchronization of the target image information is not completed in a local memory corresponding to the first host machine, identify a second host machine corresponding to the target image information;
[0030] a pulling module, configured to pull the target image information to the first host machine through the second host machine, and periodically collect the current untransmitted memory of the target image information and the current remote transmission rate of the target image information;
[0031] An adjustment module is used to calculate the remaining remote pull time of the target image information and the remaining local pull time of the target image information based on the currently untransmitted memory and the current remote transmission rate after each acquisition and when the target image information in the local memory corresponding to the first host machine is synchronized, and adjust the pull mode of the first host machine based on the remaining remote pull time and the remaining local pull time until the transmission of the target image information is completed.
[0032] Optionally, the acquisition module is specifically configured to:
[0033] Querying the changed host machine with mirror changes, and sending the mirror change information of the changed host machine to the local storage of other host machines through the mirror synchronization program;
[0034] For each other host machine, in the local memory, the sub-memory corresponding to the changed host machine and the original mirror information corresponding to the mirror change information are identified, and in the sub-memory, based on the mirror change information, the original mirror information is updated to obtain updated mirror information.
[0035] Optionally, the identification module is specifically configured to:
[0036] Querying the current status of the target image information in a local memory corresponding to the first host machine;
[0037] When the current state is synchronization completed, pulling the target image information from the local memory corresponding to the first host machine;
[0038] When the current state is in synchronization or the target mirror information does not exist in the local memory, a second host machine corresponding to the target mirror information is identified.
[0039] Optionally, the device further includes:
[0040] The synchronization module is configured to synchronize the mirror information in the local memory corresponding to the first host machine through a mirror synchronization program based on the target mirror information in the local memory corresponding to the second host machine when the target mirror information does not exist in the local memory.
[0041] Optionally, the adjustment module is specifically configured to:
[0042] Calculating the remaining remote pull time of the target image information based on the currently untransmitted memory and the current remote transmission rate, and collecting a preset local image transmission rate;
[0043] Based on the preset local image transmission rate and the currently untransmitted memory, a remaining local pull time of the target image information is calculated.
[0044] Optionally, the adjustment module is specifically configured to:
[0045] When the remaining remote pull time is not greater than the remaining local pull time, maintaining the current pull mode and returning to the step of periodically collecting the currently untransmitted memory of the target image information and the current remote transmission rate of the target image information;
[0046] When the remaining remote pull time is greater than the remaining local pull time, querying, based on the currently untransmitted memory, target transmission content corresponding to the currently untransmitted memory in target image information in the local storage corresponding to the first host machine;
[0047] Pause the process of pulling the target image information from the second host to the first host, and pull the target transmission content to the first host through the local storage corresponding to the first host;
[0048] The step of periodically collecting the currently untransmitted memory of the target mirror information and the current remote transmission rate of the target mirror information is suspended.
[0049] In a third aspect, the present application provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.
[0050] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any one of the methods in the first aspect.
[0051] In a fifth aspect, the present application provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of any one of the methods in the first aspect are implemented.
[0052] The above-mentioned efficient image pulling method, apparatus, computer device and storage medium obtain image change information of different host machines and target image requirement information of the first host machine, and synchronize the image information of the local storage corresponding to each host machine based on the image change information of each host machine; identify the target image information corresponding to the target image requirement information, and when the target image information is not completely synchronized in the local storage corresponding to the first host machine, identify the second host machine corresponding to the target image information; pull the target image information to the first host machine through the second host machine, and regularly collect the current untransmitted memory of the target image information and the current remote transmission rate of the target image information; after each collection, and when the target image information in the local storage corresponding to the first host machine is completely synchronized, calculate the remaining remote pull time of the target image information and the remaining local pull time of the target image information based on the current untransmitted memory and the current remote transmission rate, and adjust the pull mode of the first host machine based on the remaining remote pull time and the remaining local pull time until the target image information is completely transmitted. This solution establishes a local storage for storing the mirror information of other host machines in each host machine through synchronization, and then ensures that the mirror information of each host machine is the latest mirror information by synchronizing the mirror change information of each host machine in real time, so that the target mirror information can be directly pulled from the local storage corresponding to the first host machine with the mirror demand information, thereby improving the transmission efficiency of the mirror. When the target mirror information has not yet completed the mirror synchronization, the remaining pulling time is calculated to adjust the mirroring method of remote first and then local, avoiding the problem that the real-time synchronized mirror information cannot be directly pulled from the local, so that regardless of whether the synchronization of the mirror information is completed, the pulling efficiency of the mirror information can be improved, thereby comprehensively improving the transmission efficiency of the mirror. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 1 is a flow chart of an efficient image pulling method according to an embodiment;
[0054] Figure 2 This is a schematic diagram of the structure of an example of efficient image pull interaction in one embodiment;
[0055] Figure 3 A schematic diagram of a process for efficiently pulling an image in one embodiment;
[0056] Figure 4 This is a structural block diagram of an efficient image pulling device in one embodiment;
[0057] Figure 5 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0059] The efficient image pulling method provided by the embodiment of the present application can be applied to an application environment in which a host machine remotely pulls a large image. The method can be applied to a terminal, a server, or a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. The terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, etc. The terminal establishes a local storage device that stores the image information of other host machines in each host machine through synchronization, and then ensures that the image information of each host machine is the latest image information by synchronizing the image change information of each host machine in real time, so that the target image information can be directly pulled directly from the local storage device corresponding to the first host machine that receives the image demand information, thereby improving the transmission efficiency of the image, and when the target image information has not yet completed the image synchronization, by calculating the remaining pulling time, adjusting the mirroring method of remote first and local later, avoiding the problem that the real-time synchronized image information cannot be directly pulled from the local, so that regardless of whether the synchronization of the image information is completed, the pulling efficiency of the image information can be improved, thereby comprehensively improving the transmission efficiency of the image.
[0060] In one embodiment, Figure 1 As shown in the figure, an efficient image pulling method is provided, which is described by taking the application of the method to a terminal as an example, and includes the following steps:
[0061] Step S101 : acquiring image change information of different host machines and target image requirement information of a first host machine, and synchronizing image information of local storages corresponding to each host machine based on the image change information of each host machine.
[0062] In this embodiment, when the mirror information of each host machine changes, the terminal obtains the mirror change information of each host machine, and then the terminal obtains the target mirror demand information of the first host machine that needs to perform the mirror pull demand. The target mirror demand information is used to characterize the target mirror information that the first host machine needs to pull. Before obtaining the mirror change information, the staff pre-adds multiple mirror storage server nodes (i.e., sub-memory) to each host machine for storing the mirror files of all hosts involved in the remote mirror pull. For example, there are hosts in A, B, and C. If the application is deployed in A, then two storage server nodes are added in A to store the mirror files of remote B and C; if the application is deployed in B, then two storage server nodes are added in B to store the mirror files of remote A and C; if the application is deployed in C, then two storage server nodes are added in C to store the mirror files of remote A and B. Then, based on the mirror change information of each host machine, the terminal synchronizes the mirror information of the local storage corresponding to each host machine. Specifically, the terminal subscribes to, notifies, and synchronizes image changes through Zookeeper and Kafka. For example, when the host machine in location B has an image change, it is synchronized to the image storage server nodes in locations A and C in near real time through Zookeeper and Kafka; when the host machine in location C has an image change, it is synchronized to the image storage server nodes in locations A and B in near real time through Zookeeper and Kafka. The specific synchronization process will be described in detail later. Figure 2 As shown, before pulling the image, this solution remotely pre-synchronizes the image information among locations A, B, and CD, thereby synchronizing the image information of the local storage corresponding to each host machine. When the first host machine is the host machine at location A, this solution pulls the target image information to the platform application of the host machine at location A through the main control module (i.e., terminal) in the host machine at location A.
[0063] Step S102 : identifying target image information corresponding to the target image requirement information, and identifying a second host machine corresponding to the target image information when synchronization of the target image information is not completed in the local memory corresponding to the first host machine.
[0064] In this embodiment, the terminal identifies the target image information corresponding to the target image requirement information and, if the target image information has not yet been synchronized with the local storage corresponding to the first host, identifies the second host corresponding to the target image information. The second host is the host to which the target image information belongs. The specific identification process will be described in detail later. There are two situations in which the target image information may not be synchronized: one is that the target image information is in the process of being synchronized with the first host and has not yet completed synchronization; the other is that the target image information has not yet been synchronized with the first host.
[0065] Step S103: Pull the target mirror information to the first host through the second host, and periodically collect the current untransmitted memory of the target mirror information and the current remote transmission rate of the target mirror information.
[0066] In this embodiment, the terminal pulls the target image information to the first host through the second host, and regularly collects the current untransmitted memory of the target image information and the current remote transmission rate of the target image information. The timing period is the interval length preset by the staff.
[0067] Step S104, after each acquisition and when the target image information in the local memory corresponding to the first host machine is synchronized, the remaining remote pull time of the target image information and the remaining local pull time of the target image information are calculated based on the currently untransmitted memory and the current remote transmission rate, and the pull method of the first host machine is adjusted based on the remaining remote pull time and the remaining local pull time until the target image information is transmitted.
[0068] In this embodiment, after each acquisition, and when the target image information is synchronized in the local memory corresponding to the first host, the terminal calculates the remaining remote pull time and the remaining local pull time of the target image information based on the currently untransmitted memory and the current remote transmission rate. Based on the remaining remote pull time and the remaining local pull time, the terminal adjusts the pull mode of the first host until the target image information is transmitted. The specific adjustment process will be described in detail later.
[0069] Based on the above scheme, by synchronously establishing a local storage for storing the mirror information of other host machines in each host machine, and then synchronizing the mirror change information of each host machine in real time to ensure that the mirror information of each host machine is the latest mirror information, the target mirror information can be directly pulled from the local storage corresponding to the first host machine that requires the mirror information, thereby improving the transmission efficiency of the mirror. When the target mirror information has not yet completed the mirror synchronization, the remaining pulling time is calculated to adjust the mirroring method of remote first and then local, avoiding the problem that the real-time synchronized mirror information cannot be directly pulled from the local, so that regardless of whether the synchronization of the mirror information is completed, the pulling efficiency of the mirror information can be improved, thereby comprehensively improving the transmission efficiency of the mirror.
[0070] Optionally, based on the mirror change information of each host machine, the mirror information of the local storage corresponding to each host machine is synchronized, including: querying the changed host machine where the mirror change occurs, and sending the mirror change information of the changed host machine to the local storage of other host machines through the mirror synchronization program; for each other host machine, identifying the sub-storage corresponding to the changed host machine and the original mirror information corresponding to the mirror change information in the local storage, and updating the original mirror information in the sub-storage based on the mirror change information to obtain the updated mirror information.
[0071] In this embodiment, the terminal searches for the host machine with the mirror change and sends the mirror change information of the host machine to the local storage of other hosts through the mirror synchronization program. The mirror synchronization program is a program corresponding to Zookeeper and Kafka.
[0072] For each other host, in the local storage, the terminal identifies the sub-storage corresponding to the changed host and the original image information corresponding to the image change information, and updates the original image information in the sub-storage based on the image change information to obtain updated image information.
[0073] Based on the above solution, by timely updating the mirror information in the local storage corresponding to each host machine, each host machine can directly retrieve the mirror information locally when retrieving the mirror information, thereby improving the mirror transmission efficiency.
[0074] Optionally, when the target mirror information is not synchronized in the local memory corresponding to the first host machine, the second host machine corresponding to the target mirror information is identified, including: querying the current status of the target mirror information in the local memory corresponding to the first host machine; when the current status is synchronization completed, pulling the target mirror information from the local memory corresponding to the first host machine; when the current status is synchronization in progress or the target mirror information does not exist in the local memory, identifying the second host machine corresponding to the target mirror information.
[0075] In this embodiment, the terminal queries the local storage corresponding to the first host for the current status of the target image information. The terminal then determines whether the current status is synchronization complete. If so, the terminal directly retrieves the target image information from the local storage corresponding to the first host. If the current status is synchronization in progress or the target image information does not exist in the local storage, the terminal identifies the second host corresponding to the target image information. The current status includes synchronization complete, synchronization in progress, and the target image information does not exist.
[0076] Based on the above solution, by identifying the status of the target image information in the local memory corresponding to the first host, the method for pulling the target image information is determined, thereby improving the efficiency of pulling target image information in different states.
[0077] Optionally, when the target mirror information is not synchronized in the local memory corresponding to the first host machine, after identifying the second host machine corresponding to the target mirror information, it also includes: when the target mirror information does not exist in the local memory, based on the target mirror information in the local memory corresponding to the second host machine, synchronizing the mirror information in the local memory corresponding to the first host machine through a mirror synchronization program.
[0078] In this embodiment, when the terminal does not have the target image information in the local memory, the terminal synchronizes the image information in the local memory corresponding to the first host through the image synchronization program based on the target image information in the local memory corresponding to the second host.
[0079] Based on the above solution, when the target image information does not exist, the target image information is synchronized in time, which not only avoids the need for remote pulling the next time, but also enables the current pull to adjust the pulling method in time when the target image information is not pulled, thereby improving the image pulling efficiency.
[0080] Optionally, based on the currently untransmitted memory and the current remote transmission rate, the remaining remote pull time of the target mirror information and the remaining local pull time of the target mirror information are calculated, including: based on the currently untransmitted memory and the current remote transmission rate, calculating the remaining remote pull time of the target mirror information, and collecting the preset local mirror transmission rate; based on the preset local mirror transmission rate and the currently untransmitted memory, calculating the remaining local pull time of the target mirror information.
[0081] In this embodiment, the terminal calculates the remaining remote pull time for the target image information based on the currently untransmitted memory and the current remote transmission rate, and collects the preset local image transmission rate. The terminal then calculates the remaining local pull time for the target image information based on the preset local image transmission rate and the currently untransmitted memory.
[0082] Specifically, the terminal first pulls from the local image storage server node. If it cannot be pulled from the local image storage server node, it will be pulled remotely. When pulling remotely, the main control module (i.e., the terminal) determines whether the local image storage server node has the image that has been synchronized. If the local synchronization has not been completed, the remote image will be pulled immediately, and the optimal transmission time will be continuously calculated, that is: T = min [remote image transmission remaining time T1, local image transmission time T2]. For example, when the platform application at site A triggers the image pull of image C, the main control module first pulls the local image C from the storage server node at site A, but finds that the remote pre-synchronization of image C from site C to site A is not complete and cannot be pulled. At this time, the main control module immediately pulls the remote image C from site C and starts to continuously calculate the optimal transmission time.
[0083] Based on the above solution, by calculating the remaining remote pull time and the remaining local pull time, the accuracy of determining whether to change the pull method is improved.
[0084] Optionally, based on the remaining remote pull time and the remaining local pull time, the pull mode of the first host machine is adjusted until the target image information is transmitted, including: when the remaining remote pull time is not greater than the remaining local pull time, maintaining the current pull mode and returning to the step of periodically collecting the current non-transmitted memory of the target image information and the current remote transmission rate of the target image information; when the remaining remote pull time is greater than the remaining local pull time, based on the current non-transmitted memory, querying the target transmission content corresponding to the current non-transmitted memory in the target image information in the local memory corresponding to the first host machine; pausing the pulling process of pulling the target image information from the second host machine to the first host machine, and pulling the target transmission content to the first host machine through the local memory corresponding to the first host machine; pausing the step of periodically collecting the current non-transmitted memory of the target image information and the current remote transmission rate of the target image information.
[0085] In this embodiment, when the remaining remote pull time is not greater than the remaining local pull time, the terminal maintains the current pull mode and returns to the step of regularly collecting the current non-transmitted memory of the target mirror information and the current remote transmission rate of the target mirror information. Then, when the remaining remote pull time is greater than the remaining local pull time, the terminal queries the target transmission content corresponding to the current non-transmitted memory in the target mirror information in the local memory corresponding to the first host machine based on the current non-transmitted memory. Thereafter, the terminal pauses the pulling process of pulling the target mirror information from the second host machine to the first host machine, and pulls the target transmission content to the first host machine through the local memory corresponding to the first host machine. Finally, the terminal pauses the step of regularly collecting the current non-transmitted memory of the target mirror information and the current remote transmission rate of the target mirror information.
[0086] Specifically, if the remaining time for remote image transfer is less than or equal to the local image transfer time, the remote image transfer continues without checking the local and remote times until the image transfer is complete. If the remaining time for remote image transfer is greater than the local image transfer time, the remote transfer is abandoned and the image is pulled from the local image storage server node without checking the local and remote times until the image transfer is complete. This concludes the current image pull cycle and begins the next one.
[0087] Based on the above solution, the efficiency of image pulling is improved by time-consumingly determining the transformation node of the pulling method.
[0088] This application also provides an example of efficient image pulling, such as Figure 3 As shown, the specific processing process includes the following steps:
[0089] Step S301 : obtaining image change information of different host machines and target image requirement information of a first host machine.
[0090] Step S302 , searching for a changed host machine with mirror changes, and sending the mirror change information of the changed host machine to the local storage of other host machines through a mirror synchronization program.
[0091] Step S303 : For each other host machine, the sub-storage corresponding to the changed host machine and the original image information corresponding to the image change information are identified in the local storage, and the original image information is updated in the sub-storage based on the image change information to obtain updated image information.
[0092] Step S304: identifying target image information corresponding to the target image requirement information.
[0093] Step S305 : query the current status of the target image information in the local memory corresponding to the first host machine.
[0094] Step S306: When the current state is synchronization completion, the target image information is pulled from the local storage corresponding to the first host machine.
[0095] Step S307 : When the current state is synchronization or the target image information does not exist in the local memory, a second host machine corresponding to the target image information is identified.
[0096] Step S308 : When the target image information does not exist in the local memory, the image information in the local memory corresponding to the first host is synchronized through the image synchronization program based on the target image information in the local memory corresponding to the second host.
[0097] Step S309 : Based on the currently untransmitted memory and the current remote transmission rate, the remaining remote pull time of the target mirror information is calculated, and the preset local mirror transmission rate is collected.
[0098] Step S310 : Calculate the remaining local pull time of the target image information based on the preset local image transmission rate and the currently untransmitted memory.
[0099] Step S311 : when the remaining remote pull time is not greater than the remaining local pull time, the current pull mode is maintained and the process returns to the step of periodically collecting the currently untransmitted memory of the target image information and the current remote transmission rate of the target image information.
[0100] Step S312: When the remaining remote pull time is greater than the remaining local pull time, based on the currently untransmitted memory, query the target transmission content corresponding to the currently untransmitted memory in the target image information in the local storage corresponding to the first host machine.
[0101] Step S313 , suspending the process of pulling the target image information from the second host to the first host, and pulling the target transmission content to the first host through the local storage corresponding to the first host.
[0102] Step S314 , suspending the step of periodically collecting the currently untransmitted memory of the target mirror information and the current remote transmission rate of the target mirror information.
[0103] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0104] Based on the same inventive concept, embodiments of the present application also provide an efficient image pulling device for implementing the efficient image pulling method described above. The solution to the problem provided by this device is similar to the solution described in the method described above. Therefore, the specific limitations of one or more embodiments of the efficient image pulling device provided below can be found in the above-mentioned limitations of the efficient image pulling method and will not be repeated here.
[0105] In one embodiment, Figure 4 As shown, an efficient image pulling device is provided, including: an acquisition module 410, an identification module 420, a pulling module 430 and an adjustment module 440, wherein:
[0106] An acquisition module 410 is configured to acquire image change information of different host machines and target image requirement information of the first host machine, and synchronize the image information of the local storage corresponding to each host machine based on the image change information of each host machine;
[0107] an identification module 420 configured to identify target image information corresponding to the target image requirement information, and to identify a second host machine corresponding to the target image information when synchronization of the target image information is not completed in a local memory corresponding to the first host machine;
[0108] The pulling module 430 is configured to pull the target image information to the first host through the second host, and periodically collect the current untransmitted memory of the target image information and the current remote transmission rate of the target image information;
[0109] The adjustment module 440 is used to calculate the remaining remote pull time of the target image information and the remaining local pull time of the target image information based on the currently untransmitted memory and the current remote transmission rate after each acquisition and when the target image information in the local memory corresponding to the first host machine is synchronized, and adjust the pull method of the first host machine based on the remaining remote pull time and the remaining local pull time until the target image information is transmitted.
[0110] Optionally, the acquisition module 410 is specifically configured to:
[0111] Querying the changed host machine where the mirror image has changed, and sending the mirror image change information of the changed host machine to the local storage of other host machines through the mirror image synchronization program;
[0112] For each other host machine, in the local memory, the sub-memory corresponding to the changed host machine and the original mirror information corresponding to the mirror change information are identified, and in the sub-memory, based on the mirror change information, the original mirror information is updated to obtain updated mirror information.
[0113] Optionally, the identification module 420 is specifically configured to:
[0114] Querying the current status of the target image information in a local memory corresponding to the first host machine;
[0115] When the current state is synchronization completed, pulling the target image information from the local memory corresponding to the first host machine;
[0116] When the current state is in synchronization or the target mirror information does not exist in the local memory, a second host machine corresponding to the target mirror information is identified.
[0117] Optionally, the device further includes:
[0118] The synchronization module is configured to synchronize the mirror information in the local memory corresponding to the first host machine through a mirror synchronization program based on the target mirror information in the local memory corresponding to the second host machine when the target mirror information does not exist in the local memory.
[0119] Optionally, the adjustment module 440 is specifically configured to:
[0120] Calculating the remaining remote pull time of the target image information based on the currently untransmitted memory and the current remote transmission rate, and collecting a preset local image transmission rate;
[0121] Based on the preset local image transmission rate and the currently untransmitted memory, a remaining local pull time of the target image information is calculated.
[0122] Optionally, the adjustment module 440 is specifically configured to:
[0123] When the remaining remote pull time is not greater than the remaining local pull time, maintaining the current pull mode and returning to the step of periodically collecting the currently untransmitted memory of the target image information and the current remote transmission rate of the target image information;
[0124] When the remaining remote pull time is greater than the remaining local pull time, querying, based on the currently untransmitted memory, target transmission content corresponding to the currently untransmitted memory in target image information in the local storage corresponding to the first host machine;
[0125] Pause the process of pulling the target image information from the second host to the first host, and pull the target transmission content to the first host through the local storage corresponding to the first host;
[0126] The step of periodically collecting the currently untransmitted memory of the target mirror information and the current remote transmission rate of the target mirror information is suspended.
[0127] Each module in the above-mentioned efficient image pulling device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor of the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0128] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, an efficient mirror pulling method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.
[0129] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0130] In one embodiment, a computer device is provided, comprising a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of any one of the methods in the first aspect are implemented.
[0131] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the methods in the first aspect are implemented.
[0132] In one embodiment, a computer program product is provided, comprising a computer program, which implements the steps of any one of the methods of the first aspect when executed by a processor.
[0133] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0134] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0135] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0136] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. An efficient image pulling method, characterized in that: The method comprises: Obtaining image change information of different host machines and target image requirement information of the first host machine, and synchronizing the image information of the local storage corresponding to each host machine based on the image change information of each host machine; identifying target image information corresponding to the target image requirement information, and identifying a second host machine corresponding to the target image information when synchronization of the target image information is not completed in a local memory corresponding to the first host machine; Pulling the target image information to the first host through the second host, and regularly collecting the current untransmitted memory of the target image information and the current remote transmission rate of the target image information; After each acquisition, and when synchronization of the target image information in the local memory corresponding to the first host machine is completed, a remaining remote pull time of the target image information and a remaining local pull time of the target image information are calculated based on the currently untransmitted memory and the current remote transmission rate. Based on the remaining remote pull time and the remaining local pull time, a pull mode of the first host machine is adjusted until the transmission of the target image information is completed.
2. The method according to claim 1, characterized in that The step of synchronizing the mirror information of the local storage corresponding to each host machine based on the mirror change information of each host machine includes: Querying the changed host machine with mirror changes, and sending the mirror change information of the changed host machine to the local storage of other host machines through the mirror synchronization program; For each other host machine, in the local memory, the sub-memory corresponding to the changed host machine and the original mirror information corresponding to the mirror change information are identified, and in the sub-memory, based on the mirror change information, the original mirror information is updated to obtain updated mirror information.
3. The method according to claim 2, characterized in that When the target image information is not synchronized in the local memory corresponding to the first host machine, identifying the second host machine corresponding to the target image information includes: Querying the current status of the target image information in a local memory corresponding to the first host machine; When the current state is synchronization completed, pulling the target image information from the local memory corresponding to the first host machine; When the current state is in synchronization or the target mirror information does not exist in the local memory, a second host machine corresponding to the target mirror information is identified.
4. The method according to claim 3, characterized in that When the target image information is not synchronized in the local memory corresponding to the first host machine, after identifying the second host machine corresponding to the target image information, the method further includes: When the target mirror information does not exist in the local memory, the mirror information in the local memory corresponding to the first host machine is synchronized through a mirror synchronization program based on the target mirror information in the local memory corresponding to the second host machine.
5. The method according to claim 1, wherein The calculating, based on the currently untransmitted memory and the current remote transmission rate, the remaining remote pull time of the target mirror information and the remaining local pull time of the target mirror information includes: Calculating the remaining remote pull time of the target image information based on the currently untransmitted memory and the current remote transmission rate, and collecting a preset local image transmission rate; Based on the preset local image transmission rate and the currently untransmitted memory, a remaining local pull time of the target image information is calculated.
6. The method according to claim 1, characterized in that Adjusting the pulling mode of the first host machine based on the remaining remote pulling time and the remaining local pulling time until the target image information is transmitted is completed, including: When the remaining remote pull time is not greater than the remaining local pull time, maintaining the current pull mode and returning to the step of periodically collecting the currently untransmitted memory of the target image information and the current remote transmission rate of the target image information; When the remaining remote pull time is greater than the remaining local pull time, querying, based on the currently untransmitted memory, target transmission content corresponding to the currently untransmitted memory in target image information in the local storage corresponding to the first host machine; Pause the process of pulling the target image information from the second host to the first host, and pull the target transmission content to the first host through the local storage corresponding to the first host; The step of periodically collecting the currently untransmitted memory of the target mirror information and the current remote transmission rate of the target mirror information is suspended.
7. An efficient mirror image pulling device, characterized in that: The device comprises: An acquisition module, configured to acquire image change information of different host machines and target image requirement information of the first host machine, and synchronize the image information of the local storage corresponding to each host machine based on the image change information of each host machine; an identification module, configured to identify target image information corresponding to the target image requirement information, and, when synchronization of the target image information is not completed in a local memory corresponding to the first host machine, identify a second host machine corresponding to the target image information; a pulling module, configured to pull the target image information to the first host machine through the second host machine, and periodically collect the current untransmitted memory of the target image information and the current remote transmission rate of the target image information; An adjustment module is used to calculate the remaining remote pull time of the target image information and the remaining local pull time of the target image information based on the currently untransmitted memory and the current remote transmission rate after each acquisition and when the target image information in the local memory corresponding to the first host machine is synchronized, and adjust the pull mode of the first host machine based on the remaining remote pull time and the remaining local pull time until the transmission of the target image information is completed.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method and system for accelerating pulling of mirror image file
CN113190242A
Container mirror image pulling method, device and equipment and readable storage medium
CN114968283A