A mirror repository distributed cache method and apparatus

By deploying distributed caching services in each data center and optimizing the cache structure of the image repository using the LRU algorithm, the problems of massive distribution pressure and performance improvement in cross-data center scenarios of the image repository are solved, achieving faster image retrieval and reduced network communication costs.

CN115687420BActive Publication Date: 2026-01-16HANGZHOU RIVTOWER TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211321362.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-26
Publication Date
2026-01-16
Estimated Expiration
2042-10-26

AI Technical Summary

Technical Problem

Image repositories face the challenges of massive image distribution and performance improvement in cross-datacenter scenarios. How to build a highly available image caching mechanism to reduce the pressure on the central image repository and network communication costs, and improve image retrieval speed?

Method used

Deploy a block file caching service in each data center, cache recently used image block files in a distributed manner, manage cache service instances through Kubernetes, and use the LRU algorithm to evict low-frequency image block files, thereby optimizing the topology of the cache service.

Benefits of technology

It reduced network communication costs, improved image retrieval speed, reduced pressure on the central image repository, and enhanced image distribution performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115687420B_ABST
    Figure CN115687420B_ABST
Patent Text Reader

Abstract

The embodiment of the specification discloses a mirror warehouse distributed cache method and device, wherein the method comprises: deploying a service for a plurality of data center mirror warehouses, deploying and running a cache service corresponding to each data center; in response to a first data center pulling a first image request instruction, obtaining corresponding first image metadata in the mirror warehouse; querying whether the first image block file corresponding to the first image metadata has been saved in the first data center cache; when not saved, saving the first image block file to the first data center cache service and sending the first image to the first cluster node of the first data center; when saved, sending the first image to the first cluster node of the first data center, wherein the first image comprises the first image metadata and the first image block file saved in the cache service of the first data center. The scheme can significantly reduce the mirror warehouse traffic pressure, improve the image pulling speed, and reduce the network communication cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer software technology, and in particular to a distributed caching method, apparatus, electronic device and storage medium for a mirror repository. Background Technology

[0002] Image repositories provide two key functions: image storage and distribution. Storage refers to pushing images to the repository; distribution refers to distributing images from the repository to the machines running those images. Image distribution handles significantly more traffic than image storage, posing greater challenges in real-world enterprise applications. The first challenge for image repositories is handling the pressure of massive image distribution, and the second is improving distribution performance at a reasonable cost. Since image repositories are typically deployed globally across data centers in cross-datacenter scenarios, building a highly available image caching mechanism to alleviate repository pressure, improve distribution performance, reduce pressure on the central repository and network communication costs, and increase image retrieval speed are pressing technical issues that need to be addressed. Summary of the Invention

[0003] The purpose of the embodiments in this specification is to address the above-mentioned problems by providing a distributed caching method, apparatus, electronic device, and storage medium for mirror warehouses.

[0004] To solve the above-mentioned technical problems, the embodiments in this specification are implemented as follows:

[0005] Firstly, a distributed caching method for image repositories is proposed. This method deploys an image repository serving multiple data centers to provide centralized storage and distribution of images. Each data center includes at least one cluster node, and each image includes metadata and block files. A caching service for storing block files is deployed and run for each data center. This method is applied to the first data center and includes:

[0006] In response to a request to pull a first image, the first image metadata corresponding to the request is obtained from the image repository;

[0007] Query whether the first image block file corresponding to the first image metadata has been saved in the cache service of the first data center;

[0008] When not saved, the first image block file is saved to the cache service of the first data center, and the first image is sent to the first cluster node of the first data center. The first image includes the first image metadata and the first image block file.

[0009] When saved, send the first image to a first cluster node of the first data center, the first image including the first image metadata and the first image block file saved in the cache service of the first data center.

[0010] Further, a cache service for saving block files is deployed and run corresponding to each data center, including setting the size of the cache service and the validity period of the cache service.

[0011] Further, when the first cluster node is a Kubernetes node, a container pod for injecting the address corresponding to the cache service into the system hosts file is run in the first cluster node.

