Mirror pulling method and related products
Patent Information
- Application Number
- CN202080099553.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-20
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2040-05-20
AI Technical Summary
但是,Harbor的镜像复制功能无法感知所在机房内的应用镜像使用情况,会造成无意义的镜像复制,浪费网络带宽及磁盘空间
Smart Images

Figure CN115380269B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, specifically to an image retrieval method and related products. Background Technology
[0002] Harbor's policy-based Docker image replication function can synchronize images across different data centers and operating environments, and provides a user-friendly management interface, greatly simplifying image management in actual operation and maintenance. However, Harbor's image replication function cannot detect the application image usage within the same data center, resulting in meaningless image replication and wasting network bandwidth and disk space. Summary of the Invention
[0003] This application provides an image retrieval method and related products, which can detect the usage of application images in the data center and retrieve images based on the usage of application images in the data center, thereby saving network bandwidth and disk space.
[0004] In a first aspect, this application provides a mirror fetching method applied to a cached proxy repository, comprising:
[0005] The system receives image pull requests initiated by the target cluster. The cache proxy repository is located in the image distribution system, which also includes a central image repository and a message center. The cache proxy repository is located in the target data center, which also includes the target cluster.
[0006] Detect whether the image fetch request hits the preset cache;
[0007] When the image fetch request hits the preset cache, the content that the image fetch request needs to fetch is fetched from the preset cache;
[0008] When the image retrieval request fails to hit the preset cache, the content required by the image retrieval request is retrieved from the central image repository and stored in the preset cache.
[0009] Secondly, embodiments of this application provide a mirror retrieval device applied to a cache proxy repository. The device includes: a receiving unit, a detection unit, and a mirror retrieval unit, wherein...
[0010] The receiving unit is used to receive image pull requests, which are initiated by the target cluster. The cache proxy repository is located in the image distribution system, which also includes a central image repository and a message center. The cache proxy repository is located in the target data center, which also includes the target cluster.
[0011] The detection unit is used to detect whether the image fetch request hits the preset cache;
[0012] The image retrieval unit is used to retrieve the content that the image retrieval request needs to retrieve from the preset cache when the image retrieval request hits the preset cache;
[0013] The image retrieval unit is also used to retrieve the content that the image retrieval request needs to retrieve from the central image repository when the image retrieval request fails to hit the preset cache, and save it in the preset cache.
[0014] Thirdly, embodiments of this application provide a server, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for performing the steps in the first aspect of embodiments of this application.
[0015] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program for electronic data interchange, wherein the computer program causes a computer to perform some or all of the steps described in the first aspect of embodiments of this application.
[0016] Fifthly, embodiments of this application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps described in the first aspect of embodiments of this application. The computer program product may be a software installation package. Attached Figure Description
[0017] The accompanying drawings used in the description of the embodiments or prior art will be briefly introduced below.
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1A This is a schematic diagram of the structure of a server provided in an embodiment of this application;
[0020] Figure 1B This application provides an embodiment of the architecture diagram for implementing the mirror pull method;
[0021] Figure 1CThis is a flowchart illustrating a mirror retrieval method disclosed in an embodiment of this application;
[0022] Figure 2 This is a flowchart illustrating another image retrieval method disclosed in an embodiment of this application;
[0023] Figure 3 This is a schematic diagram of another server structure disclosed in an embodiment of this application;
[0024] Figure 4A This is a schematic diagram of the structure of a mirror pull-out device disclosed in an embodiment of this application;
[0025] Figure 4B This is a schematic diagram of another mirror pull device disclosed in the embodiments of this application. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0027] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0028] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0029] The cache proxy repository involved in the embodiments of this application can be a server or can be set on a server.
[0030] The embodiments of this application will be described in detail below.
[0031] Please see Figure 1A, Figure 1A This is a schematic diagram of a server structure disclosed in an embodiment of this application. The server 100 may include a control circuit, which may include a storage and processing circuit 110. The storage and processing circuit 110 may be a memory, such as a hard disk drive, non-volatile memory (e.g., flash memory or other electronically programmable read-only memory used to form a solid-state drive), volatile memory (e.g., static or dynamic random access memory), etc., and this embodiment of the application is not limited thereto. The processing circuit in the storage and processing circuit 110 can be used to control the operation of the server 100. This processing circuit can be implemented based on one or more microprocessors, microcontrollers, baseband processors, power management units, audio codec chips, application-specific integrated circuits, display driver integrated circuits, etc.
[0032] The storage and processing circuitry 110 can be used to run software in the server 100, such as internet browsing applications, Voice over Internet Protocol (VoIP) telephone calling applications, email applications, media playback applications, operating system functions, etc. This software can be used to perform various control operations, such as image acquisition based on a camera, ambient light measurement based on an ambient light sensor, proximity sensor measurement based on a proximity sensor, information display functions based on status indicators such as LED status lights, touch event detection based on a touch sensor, functions associated with displaying information on multiple (e.g., layered) displays, operations associated with performing wireless communication functions, operations associated with collecting and generating audio signals, control operations associated with collecting and processing button press event data, and other functions in the server 100, etc., which are not limited in the embodiments of this application.
[0033] Server 100 may also include input-output circuitry 150. Input-output circuitry 150 enables server 100 to input and output data, allowing server 100 to receive data from external devices and also allowing server 100 to output data from server 100 to external devices. Input-output circuitry 150 may further include sensors 170. Sensors 170 may include ambient light sensors, light- and capacitance-based proximity sensors, touch sensors (e.g., light-based touch sensors and / or capacitive touch sensors, wherein the touch sensor may be part of a touch display or used independently as a touch sensor structure), accelerometers, gravity sensors, and other sensors, etc.
[0034] The input-output circuit 150 may also include one or more displays, such as display 130. Display 130 may include one or more of the following: liquid crystal display, organic light-emitting diode display, electronic ink display, plasma display, and displays using other display technologies. Display 130 may include a touch sensor array (i.e., display 130 may be a touch screen). The touch sensor may be a capacitive touch sensor formed by an array of transparent touch sensor electrodes (e.g., indium tin oxide (ITO) electrodes), or it may be a touch sensor formed using other touch technologies, such as acoustic touch, pressure-sensitive touch, resistive touch, optical touch, etc., which are not limited in the embodiments of this application.
[0035] Audio component 140 can be used to provide audio input and output functionality for server 100. Audio component 140 in server 100 may include speakers, microphones, buzzers, tone generators, and other components for generating and detecting sound.
[0036] Communication circuitry 120 can be used to provide server 100 with the ability to communicate with external devices. Communication circuitry 120 may include analog and digital input-output interface circuitry, and wireless communication circuitry based on radio frequency signals and / or optical signals. The wireless communication circuitry in communication circuitry 120 may include radio frequency transceiver circuitry, power amplifier circuitry, low-noise amplifier, switches, filters, and antennas. For example, the wireless communication circuitry in communication circuitry 120 may include circuitry for supporting near-field communication (NFC) by transmitting and receiving near-field coupled electromagnetic signals. For example, communication circuitry 120 may include a near-field communication antenna and a near-field communication transceiver. Communication circuitry 120 may also include cellular telephone transceivers and antennas, wireless LAN transceiver circuitry and antennas, etc.
[0037] Server 100 may further include a battery, power management circuitry, and other input-output units 160. Input-output units 160 may include buttons, joysticks, click wheels, scroll wheels, touchpads, keypads, keyboards, cameras, LEDs, and other status indicators.
[0038] Users can input commands through the input-output circuit 150 to control the operation of the server 100, and can use the output data of the input-output circuit 150 to receive status information and other outputs from the server 100.
[0039] Based on this, please refer to Figure 1B , Figure 1BThis application provides a system architecture for implementing the methods described in its embodiments. The methods can be applied to a cache proxy repository, which can be hosted on a server within a cache distribution system. This system can include a central image repository, a message center, and N data centers (N being a positive integer). Each data center deploys one cache proxy repository. The central image repository stores all application images. When a client pushes an application image to the central image repository, the repository notifies the message center of the image. The image name includes the application name. The message center stores image push records and supports a real-time listening interface, through which clients can receive events indicating new image pushes in real time. The cache proxy repository serves image clients within the same data center, caching application images pulled on demand. The cache proxy repository also supports application-aware image preheating mechanisms (image preheating module) and image eviction mechanisms (image eviction module). It may also include a registry module. The cache proxy repository, central image repository, and message center can be hosted on different servers or platforms. Both the cache proxy repository and central image repository can have Docker image replication capabilities.
[0040] based on Figure 1B The system framework shown can implement the following method, which can be applied to any cache proxy repository, as follows:
[0041] The system receives image pull requests initiated by the target cluster. The cache proxy repository is located in the image distribution system, which also includes a central image repository and a message center. The cache proxy repository is located in the target data center, which also includes the target cluster.
[0042] Detect whether the image fetch request hits the preset cache;
[0043] When the image fetch request hits the preset cache, the content that the image fetch request needs to fetch is fetched from the preset cache;
[0044] When the image retrieval request fails to hit the preset cache, the content required by the image retrieval request is retrieved from the central image repository and stored in the preset cache.
[0045] As can be seen, the image retrieval method described in the above embodiments of this application is applied to a cache proxy repository, receives image retrieval requests initiated by the target cluster, the cache proxy repository is located in an image distribution system, the image distribution system also includes a central image repository and a message center, the cache proxy repository is located in a target data center, the target data center also includes a target cluster, detects whether the image retrieval request hits a preset cache, when the image retrieval request hits the preset cache, retrieves the content that the image retrieval request needs to retrieve from the preset cache, when the image retrieval request does not hit the preset cache, retrieves the content that the image retrieval request needs to retrieve from the central image repository and stores it in the preset cache, can perceive the application image usage in the data center, and implement image retrieval based on the application image usage in the data center, thus saving network bandwidth and disk space.
[0046] Please see Figure 1C , Figure 1C This is a flowchart illustrating a mirror retrieval method provided in an embodiment of this application. The mirror retrieval method described in this embodiment is applied to, for example... Figure 1A server or Figure 1B The system architecture shown includes the following image retrieval method:
[0047] 101. Receive image pull request, the image pull request is initiated by the target cluster, the cache proxy repository is located in the image distribution system, the image distribution system also includes a central image repository and a message center, the cache proxy repository is located in the target data center, the target data center also includes the target cluster.
[0048] In this embodiment, the target cluster can be any type of cluster; for example, the target cluster can be a Kubernetes (K8S) cluster. The image distribution system can include a central image repository, a message center, and multiple data centers. Each data center can include a cache proxy repository and a cluster (e.g., a K8S cluster). Both the cache proxy repository and the central image repository can be Harbor image repositories.
[0049] In practice, the cache proxy repository and the target cluster can be set up on the same server, or they can be set up on different servers. The cache proxy repository can receive image pull requests, which are initiated by the target cluster.
[0050] 102. Check whether the image fetch request hits the preset cache.
[0051] The preset cache can be a cache list or a cache region. For example, the preset cache can be set in the cache proxy repository or on the local disk (cache disk). The cache proxy repository can detect whether the image pull request hits the preset cache, which can be preset by the user or be the system default.
[0052] In one possible example, the cache proxy repository includes an image preheating module; step 102 above, detecting whether the image pull request hits the preset cache, may include the following steps:
[0053] 21. The image preheating module listens for image push events in the message center, whereby the image push event includes the image name;
[0054] 22. Parse the image name to obtain the target application name;
[0055] 23. Check whether the application corresponding to the target application name has been deployed in the target cluster of the target data center;
[0056] 24. If the application corresponding to the target application name has been deployed in the cluster of the target data center, confirm that the image pull request hits the preset cache;
[0057] 25. If the application corresponding to the target application name is not deployed in the cluster of the target data center, it is confirmed that the image pull request did not hit the preset cache.
[0058] The cache proxy repository can include an image preheating module, which is mainly used to listen for image push events in the message center.
[0059] In the specific implementation, the cache proxy repository can listen to the image push event in the message center through the image preheating module. The image push event can include the image name. Then, the image name can be parsed to obtain the target application name. It can be checked whether the application corresponding to the target application name has been deployed in the target cluster of the target data center. If the application corresponding to the target application name has been deployed in the cluster of the target data center, it can be confirmed that the image pull request has hit the preset cache. Conversely, if the application corresponding to the target application name has not been deployed in the cluster of the target data center, it can be confirmed that the image pull request has not hit the preset cache.
[0060] 103. When the image retrieval request hits the preset cache, retrieve the content that the image retrieval request needs to retrieve from the preset cache.
[0061] In the specific implementation, the cache proxy repository can retrieve the content that the image retrieval request needs to retrieve from the preset cache when the image retrieval request hits the preset cache.
[0062] 104. When the image retrieval request fails to hit the preset cache, retrieve the content required by the image retrieval request from the central image repository and save it in the preset cache.
[0063] In the specific implementation, when the image retrieval request fails to hit the preset cache, the cache proxy repository can retrieve the content that the image retrieval request needs from the central image repository and save it in the preset cache.
[0064] In this embodiment, multi-datacenter image synchronization can be achieved through the Harbor image repository. Harbor supports image replication, which allows images to be actively replicated to Harbor in other datacenters.
[0065] In one possible embodiment, the cache proxy repository further includes a mirror eviction module, and the following steps may be included before or after any of steps 101-104 above:
[0066] A1. Obtain the first cache disk usage rate;
[0067] A2. When the usage rate of the first cache disk exceeds a preset threshold, execute the image cleanup task.
[0068] The aforementioned preset threshold can be set by the user or by the system default. In the specific implementation, the cache proxy repository can obtain the first cache disk usage rate of the cache disk. If the disk usage rate is too high, it needs to be cleaned up. Therefore, when the first cache disk usage rate is greater than the preset threshold, the image cleanup task can be executed. Conversely, when the first cache disk usage rate is less than or equal to the preset threshold, it means that the disk cache space is sufficient, and the image cleanup task can be terminated.
[0069] In one possible example, step A2 above, performing the image cleanup task, may include the following steps:
[0070] A21. Detect whether image i in the preset cache is deployed in the target cluster with an application associated with image i, where image i is any image in the preset cache;
[0071] A22. If yes, retain image i; otherwise, delete image i.
[0072] In the specific implementation, taking image i as an example, image i is any image in the preset cache. The cache proxy repository can detect whether the image i in the preset cache has deployed an application associated with image i in the target cluster. If so, image i can be retained; otherwise, image i can be deleted. In this way, disk usage can be reduced.
[0073] Furthermore, in one possible embodiment, after step A2 above, the following steps may also be included:
[0074] A3. Obtain the second cache disk usage rate;
[0075] A4. When the usage rate of the second cache disk is less than or equal to the preset threshold, the image cleanup task is terminated.
[0076] After the image cleanup task is executed, the cache proxy repository can obtain the second cache disk usage rate of the cache disk. When the second cache disk usage rate is less than or equal to the preset threshold, it indicates that the disk cache space is sufficient, and the image cleanup task can be terminated.
[0077] Furthermore, in a possible example, after step A3 above, the following steps may also be included:
[0078] A4. When the second cache disk usage rate is greater than the preset threshold, obtain the application list;
[0079] A5. Retain the images that are currently in use in the application list;
[0080] A6. Delete images from the application list that are not currently in use and whose versions are lower than the preset version.
[0081] In practice, the preset version can be set by the user or be the system default. When the second cache disk usage exceeds the preset threshold, the cache proxy repository can obtain the application list. Instead of retaining the images currently in use in the application list, it can delete images with versions lower than the preset version from the images not currently in use. This way, it can retain images that are not currently in use and have lower versions.
[0082] Furthermore, in a possible example, after step A6 above, the following steps may also be included:
[0083] A7. Obtain the disk usage rate of the third cache;
[0084] A8. When the usage rate of the third cache disk exceeds the preset threshold, delete all unused images in the application list.
[0085] In practice, the cache proxy repository can obtain the third cache disk usage rate of the cache disk. When the third cache disk usage rate is greater than a preset threshold, all unused images in the application list can be deleted, thus freeing up as much free disk space as possible.
[0086] Furthermore, in a possible example, after step A7 above, the following steps may also be included:
[0087] A9. When the usage rate of the third cache disk is less than or equal to the preset threshold, the execution of the image cleanup task is terminated.
[0088] In practice, the cache proxy repository can terminate the image cleanup task when the disk usage of the third cache is less than or equal to a preset threshold, indicating that there is sufficient disk space.
[0089] Furthermore, in one possible example, after step A8 above, the following steps may also be included.
[0090] A10. Obtain the disk usage rate of the fourth cache;
[0091] A11. When the usage rate of the fourth cache disk exceeds the preset threshold, an alarm operation is triggered.
[0092] In the specific implementation, the cache proxy repository can obtain the fourth cache disk usage rate of the cache disk. When the fourth cache disk usage rate is greater than the preset threshold, an alarm operation can be triggered. The alarm operation can be at least one of the following: voice prompt, vibration prompt, sending information to a specified device, etc., without limitation. Conversely, when the fourth cache disk usage rate is less than or equal to the preset threshold, it means that the disk space is sufficient, and the image cleanup task can be terminated.
[0093] The above embodiments of this application provide a method for cross-datacenter image retrieval, a caching acceleration method, an image preheating method, and an image eviction mechanism. Cross-datacenter retrieval, especially overseas datacenters, is often slow due to limited network bandwidth between datacenters, particularly under high-concurrency image retrieval. By using an application-aware image distribution system, image caching proxy repositories are deployed in each datacenter. Image clients in each datacenter retrieve images from the nearest proxy repository in their respective datacenter; if an image is not found there, the proxy retrieves it from the central repository. Combined with the application-aware image preheating mechanism, this effectively solves the image retrieval efficiency problem caused by bandwidth limitations across multiple datacenters, thereby significantly improving application deployment efficiency.
[0094] In practice, the cache proxy repository can support on-demand image retrieval, effectively distributing the load of the central repository and improving image retrieval efficiency. In addition, it can improve the efficiency of the first image retrieval based on the application-aware image preheating method, and ensure a high cache hit rate while ensuring disk utilization based on the application-aware image eviction mechanism.
[0095] For example, the image preheating module can listen for image push events in the message center in real time. The image push event can contain the name of the newly pushed image. When the image push event is heard, the application name can be obtained by parsing the image name, and the application can be queried to see if it is deployed in the Kubernetes cluster in the local data center. If it is deployed, the corresponding content of the image is pulled into the cache in advance; otherwise, the event is ignored.
[0096] Additionally, the image eviction module can periodically check cache disk usage. When the usage reaches a preset threshold (e.g., 80%), it can initiate an image cleanup task to free up disk space. For example, in the first scan, it checks if each image in the cache has an application deployed in the local Kubernetes cluster. If so, the image is retained; otherwise, it is deleted. Further, it checks if the disk space is below a preset threshold. If so, the cleanup task ends; otherwise, a second scan is performed. In the second scan, it queries the list of all applications deployed in the local data center via the Kubernetes API. For each application, it retains a maximum of N (e.g., N=3) latest version images, prioritizing those currently in use. The remaining image versions are deleted, and the disk space is checked again. If so, the cleanup task ends; otherwise, a third scan is performed. In the third scan, all unused images are deleted, and the disk space is checked again. If so, the cleanup task ends. Otherwise, an alarm is triggered, requiring manual intervention.
[0097] In one possible example, steps 101-102 may also include the following steps:
[0098] B1. Obtain the user's target physiological state parameters;
[0099] B2. Determine the target emotion type corresponding to the target physiological state parameters;
[0100] B3. When the target emotion type is a preset emotion type, execute the step of detecting whether the image fetch request hits the preset cache.
[0101] In this embodiment, the physiological state parameters can be various parameters reflecting the user's physiological functions. These parameters can be at least one of the following: heart rate, blood pressure, blood temperature, blood lipid levels, blood glucose levels, thyroid hormone levels, adrenaline levels, platelet count, blood oxygen levels, etc., without limitation. The preset emotion type can be set by the user or by the system default. The preset emotion type can be at least one of the following: depressed, crying, calm, irritable, excited, melancholic, etc., without limitation.
[0102] In a specific implementation, the cached proxy repository can obtain the user's target physiological state parameters through a wearable device that can communicate with the cached proxy repository. Different physiological state parameters reflect the user's emotional type. The cached proxy repository can pre-store the mapping relationship between physiological state parameters and emotional types. Then, the target emotional type corresponding to the target physiological state parameter can be determined based on the mapping relationship. Then, if the target emotional type is the preset emotional type, step 102 can be executed; otherwise, step 102 can be omitted.
[0103] In one possible example, when the target physiological state parameter is a heart rate change curve over a specified time period, step B1 above, determining the target emotion type corresponding to the target physiological state parameter, can be implemented as follows:
[0104] B11. Sample the heart rate change curve to obtain multiple heart rate values;
[0105] B12. Calculate the average heart rate value by averaging the multiple heart rate values.
[0106] B13. Determine the target heart rate level corresponding to the average heart rate value;
[0107] B14. Determine the target first emotion value corresponding to the target heart rate level according to the preset mapping relationship between heart rate level and first emotion value;
[0108] B15. Perform a mean square error calculation based on the multiple heart rate values to obtain the target mean square error;
[0109] B16. Determine the target second emotion value corresponding to the target mean squared error according to the preset mapping relationship between the mean squared error and the second emotion value;
[0110] B17. According to the preset mapping relationship between heart rate levels and weight pairs, determine the target weight pair corresponding to the target heart rate level. The weight pair includes a first weight and a second weight. The first weight is the weight corresponding to the first emotion value, and the second weight is the weight corresponding to the second emotion value.
[0111] B18. Perform a weighted calculation based on the target first emotion value, the target second emotion value, and the target weight to obtain the final emotion value;
[0112] B19. Determine the target emotion type corresponding to the target emotion value according to the preset mapping relationship between emotion value and emotion type.
[0113] The specified time period can be set by the user or by system default. The cached proxy repository can pre-store preset mapping relationships between heart rate levels and first emotion values, preset mapping relationships between mean squared errors and second emotion values, preset mapping relationships between heart rate levels and weight pairs, and preset mapping relationships between emotion values and emotion types. The aforementioned weight pairs can include a first weight and a second weight, where the first weight is the weight corresponding to the first emotion value and the second weight is the weight corresponding to the second emotion value. The sum of the first weight and the second weight can be 1, and the values of both the first weight and the second weight are in the range of 0 to 1. In this embodiment, emotions can be assessed using heart rate change curves.
[0114] In specific implementation, the cached proxy repository can sample the heart rate change curve. The sampling method can be uniform sampling or random sampling to obtain multiple heart rate values. The average heart rate value can be obtained by averaging the multiple heart rate values. The cached proxy repository can pre-store the mapping relationship between heart rate values and heart rate levels. Then, the target heart rate level corresponding to the average heart rate value can be determined based on the mapping relationship. Furthermore, the target first emotion value corresponding to the target heart rate level can be determined according to the preset mapping relationship between heart rate levels and first emotion values. Furthermore, the target mean squared error can be calculated based on multiple heart rate values to obtain the target mean squared error. The target second emotion value corresponding to the target mean squared error can be determined according to the preset mapping relationship between the mean squared error and second emotion value.
[0115] Furthermore, the cached proxy repository can also determine the target weight pair corresponding to the target heart rate level according to the aforementioned preset mapping relationship between heart rate levels and weight pairs. This target weight pair can include a target first weight and a target second weight, where the target first weight is the weight corresponding to the target first emotion value, and the target second weight is the weight corresponding to the target second emotion value. Then, the cached proxy repository can perform a weighted calculation based on the target first emotion value, the target second emotion value, the target first weight, and the target second weight to obtain the final emotion value. The specific calculation formula is as follows:
[0116] Final Emotional Score = Target First Emotional Score * Target First Weight + Target Second Emotional Score * Target Second Weight
[0117] Furthermore, based on the aforementioned preset mapping relationship between emotion values and emotion types, the target emotion type corresponding to the target emotion value can be determined. Here, the average heart rate reflects the user's heart rate value, and the mean squared deviation of the heart rate reflects heart rate stability. By reflecting the user's emotion through these two dimensions—average heart rate and mean squared deviation—the user's emotion type can be accurately determined.
[0118] As can be seen, the image retrieval method described in the above embodiments of this application is applied to a cache proxy repository, receives image retrieval requests initiated by the target cluster, the cache proxy repository is located in an image distribution system, the image distribution system also includes a central image repository and a message center, the cache proxy repository is located in a target data center, the target data center also includes a target cluster, detects whether the image retrieval request hits a preset cache, when the image retrieval request hits the preset cache, retrieves the content that the image retrieval request needs to retrieve from the preset cache, when the image retrieval request does not hit the preset cache, retrieves the content that the image retrieval request needs to retrieve from the central image repository and stores it in the preset cache, can perceive the application image usage in the data center, and implement image retrieval based on the application image usage in the data center, thus saving network bandwidth and disk space.
[0119] Consistent with the above, please refer to Figure 2 , Figure 2 This is a flowchart illustrating another image retrieval method provided in this embodiment. The image retrieval method described in this embodiment is applied to, for example... Figure 1A server or Figure 1B The system architecture shown may include the following steps:
[0120] 201. Receive image pull request, the image pull request is initiated by the target cluster, the cache proxy repository is located in the image distribution system, the image distribution system also includes a central image repository and a message center, the cache proxy repository is located in the target data center, the target data center also includes the target cluster.
[0121] 202. Check whether the image fetch request hits the preset cache.
[0122] 203. When the image retrieval request hits the preset cache, retrieve the content that the image retrieval request needs to retrieve from the preset cache.
[0123] 204. When the image retrieval request fails to hit the preset cache, retrieve the content required by the image retrieval request from the central image repository and save it in the preset cache.
[0124] 205. Obtain the first cache disk usage rate.
[0125] 206. When the usage rate of the first cache disk exceeds a preset threshold, execute the image cleanup task.
[0126] 207. Obtain the second cache disk usage rate.
[0127] 208. When the usage rate of the second cache disk is less than or equal to the preset threshold, the image cleanup task is terminated.
[0128] 209. When the second cache disk usage rate is greater than the preset threshold, obtain the application list.
[0129] 210. Retain the images that are currently in use in the application list, and delete the images with versions lower than the preset version from the images that are not currently in use in the application list.
[0130] 211. Obtain the disk usage rate of the third cache.
[0131] 212. When the usage rate of the third cache disk exceeds the preset threshold, delete all applications that are not currently in use from the application list.
[0132] 213. When the usage rate of the third cache disk is less than or equal to the preset threshold, the execution of the image cleanup task is terminated.
[0133] 214. Obtain the disk usage rate of the fourth cache.
[0134] 215. When the usage rate of the fourth cache disk exceeds the preset threshold, an alarm operation is triggered.
[0135] The specific descriptions of steps 201-215 above can be found in [reference]. Figure 1C The mirror retrieval method shown will not be described in detail here.
[0136] As can be seen, the image retrieval method described in the embodiments of this application, applied to a cached proxy repository, can, on the one hand, detect the application image usage within a data center and retrieve images accordingly, thus saving network bandwidth and disk space. On the other hand, through an application-aware image distribution system, image cached proxy repositories are deployed in various data centers. Image clients in each data center retrieve images from the nearest proxy repository in their respective data center; if an image is not found there, the proxy retrieves it from the central repository. Combined with an application-aware image preheating mechanism, this effectively solves the image retrieval efficiency problem caused by bandwidth limitations in multiple data centers, thereby significantly improving application deployment efficiency.
[0137] The following is the apparatus for implementing the above mirroring method:
[0138] Consistent with the above, please refer to Figure 3 , Figure 3 This application provides a server comprising: a processor and a memory; and one or more programs stored in the memory and configured to be executed by the processor. A cached proxy repository is located on the server. The programs include instructions for performing the following steps:
[0139] The system receives image pull requests initiated by the target cluster. The cache proxy repository is located in the image distribution system, which also includes a central image repository and a message center. The cache proxy repository is located in the target data center, which also includes the target cluster.
[0140] Detect whether the image fetch request hits the preset cache;
[0141] When the image fetch request hits the preset cache, the content that the image fetch request needs to fetch is fetched from the preset cache;
[0142] When the image retrieval request fails to hit the preset cache, the content required by the image retrieval request is retrieved from the central image repository and stored in the preset cache.
[0143] As can be seen, the server described in the above embodiments of this application includes a cache proxy repository, receives image pull requests initiated by the target cluster, the cache proxy repository is located in the image distribution system, the image distribution system also includes a central image repository and a message center, the cache proxy repository is located in the target data center, the target data center also includes the target cluster, detects whether the image pull request hits the preset cache, when the image pull request hits the preset cache, pulls the content that the image pull request needs to pull from the preset cache, when the image pull request does not hit the preset cache, pulls the content that the image pull request needs to pull from the central image repository and saves it in the preset cache, can perceive the application image usage in the data center, and implement image pull based on the application image usage in the data center, thus saving network bandwidth and disk space.
[0144] In one possible example, the cache proxy repository includes an image preheating module; regarding the detection of whether the image pull request hits a preset cache, the program includes instructions for performing the following steps:
[0145] The image preheating module listens for image push events in the message center, and the image push event includes the image name;
[0146] The image name is parsed to obtain the target application name;
[0147] Detect whether the application corresponding to the target application name has been deployed in the target cluster of the target data center;
[0148] The application corresponding to the target application name has been deployed in the cluster of the target data center, confirming that the image pull request hits the preset cache;
[0149] If the application corresponding to the target application name is not deployed in the cluster of the target data center, it is confirmed that the image pull request did not hit the preset cache.
[0150] In one possible example, the cache proxy repository also includes a mirror eviction module, and the program also includes instructions for performing the following steps:
[0151] Get the first cache disk usage;
[0152] When the usage rate of the first cache disk exceeds a preset threshold, an image cleanup task is executed.
[0153] In one possible example, regarding the execution of the image cleanup task, the program includes instructions for performing the following steps:
[0154] Detect whether image i in the preset cache is deployed in the target cluster with an application associated with image i, where image i is any image in the preset cache;
[0155] If yes, retain image i; otherwise, delete image i.
[0156] In one possible example, the program also includes instructions for performing the following steps:
[0157] Get the second cache disk usage;
[0158] The image cleanup task ends when the usage rate of the second cache disk is less than or equal to the preset threshold.
[0159] In one possible example, the program also includes instructions for performing the following steps:
[0160] When the second cache disk usage exceeds the preset threshold, obtain the application list;
[0161] Retain the images that are currently in use from the application list;
[0162] Delete images from the application list that are not currently in use and whose versions are lower than the preset version.
[0163] In one possible example, the program also includes instructions for performing the following steps:
[0164] Get the third cache disk usage;
[0165] When the usage rate of the third cache disk exceeds the preset threshold, all unused images in the application list are deleted.
[0166] In one possible example, the program also includes instructions for performing the following steps:
[0167] When the usage rate of the third cache disk is less than or equal to the preset threshold, the image cleanup task is terminated.
[0168] In one possible example, the program also includes instructions for performing the following steps:
[0169] Get the fourth cache disk usage;
[0170] An alarm is triggered when the usage of the fourth cache disk exceeds the preset threshold.
[0171] Please see Figure 4A , Figure 4A This is a schematic diagram of a mirror pull device provided in this embodiment. This mirror pull device is applied to applications such as... Figure 1A The server shown or Figure 1B The system architecture shown is applied to a cache proxy repository. The device includes: a receiving unit 401, a detection unit 402, and a mirror pull unit 403, wherein...
[0172] The receiving unit 401 is used to receive image pull requests, which are initiated by the target cluster. The cache proxy repository is located in the image distribution system, which also includes a central image repository and a message center. The cache proxy repository is located in the target data center, which also includes the target cluster.
[0173] The detection unit 402 is used to detect whether the image fetch request hits the preset cache;
[0174] The image retrieval unit 403 is used to retrieve the content that the image retrieval request needs to retrieve from the preset cache when the image retrieval request hits the preset cache;
[0175] The image retrieval unit 403 is further configured to retrieve the content required by the image retrieval request from the central image repository and store it in the preset cache when the image retrieval request fails to hit the preset cache.
[0176] As can be seen, the image retrieval device described in the above embodiments of this application is applied to a cache proxy repository, receives image retrieval requests initiated by the target cluster, the cache proxy repository is located in the image distribution system, the image distribution system also includes a central image repository and a message center, the cache proxy repository is located in the target data center, the target data center also includes the target cluster, detects whether the image retrieval request hits the preset cache, when the image retrieval request hits the preset cache, retrieves the content that the image retrieval request needs to retrieve from the preset cache, when the image retrieval request does not hit the preset cache, retrieves the content that the image retrieval request needs to retrieve from the central image repository and saves it in the preset cache, can perceive the application image usage in the data center, and realize image retrieval based on the application image usage in the data center, thus saving network bandwidth and disk space.
[0177] In one possible example, the cache proxy repository includes an image preheating module; in detecting whether the image pull request hits the preset cache, the detection unit 402 is specifically used for:
[0178] The image preheating module listens for image push events in the message center, and the image push event includes the image name;
[0179] The image name is parsed to obtain the target application name;
[0180] Detect whether the application corresponding to the target application name has been deployed in the target cluster of the target data center;
[0181] The application corresponding to the target application name has been deployed in the cluster of the target data center, confirming that the image pull request hits the preset cache;
[0182] If the application corresponding to the target application name is not deployed in the cluster of the target data center, it is confirmed that the image pull request did not hit the preset cache.
[0183] In one possible example, the cache proxy repository also includes a mirror eviction module, such as... Figure 4B As shown, Figure 4B for Figure 4A Another variation of the mirror pull device shown, which is similar to Figure 4A In comparison, it's better to have: acquisition unit 404 and cleanup unit 405, where,
[0184] The acquisition unit 404 is used to acquire the first cache disk usage rate;
[0185] The cleaning unit 405 is used to perform a mirror cleaning task when the usage rate of the first cache disk is greater than a preset threshold.
[0186] In one possible example, in relation to performing the image cleanup task, the cleanup unit 405 is specifically used for:
[0187] Detect whether image i in the preset cache is deployed in the target cluster with an application associated with image i, where image i is any image in the preset cache;
[0188] If yes, retain image i; otherwise, delete image i.
[0189] In one possible example, where,
[0190] The acquisition unit 404 is also used to acquire the second cache disk usage rate;
[0191] The cleaning unit 405 is also used to terminate the image cleaning task when the second cache disk usage rate is less than or equal to the preset threshold.
[0192] In one possible example, where,
[0193] The acquisition unit 404 is further configured to acquire the application list when the second cache disk usage rate is greater than the preset threshold.
[0194] The cleaning unit 405 is also used to retain the images that are currently in use in the application list; and to delete images with versions lower than a preset version from the images that are not currently in use in the application list.
[0195] In one possible example, where,
[0196] The acquisition unit 404 is used to acquire the third cache disk usage rate;
[0197] The cleaning unit 405 is also used to delete all unused images in the application list when the third cache disk usage rate is greater than the preset threshold.
[0198] In one possible example, where,
[0199] The cleaning unit 405 is also used to terminate the image cleaning task when the usage rate of the third cache disk is less than or equal to the preset threshold.
[0200] In one possible example, where,
[0201] The acquisition unit 404 is also used to acquire the fourth cache disk usage rate;
[0202] The cleaning unit 405 is also used to trigger an alarm operation when the usage rate of the fourth cache disk is greater than the preset threshold.
[0203] It is understood that the functions of each program module of the image retrieval device in this embodiment can be specifically implemented according to the methods in the above method embodiments. The specific implementation process can be referred to the relevant descriptions in the above method embodiments, which will not be repeated here.
[0204] This application also provides a computer storage medium storing a computer program for electronic data interchange, which causes a computer to perform some or all of the steps of any of the mirroring methods described in the above method embodiments.
[0205] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the mirroring methods described in the above method embodiments.
[0206] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0207] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0208] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.
[0209] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0210] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software program module.
[0211] If the integrated unit is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0212] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage device, which may include a flash drive, ROM, RAM, disk, or optical disk, etc.
[0213] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A mirror pulling method, characterized by, The image retrieval method is applied to a cache proxy repository and is used in cross-datacenter scenarios; it includes: The system receives image pull requests initiated by the target cluster. The cache proxy repository is located in the image distribution system, which also includes a central image repository and a message center. The cache proxy repository is located in the target data center, which also includes the target cluster. Check whether the image fetch request hits the preset cache; the preset cache is set in the cache proxy repository or on the local disk; When the image fetch request hits the preset cache, the content that the image fetch request needs to fetch is fetched from the preset cache; When the image fetch request fails to hit the preset cache, the content required by the image fetch request is fetched from the central image repository and stored in the preset cache. The cache proxy repository includes an image preheating module; the step of detecting whether the image pull request hits the preset cache includes: The image preheating module listens for image push events in the message center, and the image push event includes the image name; The image name is parsed to obtain the target application name; Detect whether the application corresponding to the target application name has been deployed in the target cluster of the target data center; The application corresponding to the target application name has been deployed in the cluster of the target data center, confirming that the image pull request hits the preset cache; If the application corresponding to the target application name is not deployed in the cluster of the target data center, it is confirmed that the image pull request did not hit the preset cache.
2. The method of claim 1, wherein, The cache proxy repository also includes a mirror eviction module, and the method further includes: Get the first cache disk usage; When the usage rate of the first cache disk exceeds a preset threshold, an image cleanup task is executed.
3. The method of claim 2, wherein, The execution of the image cleanup task includes: Detect whether image i in the preset cache is deployed in the target cluster with an application associated with image i, where image i is any image in the preset cache; If yes, retain image i; otherwise, delete image i.
4. The method according to claim 2 or 3, characterized in that, The method further includes: Get the second cache disk usage; The image cleanup task ends when the usage rate of the second cache disk is less than or equal to the preset threshold.
5. The method of claim 4, wherein, The method further includes: When the second cache disk usage exceeds the preset threshold, obtain the application list; Retain the images that are currently in use from the application list; Delete images from the application list that are not currently in use and whose versions are lower than the preset version.
6. The method according to claim 5, characterized in that, The method further includes: Get the third cache disk usage; When the usage rate of the third cache disk exceeds the preset threshold, all unused images in the application list are deleted.
7. The method according to claim 6, characterized in that, The method further includes: When the usage rate of the third cache disk is less than or equal to the preset threshold, the image cleanup task is terminated.
8. The method according to claim 6, characterized in that, The method further includes: Get the fourth cache disk usage; An alarm is triggered when the usage of the fourth cache disk exceeds the preset threshold.
9. A mirror pull device, characterized in that, This device, applied to a cache proxy repository, is used in cross-datacenter scenarios. The device includes a receiving unit, a detection unit, and an image fetching unit. The receiving unit is used to receive image pull requests, which are initiated by the target cluster. The cache proxy repository is located in the image distribution system, which also includes a central image repository and a message center. The cache proxy repository is located in the target data center, which also includes the target cluster. The detection unit is used to detect whether the image fetch request hits the preset cache; the preset cache is set in the cache proxy repository or set on the local disk; The image retrieval unit is used to retrieve the content that the image retrieval request needs to retrieve from the preset cache when the image retrieval request hits the preset cache; The image retrieval unit is also used to retrieve the content that the image retrieval request needs to retrieve from the central image repository when the image retrieval request fails to hit the preset cache, and save it in the preset cache; The cache proxy repository includes an image preheating module; regarding the detection of whether the image pull request hits the preset cache, the detection unit is specifically used for: The image preheating module listens for image push events in the message center, and the image push event includes the image name; The image name is parsed to obtain the target application name; Detect whether the application corresponding to the target application name has been deployed in the target cluster of the target data center; The application corresponding to the target application name has been deployed in the cluster of the target data center, confirming that the image pull request hits the preset cache; If the application corresponding to the target application name is not deployed in the cluster of the target data center, it is confirmed that the image pull request did not hit the preset cache.
10. The apparatus according to claim 9, characterized in that, The cache proxy repository also includes a mirror eviction module, and the device further includes an acquisition unit and a cleanup unit, wherein... The acquisition unit is used to acquire the first cache disk usage rate; The cleanup unit is used to perform a mirror cleanup task when the usage rate of the first cache disk is greater than a preset threshold.
11. The apparatus according to claim 10, characterized in that, In performing the image cleanup task, the cleanup unit is specifically used for: Detect whether image i in the preset cache is deployed in the target cluster with an application associated with image i, where image i is any image in the preset cache; If yes, retain image i; otherwise, delete image i.
12. The apparatus according to claim 10 or 11, characterized in that, in, The acquisition unit is also used to acquire the second cache disk usage rate; The cleanup unit is also used to terminate the image cleanup task when the second cache disk usage is less than or equal to the preset threshold.
13. The apparatus according to claim 12, characterized in that, in, The acquisition unit is also used to acquire the application list when the second cache disk usage rate is greater than the preset threshold. The cleaning unit is also used to retain the images that are currently in use in the application list; and to delete images with versions lower than a preset version from the images that are not currently in use in the application list.
14. The apparatus according to claim 13, characterized in that, in, The acquisition unit is used to acquire the third cache disk usage rate; The cleaning unit is also used to delete all unused images in the application list when the third cache disk usage rate is greater than the preset threshold.
15. The apparatus according to claim 14, characterized in that, in, The cleanup unit is also used to terminate the image cleanup task when the usage rate of the third cache disk is less than or equal to the preset threshold.
16. A server, characterized in that, The method includes a processor, a memory, a communication interface, and one or more programs, said one or more programs being stored in the memory and configured to be executed by the processor, said programs including instructions for performing the steps of the method as described in any one of claims 1-8.
17. A computer-readable storage medium, characterized in that, A computer program for storing electronic data interchange is provided, wherein the computer program causes a computer to perform the method as described in any one of claims 1-8.
18. A computer program product, characterized in that, The computer program product includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform the method as described in any one of claims 1-8.
Citation Information
Patent Citations
Container performance acceleration method based on nonvolatile memory
CN110096333A
Method and device for constructing docker mirror image and computer readable storage medium
CN110908671A