[go: up one dir, main page]

CN114785770A - Mirror layer file sending method and device, electronic equipment and computer readable medium - Google Patents

Mirror layer file sending method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN114785770A
CN114785770A CN202210339633.XA CN202210339633A CN114785770A CN 114785770 A CN114785770 A CN 114785770A CN 202210339633 A CN202210339633 A CN 202210339633A CN 114785770 A CN114785770 A CN 114785770A
Authority
CN
China
Prior art keywords
layer file
cache
mirror
image
image layer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210339633.XA
Other languages
Chinese (zh)
Inventor
梁晓雷
何小锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jingdong Technology Information Technology Co Ltd
Original Assignee
Jingdong Technology Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jingdong Technology Information Technology Co Ltd filed Critical Jingdong Technology Information Technology Co Ltd
Priority to CN202210339633.XA priority Critical patent/CN114785770A/en
Publication of CN114785770A publication Critical patent/CN114785770A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1014Server selection for load balancing based on the content of a request
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本公开的实施例公开了镜像层文件发送方法、装置、电子设备和计算机可读介质。该方法的一具体实施方式包括:响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件;响应于确定上述缓存中不存在对应上述镜像层文件获取请求的镜像层文件,从存储后端获取对应上述镜像层文件获取请求的镜像层文件;存储上述镜像层文件至上述缓存;将上述镜像层文件发送至上述客户端。该实施方式与云计算有关,减少了镜像仓库管理端或源存储端陷入不可用状态的次数,节省了网络带宽、加快了镜像获取速度。

Figure 202210339633

Embodiments of the present disclosure disclose a method, an apparatus, an electronic device, and a computer-readable medium for sending an image layer file. A specific implementation of the method includes: in response to receiving a request for obtaining an image layer file sent by a client, determining whether there is an image layer file corresponding to the above-mentioned image layer file obtaining request in the cache of the above-mentioned mirror warehouse management end; There is no mirror layer file corresponding to the above-mentioned mirror-layer file acquisition request, obtain the mirror-layer file corresponding to the above-mentioned mirror-layer file acquisition request from the storage backend; store the above-mentioned mirror-layer file to the above-mentioned cache; Send the above-mentioned mirror-layer file to the above-mentioned client end. This implementation is related to cloud computing, which reduces the number of times that the image warehouse management end or the source storage end falls into an unavailable state, saves network bandwidth, and speeds up image acquisition.

Figure 202210339633

Description

镜像层文件发送方法、装置、电子设备和计算机可读介质Image layer file sending method, apparatus, electronic device and computer readable medium

技术领域technical field

本公开的实施例涉及计算机技术领域,具体涉及镜像层文件发送方法、装置、电子设备和计算机可读介质。The embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a method, apparatus, electronic device, and computer-readable medium for sending mirror layer files.

背景技术Background technique

随着云技术和PaaS(Platform as a Service,平台即服务)平台的发展,用户可以通过镜像仓库管理端获取镜像。目前,在利用镜像仓库管理端获取镜像时,通常采用的方式为:镜像仓库管理端直接从存储镜像的源存储端处获取镜像。With the development of cloud technology and PaaS (Platform as a Service) platform, users can obtain images through the image warehouse management terminal. At present, when the image warehouse management terminal is used to obtain the image, the method usually adopted is as follows: the image warehouse management terminal directly obtains the image from the source storage terminal where the image is stored.

然而,当采用上述方式利用镜像仓库管理端获取镜像时,经常会存在如下技术问题:当镜像仓库管理端或源存储端的并发访问量较多时,镜像仓库管理端或源存储端陷入不可用状态的次数较多,镜像仓库管理端至对应的各个客户端或镜像仓库管理端至源存储端的带宽被占满的次数也较多,且镜像仓库管理端的并发访问量较多时导致单个镜像的下载速度较慢。However, when the mirror warehouse management terminal is used to obtain images in the above manner, there are often the following technical problems: when the mirror warehouse management terminal or the source storage terminal has a large number of concurrent accesses, the mirror warehouse management terminal or the source storage terminal falls into an unavailable state. There are many times, the bandwidth from the mirror warehouse management end to the corresponding clients or the mirror warehouse management end to the source storage end is occupied more times, and the number of concurrent accesses from the mirror warehouse management end is high, which leads to a higher download speed of a single image. slow.

发明内容SUMMARY OF THE INVENTION

本公开的内容部分用于以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。本公开的内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。This summary of the disclosure serves to introduce concepts in a simplified form that are described in detail in the detailed description that follows. The content section of this disclosure is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to be used to limit the scope of the claimed technical solution.

本公开的一些实施例提出了镜像层文件发送方法、装置、电子设备和计算机可读介质,来解决以上背景技术部分提到的技术问题。Some embodiments of the present disclosure propose a method, an apparatus, an electronic device, and a computer-readable medium for sending an image layer file to solve the technical problems mentioned in the above background art section.

第一方面,本公开的一些实施例提供了一种镜像层文件发送方法,应用于镜像仓库管理端,该方法包括:响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件;响应于确定上述缓存中不存在对应上述镜像层文件获取请求的镜像层文件,从存储后端获取对应上述镜像层文件获取请求的镜像层文件;存储上述镜像层文件至上述缓存;将上述镜像层文件发送至上述客户端。In a first aspect, some embodiments of the present disclosure provide a method for sending a mirror layer file, which is applied to a mirror warehouse management end. The method includes: in response to receiving a request for obtaining a mirror layer file sent by a client, determining the above mirror warehouse management Whether there is an image layer file corresponding to the above-mentioned mirror-layer file acquisition request in the cache of the terminal; in response to determining that there is no mirror-layer file corresponding to the above-mentioned mirror-layer file acquisition request in the above-mentioned cache, acquire from the storage backend the corresponding to the above-mentioned mirror layer file acquisition request. Mirror layer file; store the above mirror layer file to the above cache; send the above mirror layer file to the above client.

可选地,方法还包括:响应于确定上述缓存中存在对应上述镜像层文件获取请求的镜像层文件,从上述缓存中获取对应上述镜像层文件获取请求的镜像层文件作为缓存镜像层文件;将上述缓存镜像层文件发送至上述客户端。Optionally, the method further includes: in response to determining that there is a mirror layer file corresponding to the above-mentioned mirror layer file acquisition request in the above-mentioned cache, obtaining the mirror layer file corresponding to the above-mentioned mirror layer file acquisition request from the above-mentioned cache as the cache mirror layer file; The above cache image layer file is sent to the above client.

可选地,上述缓存包括分布式缓存,上述存储上述镜像层文件至上述缓存,包括:将上述镜像层文件存储至上述分布式缓存。Optionally, the cache includes a distributed cache, and the storing the image layer file in the cache includes: storing the image layer file in the distributed cache.

可选地,在上述响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件之前,方法还包括:响应于接收到上述客户端发送的镜像信息获取请求,将对应上述镜像信息获取请求的镜像的至少一个层文件信息发送至上述客户端,使得上述客户端根据上述至少一个层文件信息中的每个层文件信息生成对应上述层文件信息的镜像层文件获取请求。Optionally, before determining whether there is a mirror layer file corresponding to the above-mentioned mirror layer file acquisition request in the cache of the above-mentioned mirror warehouse management terminal in response to receiving the mirror layer file acquisition request sent by the client, the method further includes: in response to receiving the request. To the mirror information acquisition request sent by the above-mentioned client, send at least one layer of file information of the mirror image corresponding to the above-mentioned mirror information acquisition request to the above-mentioned client, so that the above-mentioned client is based on the above-mentioned at least one layer of file information in each layer of file information An image layer file acquisition request corresponding to the above layer file information is generated.

可选地,上述响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件,包括:响应于在预设时间段内接收到至少一个客户端分别发送的对应于上述镜像层文件的镜像层文件获取请求,确定上述缓存中是否存在上述镜像层文件;以及上述将上述镜像层文件发送至上述客户端,包括:将上述镜像层文件分别发送至上述至少一个客户端中的各个客户端。Optionally, the above-mentioned determining whether there is an image layer file corresponding to the above-mentioned mirror layer file acquisition request in the cache of the above-mentioned mirror warehouse management terminal in response to receiving the mirror layer file acquisition request sent by the client includes: in response to a preset time period. Receive an image layer file acquisition request corresponding to the above-mentioned image layer file sent by at least one client respectively, and determine whether the above-mentioned image layer file exists in the above-mentioned cache; and the above-mentioned sending the above-mentioned image layer file to the above-mentioned client includes: The above-mentioned image layer files are respectively sent to each of the above-mentioned at least one client.

可选地,方法还包括:响应于当前时间满足预设周期时间条件,从上述缓存中删除存储时长大于等于预设周期时长的镜像层文件,上述预设周期时长对应上述预设周期时间条件。Optionally, the method further includes: in response to the current time meeting a preset cycle time condition, deleting from the cache mirror layer files whose storage duration is greater than or equal to a preset cycle duration, the preset cycle duration corresponding to the preset cycle time condition.

可选地,方法还包括:响应于上述缓存的剩余缓存容量小于等于预设缓存容量,从上述缓存中删除存储时间在预设历史时间前的镜像层文件。Optionally, the method further includes: in response to the remaining cache capacity of the cache being less than or equal to a preset cache capacity, deleting image layer files whose storage time is before a preset historical time from the cache.

可选地,方法还包括:响应于接收到上述存储后端发送的镜像层文件预存信息,将上述镜像层文件预存信息包括的镜像层文件存储至上述缓存。Optionally, the method further includes: in response to receiving the image layer file pre-storage information sent by the storage backend, storing the image layer file included in the image-layer file pre-storage information in the cache.