[0012] Further, multiple cache service instances are deployed to the first data center using Kubernetes Deployment, and the cache service instances are run using Kubernetes Service.

[0013] Further, the first image block file is allocated to multiple cache service instances of the first data center in a shared manner.

[0014] Further, according to the usage frequency of the image block file in the cache service, the LRU algorithm is used to eliminate the image block file with low usage frequency saved in the cache service.

[0015] The second aspect provides an image warehouse distributed cache device, comprising:

[0016] The first module can deploy an image warehouse for providing centralized storage and distribution of images to serve multiple data centers, the data centers including at least one cluster node, and the images including metadata and block files;

[0017] The second module can deploy and run a cache service for saving block files corresponding to each data center, applied to a first data center, including:

[0018] The third module can obtain first image metadata corresponding to a request instruction in the image warehouse in response to the request instruction for pulling a first image;

[0019] The fourth module can query whether a first image block file corresponding to the first image metadata has been saved in the cache service of the first data center;

[0020] a fifth module capable of saving the first image block file to the cache service of the first data center when not saved, and sending the first image to the first cluster node of the first data center, the first image comprising the first image metadata and the first image block file;

[0021] a sixth module capable of sending the first image to the first cluster node of the first data center when saved, the first image comprising the first image metadata and the first image block file saved in the cache service of the first data center.

[0022] Further, a cache service for saving block files is deployed and run corresponding to each data center, including setting the size of the cache service and the validity period of the cache service.

[0023] Further, when the first cluster node is a Kubernetes node, a container Pod for injecting the address corresponding to the cache service into the system hosts file is run in the first cluster node.

[0024] Further, multiple cache service instances are deployed to the first data center using Kubernetes Deployment, and the cache service instances are run using Kubernetes Service.

[0025] Further, the first image block file is allocated to multiple cache service instances of the first data center in a shared manner.

[0026] Further, according to the usage frequency of the image block file in the cache service, the LRU algorithm is used to eliminate the image block file with low usage frequency saved in the cache service.

[0027] In a third aspect, an electronic device is provided, and the electronic device comprises:

[0028] a processor; and

[0029] a memory arranged to store computer-executable instructions that, when executed, cause the processor to perform the image repository distributed cache method of the first aspect.

[0030] In a fourth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores one or more programs, which, when executed by an electronic device comprising multiple applications, cause the electronic device to perform the image repository distributed cache method of the first aspect.

[0031] The present specification can achieve at least the following technical effects:

[0032] The scheme of the present application increases a block file cache service in a distributed manner in different data centers to cache the recently used mirror block files, so that the mirror pulling is pulled from the original centralized warehouse and is pulled from the block file cache service, which greatly reduces the network communication cost, improves the mirror pulling speed, and reduces the pressure on the central mirror warehouse. BRIEF DESCRIPTION OF DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present specification or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments described in the present specification, and for those skilled in the art, other drawings can also be obtained without creative labor.

[0034] Figure 1 The system structure schematic diagram of the mirror warehouse distributed cache scheme provided for the embodiments of the present specification.

[0035] Figure 2 The mirror warehouse distributed cache method schematic diagram one provided for the embodiments of the present specification.

[0036] Figure 3 The mirror warehouse distributed cache method schematic diagram two provided for the embodiments of the present specification.

[0037] Figure 4 The mirror warehouse distributed cache device schematic diagram provided for the embodiments of the present specification.

[0038] Figure 5 The structure schematic diagram of the electronic device provided for one embodiment of the present specification. DETAILED DESCRIPTION

[0039] In order to make the person skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be described clearly and completely in the following, combined with the drawings in the embodiments of the present specification. Obviously, the described embodiments are only some of the embodiments of the present specification, not all. Based on the embodiments in the present specification, all other embodiments obtained by those skilled in the art without creative labor should belong to the scope of protection of the present specification.

[0040] KEY TERMS

