Mirror image preloading method, device, equipment, storage medium and system
By analyzing the image layer description file, obtaining the association information between the mirror layers, generating hot spots and associated mirror layers lists, pushing the preloaded mirror layer to users, solving the problem of lack of targeted image preload in the prior art, and improving the efficiency and user experience of preloading.
Patent Information
- Application Number
- CN202411765838.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-05-02
AI Technical Summary
The lack of targeted preloading strategies for existing mirrors leads to low preloaded mirror usage and overuse of network and storage resources.
By obtaining the image layer description file corresponding to the image pushed or requested by the user, obtaining the association information between the mirror layers, generating a list of hot-spot image layer and an associated image layer list, and pushing the preloaded image layer for the user based on these lists.
It improves the usage rate of preloaded mirror layer, realizes efficient preloading, reduces user waiting time, and improves user experience.
Smart Images

Figure CN119917210A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image loading technology, and in particular to an image preloading method, device, equipment, storage medium and system. Background Art
[0002] With the popularization of cloud computing, the deployment and operation of containerized applications have become increasingly important. In this context, Kubernetes (K8s for short), as an open source container orchestration platform, has become the de facto standard for deploying and operating containerized applications.
[0003] In a K8s cluster, the importance of image storage and distribution is self-evident. First of all, the container image encapsulates the binary data of the application and all its software dependencies. These images are executable software packages that can run independently and have clear presets for their operating environment. Before the Pod references the image, the kubelet checks whether a container image with the corresponding digest is cached locally. If it exists, the kubelet will use the cached image; otherwise, the kubelet will pull the image with the parsed digest and use it to start the container.
[0004] However, in a large-scale K8s cluster, if multiple Pods are started at the same time, a large number of concurrent image pull requests may be generated. This may not only cause the container image service to be overloaded and network traffic to surge, but may even cause image pull failures. In addition, in cross-regional, cross-national or long-distance Docker image download scenarios, as well as in large-scale image deployments, the download efficiency of Docker images may be relatively low. These factors may affect the performance and stability of the K8s cluster.
[0005] To address the above problems, existing optimization solutions mainly focus on three aspects:
[0006] 1. Optimize image size: By using a smaller base image, deleting unnecessary files, merging multiple RUN instructions, etc., you can optimize the image construction and reduce the image size as much as possible, which can reduce the time and network traffic required to pull the image.
[0007] 2. Accelerate image downloading: Through P2P, delayed image loading and other solutions, the time for image pulling can be effectively shortened, thus solving the problems of timeout and download failure that may occur during image downloading in the case of poor network environment or large image files. In addition, through P2P technology, the image can be distributed quickly, especially in the scenario where the same image needs to be deployed on multiple machines, which can greatly improve the deployment efficiency.
[0008] 3. Image preloading: Use manual or automatic pulling tools to pull the required images to each node in advance before deploying the application, so as to reduce the pressure on the image warehouse and network traffic when actually deploying the application. In addition, image preloading can also improve the security and reliability of application deployment by regularly updating the preloaded images.
[0009] In the image preloading strategy, automatic preloading usually preloads the entire existing image, which may lead to excessive use of network and storage resources. The preloaded image lacks specificity, resulting in low utilization of the preloaded image. Summary of the invention
[0010] In view of this, the present invention provides an image preloading method, device, equipment, storage medium and system to solve the technical problems that the existing preloaded images lack pertinence and have low utilization rate.
[0011] In a first aspect, the present invention provides an image preloading method, comprising: obtaining an image layer description file corresponding to an image pushed or requested to be pulled by a user; obtaining association information between image layers according to the image layer description file; generating a hot image layer list and an associated image layer list according to the association information; and pushing a preloaded image layer to the user based on the hot image layer list and the associated image layer list.
[0012] An image preloading method of the present invention obtains an image layer description file corresponding to an image pushed or requested to be pulled by a user, obtains association information between image layers according to the image layer description file, generates a hot image layer list and an associated image layer list according to the association information, and pushes a preloaded image layer to the user based on the hot image layer list and the associated image layer list. The pushed image layer is obtained according to the association information in the image layer description file corresponding to the image pushed or requested to be pulled by the user. The image layer that the user may need can be predicted, so that the preloaded image layer is targeted, the utilization rate of the preloaded image layer is improved, and efficient preloading is achieved, thereby reducing the user's waiting time and improving the user experience.
[0013] Optionally, generating a hotspot image layer list and an associated image layer list according to the associated information includes:
[0014] An image directed graph is constructed based on the association information. The nodes of the image directed graph are image layers. The connecting edges of the image directed graph indicate that the two connected image layers appear in the same image layer description file.
[0015] Generate a hotspot image layer list based on the image directed graph;
[0016] Determine the associated image layer list based on the image directed graph and the current image layer of the user-side image repository.
[0017] An image preloading method of the present invention can more intuitively represent the relationship between image layers through an image directed graph, which is convenient for analysis and processing, and can more accurately determine which image layers are hot spots or are associated with the image layers currently used by the user.
[0018] Optionally, a hotspot image layer list is generated according to the image directed graph, including:
[0019] Compute node initial degree, node in-degree and betweenness centrality based on the mirror directed graph;
[0020] The heat score is calculated based on the node initial degree, node in-degree and betweenness centrality;
[0021] Sort by popularity score to get a list of hot image layers.
[0022] The image preloading method of the present invention can more scientifically evaluate the popularity of the image layer by calculating the initial degree, in-degree and betweenness centrality of the node, and ensure that the preloaded image layer is the one that the user is most likely to need.
[0023] Optionally, determining an associated image layer list according to the image directed graph and the current image layer of the user-side image repository includes:
[0024] Obtain the image layer that is connected to the current image layer of the user-side image repository according to the image directed graph;
[0025] Calculate the correlation strength of the target image layer that is connected to the current image layer of the user-side image repository;
[0026] Sort by correlation strength to get a list of associated image layers.
[0027] An image preloading method of the present invention can more accurately predict the image layer that a user may need by analyzing the connection relationship and correlation strength between image layers, thereby improving the accuracy of preloading.
[0028] Optionally, calculating the correlation strength of a target image layer that is connected to the current image layer of the user-side image repository includes:
[0029] Get the first number of times the target image layer appears in the image directed graph, and the second number of times the target image layer and any image layer in the current image layer of the user-side image repository appear in the same image directed graph at the same time;
[0030] Calculate the probability that any image layer of the target image layer and the current image layer of the user-side image repository appears in an image directed graph at the same time according to the first number and the second number;
[0031] The correlation strength of the target image layer is determined based on the correlation probability.
[0032] The image preloading method of the present invention can more accurately evaluate the correlation between image layers by calculating the correlation probability, thereby pushing the related image layers more accurately and improving the efficiency and accuracy of preloading.
[0033] Optionally, preloaded image layers are pushed to users based on the hotspot image layer list and the associated image layer list, including:
[0034] Pushing the image layer in the hot image layer list that is before the first preset ranking to the user-side image repository at a first preset time interval;
[0035] The current image layer of the user-side image repository is obtained at a second preset time interval, the associated image layer list is updated according to the current image layer of the user-side image repository, and the image layer in the associated image layer list that is before the second preset ranking is pushed to the user-side image repository.
[0036] The image preloading method of the present invention can ensure that the preloaded image layer is always synchronized with the user's needs by regularly pushing and dynamically updating the associated image layer list, thereby improving the timeliness and effectiveness of preloading.
[0037] In a second aspect, the present invention provides an image preloading device, comprising: a description file acquisition module, used to obtain an image layer description file corresponding to an image pushed or requested to be pulled by a user; an associated information extraction module, used to obtain associated information between image layers according to the image layer description file; an image layer list generation module, used to generate a hot image layer list and an associated image layer list according to the associated information; an image layer push module, used to push preloaded image layers to users based on the hot image layer list and the associated image layer list.
[0038] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the image preloading method of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0039] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the image preloading method of the first aspect or any corresponding embodiment thereof.
[0040] In a fifth aspect, the present invention provides an image preloading system, comprising: a general image repository, used to store images pushed by users, and send an image layer description file to a controller when a user pushes or requests to pull an image; a user-side image repository, used to cache image layers preloaded by users; and a controller, used to execute the image preloading method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 It is a flowchart of an image preloading method according to an embodiment of the present invention;
[0043] Figure 2 is a flowchart of another image preloading method according to an embodiment of the present invention;
[0044] Figure 3 is a flowchart of another image preloading method according to an embodiment of the present invention;
[0045] Figure 4 is a structural block diagram of an image preloading system according to an embodiment of the present invention;
[0046] Figure 5 is a structural block diagram of an image preloading device according to an embodiment of the present invention;
[0047] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0049] The terms involved in the embodiments of the present invention are explained as follows:
[0050] Docker Manifest: Docker Manifest is a description file of a Docker image, which records in detail the various layers inside the image. Manifest is expressed in JSON format and contains information about the various layers and architectures of the image. The Docker client uses Manifest to determine whether an image is compatible with the current device. Manifest allows users to accurately compare two images even if they are assigned different tags. In addition, Manifest can also provide additional information, such as which operating system and architecture the image was built for.
[0051] Docker image layers: Docker image layers are the basic building blocks of a Docker image. Each image layer corresponds to an instruction in a Dockerfile. A Docker image consists of multiple read-only image layers. These image layers are listed from top to bottom, with the oldest image layer at the bottom and the most recent image layer at the top. Typically, the image layers at the bottom of the list come from the base image, while the top image layers are added by the image author using commands in the Dockerfile.
[0052] Complex network model: A complex network model is an abstract model for understanding complex systems in the real world. It abstracts entities in complex systems into nodes and relationships between entities into lines. These network models can be used to describe a large number of complex systems in nature. The main research methods of complex network models are based on the theories and methods of graph theory.
[0053] At present, in large-scale K8s clusters, in order to improve the download efficiency of Docker images, three methods are mainly used: optimizing image size, accelerating image downloading, and preloading images.
[0054] Among the strategies for image preloading, automated preloading usually involves full preloading of existing images, which may lead to excessive use of network and storage resources; while manual image preloading, although it ensures that only required images are preloaded, will increase the workload. Therefore, it is worth exploring how to preload the images required for each K8s node in a targeted manner.
[0055] During the image pull process, when an image pull operation is performed (such as the docker pull command), Docker performs the following steps:
[0056] First, Docker will pull the image's manifest from the image repository. The manifest is a JSON file that contains some key information about the image, such as the image's layers, the size of each layer, and the digest.
[0057] Then, Docker will pull each layer of the image from the image repository based on the information in the manifest. Each layer is an independent file that contains part of the image content.
[0058] Finally, Docker combines all the pulled image layers together to form a complete image.
[0059] Therefore, the image pulling process can be simply understood as pulling the Docker Manifest and Docker image layers. Usually, the Docker Manifest is a small JSON file that contains relevant information about the Docker image layer. Therefore, image preloading can obtain the associated information of the image layer file by analyzing the Docker Manifest file. Based on this associated information, the required image layer can be preloaded for each K8s node in a targeted manner.
[0060] According to the above analysis, an embodiment of the present invention proposes a method for preloading images. Compared with full image preloading, by analyzing the existing Docker Manifest file, the association information between image layers is obtained, and a complex network model of image layer files is constructed accordingly. According to the model, a list of associated image layers and a list of hot image layers are formed to achieve targeted preloading of image layer files for user nodes. This method can not only ensure the stability of application deployment in the node, but also improve deployment efficiency and save storage space. In general, this is an efficient and practical image preloading strategy.
[0061] According to an embodiment of the present invention, an embodiment of an image preloading method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0062] In this embodiment, a method for preloading an image is provided, which can be used for mobile terminals such as computers, and can be specifically applied to a controller deployed on the side of a general image warehouse. The general image warehouse is an image warehouse deployed in a large resource pool, which is responsible for storing all images pushed by each user resource pool, and the controller pushes preloaded image layers to different user-side image warehouses according to the policy. The user-side image warehouse is an image warehouse deployed in the same resource pool as the user. The controller receives the Manifest file sent from the general image warehouse, analyzes the image layer association information, and updates the complex network model; maintains a list of hot image layers, and regularly pushes hot image layers to the user-side image warehouse; forms a user-specific list of associated image layers, and regularly pushes associated image layers to the user-side image warehouse.
[0063] like Figure 1 As shown, the image preloading method of the embodiment of the present invention includes the following steps:
[0064] Step S101, obtaining an image layer description file corresponding to an image that a user has pushed or requested to pull.
[0065] Specifically, when a user pushes an image, it is first pushed to the user-side image repository through the agent, and an image push task is created. The image is pushed to the remote general image repository during idle time. When a new image is pushed to the general image repository, the Manifest file of the image, that is, the image layer description file, is pushed to the controller.
[0066] When a user pulls an image, the user first accesses the image repository on the user side through the proxy. If the required image layer exists, it is directly pulled. If the image repository in the same resource pool does not have the required image, the remote total image repository is accessed to pull it, and the image layer description file of the image is pushed to the controller;
[0067] In this way, the controller can accept and obtain the image layer description file corresponding to the image that the user has pushed or requested to pull.
[0068] Step S102, obtaining association information between image layers according to the image layer description file.
[0069] Specifically, the controller analyzes the received image layer description file and extracts the associated information of the included image layers.
[0070] The associated information contains some key information about the image, such as the image layers, the size of each layer, and the summary. These image layers are in a certain order and are listed from top to bottom, with the earliest image layer at the bottom and the most recent image layer at the top.
[0071] Step S103: Generate a hotspot image layer list and an associated image layer list according to the associated information.
[0072] Specifically, the extracted association information is added to the complex network model. The complex network model is an abstract model for understanding complex systems in the real world. It abstracts the entities in the complex system into nodes and the relationships between the entities into lines. These network models can be used to describe a large number of complex systems in nature. The main research methods of complex network models are based on the theories and methods of graph theory. They can analyze the degree of association between each mirror layer according to the association information of the mirror layer and calculate various graph theory indicators, such as node out-degree, node in-degree and betweenness centrality.
[0073] According to the degree of association between each image layer, a list of associated image layers is generated, and a list of hot image layers is calculated based on indicators such as node out-degree, node in-degree, and betweenness centrality.
[0074] Step S104: Push preloaded image layers to the user based on the hotspot image layer list and the associated image layer list.
[0075] Specifically, the number of image layers pushed in the hot image layer list and the associated image layer list is set according to the size of the user's cache space, and the image layers in the hot image layer list and the associated image layer list are pushed to the user at a regular interval.
[0076] An image preloading method according to an embodiment of the present invention obtains an image layer description file corresponding to an image pushed or requested to be pulled by a user, obtains association information between image layers according to the image layer description file, generates a hot image layer list and an associated image layer list according to the association information, and pushes a preloaded image layer to the user based on the hot image layer list and the associated image layer list. The pushed image layer is obtained according to the association information in the image layer description file corresponding to the image pushed or requested to be pulled by the user. The image layer that the user may need can be predicted, so that the preloaded image layer is targeted, the utilization rate of the preloaded image layer is improved, and efficient preloading is achieved, thereby reducing the user's waiting time and improving the user experience.
[0077] In an embodiment of the present invention, a method for preloading an image is provided. Figure 2 As shown, the process includes the following steps:
[0078] Step S201, obtain the image layer description file corresponding to the image that the user has pushed or requested to pull. For details, see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0079] Step S202, obtain the association information between image layers according to the image layer description file. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0080] Step S203: Generate a hotspot image layer list and an associated image layer list according to the associated information.
[0081] Specifically, step S203 includes:
[0082] Step S2031, constructing an image directed graph according to the association information, wherein the nodes of the image directed graph are image layers, and the connecting edges of the image directed graph indicate that the two connected image layers appear in the same image layer description file.
[0083] Specifically, the image layer is a node of the image directed graph, and the connecting edge indicates that the two image layers connected by it appear in the same image layer description file, and the direction of the connecting line is set according to the order in which the two image layers appear in the image layer description file, for example, the later image layer points to the earlier image layer.
[0084] Step S2032, generating a hotspot image layer list according to the image directed graph.
[0085] Specifically, step S2032 includes:
[0086] Step a1, calculate the node initial degree, node in-degree and betweenness centrality according to the mirror directed graph.
[0087] The out-degree of a node refers to the number of edges that originate from that node. In a directed network, the out-degree represents the number of connections that a node sends to other nodes. In the mirror directed graph G(V,E), V is the set of nodes and E is the set of edges. The out-degree of node A can be obtained by calculating the number of its outgoing edges, using d out (A) indicates.
[0088] The out-degree calculation formula of node A is:
[0089] d out (A)=|(A,B)∈E|
[0090] The in-degree of a node is the number of edges pointing to that node. In a directed network, the in-degree represents the number of connections a node receives.
[0091] Similar to the out-degree, the in-degree of node A can be obtained by counting the number of incoming edges pointing to it, using d in (A) indicates.
[0092] The in-degree calculation formula of node A is:
[0093] d in (A)=|(B,A)∈E|
[0094] Betweenness centrality is used to measure the importance of a node as a "bridge" between other nodes in the network. A high betweenness centrality of a node indicates that it is able to connect many shortest paths in the network, which usually reflects the criticality of the node in information dissemination or control. For each pair of nodes s and t, find all the shortest paths from node s to node t. If node A is on these shortest paths, then its weight will increase. Finally, add up the number of times all nodes appear in the shortest paths to get the betweenness centrality of node A.
[0095] The calculation formula of the betweenness centrality of node A is:
[0096]
[0097] Among them, C B (A) is the betweenness centrality of node A. σ st is the total number of shortest paths from node s to node t. st (A) is the number of shortest paths involving node A.
[0098] Step a2, calculate the heat score based on the node initial degree, node in-degree and betweenness centrality.
[0099] Specifically, corresponding weights are set for the node initial degree, node in-degree and betweenness centrality, and weighted calculations are performed based on the node initial degree, node in-degree and betweenness centrality to obtain the heat score.
[0100] Step a3, sorting by heat score to obtain a hotspot image layer list.
[0101] The order of the hot image layer list indicates the ranking of the popularity score. The higher the popularity score, the higher the image layer is in the hot image layer list.
[0102] By calculating the initial degree, in-degree, and betweenness centrality of a node, you can more scientifically evaluate the popularity of the image layer and ensure that the preloaded image layer is the one that users are most likely to need.
[0103] Step S2033: Determine an associated image layer list according to the image directed graph and the current image layer of the user-side image repository.
[0104] Specifically, step S2033 includes:
[0105] Step b1, obtaining an image layer that is connected to the current image layer of the user-side image repository according to the image directed graph.
[0106] Specifically, the controller periodically obtains the current image layer of the image warehouse on the user side, finds the node corresponding to the current image layer of the image warehouse on the user side in the image directed graph, and finds the image layer associated with it.
[0107] Step b2: Calculate the correlation strength of the target image layer that is connected to the current image layer of the user-side image repository.
[0108] Specifically, an image layer description file is represented by an independent image directed graph. All nodes in an image directed graph are connected in the order in which they appear in the image layer description file. All image layers in the same image layer description file have a connection relationship. The correlation strength between image layers indicates the probability of appearing in the same image layer description file at the same time.
[0109] Further, step b2 comprises:
[0110] Step b21, obtaining the first number of times the target image layer appears in the image directed graph, and the second number of times the target image layer and any image layer in the current image layer of the user-side image repository simultaneously appear in the same image directed graph;
[0111] Step b22, calculating the probability that any one of the target image layer and the current image layer of the user-side image repository appears in an image directed graph at the same time according to the first number and the second number;
[0112] Step b23: determining the correlation strength of the target image layer based on the correlation probability.
[0113] Specifically, the second number is divided by the first number to obtain the correlation probability that any image layer of the target image layer and the current image layer of the user-side image repository simultaneously appears in an image directed graph. The correlation probability of each image layer of the current image layer and the target image layer is calculated in turn, and all the obtained correlation probabilities are added together to obtain the correlation strength.
[0114] Step b3, sorting according to the magnitude of the correlation strength to obtain a list of associated image layers.
[0115] By calculating the correlation probability and then obtaining the correlation strength, the correlation between image layers can be evaluated more accurately, so that related image layers can be pushed more accurately, improving the efficiency and accuracy of preloading.
[0116] Step S204: Push preloaded image layers to the user based on the hot image layer list and the associated image layer list. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0117] An image preloading method according to an embodiment of the present invention can more intuitively represent the relationship between image layers through an image directed graph, which is convenient for analysis and processing, and can more accurately determine which image layers are hot spots or are associated with the image layers currently used by the user.
[0118] In an embodiment of the present invention, a method for preloading an image is provided. Figure 3 As shown, the process includes the following steps:
[0119] Step S301, obtain the image layer description file corresponding to the image that the user has pushed or requested to pull. For details, see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0120] Step S302, obtain the association information between image layers according to the image layer description file. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0121] Step S303: Generate a hotspot image layer list and an associated image layer list according to the associated information. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0122] Step S304: Push preloaded image layers to the user based on the hotspot image layer list and the associated image layer list.
[0123] Specifically, step S304 includes:
[0124] Step S3041: Pushing an image layer that is before a first preset ranking in a hot image layer list to a user-side image repository at a first preset time interval.
[0125] Step S3042: Obtain the current image layer of the user-side image repository at a second preset time interval, update the associated image layer list according to the current image layer of the user-side image repository, and push the image layer in the associated image layer list that is before the second preset ranking to the user-side image repository.
[0126] Specifically, during the idle period of the controller, the controller pushes the image layer according to the hotspot image layer list and the associated image layer list, and the user-side image repository preloads the pushed image layer.
[0127] The first preset time and the second preset time can be set according to actual conditions, and the first preset ranking and the second preset ranking can be set according to the cache size of the user-side image repository. For example, the first preset ranking and the second preset ranking are both set to 1000.
[0128] By regularly pushing and dynamically updating the list of associated image layers, it is possible to ensure that the preloaded image layers are always synchronized with user needs, thereby improving the timeliness and effectiveness of preloading.
[0129] The embodiment of the present invention also provides an image preloading system, such as Figure 4 As shown, the system includes:
[0130] The main image repository is used to store images pushed by users and send image layer description files to the controller when users push or request to pull images;
[0131] User-side image repository, used to cache image layers preloaded by users;
[0132] The controller is used to execute the image preloading method in the above embodiment.
[0133] Specifically, the controller adds the extracted association information to the complex network model. The complex network model uses the image layer as a node, the connecting edge indicates the existence of the association between the image layers, and the correlation strength indicates the strength of the association between the image layers. The complex network model also provides indicators such as node out-degree, in-degree, and betweenness centrality. By calculating indicators such as correlation strength, node out-degree, in-degree, and betweenness centrality, the controller can form a list of associated image layers and a list of hotspot image layers.
[0134] The image preloading system can realize three functional scenarios: image push, image pull, and idle period.
[0135] Image push:
[0136] (1) When a user pushes an image, it is first pushed to the user-side image repository through a proxy, and an image push task is created to push the image to the remote general image repository during idle time.
[0137] (2) When a new image is pushed to the remote main image repository, the manifest file of the image, i.e. the image layer description file, is pushed to the controller;
[0138] (3) The controller analyzes the image layer description file, extracts the associated information of the included image layers, and adds it to the complex network model;
[0139] (4) The controller obtains the hotspot image layer from the complex network model and updates the hotspot image layer list.
[0140] Image pull:
[0141] (1) When a user pulls an image, the user first accesses the image repository on the user side through a proxy. If the required image layer exists, it is directly pulled;
[0142] (2) If the required image does not exist in the image repository in the same resource pool, access the remote image repository to pull it, and push the image layer description file of the image to the controller;
[0143] (3) The controller analyzes the image layer description file, extracts the associated information of the included image layers, and adds it to the complex network model;
[0144] (4) The controller obtains the hotspot image layer from the complex network model and updates the hotspot image layer list.
[0145] Free time:
[0146] (1) The controller pushes the hotspot image layer to the user-side image warehouse at regular intervals based on the hotspot image layer list;
[0147] (2) The controller periodically obtains the existing image layers from the user-side image repository, finds the image layers with greater correlation with the existing image layers, and pushes them.
[0148] The embodiment of the present invention also provides an image preloading device, such as Figure 5 As shown, including:
[0149] The description file acquisition module 501 is used to obtain the image layer description file corresponding to the image that the user has pushed or requested to pull;
[0150] The association information extraction module 502 is used to obtain the association information between image layers according to the image layer description file;
[0151] An image layer list generating module 503 is used to generate a hotspot image layer list and an associated image layer list according to the associated information;
[0152] The image layer push module 504 is used to push the preloaded image layer to the user based on the hot image layer list and the associated image layer list.
[0153] The image preloading device of the embodiment of the present invention obtains the image layer description file corresponding to the image pushed or requested to be pulled by the user, obtains the association information between the image layers according to the image layer description file, generates a hot image layer list and an associated image layer list according to the association information, and pushes the preloaded image layer to the user based on the hot image layer list and the associated image layer list. The pushed image layer is obtained according to the association information in the image layer description file corresponding to the image pushed or requested to be pulled by the user. The image layer that the user may need can be predicted, so that the preloaded image layer is targeted, the utilization rate of the preloaded image layer is improved, and efficient preloading is achieved, thereby reducing the user's waiting time and improving the user experience.
[0154] Furthermore, the image layer list generation module 503 includes:
[0155] A directed graph construction module is used to construct an image directed graph according to the associated information. The nodes of the image directed graph are image layers. The connection edges of the image directed graph indicate that the two connected image layers appear in the same image layer description file.
[0156] A hotspot image layer list generation module is used to generate a hotspot image layer list according to an image directed graph;
[0157] The associated image layer list generation module is used to determine the associated image layer list according to the image directed graph and the current image layer of the user-side image repository.
[0158] Furthermore, the hotspot image layer list generation module includes:
[0159] The indicator calculation module is used to calculate the node initial degree, node in-degree and betweenness centrality based on the mirror directed graph;
[0160] The heat score calculation module is used to calculate the heat score based on the node initial degree, node in-degree and betweenness centrality;
[0161] The heat score sorting module is used to sort according to the heat score to obtain a list of hot image layers.
[0162] Furthermore, the associated image layer list generation module includes:
[0163] A connection image layer acquisition module is used to acquire an image layer that is connected to the current image layer of the user-side image repository according to the image directed graph;
[0164] A correlation strength calculation module is used to calculate the correlation strength of a target image layer that is connected to the current image layer of the user-side image repository;
[0165] The correlation strength sorting module is used to sort according to the size of the correlation strength to obtain a list of associated image layers.
[0166] Furthermore, the correlation strength calculation module includes:
[0167] A frequency statistics module is used to obtain the first number of times the target image layer appears in the image directed graph, and the second number of times the target image layer and any image layer in the current image layer of the user-side image repository appear in the same image directed graph at the same time;
[0168] A correlation probability calculation module, used to calculate the correlation probability that any one of the target image layer and the current image layer of the user-side image warehouse appears in an image directed graph at the same time according to the first number and the second number;
[0169] The correlation strength determination module is used to determine the correlation strength of the target image layer based on the correlation probability.
[0170] Furthermore, the image layer push module 504 includes:
[0171] A hotspot image layer push module, configured to push an image layer in the hotspot image layer list that is before a first preset ranking to a user-side image repository at a first preset interval;
[0172] The associated image layer push module is used to obtain the current image layer of the user-side image warehouse every second preset time, update the associated image layer list according to the current image layer of the user-side image warehouse, and push the image layer in the associated image layer list that is before the second preset ranking to the user-side image warehouse.
[0173] The embodiment of the present invention also provides a schematic diagram of the structure of a computer device, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0174] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0175] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0176] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0177] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0178] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0179] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0180] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0181] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0182] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope of protection.
Claims
1. A method for preloading an image, characterized in that: include: Get the image layer description file corresponding to the image that the user has pushed or requested to pull; Acquire association information between image layers according to the image layer description file; Generate a hotspot image layer list and an associated image layer list according to the associated information; The preloaded image layer is pushed to the user based on the hotspot image layer list and the associated image layer list.
2. The image preloading method according to claim 1, characterized in that: The generating of the hotspot image layer list and the associated image layer list according to the associated information includes: Constructing an image directed graph according to the association information, wherein the nodes of the image directed graph are image layers, and the connecting edges of the image directed graph indicate that the two connected image layers appear in the same image layer description file; Generate a hotspot image layer list according to the image directed graph; Determine an associated image layer list according to the image directed graph and the current image layer of the user-side image repository.
3. The image preloading method according to claim 2, characterized in that: The generating a hotspot image layer list according to the image directed graph includes: Calculating node initial degree, node in-degree and betweenness centrality according to the mirror directed graph; A heat score is obtained by calculating according to the node initial degree, the node in-degree and the betweenness centrality; The hotspot image layer list is obtained by sorting the layers according to the heat scores.
4. The image preloading method according to claim 2, characterized in that: The determining of the associated image layer list according to the image directed graph and the current image layer of the user-side image repository includes: Acquire, according to the image directed graph, an image layer that is connected to the current image layer of the user-side image repository; Calculate the correlation strength of the target image layer that is connected to the current image layer of the user-side image repository; The associated image layer list is obtained by sorting the layers according to the magnitude of the correlation strength.
5. The image preloading method according to claim 4, characterized in that: The calculating the correlation strength of the target image layer that is connected to the current image layer of the user-side image repository includes: Obtain the first number of times the target image layer appears in the image directed graph, and the second number of times the target image layer and any image layer in the current image layer of the user-side image repository appear in the image directed graph at the same time; Calculate the probability that any one of the target image layer and the current image layer of the user-side image repository appears in the image directed graph at the same time according to the first number and the second number; A correlation strength of the target image layer is determined based on the correlation probability.
6. The image preloading method according to claim 1, characterized in that: The pushing of the preloaded image layer to the user based on the hotspot image layer list and the associated image layer list includes: Pushing the image layer in the hot image layer list that is before the first preset ranking to the user-side image repository at a first preset time interval; The current image layer of the user-side image warehouse is obtained every second preset time, the associated image layer list is updated according to the current image layer of the user-side image warehouse, and the image layer in the associated image layer list that is before the second preset ranking is pushed to the user-side image warehouse.
7. An image preloading device, characterized in that: include: The description file acquisition module is used to obtain the image layer description file corresponding to the image that the user has pushed or requested to pull; An associated information extraction module, used to obtain associated information between image layers according to the image layer description file; An image layer list generation module, used to generate a hotspot image layer list and an associated image layer list according to the associated information; The image layer push module is used to push the preloaded image layer to the user based on the hot image layer list and the associated image layer list.
8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the image preloading method according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the image preloading method according to any one of claims 1 to 6.
10. An image preloading system, characterized in that: include: The main image repository is used to store images pushed by users and send image layer description files to the controller when users push or request to pull images; User-side image repository, used to cache image layers preloaded by users; The controller is used to execute the image preloading method according to any one of claims 1 to 6.