第二方面,本公开的一些实施例提供了一种镜像层文件发送装置,应用于镜像仓库管理端,装置包括:确定单元,被配置成响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件;获取单元,被配置成响应于确定上述缓存中不存在对应上述镜像层文件获取请求的镜像层文件,从存储后端获取对应上述镜像层文件获取请求的镜像层文件;存储单元,被配置成存储上述镜像层文件至上述缓存;发送单元,被配置成将上述镜像层文件发送至上述客户端。In a second aspect, some embodiments of the present disclosure provide an apparatus for sending an image layer file, which is applied to an image warehouse management terminal. The apparatus includes: a determining unit configured to, in response to receiving a request for obtaining an image layer file sent by a client, Determine whether there is a mirror layer file corresponding to the above-mentioned mirror layer file acquisition request in the cache of the above-mentioned mirror warehouse management end; the acquiring unit is configured to respond to determining that there is no mirror layer file corresponding to the above-mentioned mirror layer file in the cache. The backend obtains the mirror layer file corresponding to the above-mentioned mirror layer file obtaining request; the storage unit is configured to store the above-mentioned mirror layer file to the above-mentioned cache; the sending unit is configured to send the above-mentioned mirror layer file to the above-mentioned client.

可选地,装置还包括:镜像层文件获取单元和镜像层文件发送单元。其中,镜像层文件获取单元被配置成响应于确定上述缓存中存在对应上述镜像层文件获取请求的镜像层文件,从上述缓存中获取对应上述镜像层文件获取请求的镜像层文件作为缓存镜像层文件。镜像层文件发送单元被配置成将上述缓存镜像层文件发送至上述客户端。Optionally, the apparatus further includes: an image layer file acquiring unit and an image layer file sending unit. The image layer file obtaining unit is configured to, in response to determining that the image layer file corresponding to the image layer file obtaining request exists in the cache, obtain the image layer file corresponding to the image layer file obtaining request from the cache as the cache image layer file . The image layer file sending unit is configured to send the cache image layer file to the client.

可选地,上述缓存包括分布式缓存。存储单元进一步被配置成:将上述镜像层文件存储至上述分布式缓存。Optionally, the above cache includes a distributed cache. The storage unit is further configured to: store the image layer file in the distributed cache.

可选地,在确定单元之前,装置还包括:层文件信息发送单元,被配置成响应于接收到上述客户端发送的镜像信息获取请求,将对应上述镜像信息获取请求的镜像的至少一个层文件信息发送至上述客户端,使得上述客户端根据上述至少一个层文件信息中的每个层文件信息生成对应上述层文件信息的镜像层文件获取请求。Optionally, before the determining unit, the apparatus further includes: a layer file information sending unit, configured to, in response to receiving the mirror image information acquisition request sent by the above-mentioned client, send at least one layer file of the mirror image corresponding to the above-mentioned mirror information acquisition request. The information is sent to the above-mentioned client, so that the above-mentioned client generates a mirror layer file acquisition request corresponding to the above-mentioned layer file information according to each layer of file information in the above-mentioned at least one layer of file information.

可选地,确定单元进一步被配置成:响应于在预设时间段内接收到至少一个客户端分别发送的对应于上述镜像层文件的镜像层文件获取请求,确定上述缓存中是否存在上述镜像层文件。以及发送单元504可以进一步被配置成:将上述镜像层文件分别发送至上述至少一个客户端中的各个客户端。Optionally, the determining unit is further configured to: in response to receiving, within a preset time period, a request for obtaining an image layer file corresponding to the above-mentioned image layer file sent by at least one client respectively, to determine whether the above-mentioned image layer exists in the above-mentioned cache. document. And the sending unit 504 may be further configured to: send the above image layer file to each of the above at least one client respectively.

可选地,装置还包括:第一删除单元,被配置成响应于当前时间满足预设周期时间条件,从上述缓存中删除存储时长大于等于预设周期时长的镜像层文件,上述预设周期时长对应上述预设周期时间条件。Optionally, the device further includes: a first deletion unit configured to delete, from the cache, the mirror layer files whose storage duration is greater than or equal to the preset cycle duration in response to the current time meeting the preset cycle time condition, and the preset cycle duration Corresponding to the above preset cycle time conditions.

可选地,装置还包括:第二删除单元,被配置成响应于上述缓存的剩余缓存容量小于等于预设缓存容量,从上述缓存中删除存储时间在预设历史时间前的镜像层文件。Optionally, the apparatus further includes: a second deletion unit configured to delete the mirror layer files whose storage time is before the preset historical time from the cache in response to the remaining cache capacity of the cache being less than or equal to the preset cache capacity.

可选地,装置还包括:镜像层文件存储单元,被配置成响应于接收到上述存储后端发送的镜像层文件预存信息,将上述镜像层文件预存信息包括的镜像层文件存储至上述缓存。Optionally, the apparatus further includes: an image layer file storage unit, configured to store the image layer file included in the image layer file pre-storage information in the cache in response to receiving the image layer file pre-storage information sent by the storage backend.

第三方面,本公开的一些实施例提供了一种电子设备,包括:一个或多个处理器;存储装置,其上存储有一个或多个程序,当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现上述第一方面任一实现方式所描述的方法。In a third aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, when one or more programs are stored by one or more The processor executes, causing one or more processors to implement the method described in any implementation manner of the above first aspect.

第四方面,本公开的一些实施例提供了一种计算机可读介质,其上存储有计算机程序,其中,程序被处理器执行时实现上述第一方面任一实现方式所描述的方法。In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium on which a computer program is stored, wherein, when the program is executed by a processor, the method described in any implementation manner of the above-mentioned first aspect is implemented.

本公开的上述各个实施例具有如下有益效果:通过本公开的一些实施例的镜像层文件发送方法,减少了镜像仓库管理端或源存储端陷入不可用状态的次数,节省了网络带宽、加快了镜像获取速度。具体来说,造成镜像仓库管理端或源存储端陷入不可用状态的次数较多、网络带宽被占满的次数较多以及镜像获取速度较慢的原因在于:当镜像仓库管理端或源存储端的并发访问量较多时,镜像仓库管理端或源存储端陷入不可用状态的次数较多,镜像仓库管理端至对应的各个客户端或镜像仓库管理端至源存储端的带宽被占满的次数也较多,且镜像仓库管理端的并发访问量较多时导致单个镜像的下载速度较慢。基于此,本公开的一些实施例的镜像层文件发送方法,首先,响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件。由此,可以预先判断镜像仓库管理端的缓存中是否预先缓存了镜像层文件获取请求对应的镜像层文件。然后,响应于确定上述缓存中不存在对应上述镜像层文件获取请求的镜像层文件,从存储后端获取对应上述镜像层文件获取请求的镜像层文件。由此,可以在镜像仓库管理端的缓存中未预先缓存镜像层文件获取请求对应的镜像层文件时,才从存储后端获取该镜像层文件。其次,存储上述镜像层文件至上述缓存。由此,可以在获取到镜像层文件获取请求对应的镜像层文件以及未预先缓存该镜像层文件时,将从存储后端获取到的镜像层文件添加至缓存中。最后,将上述镜像层文件发送至上述客户端。由此,可以将获取到的镜像层文件返回至客户端以响应客户端的镜像层文件获取请求。也因为在接收到客户端的镜像层文件获取请求后,未直接从存储后端获取镜像层文件,可以减少镜像仓库管理端至存储后端的并发访问量,进而可以减少源存储端(存储后端)陷入不可用状态的次数、节省网络带宽。又因为镜像仓库管理端将从存储后端获取到的镜像层文件添加至缓存中,再次接收到对应该镜像层文件的镜像层文件获取请求时,可以直接从镜像仓库管理端的缓存中读取该镜像层文件,无需从存储后端获取,可以加快客户端获取镜像的速度。同时,镜像仓库管理端在接收到多个镜像层文件获取请求时,若缓存中存在对应镜像层文件获取请求的镜像层文件,可以无需从存储后端获取,节省了镜像仓库管理端的内存,从而减少了镜像仓库管理端陷入不可用状态的次数、节省了网络带宽。由此,减少了镜像仓库管理端或源存储端陷入不可用状态的次数,节省了网络带宽、加快了镜像获取速度。The above-mentioned embodiments of the present disclosure have the following beneficial effects: the method for sending mirror layer files according to some embodiments of the present disclosure reduces the number of times that the mirror warehouse management end or the source storage end falls into an unavailable state, saves network bandwidth, and speeds up Image acquisition speed. Specifically, the reason why the mirror warehouse management end or the source storage end is in an unavailable state more often, the network bandwidth is occupied more times, and the image acquisition speed is slow is: when the mirror warehouse management end or the source storage end When there are many concurrent visits, the mirror warehouse management end or the source storage end falls into an unavailable state more often, and the bandwidth from the mirror warehouse management end to the corresponding clients or the mirror warehouse management end to the source storage end is occupied more frequently. When the number of concurrent accesses on the management side of the mirror warehouse is large, the download speed of a single image is slow. Based on this, in the methods for sending mirror layer files according to some embodiments of the present disclosure, firstly, in response to receiving the mirror layer file acquisition request sent by the client, it is determined whether there is a cache corresponding to the above mirror layer file acquisition request in the cache of the above-mentioned mirror warehouse management end. Image layer file. In this way, it can be judged in advance whether the mirror layer file corresponding to the request for obtaining the mirror layer file is pre-cached in the cache of the mirror warehouse management end. Then, in response to determining that the image layer file corresponding to the image layer file obtaining request does not exist in the cache, obtain the image layer file corresponding to the image layer file obtaining request from the storage backend. Therefore, the mirror layer file can be obtained from the storage backend only when the mirror layer file corresponding to the request for obtaining the mirror layer file is not pre-cached in the cache of the mirror warehouse management end. Next, store the above-mentioned image layer file in the above-mentioned cache. Therefore, when the mirror layer file corresponding to the mirror layer file acquisition request is obtained and the mirror layer file is not cached in advance, the mirror layer file obtained from the storage backend can be added to the cache. Finally, the above image layer file is sent to the above client. Thus, the obtained image layer file can be returned to the client to respond to the client's request for obtaining the image layer file. It is also because the mirror layer file is not directly obtained from the storage backend after receiving the client's request for obtaining the mirror layer file, which can reduce the concurrent access from the mirror warehouse management end to the storage backend, which in turn can reduce the source storage end (storage backend) The number of times it was stuck in an unavailable state, saving network bandwidth. And because the mirror warehouse management end adds the mirror layer file obtained from the storage backend to the cache, when it receives the mirror layer file acquisition request corresponding to the mirror layer file again, it can directly read the mirror layer file from the cache of the mirror warehouse management end. The image layer file does not need to be obtained from the storage backend, which can speed up the speed of the client to obtain the image. At the same time, when the mirror warehouse management end receives multiple mirror layer file acquisition requests, if there is an mirror layer file corresponding to the mirror layer file acquisition request in the cache, it can be obtained from the storage backend without needing to obtain it from the storage backend, which saves the memory of the mirror warehouse management end. It reduces the number of times that the mirror warehouse management end falls into an unavailable state and saves network bandwidth. As a result, the number of times that the image warehouse management end or the source storage end falls into an unavailable state is reduced, network bandwidth is saved, and the image acquisition speed is accelerated.