[0041] Mirror repository: As one of the core components of Docker technology, its main function is to store and distribute image content. In terms of usage, it is divided into "public image repository" and "private image repository". The public image repository can be used by anyone, while the private image repository refers to the image repository deployed within a company or organization for its own application Docker image storage and distribution. In the process of building an automated publishing system for internal use, from a security perspective, the packaged image will generally only be stored in the private image repository, and the connection point of the CI / CD process is also achieved by uploading and pulling images to the private image repository.

[0042] Cache service: refers to a technology or service that stores frequently accessed network content in a system closest to the user and with faster access speed to improve content access speed. Distributed cache can read data with high performance, dynamically expand cache nodes, automatically discover and switch failed nodes, automatically balance data partitioning, and provide users with a graphical management interface, making deployment and maintenance very convenient. Distributed cache has been widely used in distributed and cloud computing fields. Cache hit rate is one of the important factors to judge the effectiveness of improving access speed.

[0043] The mirror repository distributed cache scheme involved in the present specification will be described in detail below through specific examples.

[0044] Embodiment one

[0045] The focus of the present application is how to build a highly available image cache mechanism to relieve the pressure of the mirror repository and improve the performance of image distribution, reduce the pressure on the central mirror repository and network communication cost, and improve the image pulling speed. The image file Image includes metadata and block files. Docker container images are designed to completely separate image metadata and block files. Among them, the image layer metadata adopts a three-level repository, image and layer from top to bottom; the repository layer stores the name, tag and corresponding ID of the image, the image layer contains the image architecture, operating system, creation time, history information and rootfs; the layer layer corresponds to the physical image layer block file. Based on this design of image file Image, in the actual development process, developers often use the same tag to push to the image repository. After each new image is pushed, the same tag is pulled again, and because there is already a complete image in the cache service, the latest image will not be pulled from the image repository, and the image finally obtained is the old version of the image in the cache server. It can be understood that if the cache service only caches the image block file and does not cache the image metadata, the latest version of the image file can be more accurately obtained.

[0046] To this end, the technical scheme of the embodiment of the application is to introduce the block file storage according to whether the mirror repository is a commonly used mirror, and at the same time, the validity period of the block file cache and the cache size need to be considered, and the LRU mechanism is used to eliminate a part of the mirror cache, so as to keep the cache service in a healthy state, and at the same time, the problem of cache invalidation and cache jitter caused by too low cache hit rate will not be caused.

[0047] Referring to Figure 1 Fig. 1 shows a system structure diagram of an embodiment of the application. For an application scenario composed of multiple data centers, the mirror repository is generally globally deployed across data centers, so the cache service needs to be optimized in its topology structure first. It should be noted that if the cache service is globally deployed across data centers like the mirror repository, each data center corresponding cluster will interact with the cache service when pulling the mirror, and the block file in the cache service will be refreshed when pulling the block file that does not exist. When using the topology structure of global mirror repository plus global cache service, if the block file to be pulled is in the cache service but not in the same data center, the performance of obtaining the mirror may not be as good as directly pulling the block file through the mirror repository. At the same time, this topology has a disadvantage that the cache service will enter the frequent cache refreshing state due to the large difference in the globally used mirror files, and will cause the cache hit rate to decrease. Therefore, deploying the cache service in a distributed manner in each data center can narrow the search range of the block file cache and avoid pulling the mirror block file across data centers, thereby improving the cache hit rate.

[0048] Referring to Figure 2 Fig. 2 shows a distributed cache method of a mirror repository according to an embodiment of the application. The method includes the following steps:

[0049] S1: deploying a mirror repository for providing centralized storage and distribution of mirrors to serve multiple data centers, the data centers including at least one cluster node, and the mirrors including metadata and block files.

[0050] Optionally, a cache service for saving block files is deployed and run corresponding to each data center, including setting the size of the cache service and the validity period of the cache service.

[0051] S2: deploying and running a cache service for saving block files corresponding to each data center; and,

[0052] For any of the data centers, including:

[0053] S3: in response to a request instruction for pulling a first mirror, obtaining first mirror metadata corresponding to the request instruction in the mirror repository.

[0054] S4: querying whether a first image block file corresponding to the first image metadata has been saved in the cache service of the first data center.

