Pod startup acceleration method, system, electronic device and storage medium
By building a hierarchical cache of images and using the image proxy module to query and download, we solved the image repository performance bottleneck and slow local image loading problems, and achieved fast pod startup.
Patent Information
- Application Number
- CN202310057377.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-16
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2043-01-16
AI Technical Summary
When the pod is started, the performance bottleneck of the image repository causes a large number of pods to take longer to start, and the local image is loaded slowly from the hard disk, making it impossible to start quickly.
Build cache information of image layered data, query and download cache information through the image proxy module, implement distributed image layered cache, reduce downloading from external image repositories and reading disk operations from local image repositories, and improve cache hit rate.
Through the image layered caching mechanism, pods can be started quickly, image download time can be reduced, and startup efficiency can be improved.
Smart Images

Figure CN116048662B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer information technology, and in particular relates to a pod startup acceleration method, system, electronic device and storage medium. Background Art
[0002] To start a pod, if the current node image does not exist, it is necessary to pull the image from the configured image repository. Only after the image is pulled can the pod be started. The following are the main problems:
[0003] 1. When a large number of pods are started, images are pulled from the same image repository, which creates a performance bottleneck. 2. When there is no image on the local node, images are pulled from the image repository, which lengthens the pod startup time. 3. When images exist locally, images are loaded from the local hard disk. The reading time from the hard disk is longer than the reading time from the memory, and the pod cannot start quickly. Therefore, this patent application designs a pod startup acceleration method, system, electronic device, and storage medium. Summary of the Invention
[0004] In view of this, the present invention aims to provide a pod startup acceleration method, system, electronic device and storage medium to solve the problem of not being able to meet the pod's fast startup requirements when starting the pod.
[0005] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0006] The present invention provides a pod startup acceleration method, the method comprising:
[0007] Constructing cache information in the image layered data, wherein the cache information at least includes the number of accesses and whether the image layered data is stored in memory;
[0008] Query and download the dependent cache information from the local mirror proxy module on the pod scheduling node, and determine whether the cache information query hits;
[0009] In response to the query hitting the cache information, obtaining the cache information from the local mirror proxy module and refreshing the access count of the mirror layered data;
[0010] In response to the query not hitting the cache information, querying the cache information from the remaining mirror proxy modules on the pod scheduling node, notifying the current mirror proxy module to insert the cache information, and updating the access count of the mirror layered data;
[0011] The cache information is queried and downloaded, and the pod is started successfully.
[0012] Furthermore, in response to the query not hitting the cache information, querying the cache information from the remaining mirror proxy modules on the pod scheduling node, notifying the current mirror proxy module to insert the cache information, and updating the access count of the mirror layered data, including:
[0013] Determine whether the query to the remaining mirror proxy modules hits the cache information;
[0014] In response to the query hitting the cache information, notifying each mirror proxy module to refresh the access count of the mirror layered data;
[0015] In response to the query not hitting the cache information, successfully downloading the cache information from the configured external image repository;
[0016] The current mirror proxy module is notified to insert the cache information and update the access count of the mirror layered data.
[0017] Furthermore, in response to the query hitting the cache information, each mirror proxy module is notified to refresh the access count of the mirror layered data, including:
[0018] Query and hit the cache information, download the cache information to the mirror proxy module corresponding to the least connected node in the order of the node download connection number, and determine whether the download is successful;
[0019] In response to a successful download, each mirror proxy module is notified to refresh the access count of the mirror layered data;
[0020] In response to an unsuccessful download, determining whether there is a mirror proxy module that can download the cache information; if so, continuing to download the cache information to the mirror proxy module corresponding to the least connected node in the order of the node download connection number, and caching it in the local mirror proxy module until the download is completed;
[0021] If not, it is determined whether the cache information is successfully downloaded from the configured external image repository.
[0022] Furthermore, the notifying the current mirror proxy module to insert the cache information and update the access count of the mirror layered data further includes:
[0023] Notifying the current mirror proxy module to insert the cache information;
[0024] Determine whether the current warehouse space in the current mirror proxy module reaches a threshold;
[0025] If the current warehouse space has reached the threshold, the cached data in the local warehouse is eliminated;
[0026] If the current warehouse space does not reach the threshold, then continue to determine whether the data storage memory reaches the cache memory threshold; if so, eliminate the image layered data with the least number of accesses from the cache information, and insert the image layered data into the image proxy module that can store the image layered data;
[0027] If the cache memory threshold is not reached, the current mirror proxy module inserts the cache information and updates the access count of the mirror layered data.
[0028] Furthermore, in response to failure to successfully download the cache information from the configured external image repository, the pod startup fails.
[0029] Furthermore, before constructing the cache information in the image layered data, the method further includes:
[0030] An image proxy module runs on each pod scheduling node. When the proxy module is first started, it reads the image layer data from the local warehouse and builds cache information in the image layer data based on the cache size.
[0031] Based on the same inventive concept, the present invention also provides a pod startup acceleration system, the system comprising:
[0032] A construction module, configured to construct cache information in the image layered data, wherein the cache information includes at least the number of accesses and whether the image layered data is stored in memory;
[0033] A judgment module is used to query and download the dependent cache information from the current image proxy module on the pod scheduling node to which it belongs, and determine whether the cache information query hits;
[0034] A first response module, in response to a query hitting the cache information, obtains the cache information from the local mirror proxy module and refreshes the access count of the mirror layered data;
[0035] The second response module, in response to the query not hitting the cache information, queries the cache information from the remaining mirror proxy modules on the pod scheduling node, notifies the current mirror proxy module to insert the cache information, and updates the access count of the mirror layered data.
[0036] The startup module is used to query and download the cache information, and the pod is started successfully.
[0037] Based on the same inventive concept, the present invention also provides an electronic device, including a processor, and a memory connected to the processor for storing instructions executable by the processor, wherein when the processor executes the instructions, the steps of the pod startup acceleration method described above are implemented.
[0038] Based on the same inventive concept, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the pod startup acceleration method described above.
[0039] Compared with the prior art, the pod startup acceleration method, system, electronic device, and storage medium of the present invention have the following beneficial effects:
[0040] The pod startup acceleration method, system, electronic device, and storage medium disclosed in the present invention provide a distributed image layered caching and downloading mechanism. The pod scheduling node starts an image proxy module, which is responsible for processing the images that the current node pod startup depends on. This reduces image downloads from external image repositories, reduces disk read operations on local image repositories in the same layered data, and improves the cache hit rate of the same layered data, thereby achieving the purpose of quickly starting the pod. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings, which constitute part of the present invention, are provided to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are provided to explain the present invention and do not constitute an undue limitation of the present invention. In the accompanying drawings:
[0042] Figure 1 This is a schematic diagram of the process of the pod startup acceleration method according to an embodiment of the present invention;
[0043] Figure 2 This is a schematic diagram of mirrored layered data according to an embodiment of the present invention;
[0044] Figure 3 This is a schematic diagram of the initialization data structure for the node1 mirror proxy module according to an embodiment of the present invention;
[0045] Figure 4 This is a schematic diagram of the process of downloading the image image3 according to an embodiment of the present invention;
[0046] Figure 5 This is a schematic diagram of the first process of the node1 mirror proxy module cache data structure according to an embodiment of the present invention;
[0047] Figure 6 This is a schematic diagram of the second process of the node1 proxy module cache data structure according to an embodiment of the present invention;
[0048] Figure 7 This is a schematic diagram of the third process of the node1 proxy module cache data structure according to an embodiment of the present invention;
[0049] Figure 8 This is a schematic diagram of the structure of a pod startup acceleration system according to an embodiment of the present invention.
[0050] Description of reference numerals:
[0051] 11. Construction module; 12. Judgment module; 13. First response module; 14. Second response module; 15. Startup module. DETAILED DESCRIPTION
[0052] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0053] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0054] See also Figure 1 As shown, an embodiment of the present invention provides a pod startup acceleration method, the method comprising the following steps:
[0055] Step 1: Each node in the cluster runs a mirror proxy module. When the proxy module is started for the first time, it reads the mirror layer data from the local warehouse and builds the mirror layer data cache information (number of accesses, whether the mirror layer data is stored in memory) based on the cache size. If the cache cannot hold all the local warehouse data, the actual data will not be stored.
[0056] Step 2: When the pod starts, query and download the dependent image layer data from the image agent module on the pod scheduling node.
[0057] Step 3: When the local image proxy module queries the cache and a hit occurs, the image layer data is obtained from the local proxy module, and the access count of the image layer data is refreshed.
[0058] Step 4: When the local mirror proxy module does not hit the cache, it queries the cache information of the mirror layer data from the other mirror proxy modules of the cluster nodes to obtain the node and download connection number of the mirror layer data.
[0059] Step 5. When the cache information exists, it is sorted by node and number of download connections, and the cache information is downloaded to the mirror proxy module corresponding to the least connected node in turn to the local mirror proxy module for caching until the download is successful. If the download is successful, the local mirror proxy module notifies each mirror proxy module that has the mirror layered data, refreshes the cache information of the mirror layered data, and accesses the number of times.
[0060] Step 6: The mirror proxy module confirms the storage of the mirror layered data. The mirror proxy module confirms whether the storage of the mirror layered data in the local warehouse reaches a threshold. If the threshold is reached, the mirror layered data with the smallest number of mirror layer accesses in the local warehouse is eliminated.
[0061] Step 7: If the threshold is not reached, continue to determine whether the data storage memory reaches the cache memory threshold. If the cache memory threshold is not reached, the mirror proxy module inserts the cache information and updates the access count of the mirror layered data. If the cache memory threshold is reached, the mirror layered data with the smallest access count is eliminated and deleted from the cache until it is eliminated to the mirror proxy module that can store the mirror layered data, and then the cache information of the mirror layered data is inserted, and the cache information of the mirror layered data is refreshed, and the access count information is updated.
[0062] The cache information is queried and downloaded, and the pod is started successfully. This embodiment will not go into details about the situation where the pod download fails.
[0063] The present invention combines the image layered storage mechanism, the existence of the same layered data between different images, the cluster distributed image layered caching and downloading mechanism, and dispatches the image agent of each node to download the image from the pod to achieve the effect of load balancing; at the same time, it reduces the download of images from the image warehouse, reduces the disk reading operations of the local image warehouse for the same layered data, and improves the cache hit rate of the same layered data, thereby achieving the purpose of quickly starting the pod.
[0064] When implementing this solution, take the existence of three images: image1, image2, and image3 as an example. The image layer data is as follows: Figure 2 As shown:
[0065] Cluster nodes: node1, node2, node3, each node's local warehouse has the following mirror:
[0066] node1:image1,image2;
[0067] node2:image3;
[0068] node3: No image.
[0069] The node1 node agent module starts the initialization data structure as follows Figure 3 shown.
[0070] The number of times the image layer data appears is as follows:
[0071] A:2;
[0072] B:2;
[0073] C:1;
[0074] D:1;
[0075] E:1.
[0076] Y means the data is in the cache, N means the data is not in the cache. Based on the cache size, the cache only stores the data of layers A, B, and C, while the data of layers D and E are in the local warehouse.
[0077] Start a pod on node1 and download image3. The flow chart is as follows Figure 4 As shown, the dotted line part is the step process direction.
[0078] The node1 proxy module cache data structure is updated as follows Figure 5 As shown, (the local warehouse eliminates data E, and the cache eliminates data C).
[0079] A pod is started again on node 1, which depends on the base image image 3. Image 3 is hit from the local cache, and the cache data structure of the node 1 image proxy module is updated as follows: Figure 6 shown.
[0080] Delete the pod on node Node1, and the cache data structure of node1 mirror proxy module is updated as follows Figure 7 shown.
[0081] Based on the same inventive concept, Figure 8 As shown, an embodiment of the present invention further provides a pod startup acceleration system, the system comprising:
[0082] A construction module 11 is configured to construct cache information in the mirror layered data, wherein the cache information includes at least the number of accesses and whether the mirror layered data is stored in memory;
[0083] A judgment module 12 is configured to query and download the dependent cache information from the local mirror proxy module on the pod scheduling node to which it belongs, and determine whether the cache information query is a hit;
[0084] The first response module 13 obtains the cache information from the local mirror proxy module in response to the query hitting the cache information, and refreshes the access count of the mirror layered data;
[0085] In response to the query not hitting the cache information, the second response module 14 queries the cache information from the remaining mirror proxy modules on the pod scheduling node, notifies the current mirror proxy module to insert the cache information, and updates the access count of the mirror layered data.
[0086] The startup module 15 is used to query and download the cache information, and the pod is started successfully.
[0087] Based on the same inventive concept, an embodiment of the present invention also provides an electronic device, including a processor, and a memory connected to the processor for storing instructions executable by the processor. When the processor executes the instructions, the steps of the pod startup acceleration method described above are implemented.
[0088] Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the pod startup acceleration method described above.
[0089] Those skilled in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0090] In the several embodiments provided in this application, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the division of the units described above is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The above-mentioned units may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment of the present invention.
[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and description of the present invention.
[0092] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. Pod startup acceleration method, characterized in that: The method comprises: Constructing cache information in the image layered data, wherein the cache information at least includes the number of accesses and whether the image layered data is stored in memory; Query and download the dependent cache information from the local mirror proxy module on the pod scheduling node, and determine whether the cache information query hits; In response to the query hitting the cache information, obtaining the cache information from the local mirror proxy module and refreshing the access count of the mirror layered data; In response to the query not hitting the cache information, querying the cache information from the remaining mirror proxy modules on the pod scheduling node, notifying the local mirror proxy module to insert the cache information, and updating the access count of the mirror layered data; The cache information is queried and downloaded, and the pod is started successfully. In response to the query not hitting the cache information, querying the cache information from the remaining mirror proxy modules on the pod scheduling node, notifying the local mirror proxy module to insert the cache information, and updating the access count of the mirror layered data, including: Determine whether the query to the remaining mirror proxy modules hits the cache information; In response to the query hitting the cache information, notifying each mirror proxy module to refresh the access count of the mirror layered data; In response to the query not hitting the cache information, successfully downloading the cache information from the configured external image repository; Notifying the local mirror proxy module to insert the cache information and update the access count of the mirror layered data; In response to the query hitting the cache information, notifying each mirror proxy module to refresh the access count of the mirror layered data includes: Query and hit the cache information, download the cache information to the mirror proxy module corresponding to the least connected node in the order of the node download connection number, and determine whether the download is successful; In response to a successful download, each mirror proxy module is notified to refresh the access count of the mirror layered data; In response to an unsuccessful download, determining whether there is a mirror proxy module that can download the cache information; if so, continuing to download the cache information to the mirror proxy module corresponding to the least connected node in the order of the node download connection number, and caching it in the local mirror proxy module until the download is completed; If not, it is determined whether the cache information is successfully downloaded from the configured external image repository.
2. The pod startup acceleration method according to claim 1, characterized in that: The notifying the local mirror proxy module to insert the cache information and update the access count of the mirror layered data further includes: Notifying the local mirror proxy module to insert the cache information; Determine whether the current warehouse space in the local mirror agent module reaches a threshold; If the current warehouse space has reached the threshold, the cached information in the local warehouse is eliminated; If the current warehouse space does not reach the threshold, then continue to determine whether the data storage memory reaches the cache memory threshold; if so, eliminate the image layered data with the least number of accesses from the cache information, and insert the image layered data into the image proxy module that can store the image layered data; If the cache memory threshold is not reached, the local mirror proxy module inserts the cache information and updates the access count of the mirror layered data.
3. The pod startup acceleration method according to claim 2, characterized in that: In response to failure to successfully download the cache information from the configured external image repository, the pod startup fails.
4. The pod startup acceleration method according to claim 1, characterized in that: Before constructing the cache information in the image layered data, the method further includes: An image proxy module runs on each pod scheduling node. When the proxy module is first started, it reads the image layer data from the local warehouse and builds cache information in the image layer data based on the cache size.
5. A pod startup acceleration system, used to execute the method according to any one of claims 1 to 4, characterized in that: The system comprises: A construction module, configured to construct cache information in the image layered data, wherein the cache information includes at least the number of accesses and whether the image layered data is stored in memory; A judgment module is used to query and download the dependent cache information from the local mirror proxy module on the pod scheduling node to which it belongs, and determine whether the cache information query hits; A first response module, in response to a query hitting the cache information, obtains the cache information from the local mirror proxy module and refreshes the access count of the mirror layered data; The second response module, in response to the query not hitting the cache information, queries the cache information from the remaining mirror proxy modules on the pod scheduling node, notifies the local mirror proxy module to insert the cache information, and updates the access count of the mirror layered data; The startup module is used to query and download the cache information, and the pod is started successfully.
6. An electronic device comprising a processor and a memory connected to the processor for storing instructions executable by the processor, characterized in that: When the processor executes the instructions, the steps of the pod startup acceleration method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the pod startup acceleration method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Mirror image cache management method and device, equipment and storage medium
CN114116538A
Pod scheduling method, scheduler, scheduling system and electronic equipment
CN115421850A