附图说明Description of drawings

结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,元件和元素不一定按照比例绘制。The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent when taken in conjunction with the accompanying drawings and with reference to the following detailed description. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and elements are not necessarily drawn to scale.

图1是根据本公开的一些实施例的镜像层文件发送方法的一个应用场景的示意图;1 is a schematic diagram of an application scenario of a method for sending an image layer file according to some embodiments of the present disclosure;

图2是根据本公开的镜像层文件发送方法的一些实施例的流程图;2 is a flowchart of some embodiments of a method for sending an image layer file according to the present disclosure;

图3是根据本公开的镜像层文件发送方法的另一些实施例的流程图;3 is a flowchart of other embodiments of the method for sending an image layer file according to the present disclosure;

图4是根据本公开的镜像层文件发送方法的又一些实施例的流程图;FIG. 4 is a flowchart of still other embodiments of a method for sending an image layer file according to the present disclosure;

图5是根据本公开的镜像层文件发送装置的一些实施例的结构示意图;5 is a schematic structural diagram of some embodiments of an image layer file sending apparatus according to the present disclosure;

图6是适于用来实现本公开的一些实施例的电子设备的结构示意图。6 is a schematic structural diagram of an electronic device suitable for implementing some embodiments of the present disclosure.

具体实施方式Detailed ways

下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例。相反,提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided for a thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes, and are not intended to limit the protection scope of the present disclosure.

另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。在不冲突的情况下,本公开中的实施例及实施例中的特征可以相互组合。In addition, it should be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings. The embodiments of this disclosure and features of the embodiments may be combined with each other without conflict.

需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。It should be noted that concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or interdependence.

需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。It should be noted that the modifications of "a" and "a plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, they should be understood as "one or a plurality of". multiple".

本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of these messages or information.

下面将参考附图并结合实施例来详细说明本公开。The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

图1是根据本公开一些实施例的镜像层文件发送方法的一个应用场景的示意图。FIG. 1 is a schematic diagram of an application scenario of a method for sending an image layer file according to some embodiments of the present disclosure.

在图1的应用场景中,首先,计算设备101可以响应于接收到客户端102发送的镜像层文件获取请求103,确定上述镜像仓库管理端102的缓存104中是否存在对应上述镜像层文件获取请求103的镜像层文件105。然后,计算设备101可以响应于确定上述缓存104中不存在对应上述镜像层文件获取请求103的镜像层文件105,从存储后端106获取对应上述镜像层文件获取请求103的镜像层文件105。其次,计算设备101可以存储上述镜像层文件105至上述缓存104。最后,计算设备101可以将上述镜像层文件105发送至上述客户端102。In the application scenario of FIG. 1 , first, the computing device 101 may, in response to receiving the image layer file obtaining request 103 sent by the client 102, determine whether there is a corresponding image layer file obtaining request in the cache 104 of the above-mentioned mirror warehouse management terminal 102 Mirror layer file 105 of 103 . Then, the computing device 101 may, in response to determining that the image layer file 105 corresponding to the image layer file obtaining request 103 does not exist in the cache 104, obtain the image layer file 105 corresponding to the image layer file obtaining request 103 from the storage backend 106. Secondly, the computing device 101 may store the above-mentioned image layer file 105 to the above-mentioned cache 104 . Finally, the computing device 101 may send the above-mentioned image layer file 105 to the above-mentioned client 102 .

需要说明的是,上述计算设备101可以是硬件,也可以是软件。当计算设备为硬件时,可以实现成多个服务器或终端设备组成的分布式集群,也可以实现成单个服务器或单个终端设备。当计算设备体现为软件时,可以安装在上述所列举的硬件设备中。其可以实现成例如用来提供分布式服务的多个软件或软件模块,也可以实现成单个软件或软件模块。在此不做具体限定。It should be noted that the above computing device 101 may be hardware or software. When the computing device is hardware, it can be implemented as a distributed cluster composed of multiple servers or terminal devices, or can be implemented as a single server or a single terminal device. When a computing device is embodied as software, it may be installed in the hardware devices listed above. It can be implemented, for example, as multiple software or software modules for providing distributed services, or as a single software or software module. There is no specific limitation here.

应该理解,图1中的计算设备的数目仅仅是示意性的。根据实现需要,可以具有任意数目的计算设备。It should be understood that the number of computing devices in FIG. 1 is merely illustrative. There may be any number of computing devices depending on implementation needs.

继续参考图2,示出了根据本公开的镜像层文件发送方法的一些实施例的流程200。该镜像层文件发送方法,应用于镜像仓库管理端,包括以下步骤:Continuing to refer to FIG. 2 , a flow 200 of some embodiments of a method for sending an image layer file according to the present disclosure is shown. The image layer file sending method, applied to the image warehouse management terminal, includes the following steps:

步骤201,响应于接收到客户端发送的镜像层文件获取请求,确定镜像仓库管理端的缓存中是否存在对应镜像层文件获取请求的镜像层文件。Step 201 , in response to receiving a request for obtaining an image layer file sent by a client, determine whether an image layer file corresponding to the image layer file obtaining request exists in the cache of the image warehouse management end.

在一些实施例中,镜像层文件发送方法的执行主体(例如图1所示的计算设备101)可以响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件。其中,上述镜像仓库管理端可以为用于处理一机房对应的各个客户端的镜像相关请求的管理端。上述机房与上述各个客户端的对应关系可以为上述各个客户端可以共用上述机房。上述缓存可以包括镜像仓库管理端的本地缓存。上述镜像层文件获取请求可以为用于获取一镜像层文件的请求,可以包括镜像层文件标识。镜像层文件标识可以唯一标识镜像层文件。上述镜像层文件可以为镜像层对应的文件。实践中,上述执行主体可以确定本地缓存中是否存在镜像层文件标识为上述镜像层文件获取请求包括的镜像层文件标识的镜像层文件。由此,可以预先判断是否预先缓存了镜像层文件获取请求对应的镜像层文件。In some embodiments, the execution body of the method for sending an image layer file (for example, the computing device 101 shown in FIG. 1 ) may, in response to receiving a request for obtaining an image layer file sent by a client, determine whether the above-mentioned cache of the image warehouse management end exists. The image layer file corresponding to the above image layer file acquisition request. Wherein, the above-mentioned mirror warehouse management terminal may be a management terminal for processing mirror-related requests of each client corresponding to a computer room. The corresponding relationship between the above-mentioned computer room and each of the above-mentioned clients may be that each of the above-mentioned clients may share the above-mentioned computer room. The above cache may include a local cache on the image repository management side. The above request for obtaining an image layer file may be a request for obtaining an image layer file, and may include an image layer file identifier. The image layer file identifier can uniquely identify the image layer file. The above image layer file may be a file corresponding to the image layer. In practice, the execution body may determine whether there is an image layer file whose image layer file identifier is the image layer file identifier included in the image layer file acquisition request in the local cache. Thus, it can be determined in advance whether the mirror layer file corresponding to the mirror layer file acquisition request is pre-cached.

在一些实施例的一些可选的实现方式中,上述执行主体可以响应于在预设时间段内接收到至少一个客户端分别发送的对应于上述镜像层文件的镜像层文件获取请求,确定上述缓存中是否存在上述镜像层文件。这里,对于预设时间段的具体设定,不作限定。实践中,上述执行主体可以响应于在预设时间段内接收到至少一个客户端分别发送的对应于镜像层文件的镜像层文件获取请求,确定本地缓存中是否存在镜像层文件标识与上述镜像层文件标识相同的镜像层文件。由此,可以在预设时间段内接收到多个用于获取同一镜像层文件的镜像层文件获取请求时,仅进行一次后续处理。可以理解的是,上述执行主体还可以响应于同时接收到至少一个客户端分别发送的对应于镜像层文件的镜像层文件获取请求,确定缓存中是否存在上述镜像层文件。由此,可以在同时接收到多个用于获取同一镜像层文件的镜像层文件获取请求时,仅进行一次后续处理。In some optional implementations of some embodiments, the above-mentioned execution body may determine the above-mentioned cache in response to receiving, within a preset time period, at least one client, respectively, sending an image-layer file acquisition request corresponding to the above-mentioned image-layer file. Whether the above image layer file exists in the file. Here, the specific setting of the preset time period is not limited. In practice, the above-mentioned execution body can determine whether there is an image layer file identifier and the above-mentioned image layer in the local cache in response to receiving a request for obtaining an image layer file corresponding to the image layer file sent by at least one client respectively within a preset time period. The file identifies the same image layer file. Therefore, when multiple image layer file acquisition requests for acquiring the same image layer file are received within a preset time period, only one subsequent processing can be performed. It can be understood that the above-mentioned execution body can also determine whether the above-mentioned mirror-layer file exists in the cache in response to simultaneously receiving at least one request for obtaining the mirror-layer file corresponding to the mirror-layer file sent by at least one client at the same time. In this way, when a plurality of mirror layer file acquisition requests for acquiring the same mirror layer file are received at the same time, subsequent processing can be performed only once.