[0055] S5: when not saved, saving the first image block file to the cache service of the first data center, and sending the first image to the first cluster node of the first data center, the first image including the first image metadata and the first image block file.

[0056] Optionally, when the first cluster node is a Kubernetes node, a container Pod for injecting the address of the cache service into a system hosts file is run in the first cluster node.

[0057] Specifically, as shown in Figure 3 the image cache service is a service running inside each cluster, and its service address is an internal address of the Kubernetes cluster. When the container runtime pulls an image, it accesses the image repository rather than the cache service. If the container runtime pulls an image from the cache service inside the cluster, the traffic accessing the image repository needs to be intercepted inside the cluster and transferred to the cache service inside the cluster. A Pod for injecting the cache service into the hosts file can be run on the Kubernetes node. After the Pod is started, the cluster address of the cache service is injected into the hosts file, and subsequent pulling of images on the host is pulled through the cache service. The Pod can be managed by Kubernetes DaemonSet to ensure that an instance is run on each node.

[0058] Optionally, multiple cache service instances are deployed to the first data center using Kubernetes Deployment, and the cache service instances are run using Kubernetes Service. Specifically, all block files of the cache service are obtained from the image repository, and the loss of any instance will only lose part of the cache block file, without affecting the pulling speed of the image.

[0059] Optionally, the first image block file is allocated to multiple cache service instances of the first data center in a shared manner. Specifically, this manner can enable each newly cached block file to be shared to all cache instances, thereby providing stable cache service performance.

[0060] S6: when saved, sending the first image to the first cluster node of the first data center, the first image including the first image metadata and the first image block file saved in the cache service of the first data center.

[0061] Optionally, according to the usage frequency of the mirror block file in the cache service, the LRU algorithm is used to eliminate the mirror block file with low usage frequency saved in the cache service. Specifically, since the block file in the cache service has an elimination mechanism and the cache instance is stateless, the cache service instance can be deployed by Kubernetes Deployment, and the service is provided by Kubernetes Service. At the same time, there is a small problem with multiple cache service instances. The block file cached by each instance is different according to the different image requests served, so when the cluster pulls an image, the request will be randomly sent to one of the instances, but the instance has not cached the block file of the image. This will cause the performance to be lower than that of the instance that has cached the block file of the image.

[0062] Embodiment two

[0063] Figure 4 The structure diagram of the image warehouse distributed cache device 400 provided by one embodiment of the present specification is shown. Please refer to Figure 4 In one embodiment of the image warehouse distributed cache device 400, it comprises:

[0064] The first module 401 can deploy a mirror warehouse for providing centralized storage and distribution of images, which serves multiple data centers, the data centers include at least one cluster node, and the images include metadata and block files;

[0065] The second module 402 can deploy and run a cache service for saving block files corresponding to each data center, which is applied to the first data center and comprises:

[0066] The third module 403 can respond to the request instruction for pulling the first image, and obtain the first image metadata corresponding to the request instruction in the image warehouse;

[0067] The fourth module 404 can query whether the first image block file corresponding to the first image metadata has been saved in the cache service of the first data center;

[0068] The fifth module 405 can save the first image block file to the cache service of the first data center when it is not saved, and send the first image to the first cluster node of the first data center, the first image comprising the first image metadata and the first image block file;

[0069] The sixth module 406 can send the first image to the first cluster node of the first data center when it is saved, the first image comprising the first image metadata and the first image block file saved in the cache service of the first data center.

[0070] It should be understood that the mirror repository distributed cache apparatus of an embodiment of the present specification can also perform the method performed by the mirror repository distributed cache apparatus (or device) and realize the functions of the mirror repository distributed cache apparatus (or device) in the present specification, which will not be described here again. Figures 1 to 3 The mirror repository distributed cache apparatus (or device) performs the method, and realizes the functions of the mirror repository distributed cache apparatus (or device) in the present specification, which will not be described here again. Figures 1 to 3 The mirror repository distributed cache apparatus (or device) performs the method, and realizes the functions of the mirror repository distributed cache apparatus (or device) in the present specification, which will not be described here again.