步骤202,响应于确定缓存中不存在对应镜像层文件获取请求的镜像层文件,从存储后端获取对应镜像层文件获取请求的镜像层文件。Step 202, in response to determining that the mirror layer file corresponding to the mirror layer file acquisition request does not exist in the cache, acquire the mirror layer file corresponding to the mirror layer file acquisition request from the storage backend.

在一些实施例中,上述执行主体可以响应于确定上述缓存中不存在对应上述镜像层文件获取请求的镜像层文件,从存储后端获取对应上述镜像层文件获取请求的镜像层文件。其中,上述存储后端可以为存储了各个镜像层文件,以响应各个机房对应的各个镜像仓库管理端的获取镜像层文件的请求的终端。实践中,上述执行主体可以响应于确定本地缓存中不存在镜像层文件标识为上述镜像层文件获取请求包括的镜像层文件标识的镜像层文件,向上述存储后端发送用于获取上述镜像层文件的请求,以获取上述镜像层文件。由此,可以在未预先缓存镜像层文件获取请求对应的镜像层文件时,才从存储后端获取该镜像层文件。In some embodiments, in response to determining that the image layer file corresponding to the image layer file obtaining request does not exist in the cache, the execution body may obtain the image layer file corresponding to the image layer file obtaining request from the storage backend. Wherein, the above storage backend may be a terminal that stores each image layer file to respond to the request of each image warehouse management terminal corresponding to each computer room to obtain the image layer file. In practice, the above-mentioned execution body may, in response to determining that there is no mirror-layer file in the local cache with the mirror-layer file identified as the mirror-layer file identifier included in the mirror-layer file acquisition request, send to the above-mentioned storage back-end for obtaining the above-mentioned mirror-layer file. request to obtain the above image layer files. Therefore, the mirror layer file can be obtained from the storage backend only when the mirror layer file corresponding to the request for obtaining the mirror layer file is not pre-cached.

步骤203,存储镜像层文件至缓存。Step 203, store the image layer file in the cache.

在一些实施例中,上述执行主体可以存储上述镜像层文件至上述缓存。实践中,上述执行主体可以存储上述镜像层文件至上述本地缓存。由此,可以在获取到镜像层文件获取请求对应的镜像层文件以及未预先缓存该镜像层文件时,将从存储后端获取到的镜像层文件添加至缓存中。In some embodiments, the execution body may store the image layer file in the cache. In practice, the execution body may store the image layer file in the local cache. Therefore, when the mirror layer file corresponding to the mirror layer file acquisition request is obtained and the mirror layer file is not cached in advance, the mirror layer file obtained from the storage backend can be added to the cache.

步骤204,将镜像层文件发送至客户端。Step 204, sending the image layer file to the client.

在一些实施例中,上述执行主体可以将上述镜像层文件发送至上述客户端。由此,可以将获取到的镜像层文件返回至客户端以响应客户端的镜像层文件获取请求。In some embodiments, the execution body may send the image layer file to the client. Thus, the obtained image layer file can be returned to the client to respond to the client's request for obtaining the image layer file.

可选地,上述执行主体可以响应于确定缓存中存在对应上述镜像层文件获取请求的镜像层文件,从缓存中获取对应上述镜像层文件获取请求的镜像层文件作为缓存镜像层文件。实践中,上述执行主体可以响应于确定本地缓存中存在镜像层文件标识与上述镜像层文件获取请求包括的镜像层文件标识相同的镜像层文件,从本地缓存中读取上述镜像层文件作为缓存镜像层文件。然后,可以将上述缓存镜像层文件发送至上述客户端。由此,可以在缓存中存在镜像层文件获取请求的镜像层文件时,直接将从缓存中读取的镜像层文件返回给客户端以响应客户端的镜像层文件获取请求。Optionally, in response to determining that a mirror layer file corresponding to the above-mentioned mirror layer file acquisition request exists in the cache, the above-mentioned execution body may acquire the mirror layer file corresponding to the above-mentioned mirror layer file acquisition request from the cache as the cache mirror layer file. In practice, the above-mentioned execution body can read the above-mentioned mirror-layer file from the local cache as a cache image in response to determining that there is a mirror-layer file with the same mirror-layer file identifier as the mirror-layer file identification included in the above-mentioned mirror-layer file acquisition request in the local cache. layer file. Then, the above cache image layer file may be sent to the above client. Therefore, when the mirror layer file for the mirror layer file acquisition request exists in the cache, the mirror layer file read from the cache can be directly returned to the client to respond to the client's mirror layer file acquisition request.

可选地,上述执行主体可以将上述镜像层文件分别发送至上述至少一个客户端中的各个客户端。由此,可以在预设时间段内接收到多个用于获取同一镜像层文件的镜像层文件获取请求时,仅从存储后端获取一次镜像层文件,以将获取的镜像层文件分别发送至各个客户端。Optionally, the above-mentioned execution body may send the above-mentioned image layer file to each of the above-mentioned at least one client respectively. In this way, when multiple requests for obtaining mirror layer files for obtaining the same mirror layer file are received within a preset time period, the mirror layer files are only obtained once from the storage backend, and the obtained mirror layer files are sent to each client.

可选地,上述执行主体可以响应于当前时间满足预设周期时间条件,从上述缓存中删除存储时长大于等于预设周期时长的镜像层文件,所述预设周期时长对应所述预设周期时间条件。其中,上述预设周期时间条件可以为“当前时间为以预设时长为周期的时间”。例如,预设时长可以为一周。若上次删除缓存中的镜像层文件的时间为2022年2月28日00:00:00。当前时间为2022年3月7日00:00:00时,满足预设周期时间条件。上述预设周期时长可以和上述预设时长相同,也可以和上述预设时长相异。由此,可以定时删除缓存中的镜像层文件,以节省缓存空间。Optionally, the above-mentioned execution body may delete, from the above-mentioned cache, mirror layer files whose storage duration is greater than or equal to a preset period of time in response to the current time meeting a preset cycle time condition, and the preset period of time corresponds to the preset period of time. condition. Wherein, the above-mentioned preset period time condition may be "the current time is a period with a preset duration as a period". For example, the preset time period may be one week. If the last time the image layer file in the cache was deleted was February 28, 2022 00:00:00. The current time is 00:00:00 on March 7, 2022, which meets the preset cycle time conditions. The above-mentioned preset period duration may be the same as the above-mentioned preset period, or may be different from the above-mentioned preset period. In this way, the image layer files in the cache can be deleted periodically to save the cache space.

可选地,上述执行主体可以响应于上述缓存的剩余缓存容量小于等于预设缓存容量,从上述缓存中删除存储时间在预设历史时间前的镜像层文件。剩余缓存容量可以为缓存中可用于存储的缓存空间的大小。这里,对于预设缓存容量和预设历史时间的具体设定,不作限定。由此,可以缓存的剩余缓存容量小于等于预设缓存容量时,删除缓存中的镜像层文件,以节省缓存空间。Optionally, in response to the remaining cache capacity of the cache being less than or equal to a preset cache capacity, the execution body may delete image layer files whose storage time is before the preset historical time from the cache. The remaining cache capacity may be the size of the cache space available for storage in the cache. Here, the specific settings of the preset cache capacity and the preset historical time are not limited. Therefore, when the remaining cache capacity that can be cached is less than or equal to the preset cache capacity, the image layer file in the cache is deleted to save the cache space.

可选地,上述执行主体可以响应于接收到上述存储后端发送的镜像层文件预存信息,将上述镜像层文件预存信息包括的镜像层文件存储至上述缓存。上述镜像层文件预存信息可以为表征存储后端新存储了镜像层文件的信息,可以包括镜像层文件。由此,可以在存储后端新存储了镜像层文件时,将该镜像层文件预存至镜像仓库管理端的缓存中。Optionally, the execution body may, in response to receiving the image layer file pre-storage information sent by the storage backend, store the image-layer file included in the image-layer file pre-storage information in the cache. The above-mentioned pre-stored information of the image layer file may be information indicating that the storage backend newly stores the image layer file, and may include the image layer file. Therefore, when the mirror layer file is newly stored in the storage backend, the mirror layer file can be pre-stored in the cache of the mirror warehouse management end.

本公开的上述各个实施例具有如下有益效果:通过本公开的一些实施例的镜像层文件发送方法,减少了镜像仓库管理端或源存储端陷入不可用状态的次数,节省了网络带宽、加快了镜像获取速度。具体来说,造成镜像仓库管理端或源存储端陷入不可用状态的次数较多、网络带宽被占满的次数较多以及镜像获取速度较慢的原因在于:当镜像仓库管理端或源存储端的并发访问量较多时,镜像仓库管理端或源存储端陷入不可用状态的次数较多,镜像仓库管理端至对应的各个客户端或镜像仓库管理端至源存储端的带宽被占满的次数也较多,且镜像仓库管理端的并发访问量较多时导致单个镜像的下载速度较慢。基于此,本公开的一些实施例的镜像层文件发送方法,首先,响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件。由此,可以预先判断镜像仓库管理端的缓存中是否预先缓存了镜像层文件获取请求对应的镜像层文件。然后,响应于确定上述缓存中不存在对应上述镜像层文件获取请求的镜像层文件,从存储后端获取对应上述镜像层文件获取请求的镜像层文件。由此,可以在镜像仓库管理端的缓存中未预先缓存镜像层文件获取请求对应的镜像层文件时,才从存储后端获取该镜像层文件。其次,存储上述镜像层文件至上述缓存。由此,可以在获取到镜像层文件获取请求对应的镜像层文件以及未预先缓存该镜像层文件时,将从存储后端获取到的镜像层文件添加至缓存中。最后,将上述镜像层文件发送至上述客户端。由此,可以将获取到的镜像层文件返回至客户端以响应客户端的镜像层文件获取请求。也因为在接收到客户端的镜像层文件获取请求后,未直接从存储后端获取镜像层文件,可以减少镜像仓库管理端至存储后端的并发访问量,进而可以减少源存储端(存储后端)陷入不可用状态的次数、节省网络带宽。又因为镜像仓库管理端将从存储后端获取到的镜像层文件添加至缓存中,再次接收到对应该镜像层文件的镜像层文件获取请求时,可以直接从镜像仓库管理端的缓存中读取该镜像层文件,无需从存储后端获取,可以加快客户端获取镜像的速度。同时,镜像仓库管理端在接收到多个镜像层文件获取请求时,若缓存中存在对应镜像层文件获取请求的镜像层文件,可以无需从存储后端获取,节省了镜像仓库管理端的内存,从而减少了镜像仓库管理端陷入不可用状态的次数、节省了网络带宽。由此,减少了镜像仓库管理端或源存储端陷入不可用状态的次数,节省了网络带宽、加快了镜像获取速度。The above-mentioned embodiments of the present disclosure have the following beneficial effects: the method for sending mirror layer files according to some embodiments of the present disclosure reduces the number of times that the mirror warehouse management end or the source storage end falls into an unavailable state, saves network bandwidth, and speeds up Image acquisition speed. Specifically, the reason why the mirror warehouse management end or the source storage end is in an unavailable state more often, the network bandwidth is occupied more times, and the image acquisition speed is slow is: when the mirror warehouse management end or the source storage end When there are many concurrent visits, the mirror warehouse management end or the source storage end falls into an unavailable state more often, and the bandwidth from the mirror warehouse management end to the corresponding clients or the mirror warehouse management end to the source storage end is occupied more frequently. When the number of concurrent accesses on the management side of the mirror warehouse is large, the download speed of a single image is slow. Based on this, in the methods for sending mirror layer files according to some embodiments of the present disclosure, firstly, in response to receiving the mirror layer file acquisition request sent by the client, it is determined whether there is a cache corresponding to the above mirror layer file acquisition request in the cache of the above-mentioned mirror warehouse management end. Image layer file. In this way, it can be judged in advance whether the mirror layer file corresponding to the request for obtaining the mirror layer file is pre-cached in the cache of the mirror warehouse management end. Then, in response to determining that the image layer file corresponding to the image layer file obtaining request does not exist in the cache, obtain the image layer file corresponding to the image layer file obtaining request from the storage backend. Therefore, the mirror layer file can be obtained from the storage backend only when the mirror layer file corresponding to the request for obtaining the mirror layer file is not pre-cached in the cache of the mirror warehouse management end. Next, store the above-mentioned image layer file in the above-mentioned cache. Therefore, when the mirror layer file corresponding to the mirror layer file acquisition request is obtained and the mirror layer file is not cached in advance, the mirror layer file obtained from the storage backend can be added to the cache. Finally, the above image layer file is sent to the above client. Thus, the obtained image layer file can be returned to the client to respond to the client's request for obtaining the image layer file. It is also because the mirror layer file is not directly obtained from the storage backend after receiving the client's request for obtaining the mirror layer file, which can reduce the concurrent access from the mirror warehouse management end to the storage backend, which in turn can reduce the source storage end (storage backend) The number of times it was stuck in an unavailable state, saving network bandwidth. And because the mirror warehouse management end adds the mirror layer file obtained from the storage backend to the cache, when it receives the mirror layer file acquisition request corresponding to the mirror layer file again, it can directly read the mirror layer file from the cache of the mirror warehouse management end. The image layer file does not need to be obtained from the storage backend, which can speed up the speed of the client to obtain the image. At the same time, when the mirror warehouse management end receives multiple mirror layer file acquisition requests, if there is an mirror layer file corresponding to the mirror layer file acquisition request in the cache, it can be obtained from the storage backend without needing to obtain it from the storage backend, which saves the memory of the mirror warehouse management end. It reduces the number of times that the mirror warehouse management end falls into an unavailable state and saves network bandwidth. As a result, the number of times that the image warehouse management end or the source storage end falls into an unavailable state is reduced, network bandwidth is saved, and the image acquisition speed is accelerated.

进一步参考图3,其示出了镜像层文件发送方法的另一些实施例的流程300。该镜像层文件发送方法的流程300,应用于镜像仓库管理端,包括以下步骤:Referring further to FIG. 3 , it shows a process 300 of other embodiments of the method for sending an image layer file. The process 300 of the image layer file sending method, applied to the image warehouse management terminal, includes the following steps:

步骤301,响应于接收到客户端发送的镜像层文件获取请求,确定镜像仓库管理端的缓存中是否存在对应镜像层文件获取请求的镜像层文件。Step 301 , in response to receiving a request for obtaining an image layer file sent by a client, determine whether an image layer file corresponding to the image layer file obtaining request exists in the cache of the image warehouse management end.

在一些实施例中,镜像层文件发送方法的执行主体(例如图1所示的计算设备101)可以响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件。其中,上述缓存还可以包括分布式缓存。上述分布式缓存可以为上述镜像仓库管理端的分布式缓存系统。实践中,上述执行主体可以确定上述分布式缓存中是否存在镜像层文件标识为上述镜像层文件获取请求包括的镜像层文件标识的镜像层文件。由此,可以预先判断分布式缓存中是否预先添加了镜像层文件获取请求对应的镜像层文件。In some embodiments, the execution body of the method for sending an image layer file (for example, the computing device 101 shown in FIG. 1 ) may, in response to receiving a request for obtaining an image layer file sent by a client, determine whether the above-mentioned cache of the image warehouse management end exists. The image layer file corresponding to the above image layer file acquisition request. Wherein, the above cache may also include a distributed cache. The above-mentioned distributed cache may be the distributed cache system of the above-mentioned mirror warehouse management end. In practice, the execution body may determine whether there is an image layer file whose image layer file identifier is the image layer file identifier included in the image layer file acquisition request in the distributed cache. In this way, it can be determined in advance whether the image layer file corresponding to the image layer file acquisition request is pre-added in the distributed cache.

步骤302,响应于确定缓存中不存在对应镜像层文件获取请求的镜像层文件,从存储后端获取对应镜像层文件获取请求的镜像层文件。Step 302, in response to determining that the mirror layer file corresponding to the mirror layer file acquisition request does not exist in the cache, acquire the mirror layer file corresponding to the mirror layer file acquisition request from the storage backend.

在一些实施例中,上述执行主体可以响应于确定上述缓存中不存在对应上述镜像层文件获取请求的镜像层文件,从存储后端获取对应上述镜像层文件获取请求的镜像层文件。实践中,上述执行主体可以响应于确定分布式缓存中不存在对应上述镜像层文件获取请求的镜像层文件,从存储后端获取对应上述镜像层文件获取请求的镜像层文件。由此,可以在分布式缓存中未预先添加镜像层文件获取请求对应的镜像层文件时,才从存储后端获取该镜像层文件。In some embodiments, in response to determining that the image layer file corresponding to the image layer file obtaining request does not exist in the cache, the execution body may obtain the image layer file corresponding to the image layer file obtaining request from the storage backend. In practice, in response to determining that the image layer file corresponding to the image layer file obtaining request does not exist in the distributed cache, the execution body may obtain the image layer file corresponding to the image layer file obtaining request from the storage backend. Therefore, the mirror layer file can be obtained from the storage backend only when the mirror layer file corresponding to the request for obtaining the mirror layer file is not pre-added in the distributed cache.

步骤303,将镜像层文件存储至分布式缓存。Step 303: Store the image layer file in the distributed cache.

在一些实施例中,上述执行主体可以将上述镜像层文件存储至分布式缓存。由此,可以在获取到镜像层文件获取请求对应的镜像层文件以及分布式缓存中未预先添加该镜像层文件时,将从存储后端获取到的镜像层文件添加至分布式缓存中。In some embodiments, the above-mentioned execution body may store the above-mentioned image layer file in a distributed cache. Therefore, when the mirror layer file corresponding to the mirror layer file acquisition request is obtained and the mirror layer file is not pre-added in the distributed cache, the mirror layer file obtained from the storage backend can be added to the distributed cache.

步骤304,将镜像层文件发送至客户端。Step 304, sending the image layer file to the client.

在一些实施例中,步骤304的具体实现及所带来的技术效果可以参考图2对应的那些实施例中的步骤204,在此不再赘述。In some embodiments, for the specific implementation of step 304 and the technical effect brought about, reference may be made to step 204 in those embodiments corresponding to FIG. 2 , and details are not repeated here.

从图3中可以看出,与图2对应的一些实施例的描述相比,图3对应的一些实施例中的镜像层文件发送方法的流程300体现了对分布式缓存进行扩展的步骤。由此,这些实施例描述的方案可以在获取到镜像层文件获取请求对应的镜像层文件时,将从存储后端获取到的镜像层文件添加至分布式缓存中。进而可以直接将从分布式缓存中读取的镜像层文件返回给客户端以响应客户端的镜像层文件获取请求。也因为分布式缓存在高并发场景中的数据读写性能较好,可以进一步减少镜像仓库管理端或源存储端陷入不可用状态的次数,节省网络带宽,加快镜像获取速度。As can be seen from FIG. 3 , compared with the description of some embodiments corresponding to FIG. 2 , the process 300 of the method for sending mirror layer files in some embodiments corresponding to FIG. 3 embodies the steps of extending the distributed cache. Therefore, the solutions described in these embodiments can add the mirror layer file obtained from the storage backend to the distributed cache when the mirror layer file corresponding to the mirror layer file obtaining request is obtained. Furthermore, the image layer file read from the distributed cache can be directly returned to the client to respond to the client's request for obtaining the image layer file. Also, because the distributed cache has better data read and write performance in high concurrency scenarios, it can further reduce the number of times the mirror warehouse management end or source storage end falls into an unavailable state, save network bandwidth, and speed up image acquisition.