[0071] Embodiment Three

[0072] Figure 5 is a structural schematic diagram of an electronic device of an embodiment of the present specification. Please refer to Figure 5 At the hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The memory can include a memory such as a high-speed random-access memory (RAM), and can also include a non-volatile memory such as at least one disk memory. Of course, the electronic device can also include other hardware required by the business.

[0073] The processor, the network interface, and the memory can be connected to each other through the internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 5 In the present specification, only one bidirectional arrow is used to represent the bus, but it does not mean that there is only one bus or only one type of bus.

[0074] The memory is used to store programs. Specifically, the program can include program code, and the program code includes computer operation instructions. The memory can include a memory and a non-volatile memory, and provides instructions and data for the processor.

[0075] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs, and forms a shared resource access control apparatus at the logical level. The processor executes the program stored in the memory, and is specifically used for performing the following operations:

[0076] Deploy a mirror repository for providing mirror centralized storage and distribution, which serves multiple data centers, the data centers include at least one cluster node, and the mirror includes metadata and block files;

[0077] corresponding to each data center and run a cache service for saving block files;

[0078] in response to a request instruction of a first data center for pulling a first image, obtaining first image metadata corresponding to the request instruction in the image repository;

[0079] querying whether a first image block file corresponding to the first image metadata has been saved in the cache service of the first data center;

[0080] when not saved, saving the first image block file to the cache service of the first data center, and sending the first image to a first cluster node of the first data center, the first image including the first image metadata and the first image block file;

[0081] when saved, sending the first image to a first cluster node of the first data center, the first image including the first image metadata and the first image block file saved in the cache service of the first data center.

[0082] The above as described in the specification Figures 1 to 3The mirror repository distributed cache method disclosed in the embodiment can be applied to or implemented by a processor. The processor can be an integrated circuit chip having a signal processing capability. In the implementation, the steps of the method can be completed by integrated logic circuits in the processor or instructions in the form of software. The processor can be a general processor, including a central processing unit (CPU), a network processor (NP), etc. It can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The methods, steps and logic block diagrams disclosed in the embodiments of the present specification can be implemented or executed. The general processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present specification can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory, and the processor reads the information in the memory and combines the hardware to complete the steps of the method.

[0083] Of course, in addition to the software implementation, the electronic device of the embodiments of the present specification does not exclude other implementation manners, such as logic devices or a combination of software and hardware, etc. That is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or a logic device.

[0084] Embodiment four

[0085] The embodiments of the present specification also propose a computer readable storage medium storing one or more programs, the one or more programs including instructions that, when executed by a portable electronic device including a plurality of applications, can cause the portable electronic device to execute Figures 1 to 3 The method of the embodiment, and specifically for executing the following method:

[0086] Deploy a mirror repository for providing mirror centralized storage and distribution, which serves a plurality of data centers, the data centers including at least one cluster node, and the mirror including metadata and block files;

[0087] corresponding to each data center and run a cache service for saving block files;

[0088] obtaining first image metadata corresponding to the request instruction in the image repository in response to the request instruction of the first data center pulling the first image;

[0089] querying whether a first image block file corresponding to the first image metadata has been saved in the cache service of the first data center;

[0090] when not saved, saving the first image block file to the cache service of the first data center, and sending the first image to a first cluster node of the first data center, the first image including the first image metadata and the first image block file;

[0091] when saved, sending the first image to a first cluster node of the first data center, the first image including the first image metadata and the first image block file saved in the cache service of the first data center.

[0092] In summary, the above only describes preferred embodiments of the present specification, and is not used to limit the protection scope of the present specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the protection scope of the present specification.

[0093] The systems, apparatuses, modules or units illustrated by the above embodiments can be specifically implemented by a computer chip or entity, or by a product with certain functions. A typical implementation device is a computer. Specifically, the computer may, for example, be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0094] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.

[0095] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusions, so that a process, method, article or apparatus that includes a list of elements does not only include those elements, but also includes other elements not explicitly listed, or inherent to such a process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.