进一步参考图4,其示出了镜像层文件发送方法的又一些实施例的流程400。该镜像层文件发送方法的流程400,应用于镜像仓库管理端,包括以下步骤:With further reference to FIG. 4 , a flow 400 of further embodiments of the method for sending an image layer file is shown. The process 400 of the image layer file sending method, applied to the image warehouse management terminal, includes the following steps:

步骤401,响应于接收到客户端发送的镜像信息获取请求,将对应镜像信息获取请求的镜像的至少一个层文件信息发送至客户端。Step 401 , in response to receiving a request for obtaining image information sent by the client, send at least one layer file information of the image corresponding to the request for obtaining image information to the client.

在一些实施例中,镜像层文件发送方法的执行主体(例如图1所示的计算设备101)可以响应于接收到上述客户端发送的镜像信息获取请求,将对应上述镜像信息获取请求的镜像的至少一个层文件信息发送至上述客户端,使得上述客户端根据上述至少一个层文件信息中的每个层文件信息生成对应上述层文件信息的镜像层文件获取请求。其中,上述镜像信息获取请求可以为用于获取镜像相关信息的请求。上述层文件信息可以为上述镜像的镜像层文件的相关信息,可以包括但不限于以下至少一项:镜像层文件标识,镜像层文件名称。上述至少一个层文件信息可以为上述镜像对应的各个镜像层文件的层文件信息。上述客户端接收到上述至少一个层文件信息后,可以生成对应上述至少一个层文件信息中每个层文件信息的镜像层文件获取请求。之后,可以将生成的镜像层文件获取请求发送至上述执行主体。由此,可以使得上述客户端根据预先获取的一镜像的层文件信息生成镜像层文件获取请求,以用于获取层文件信息对应的镜像层文件。In some embodiments, the execution body of the image layer file sending method (for example, the computing device 101 shown in FIG. 1 ) may, in response to receiving the image information acquisition request sent by the client, send the image corresponding to the image information acquisition request above. The at least one layer file information is sent to the above-mentioned client, so that the above-mentioned client generates a mirror layer file acquisition request corresponding to the above-mentioned layer file information according to each layer file information in the above-mentioned at least one layer file information. The above-mentioned mirror information acquisition request may be a request for acquiring mirror-related information. The above-mentioned layer file information may be related information of the above-mentioned mirror image layer file, which may include but not limited to at least one of the following: an image layer file identifier and an image layer file name. The at least one layer file information may be layer file information of each image layer file corresponding to the image above. After receiving the above-mentioned at least one layer file information, the above-mentioned client may generate an image layer file acquisition request corresponding to each layer file information in the above-mentioned at least one layer file information. After that, the generated image layer file acquisition request may be sent to the above-mentioned execution body. In this way, the client can be made to generate an image layer file acquisition request according to pre-acquired layer file information of an image, so as to obtain an image layer file corresponding to the layer file information.

步骤402,响应于接收到客户端发送的镜像层文件获取请求,确定镜像仓库管理端的缓存中是否存在对应镜像层文件获取请求的镜像层文件。Step 402: In response to receiving the request for obtaining the image layer file sent by the client, determine whether there is an image layer file corresponding to the image layer file obtaining request in the cache of the image warehouse management end.

步骤403,响应于确定缓存中不存在对应镜像层文件获取请求的镜像层文件,从存储后端获取对应镜像层文件获取请求的镜像层文件。Step 403, in response to determining that the mirror layer file corresponding to the mirror layer file acquisition request does not exist in the cache, acquire the mirror layer file corresponding to the mirror layer file acquisition request from the storage backend.

步骤404,存储镜像层文件至缓存。Step 404, store the image layer file in the cache.

步骤405,将镜像层文件发送至客户端。Step 405, sending the image layer file to the client.

在一些实施例中,步骤402-405的具体实现及所带来的技术效果可以参考图2对应的那些实施例中的步骤201-204,在此不再赘述。In some embodiments, for the specific implementation of steps 402-405 and the technical effects brought about, reference may be made to steps 201-204 in those embodiments corresponding to FIG. 2, and details are not repeated here.

从图4中可以看出,与图2对应的一些实施例的描述相比,图4对应的一些实施例中的镜像层文件发送方法的流程400体现了对发送层文件信息进行扩展的步骤。由此,这些实施例描述的方案使得上述客户端根据预先获取的一镜像的层文件信息生成镜像层文件获取请求,以用于获取层文件信息对应的镜像层文件。As can be seen from FIG. 4 , compared with the descriptions of some embodiments corresponding to FIG. 2 , the process 400 of the method for sending a mirror layer file in some embodiments corresponding to FIG. 4 embodies the steps of extending the sending layer file information. Therefore, the solutions described in these embodiments enable the client to generate an image layer file acquisition request according to pre-acquired layer file information of an image, so as to obtain an image layer file corresponding to the layer file information.

进一步参考图5,作为对上述各图所示方法的实现,本公开提供了一种镜像层文件发送装置的一些实施例,这些装置实施例与图2所示的那些方法实施例相对应,应用于镜像仓库管理端,该装置具体可以应用于各种电子设备中。With further reference to FIG. 5 , as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of an apparatus for sending an image layer file. These apparatus embodiments correspond to those method embodiments shown in FIG. 2 . For the mirror warehouse management end, the device can be specifically applied to various electronic devices.

如图5所示,一些实施例的镜像层文件发送装置500包括:确定单元501、获取单元502、存储单元503和发送单元504。其中,确定单元501被配置成响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件;获取单元502被配置成响应于确定上述缓存中不存在对应上述镜像层文件获取请求的镜像层文件,从存储后端获取对应上述镜像层文件获取请求的镜像层文件;存储单元503被配置成存储上述镜像层文件至上述缓存;发送单元504被配置成将上述镜像层文件发送至上述客户端。As shown in FIG. 5 , the apparatus 500 for sending an image layer file in some embodiments includes: a determining unit 501 , an obtaining unit 502 , a storage unit 503 and a sending unit 504 . Wherein, the determining unit 501 is configured to, in response to receiving the request for obtaining the mirror layer file sent by the client, determine whether there is an image layer file corresponding to the above-mentioned mirror layer file obtaining request in the cache of the above-mentioned mirror warehouse management end; the obtaining unit 502 is configured to In response to determining that the mirror layer file corresponding to the above-mentioned mirror layer file acquisition request does not exist in the above-mentioned cache, the mirror layer file corresponding to the above-mentioned mirror layer file acquisition request is obtained from the storage backend; the storage unit 503 is configured to store the above-mentioned mirror layer file to the above-mentioned mirror layer file. Cache; the sending unit 504 is configured to send the above-mentioned image layer file to the above-mentioned client.

可选地,镜像层文件发送装置500还可以包括:镜像层文件获取单元和镜像层文件发送单元(图中未示出)。其中,镜像层文件获取单元被配置成响应于确定上述缓存中存在对应上述镜像层文件获取请求的镜像层文件,从上述缓存中获取对应上述镜像层文件获取请求的镜像层文件作为缓存镜像层文件。镜像层文件发送单元被配置成将上述缓存镜像层文件发送至上述客户端。Optionally, the apparatus 500 for sending an image layer file may further include: an image layer file acquiring unit and an image layer file sending unit (not shown in the figure). The image layer file obtaining unit is configured to, in response to determining that the image layer file corresponding to the image layer file obtaining request exists in the cache, obtain the image layer file corresponding to the image layer file obtaining request from the cache as the cache image layer file . The image layer file sending unit is configured to send the cache image layer file to the client.

可选地,上述缓存包括分布式缓存。存储单元503可以进一步被配置成:将上述镜像层文件存储至上述分布式缓存。Optionally, the above cache includes a distributed cache. The storage unit 503 may be further configured to: store the above-mentioned image layer file in the above-mentioned distributed cache.

可选地,在确定单元501之前,镜像层文件发送装置500还可以包括:层文件信息发送单元(图中未示出),被配置成响应于接收到上述客户端发送的镜像信息获取请求,将对应上述镜像信息获取请求的镜像的至少一个层文件信息发送至上述客户端,使得上述客户端根据上述至少一个层文件信息中的每个层文件信息生成对应上述层文件信息的镜像层文件获取请求。Optionally, before the determining unit 501, the apparatus for sending mirror layer files 500 may further include: a layer file information sending unit (not shown in the figure), configured to respond to receiving the mirror information acquisition request sent by the above-mentioned client, Send at least one layer file information of the mirror image corresponding to the above-mentioned mirror information acquisition request to the above-mentioned client, so that the above-mentioned client generates the mirror layer file corresponding to the above-mentioned layer file information according to each layer file information in the above-mentioned at least one layer file information. ask.

可选地,确定单元501可以进一步被配置成:响应于在预设时间段内接收到至少一个客户端分别发送的对应于上述镜像层文件的镜像层文件获取请求,确定上述缓存中是否存在上述镜像层文件。以及发送单元504可以进一步被配置成:将上述镜像层文件分别发送至上述至少一个客户端中的各个客户端。Optionally, the determining unit 501 may be further configured to: in response to receiving, within a preset period of time, a request for obtaining an image layer file corresponding to the above-mentioned image layer file sent by at least one client respectively, determine whether the above-mentioned cache exists in the above-mentioned cache. Image layer file. And the sending unit 504 may be further configured to: send the above image layer file to each of the above at least one client respectively.

可选地,镜像层文件发送装置500还可以包括:第一删除单元(图中未示出),被配置成响应于当前时间满足预设周期时间条件,从上述缓存中删除存储时长大于等于预设周期时长的镜像层文件,上述预设周期时长对应上述预设周期时间条件。Optionally, the image layer file sending apparatus 500 may further include: a first deletion unit (not shown in the figure), configured to delete the storage duration from the above-mentioned cache in response to the current time meeting the preset cycle time condition, and the storage duration is greater than or equal to the preset period. Set the image layer file of the cycle duration, and the preset cycle duration corresponds to the preset cycle time condition.

可选地,镜像层文件发送装置500还可以包括:第二删除单元(图中未示出),被配置成响应于上述缓存的剩余缓存容量小于等于预设缓存容量,从上述缓存中删除存储时间在预设历史时间前的镜像层文件。Optionally, the image layer file sending apparatus 500 may further include: a second deletion unit (not shown in the figure), configured to delete the storage from the above-mentioned cache in response to the remaining buffer capacity of the above-mentioned cache being less than or equal to the preset buffer capacity. The image layer file whose time is before the preset historical time.

可选地,镜像层文件发送装置500还可以包括:镜像层文件存储单元(图中未示出),被配置成响应于接收到上述存储后端发送的镜像层文件预存信息,将上述镜像层文件预存信息包括的镜像层文件存储至上述缓存。Optionally, the apparatus 500 for sending mirror layer files may further include: a mirror layer file storage unit (not shown in the figure), configured to store the above mirror layer files in response to receiving the mirror layer file pre-storage information sent by the above-mentioned storage backend. The image layer files included in the file pre-storage information are stored in the cache.

可以理解的是,该装置500中记载的诸单元与参考图2描述的方法中的各个步骤相对应。由此,上文针对方法描述的操作、特征以及产生的有益效果同样适用于装置500及其中包含的单元,在此不再赘述。It can be understood that the units recorded in the apparatus 500 correspond to the respective steps in the method described with reference to FIG. 2 . Therefore, the operations, features and beneficial effects described above with respect to the method are also applicable to the apparatus 500 and the units included therein, and details are not described herein again.

下面参考图6,其示出了适于用来实现本公开的一些实施例的电子设备(例如图1中的计算设备101)600的结构示意图。图6示出的电子设备仅仅是一个示例,不应对本公开的实施例的功能和使用范围带来任何限制。Referring now to FIG. 6 , a schematic structural diagram of an electronic device (eg, computing device 101 in FIG. 1 ) 600 suitable for implementing some embodiments of the present disclosure is shown. The electronic device shown in FIG. 6 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.

如图6所示,电子设备600可以包括处理装置(例如中央处理器、图形处理器等)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储装置608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有电子设备600操作所需的各种程序和数据。处理装置601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。As shown in FIG. 6, an electronic device 600 may include a processing device (eg, a central processing unit, a graphics processor, etc.) 601 that may be loaded into random access according to a program stored in a read only memory (ROM) 602 or from a storage device 608 Various appropriate actions and processes are executed by the programs in the memory (RAM) 603 . In the RAM 603, various programs and data necessary for the operation of the electronic device 600 are also stored. The processing device 601 , the ROM 602 , and the RAM 603 are connected to each other through a bus 604 . An input/output (I/O) interface 605 is also connected to bus 604 .

通常,以下装置可以连接至I/O接口605:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置606;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。通信装置609可以允许电子设备600与其他设备进行无线或有线通信以交换数据。虽然图6示出了具有各种装置的电子设备600,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。图6中示出的每个方框可以代表一个装置,也可以根据需要代表多个装置。Typically, the following devices can be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibration An output device 607 of a computer, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. Communication means 609 may allow electronic device 600 to communicate wirelessly or by wire with other devices to exchange data. While FIG. 6 shows electronic device 600 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in FIG. 6 may represent one device, or may represent multiple devices as required.

特别地,根据本公开的一些实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的一些实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的一些实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置608被安装,或者从ROM 602被安装。在该计算机程序被处理装置601执行时,执行本公开的一些实施例的方法中限定的上述功能。In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In some such embodiments, the computer program may be downloaded and installed from the network via the communication device 609 , or from the storage device 608 , or from the ROM 602 . When the computer program is executed by the processing device 601, the above-mentioned functions defined in the methods of some embodiments of the present disclosure are performed.

需要说明的是,本公开的一些实施例中记载的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开的一些实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开的一些实施例中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium described in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In some embodiments of the present disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. Rather, in some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.

在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText TransferProtocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, the client and server can communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with digital data in any form or medium (eg, a communications network) interconnected. Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet (eg, the Internet), and peer-to-peer networks (eg, ad hoc peer-to-peer networks), as well as any currently known or future development network of.

上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件;响应于确定上述缓存中不存在对应上述镜像层文件获取请求的镜像层文件,从存储后端获取对应上述镜像层文件获取请求的镜像层文件;存储上述镜像层文件至上述缓存;将上述镜像层文件发送至上述客户端。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled into the electronic device. The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: in response to receiving a request for obtaining an image layer file sent by a client, determine the above-mentioned mirror warehouse Whether there is an image layer file corresponding to the above-mentioned image layer file acquisition request in the cache of the management end; in response to determining that there is no image layer file corresponding to the above-mentioned image layer file acquisition request in the above-mentioned cache, obtain from the storage backend corresponding to the above-mentioned image layer file acquisition request The image layer file is stored; the image layer file is stored in the cache; the image layer file is sent to the client.

可以以一种或多种程序设计语言或其组合来编写用于执行本公开的一些实施例的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of some embodiments of the present disclosure may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, or a combination thereof, Also included are conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider to via Internet connection).

附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.

描述于本公开的一些实施例中的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括确定单元、获取单元、存储单元和发送单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,确定单元还可以被描述为“响应于接收到客户端发送的镜像层文件获取请求,确定上述镜像仓库管理端的缓存中是否存在对应上述镜像层文件获取请求的镜像层文件的单元”。The units described in some embodiments of the present disclosure may be implemented by means of software, and may also be implemented by means of hardware. The described unit may also be provided in the processor, for example, it may be described as: a processor includes a determination unit, an acquisition unit, a storage unit and a transmission unit. Wherein, the names of these units do not constitute a limitation on the unit itself under certain circumstances, for example, the determination unit may also be described as "in response to receiving the request for obtaining the image layer file sent by the client, determine the above-mentioned image warehouse management Whether there is a unit corresponding to the mirror layer file of the above-mentioned mirror layer file acquisition request in the cache of the client".

本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), Systems on Chips (SOCs), Complex Programmable Logical Devices (CPLDs) and more.

以上描述仅为本公开的一些较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开的实施例中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开的实施例中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above descriptions are merely some preferred embodiments of the present disclosure and illustrations of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solution formed by the specific combination of the above-mentioned technical features, and should also cover, without departing from the above-mentioned inventive concept, the above-mentioned Other technical solutions formed by any combination of technical features or their equivalent features. For example, a technical solution is formed by replacing the above-mentioned features with the technical features disclosed in the embodiments of the present disclosure (but not limited to) with similar functions.

Claims (11)