[0096] Each of the embodiments in the specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, for system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.

Claims

1. A method for mirroring repository distributed cache, characterized in that, Deploy a mirror warehouse for providing centralized storage and distribution of images, which serves multiple data centers, each of which includes at least one cluster node, and each image includes metadata and a block file; Deploy and run a cache service for saving block files corresponding to each data center, including: In response to a request instruction for pulling a first image from a first data center, obtain first image metadata corresponding to the request instruction in the mirror warehouse; Query whether a first image block file corresponding to the first image metadata has been saved in the cache service of the first data center; When not saved, save the first image block file to the cache service of the first data center, and send the first image to the first cluster node of the first data center, the first image including the first image metadata and the first image block file; When saved, send the first image to the first cluster node of the first data center, the first image including the first image metadata and the first image block file saved in the cache service of the first data center.

2. The mirror repository distributed cache method of claim 1, wherein, Deploy and run a cache service for saving block files corresponding to each data center, including setting the size of the cache service and the validity period of the cache service.

3. The mirror repository distributed cache method of claim 2, wherein, When the first cluster node is a Kubernetes node, run a container pod in the first cluster node for injecting the address of the cache service into the system hosts file.

4. The mirror repository distributed cache method of claim 3, wherein, Deploy multiple instances of the cache service to the first data center using Kubernetes Deployment, and run the instances of the cache service using Kubernetes Service.

5. The mirror repository distributed cache method of claim 4, wherein, Distribute the first image block file to multiple instances of the cache service in the first data center in a shared manner.

6. The mirror repository distributed cache method according to any one of claims 1 to 5, characterized in that, According to the usage frequency of the image block file in the cache service, use the LRU algorithm to eliminate the image block file with low usage frequency saved in the cache service.

7. A mirror repository distributed cache apparatus, characterized by, Including: A first module capable of deploying a mirror warehouse for providing centralized storage and distribution of images, which serves multiple data centers, each of which includes at least one cluster node, and each image includes metadata and a block file; A second module capable of deploying and running a cache service for saving block files corresponding to each data center, applied to a first data center, including: A third module capable of obtaining first image metadata corresponding to a request instruction for pulling a first image in the mirror warehouse in response to the request instruction; A fourth module capable of querying whether a first image block file corresponding to the first image metadata has been saved in the cache service of the first data center; A fifth module capable of saving the first image block file to the cache service of the first data center when not saved, and sending the first image to the first cluster node of the first data center, the first image including the first image metadata and the first image block file; A sixth module, capable of sending the first image to the first cluster node of the first data center when saved, the first image comprising the first image metadata and the first image block file saved in the cache service of the first data center.

8. The mirror repository distributed cache apparatus of claim 7, wherein, A cache service for saving block files is deployed and run corresponding to each data center, including setting the size of the cache service and the validity period of the cache service.

9. The mirror repository distributed cache apparatus of claim 8, wherein, When the first cluster node is a Kubernetes node, a container Pod for injecting the address corresponding to the cache service into the system hosts file is run in the first cluster node.

10. The mirror repository distributed cache apparatus of claim 9, wherein, A plurality of cache service instances are deployed to the first data center using Kubernetes Deployment, and the cache service instances are run using Kubernetes Service.

11. The mirror repository distributed cache apparatus of claim 10, wherein, The first image block file is allocated to a plurality of cache service instances of the first data center in a shared manner.

12. The mirror repository distributed cache apparatus of any of claims 7 to 11, wherein, According to the usage frequency of the image block file in the cache service, the image block file with low usage frequency saved in the cache service is eliminated using the LRU algorithm.

13. An electronic device, comprising: Comprise: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform the image warehouse distributed cache method of any one of claims 1 to 6.

14. A computer-readable storage medium, characterized in that, The computer readable storage medium stores one or more programs, which when executed by an electronic device comprising a plurality of applications, cause the electronic device to perform the image warehouse distributed cache method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • System and method for multi-cluster container deployment

    CN109391664A

  • Mirror image layer file sending method and device, electronic equipment and computer readable medium

    CN114785770A