1.一种镜像层文件发送方法,应用于镜像仓库管理端,包括:1. A method for sending mirror layer files, applied to a mirror warehouse management terminal, comprising: 响应于接收到客户端发送的镜像层文件获取请求,确定所述镜像仓库管理端的缓存中是否存在对应所述镜像层文件获取请求的镜像层文件;In response to receiving the mirror layer file acquisition request sent by the client, determine whether there is an mirror layer file corresponding to the mirror layer file acquisition request in the cache of the mirror warehouse management end; 响应于确定所述缓存中不存在对应所述镜像层文件获取请求的镜像层文件,从存储后端获取对应所述镜像层文件获取请求的镜像层文件;In response to determining that the mirror layer file corresponding to the mirror layer file acquisition request does not exist in the cache, acquire the mirror layer file corresponding to the mirror layer file acquisition request from the storage backend; 存储所述镜像层文件至所述缓存;storing the image layer file in the cache; 将所述镜像层文件发送至所述客户端。Send the image layer file to the client. 2.根据权利要求1所述的方法,其中,所述方法还包括:2. The method of claim 1, wherein the method further comprises: 响应于确定所述缓存中存在对应所述镜像层文件获取请求的镜像层文件,从所述缓存中获取对应所述镜像层文件获取请求的镜像层文件作为缓存镜像层文件;In response to determining that an image layer file corresponding to the image layer file acquisition request exists in the cache, acquiring an image layer file corresponding to the image layer file acquisition request from the cache as a cache image layer file; 将所述缓存镜像层文件发送至所述客户端。Send the cache image layer file to the client. 3.根据权利要求2所述的方法,其中,所述缓存包括分布式缓存,3. The method of claim 2, wherein the cache comprises a distributed cache, 所述存储所述镜像层文件至所述缓存,包括:The storing of the image layer file to the cache includes: 将所述镜像层文件存储至所述分布式缓存。storing the image layer file in the distributed cache. 4.根据权利要求1所述的方法,其中,在所述响应于接收到客户端发送的镜像层文件获取请求,确定所述镜像仓库管理端的缓存中是否存在对应所述镜像层文件获取请求的镜像层文件之前,所述方法还包括:4. The method according to claim 1, wherein, in the response to receiving the image layer file acquisition request sent by the client, it is determined whether there is a cache corresponding to the image layer file acquisition request in the cache of the image warehouse management end. Before the image layer file, the method further includes: 响应于接收到所述客户端发送的镜像信息获取请求,将对应所述镜像信息获取请求的镜像的至少一个层文件信息发送至所述客户端,使得所述客户端根据所述至少一个层文件信息中的每个层文件信息生成对应所述层文件信息的镜像层文件获取请求。In response to receiving the mirror image information acquisition request sent by the client, send at least one layer file information of the mirror image corresponding to the mirror information acquisition request to the client, so that the client can obtain the mirror image information according to the at least one layer file information. Each layer file information in the information generates an image layer file acquisition request corresponding to the layer file information. 5.根据权利要求1所述的方法,其中,所述响应于接收到客户端发送的镜像层文件获取请求,确定所述镜像仓库管理端的缓存中是否存在对应所述镜像层文件获取请求的镜像层文件,包括:5. The method according to claim 1, wherein, in response to receiving an image layer file acquisition request sent by a client, it is determined whether there is an image corresponding to the image layer file acquisition request in the cache of the image warehouse management end Layer files, including: 响应于在预设时间段内接收到至少一个客户端分别发送的对应于所述镜像层文件的镜像层文件获取请求,确定所述缓存中是否存在所述镜像层文件;以及In response to receiving within a preset period of time a request for obtaining an image layer file corresponding to the image layer file sent by at least one client respectively, determining whether the image layer file exists in the cache; and 所述将所述镜像层文件发送至所述客户端,包括:The sending the image layer file to the client includes: 将所述镜像层文件分别发送至所述至少一个客户端中的各个客户端。Send the image layer file to each of the at least one client respectively. 6.根据权利要求1-5之一所述的方法,其中,所述方法还包括:6. The method of one of claims 1-5, wherein the method further comprises: 响应于当前时间满足预设周期时间条件,从所述缓存中删除存储时长大于等于预设周期时长的镜像层文件,所述预设周期时长对应所述预设周期时间条件。In response to the current time meeting a preset cycle time condition, delete from the cache mirror layer files whose storage duration is greater than or equal to a preset cycle duration, where the preset cycle duration corresponds to the preset cycle time condition. 7.根据权利要求1-5之一所述的方法,其中,所述方法还包括:7. The method of one of claims 1-5, wherein the method further comprises: 响应于所述缓存的剩余缓存容量小于等于预设缓存容量,从所述缓存中删除存储时间在预设历史时间前的镜像层文件。In response to the remaining cache capacity of the cache being less than or equal to the preset cache capacity, delete the mirror layer files whose storage time is before the preset historical time from the cache. 8.根据权利要求1-5之一所述的方法,其中,所述方法还包括:8. The method of one of claims 1-5, wherein the method further comprises: 响应于接收到所述存储后端发送的镜像层文件预存信息,将所述镜像层文件预存信息包括的镜像层文件存储至所述缓存。In response to receiving the image layer file pre-storage information sent by the storage back end, the image layer file included in the image-layer file pre-storage information is stored in the cache. 9.一种镜像层文件发送装置,应用于镜像仓库管理端,包括:9. A device for sending mirror layer files, applied to a mirror warehouse management terminal, comprising: 确定单元,被配置成响应于接收到客户端发送的镜像层文件获取请求,确定所述镜像仓库管理端的缓存中是否存在对应所述镜像层文件获取请求的镜像层文件;a determining unit, configured to, in response to receiving the image layer file acquisition request sent by the client, determine whether there is an image layer file corresponding to the image layer file acquisition request in the cache of the image warehouse management end; 获取单元,被配置成响应于确定所述缓存中不存在对应所述镜像层文件获取请求的镜像层文件,从存储后端获取对应所述镜像层文件获取请求的镜像层文件;an obtaining unit, configured to obtain, from the storage back-end, an image layer file corresponding to the image layer file obtaining request from the storage backend in response to determining that the image layer file corresponding to the image layer file obtaining request does not exist in the cache; 存储单元,被配置成存储所述镜像层文件至所述缓存;a storage unit configured to store the image layer file to the cache; 发送单元,被配置成将所述镜像层文件发送至所述客户端。A sending unit, configured to send the image layer file to the client. 10.一种电子设备,包括:10. An electronic device comprising: 一个或多个处理器;one or more processors; 存储装置,其上存储有一个或多个程序,a storage device on which one or more programs are stored, 当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-8中任一所述的方法。The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8. 11.一种计算机可读介质,其上存储有计算机程序,其中,所述程序被处理器执行时实现如权利要求1-8中任一所述的方法。11. A computer-readable medium having stored thereon a computer program, wherein the program, when executed by a processor, implements the method of any one of claims 1-8.
CN202210339633.XA 2022-04-01 2022-04-01 Mirror layer file sending method and device, electronic equipment and computer readable medium Pending CN114785770A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210339633.XA CN114785770A (en) 2022-04-01 2022-04-01 Mirror layer file sending method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210339633.XA CN114785770A (en) 2022-04-01 2022-04-01 Mirror layer file sending method and device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN114785770A true CN114785770A (en) 2022-07-22

Family

ID=82426805

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210339633.XA Pending CN114785770A (en) 2022-04-01 2022-04-01 Mirror layer file sending method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN114785770A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116909752A (en) * 2023-09-11 2023-10-20 京东科技信息技术有限公司 A page mirror storage method, device, equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB201408152D0 (en) * 2013-05-10 2014-06-25 Appsense Ltd Systems, methods and media for minimizing data downloads
CN109246234A (en) * 2018-09-30 2019-01-18 北京金山云网络技术有限公司 A kind of image file method for down loading, device, electronic equipment and storage medium
CN111625320A (en) * 2020-05-27 2020-09-04 苏州浪潮智能科技有限公司 Mirror image management method, system, device and medium
CN111858156A (en) * 2020-06-12 2020-10-30 北京金山云网络技术有限公司 Image management method, device and electronic device
CN112748879A (en) * 2020-12-30 2021-05-04 中科曙光国际信息产业有限公司 Data acquisition method, system, device, computer equipment and storage medium
CN112799780A (en) * 2021-01-15 2021-05-14 中国银联股份有限公司 Container image sharing method, apparatus, server, device and medium
CN113127430A (en) * 2019-12-30 2021-07-16 北京懿医云科技有限公司 Mirror image information processing method and device, computer readable medium and electronic equipment
CN113495870A (en) * 2020-04-01 2021-10-12 北京沃东天骏信息技术有限公司 Mirror image construction method and device, electronic equipment and storage medium
WO2021232289A1 (en) * 2020-05-20 2021-11-25 深圳市欢太科技有限公司 Image pulling method and related product
WO2021237645A1 (en) * 2020-05-29 2021-12-02 深圳市欢太科技有限公司 Method and apparatus for updating mirroring, and electronic device and storage medium
CN114116538A (en) * 2021-11-26 2022-03-01 新华三大数据技术有限公司 Mirror cache management method, device, equipment and storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB201408152D0 (en) * 2013-05-10 2014-06-25 Appsense Ltd Systems, methods and media for minimizing data downloads
CN109246234A (en) * 2018-09-30 2019-01-18 北京金山云网络技术有限公司 A kind of image file method for down loading, device, electronic equipment and storage medium
CN113127430A (en) * 2019-12-30 2021-07-16 北京懿医云科技有限公司 Mirror image information processing method and device, computer readable medium and electronic equipment
CN113495870A (en) * 2020-04-01 2021-10-12 北京沃东天骏信息技术有限公司 Mirror image construction method and device, electronic equipment and storage medium
WO2021232289A1 (en) * 2020-05-20 2021-11-25 深圳市欢太科技有限公司 Image pulling method and related product
CN111625320A (en) * 2020-05-27 2020-09-04 苏州浪潮智能科技有限公司 Mirror image management method, system, device and medium
WO2021237645A1 (en) * 2020-05-29 2021-12-02 深圳市欢太科技有限公司 Method and apparatus for updating mirroring, and electronic device and storage medium
CN111858156A (en) * 2020-06-12 2020-10-30 北京金山云网络技术有限公司 Image management method, device and electronic device
CN112748879A (en) * 2020-12-30 2021-05-04 中科曙光国际信息产业有限公司 Data acquisition method, system, device, computer equipment and storage medium
CN112799780A (en) * 2021-01-15 2021-05-14 中国银联股份有限公司 Container image sharing method, apparatus, server, device and medium
CN114116538A (en) * 2021-11-26 2022-03-01 新华三大数据技术有限公司 Mirror cache management method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116909752A (en) * 2023-09-11 2023-10-20 京东科技信息技术有限公司 A page mirror storage method, device, equipment and storage medium
CN116909752B (en) * 2023-09-11 2024-02-02 京东科技信息技术有限公司 Page mirror image storage method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN112363879B (en) Cache server performance test method, device, equipment and medium
CN114637703B (en) Data access device, method, readable medium and electronic equipment
CN110795446A (en) List updating method and device, readable medium and electronic equipment
CN113468445B (en) Request processing method, apparatus, electronic device and computer readable medium
WO2024124789A1 (en) File processing method and apparatus, server, and medium
CN113760536A (en) Data caching method and device, electronic equipment and computer readable medium
CN114785770A (en) Mirror layer file sending method and device, electronic equipment and computer readable medium
WO2023273576A1 (en) Abnormal request processing method and apparatus, electronic device and storage medium
CN113157365A (en) Program running method and device, electronic equipment and computer readable medium
CN113553206B (en) Data event execution method and device, electronic equipment and computer readable medium
CN111309366A (en) Method, device, medium and electronic equipment for managing registration core
CN112311840A (en) Multi-terminal data synchronization method, device, equipment and medium
CN112163176B (en) Data storage method, device, electronic device and computer readable medium
CN114490718A (en) Data output method, data output device, electronic equipment and computer readable medium
CN114115941A (en) Resource sending method, page rendering method, apparatus, electronic device and medium
CN113342837B (en) Data transmission method, device, electronic equipment and computer readable medium
CN115993942B (en) Data caching method, device, electronic equipment and computer readable medium
CN112115154A (en) Data processing and data query method, device, equipment and computer readable medium
CN114610760A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN111580890A (en) Method, apparatus, electronic device, and computer-readable medium for processing features
CN113467883A (en) Container management method and device in application development and computer-readable storage medium
CN117785477B (en) Distributed database service request execution method, device, electronic device and medium
CN113407493B (en) Operation method, data reading and writing method, device, electronic equipment and medium
CN111314457B (en) Method and device for setting virtual private cloud
CN114116859A (en) Number source information sending method and device, electronic equipment and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination