Container mirror image reading method and system, electronic equipment and storage medium
By allocating resources and sending device paths in multiple block storage devices of the container image reading disk, the problem of low container image reading efficiency is solved, more efficient container instance creation and startup is achieved, and concurrent reading capability is improved.
Patent Information
- Application Number
- CN202311060010.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-21
- Publication Date
- 2025-02-28
AI Technical Summary
The read efficiency of container images is low, which affects the creation and startup efficiency of container instances.
In multiple block storage devices of the container image reading disk, the corresponding block storage device is allocated for each container image reading request, and the device path is sent to the cloud server instance for it to read the container image.
By reading container images from block storage devices, the reading speed and efficiency of container images are improved, thus improving the creation and startup efficiency of container instances, and improving the concurrent reading capability of container images.
Smart Images

Figure CN119536895A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a method, system, electronic device, and storage medium for reading container images. Background Art
[0002] Container technology has been widely used due to its advantages such as lightness, portability, scalability and environmental isolation. In the application process of container technology, if you want to create and start a container instance, you need to read the corresponding configured container image first. Therefore, the reading efficiency of the container image has a crucial impact on the creation and startup efficiency of the container instance. Therefore, how to improve the reading efficiency of the container image has become a technical problem that needs to be solved in the application process of container technology. Summary of the invention
[0003] The embodiments of the present application provide a method, system, electronic device, and storage medium for reading a container image to improve the reading efficiency of a container image.
[0004] In a first aspect, an embodiment of the present application provides a first method for reading a container image, comprising: for multiple container image reading requests received, allocating a corresponding block storage device to each container image reading request in multiple block storage devices of a container image reading disk; multiple container image reading requests are provided by at least one cloud server instance for the container image reading disk; container images are stored in each block storage device; a device path of the block storage device allocated to each container image reading request is sent to the corresponding cloud server instance, so that the cloud server instance reads the container image from the corresponding block storage device according to the device path; the device path is used to identify the path of the block storage device in the container image reading disk.
[0005] In a second aspect, an embodiment of the present application provides another method for reading a container image, which is applied to a target cloud server instance, the method comprising: sending a target container image read request to a server for a container image read disk; the server is used to allocate a corresponding block storage device to each container image read request in multiple block storage devices of the container image read disk for multiple container image read requests received; sending a device path of the block storage device to which each container image read request is allocated to a corresponding cloud server instance, so that the cloud server instance reads the container image from the corresponding block storage device according to the device path; wherein the multiple container image read requests are provided by at least one cloud server instance for a container image read disk, the at least one cloud server instance includes a target cloud server instance, each block storage device stores a container image respectively, the device path is used to identify the path of the block storage device in the container image read disk, and the target container image read request is allocated to the target block storage device; obtaining the device path corresponding to the target block storage device provided by the server; and reading the container image stored in the target block storage device according to the device path corresponding to the target block storage device for creating a container instance.
[0006] In a third aspect, an embodiment of the present application provides a container image reading system, comprising: at least one cloud server instance, a server, and multiple block storage devices constituting a container image reading disk; the server is used to execute the first container image reading method provided in the embodiment of the present application; a target cloud server instance in at least one cloud server instance is used to execute another container image reading method provided in the embodiment of the present application; and a block storage device is used to store and provide the cloud server instance with reading container images.
[0007] In a fourth aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory, and the processor implements the method provided in any embodiment of the present application when executing the computer program.
[0008] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method provided in any embodiment of the present application is implemented.
[0009] Compared with the prior art, this application has the following advantages:
[0010] The technical solution of the present application, after receiving multiple container image reading requests provided by at least one cloud server instance for a container image reading disk, will allocate a corresponding block storage device to each container image reading request in multiple block storage devices of the container image reading disk, and will further send the device path of the block storage device to which each container image reading request is allocated to the corresponding cloud server instance, so that the cloud server instance can read the container image from the corresponding block storage device according to the device path. Compared with reading a container image from an object storage device, reading a container image from a block storage device will result in a faster reading speed of the container image. Therefore, compared with reading a container image from an object storage device, reading a container image from a block storage device will make the reading efficiency of the container image higher, and thus compared with reading a container image from an object storage device, reading a container image from a block storage device will make the creation and startup of a container instance more efficient.
[0011] In addition, since a corresponding block storage device is allocated to each container image read request among the multiple block storage devices of the container image reading disk, the multiple block storage devices of the container image reading disk are used to simultaneously support the reading of the container image, which can improve the concurrent reading capability of the container image. Therefore, by using multiple block storage devices to simultaneously support the reading of the container image, the reading efficiency of the container image can be improved when facing multiple container image read requests. In other words, based on the technical solution of the present application, the reading efficiency of the container image can be improved when facing multiple container image read requests, and thus based on the technical solution of the present application, when there is a need to concurrently create and start multiple container instances and the container image needs to be read concurrently, the efficiency of creating and starting the container instance can be improved.
[0012] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application.
[0014] Figure 1 A schematic diagram of the container image reading process for the application scenario of this application;
[0015] Figure 2 This is a flowchart of a method for reading a container image according to Embodiment 1 of the present application;
[0016] Figure 3 This is a flowchart of a method for reading a container image according to Embodiment 2 of the present application;
[0017] Figure 4 This is a structural block diagram of a container image reading system according to Embodiment 5 of the present application;
[0018] Figure 5 A block diagram of an electronic device used to implement an embodiment of the present application. DETAILED DESCRIPTION
[0019] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the concept or scope of the present application. Therefore, the drawings and descriptions are considered to be exemplary in nature and not restrictive.
[0020] To facilitate understanding of the technical solutions of the embodiments of the present application, the following describes the related technologies of the embodiments of the present application. The following related technologies can be combined with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application.
[0021] Explanation of terms
[0022] A cloud server instance is a virtual server created and run on a cloud computing platform. Common cloud server instances are of the following types: 1. General Purpose Instances. This type of instance is suitable for most general computing tasks and provides balanced computing, memory, and network performance. 2. Compute-Optimized Instances. This type of instance focuses on providing powerful computing capabilities and is suitable for workloads that require high-performance computing. 3. Memory-Optimized Instances. This type of instance provides large-capacity memory resources and is suitable for memory-intensive workloads such as cache servers and in-memory databases. 4. Storage-Optimized Instances. This type of instance focuses on providing high-performance storage resources and is suitable for workloads that need to process large-scale data and high throughput. 5. GPU Instances. This type of instance is equipped with a graphics processing unit (GPU) and is suitable for computing-intensive workloads such as graphics processing and machine learning. 6. Elastic Compute Instances. This type of instance is scalable and can be dynamically adjusted according to actual needs to achieve elastic expansion and contraction. Specifically, the specific form of the cloud server instance can be a virtual machine (VM) instance, an elastic cloud server (ECS) instance, and a bare metal server (BMS) instance. It should be noted that the type and specific form of the cloud server instance are not specifically limited in the embodiments of the present application.
[0023] The container image read request in the embodiment of the present application is initiated by the cloud server instance for the container image read disk to create the container instance. Specifically, in the process of creating the container instance, the cloud server instance needs to read the container image first, and then create the container instance based on the read container image. In order to read the container image, the cloud server instance will initiate a container image read request to the server for the container image read disk.
[0024] Among them, the server generally refers to a cloud server, and may also refer to a server or a server cluster. A container instance is used to provide an independent runtime environment so that an application can run in an isolated container. In addition, a container image includes components required by the application's code, runtime environment, system tools, and dependent libraries, as well as configurations and parameters required to start and run the application. In an embodiment of the present application, a container instance generally refers to an ECI (Elastic Container Instance), and may also be a container instance of other types besides an ECI.
[0025] The container image reading disk is pre-configured using multiple block storage devices to store container images so that the cloud server instance can read the container image from it. Specifically, each block storage device stores a container image respectively, and the cloud server instance reading the container image from the container image reading disk specifically means that the cloud server instance reads the container image from the block storage device corresponding to the device path provided by the server. For the cloud server instance, the object to which the cloud server instance sends the container image reading request is the container image reading disk, not the multiple block storage devices in the container image reading disk. For the server, after receiving the container image reading request provided by the cloud server instance for the container image reading disk, the server will allocate the corresponding block storage device for the container image reading request from the multiple block storage devices of the container image reading disk, that is, for the server, the allocation object of the server is each block storage device in the container image reading disk, not the container image reading disk.
[0026] The container image read request provided by the cloud server instance carries the container image read disk identifier. After receiving the container image read request, the server will first parse the container image read request to obtain the container image read disk identifier. Then, based on the container image read disk identifier, the container image read disk targeted by the container image read request is located. Finally, the server will allocate a corresponding block storage device to the container image read request from multiple block storage devices of the container image read disk targeted by the container image read request.
[0027] In the embodiment of the present application, among the multiple block storage devices of the container image reading disk, allocating a corresponding block storage device for each container image reading request means first matching the metadata pre-configured for the container image reading disk according to the container image reading disk identifier carried in the container image reading request. Then, in the metadata configured for the container image reading disk, the block storage device identifier recorded in the metadata is searched to determine the multiple block storage devices in the container image reading disk. Finally, among the multiple block storage devices, a corresponding block storage device is allocated for each container image reading request.
[0028] Among them, the container image reading disk identifier can be composed of the container image reading disk prefix identifier constant "Container" + the disk ID (Identity Document, exclusive number) pre-assigned for the container image reading disk. In addition, the block storage device identifier can be composed of the container image reading disk identifier + setting information. Specifically, the setting information can be the creation time corresponding to each block storage device, or it can be the block storage device ID pre-assigned to each block storage device. It should be noted that the type of setting information is not specifically limited in the embodiments of the present application, as long as it can ensure that the setting information can uniquely identify the block storage device.
[0029] In one example, a container image reading disk includes four block storage devices, the container image reading disk is identified as Container+1234567890, and the block storage device identifiers of each block storage device are: Container+1234567890+creation time 1 (i.e., the creation time of the first block storage device), Container+1234567890+creation time 2 (i.e., the creation time of the second block storage device), Container+1234567890+creation time 3 (i.e., the creation time of the third block storage device), and Container+1234567890+creation time 4 (i.e., the creation time of the fourth block storage device).
[0030] In an embodiment of the present application, among multiple block storage devices, allocating a corresponding block storage device to each container image read request may mean first obtaining current device loads corresponding to the multiple block storage devices respectively, and then allocating a corresponding block storage device to each container image read request based on the current device loads corresponding to the multiple block storage devices respectively.
[0031] After allocating the corresponding block storage device to each container image read request, the device path of the block storage device allocated to each container image read request can be further determined for the block storage device allocated to each container image read request. Specifically, in the metadata configured for the container image read disk, the correspondence between the block storage device identifier and the device path of the block storage device in the container image read disk is also recorded. In this way, after allocating the corresponding block storage device to each container image read request, the device path of the block storage device allocated to each container image read request can be determined based on the correspondence between the block storage device identifier and the device path of the block storage device in the container image read disk for the device identifier corresponding to the block storage device allocated to each container image read request. The device path of the block storage device allocated to each container image read request is hereinafter recorded as: the device path matching each container image read request. It should be noted that in the metadata configured for the container image read disk, at least the container image read disk identifier, the block storage device identifier, and the correspondence between the block storage device identifier and the device path of the block storage device in the container image read disk are recorded.
[0032] In one example, the container image reading disk includes four block storage devices, which are recorded as: block storage device 1, block storage device 2, block storage device 3, and block storage device 4. The block storage device identifiers of each block storage device are: Container+1234567890+creation time 1, Container+1234567890+creation time 2, Container+1234567890+creation time 3, and Container+1234567890+creation time 4. The device paths of each block storage device in the container image reading disk are path: / / cluster ID / block storage device ID1, path: / / cluster ID / block storage device ID2, path: / / cluster ID / block storage device ID3, and path: / / cluster ID / block storage device ID4. In this case, the correspondence between the block storage device identifier and the device path of each block storage device is: Container+1234567890+creation time1, corresponding to the device path path: / / cluster ID1 / block storage device ID1; Container+1234567890+creation time2, corresponding to the device path path: / / cluster ID2 / block storage device ID2; Container+1234567890+creation time3, corresponding to the device path path: / / cluster ID2 / block storage device ID3; Container+1234567890+creation time4, corresponding to the device path path: / / cluster ID3 / block storage device ID4.
[0033] The current device load can be the number of cloud server instances currently mounted on the block storage device, or the current utilization rate of the block storage device, or other types of device loads, such as the current saturation of the block storage device, the current IOPS (Input / Output Per Second) of the block storage device, and the current throughput of the block storage device. Specifically, in the embodiments of the present application, the type of device load is not specifically limited, and the type of device load can be configured according to individual needs. Among them, the utilization rate refers to the percentage of time that the block storage device processes I / O (Input / Output), the saturation refers to the busyness of the block storage device in processing I / O, and IOPS refers to the number of I / O requests per second for the block storage device.
[0034] In the embodiment of the present application, the server provides mounting and unmounting capabilities. Specifically, the server can mount the container image reading disk to the cloud server instance that sends the container image reading request, and can also unmount the container image reading disk from the cloud server instance. In addition, after the server allocates the corresponding block storage device for the container image reading request, the corresponding block storage device allocated for the container image reading request can be mounted to the cloud server instance that sends the container image reading request. Similarly, the server can also unmount the block storage device from the cloud server instance.
[0035] In the embodiment of the present application, the container image reading disk is pre-configured based on the container image reading disk load demand provided by the cloud server instance operator. Specifically, when the device type of multiple block storage devices in the container image reading disk is a mechanical hard disk or (Hard Disk Drive, HDD) or a solid state drive (Solid State Drive, SSD), the cloud server instance operator generally needs to provide the maximum container image reading disk load demand required by it. When configuring the container image reading disk, the number of block storage devices required to meet the maximum container image reading disk load demand can be determined based on the maximum container image reading disk load demand and the maximum device load that a single block storage device can support. Then, based on the number of block storage devices, a container image reading disk including a corresponding number of block storage devices is configured. In addition, when the device type of multiple block storage devices in the container image reading disk is an elastic block storage device (Elastic Block Store, EBS) device, the cloud server instance operator generally needs to provide the minimum container image reading disk load demand and the maximum container image reading disk load demand required by it. When configuring a container image reading disk, you can first determine the number of block storage devices required to meet the minimum container image reading disk load requirement based on the minimum container image reading disk load requirement and the maximum device load that a single block storage device can support. Then, based on the number of block storage devices, configure a container image reading disk that includes a corresponding number of block storage devices. In this case, if the container image reading disk cannot meet the concurrent reading requirements of the cloud server instance for the container image, a new EBS device can be added to the container image reading disk. After adding a new EBS device to the container image reading disk, if the concurrent reading requirements of the cloud server instance for the container image are reduced, some EBS devices can also be deleted from the container image reading disk. That is to say, in the present embodiment, the server will also provide the function of adding and deleting block storage devices.
[0036] Application Scenario
[0037] The embodiments of the present application involve a container image reading solution, which can be applied in the process of concurrently creating and starting multiple ECI instances. Figure 1As shown, when at least one cloud server instance has the need to concurrently create and start multiple ECI instances, the at least one cloud server instance will send multiple container image read requests to the server for the container image read disk. Specifically, when a cloud server instance has the need to concurrently create and start multiple ECI instances, the cloud server instance will send multiple container image read requests to the server for the container image read disk, or, when each of the multiple cloud server instances has the need to create and start at least one ECI instance, the multiple cloud server instances will send multiple container image read requests to the server for the container image read disk.
[0038] After the server receives multiple container image read requests for the container image read disk, it will first allocate a corresponding block storage device to each container image read request in the multiple block storage devices of the container image read disk. Specifically, the server will first parse the container image read request to obtain the container image read disk identifier. Then, based on the container image read disk identifier, the container image read disk targeted by the container image read request is located. Finally, the server will allocate a corresponding block storage device to the container image read request in the multiple block storage devices of the container image read disk targeted by the container image read request.
[0039] When the server allocates a corresponding block storage device to each container image read request from multiple block storage devices of the container image read disk, it can first match the metadata pre-configured for the container image read disk based on the container image read disk identifier carried in the container image read request. Then, in the metadata configured for the container image read disk, the block storage device identifier recorded in the metadata is searched to determine the multiple block storage devices in the container image read disk. Finally, the corresponding block storage device is allocated to each container image read request from multiple block storage devices.
[0040] After allocating the corresponding block storage device to each container image read request, the server will further determine the device path that matches each container image read request, and send the device path of the block storage device to which each container image read request is allocated to the corresponding cloud server instance (that is, the device path that matches each container image read request is sent to the corresponding cloud server instance), so that the cloud server instance can read the container image from the corresponding block storage device according to the device path. Specifically, when determining the device path that matches each container image read request, the server will determine the device path corresponding to the block storage device allocated to each container image read request based on the corresponding relationship between the block storage device identifier and the device path of the block storage device in the container image read disk.
[0041] After each cloud server instance obtains the device path provided by the server, it will read the container image from the corresponding block storage device according to the device path. After reading the container image, it will create and start the ECI instance based on the container image to complete the concurrent creation and startup of multiple ECI instances.
[0042] The technical solution of the present application, after receiving multiple container image reading requests provided by at least one cloud server instance for a container image reading disk, will allocate a corresponding block storage device to each container image reading request in multiple block storage devices of the container image reading disk, and will further send the device path of the block storage device to which each container image reading request is allocated to the corresponding cloud server instance, so that the cloud server instance can read the container image from the corresponding block storage device according to the device path. Compared with reading a container image from an object storage device, reading a container image from a block storage device will result in a faster reading speed of the container image, therefore, compared with reading a container image from an object storage device, reading a container image from a block storage device will make the reading efficiency of the container image higher, and thus compared with reading a container image from an object storage device, reading a container image from a block storage device will make the creation and startup of the ECI instance more efficient.
[0043] In addition, since a corresponding block storage device is allocated to each container image read request among the multiple block storage devices of the container image reading disk, the multiple block storage devices of the container image reading disk are used to simultaneously support the reading of the container image, which can improve the concurrent reading capability of the container image. Therefore, by using multiple block storage devices to simultaneously support the reading of the container image, the reading efficiency of the container image can be improved when facing multiple container image read requests. In other words, based on the technical solution of the present application, the reading efficiency of the container image can be improved when facing multiple container image read requests, and thus based on the technical solution of the present application, when there is a need to concurrently create and start multiple ECI instances and the container image needs to be read concurrently, the creation and startup efficiency of the ECI instance can be improved.
[0044] It should be noted that the above-mentioned application scenarios of the method for reading container images provided in the embodiments of the present application are for ease of understanding and are not used to limit the method for reading container images provided in the embodiments of the present application. Specifically, the application scenarios of the method for reading container images provided in the embodiments of the present application are not specifically limited, that is, the method for reading container images provided in the embodiments of the present application can be applied to the concurrent creation and startup of multiple ECI instances, as well as the concurrent creation and startup of multiple container instances other than ECI instances.
[0045] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The listed specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0046] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose or edit authorization or rejection.
[0047] Embodiment 1
[0048] Figure 2 The flowchart of the first container image reading method provided in the embodiment of the present application is shown. The container image reading method can be applied to the server, or the container image reading device configured by the server. Figure 2 As shown, the method for reading the container image may include the following steps:
[0049] Step S201: for multiple container image read requests received, a corresponding block storage device is allocated to each container image read request in multiple block storage devices of the container image read disk; the multiple container image read requests are provided by at least one cloud server instance for the container image read disk; and the container image is stored in each block storage device.
[0050] A cloud server instance is a virtual server created and run on a cloud computing platform. Specifically, a cloud server instance can be in the form of a virtual machine instance, an elastic cloud server instance, or a bare metal server instance.
[0051] In the embodiment of the present application, multiple container image read requests provided by at least one cloud server instance for the container image read disk may refer to one cloud server instance sending multiple container image read requests for the container image read disk. Multiple container image read requests provided by at least one cloud server instance for the container image read disk may also refer to multiple cloud server instances sending at least one container image read request for the container image read disk respectively.
[0052] In the embodiment of the present application, the container instance generally refers to ECI, and may also be other types of container instances besides ECI. In addition, the device type of the block storage device is generally an EBS device, and may also be a mechanical hard disk or a solid state disk.
[0053] Step S202: Send the device path of the block storage device assigned to each container image read request to the corresponding cloud server instance, so that the cloud server instance can read the container image from the corresponding block storage device according to the device path; the device path is used to identify the path of the block storage device in the container image reading disk.
[0054] The device path of the block storage device assigned to each container image read request specifically refers to the device path corresponding to the block storage device assigned to each container image read request in the container image read disk. In an embodiment of the present application, the device path of the block storage device assigned to each container image read request can be recorded as the device path that matches each container image read request. Sending the device path that matches each container image read request to the corresponding cloud server instance means that the device path corresponding to the block storage device assigned to each container image read request in the container image read disk is sent to the block storage device that provides each container image read request.
[0055] When allocating a corresponding block storage device to each container image read request among multiple block storage devices of a container image read disk for multiple container image read requests received, the current device loads corresponding to the multiple block storage devices may be first obtained. Then, according to the current device loads corresponding to the multiple block storage devices, a corresponding block storage device is allocated to each container image read request among the multiple block storage devices for multiple container image read requests.
[0056] The current device load may be the number of cloud server instances currently mounted on the block storage device, or may refer to the current usage rate of the block storage device, or may refer to other types of device loads. Specifically, in the embodiments of the present application, the type of device load is not specifically limited. In actual applications, the type of device load can be configured according to individual needs. The following only takes the example that the current device load may be the number of cloud server instances currently mounted on the block storage device to illustrate the method for reading the container image provided in the embodiments of the present application. Other types of device loads will not be described one by one here.
[0057] In order to prevent the device loads between multiple block storage devices from being too dispersed, when allocating corresponding block storage devices to each container image read request based on the current device loads corresponding to each of the multiple block storage devices, the block storage devices to be allocated whose current device loads are not less than the first current device load threshold can be first selected from the multiple block storage devices based on the current device loads corresponding to each of the multiple block storage devices. Then, the corresponding block storage devices are allocated to each container image read request from the block storage devices to be allocated.
[0058] Specifically, the first current device load threshold is generally configured based on the maximum device load of the block storage device. For example, the maximum device load of the block storage device is that the block storage device can support up to 100 cloud server instances. In this case, the first current device load threshold can be set to mount 60 cloud server instances. For another example, the maximum device load of the block storage device is the maximum usage rate of the block storage device. In this case, the first current device load threshold can be set to 80% of the maximum usage rate.
[0059] In the block storage devices to be allocated whose current device load is not less than the first current device load threshold, a corresponding block storage device is allocated to each container image read request, so that the device load can be concentrated in the block storage device to be allocated, thereby preventing the device loads of multiple block storage devices from being too dispersed.
[0060] In one implementation, the device type of the block storage device includes an elastic block storage device. In this case, after obtaining the current device loads respectively corresponding to the plurality of block storage devices, the block storage device may be further adjusted for the container image reading disk according to the current device loads respectively corresponding to the plurality of block storage devices.
[0061] When adjusting the block storage device of the container image reading disk according to the current device loads respectively corresponding to the multiple block storage devices, the current total device loads corresponding to the multiple block storage devices can be determined according to the current device loads respectively corresponding to the multiple block storage devices. Then, when the current total device load reaches the first total load threshold of the corresponding configuration, a new block storage device is added to the container image reading disk.
[0062] Specifically, the container image reading disk is pre-configured based on the container image reading disk load requirement provided by the cloud server instance operator. When the device type of multiple block storage devices in the container image reading disk is an EBS device, the cloud server instance operator generally needs to provide the minimum container image reading disk load requirement and the maximum container image reading disk load requirement required by it. When configuring the container image reading disk, the number of block storage devices required to meet the minimum container image reading disk load requirement can be determined based on the minimum container image reading disk load requirement and the maximum device load that a single block storage device can support. At the same time, the number of block storage devices required to meet the maximum container image reading disk load requirement will also be determined based on the maximum container image reading disk load requirement and the maximum device load that a single block storage device can support.
[0063] In one example, the number of block storage devices required to meet the minimum container image read disk load requirement is 5, the number of block storage devices required to meet the maximum container image read disk load requirement is 10, and the current number of block storage devices in the container image read disk is 6 (i.e., the container image read disk currently includes 6 block storage devices).
[0064] For example, if the current device load is the number of cloud server instances currently mounted on the block storage device, and if the maximum mount capacity supported by each of the 10 block storage devices is 100 cloud server instances, then when the container image reading disk includes 6 block storage devices, the maximum mount capacity supported by the container image reading disk is 600 cloud server instances. At this time, if the current device loads corresponding to the 6 block storage devices are respectively: 90 cloud server instances mounted, 90 cloud server instances mounted, 90 cloud server instances mounted, 95 cloud server instances mounted, 95 cloud server instances mounted, and 95 cloud server instances mounted. Then the current total device load corresponding to the multiple block storage devices is: 555 cloud server instances mounted.
[0065] The first total load threshold is generally configured based on the total device load that multiple block storage devices can support. For example, the first total load threshold can be 90% of the total device load that multiple block storage devices can support. When the first total load threshold is 90% of the total device load that multiple block storage devices can support, if the current total device load corresponding to multiple block storage devices is: mounting 555 cloud server instances, and the maximum mounting capacity that the container image reading disk can support is 600 cloud server instances, then it can be determined that the current total device load "555" corresponding to multiple block storage devices exceeds the first total load threshold (600*0.90=540). In this case, it can be determined that a new block storage device needs to be added to the container image reading disk. That is, a new block storage device is further added on the basis of 6 block storage devices.
[0066] In the embodiment of the present application, the stopping condition for adding a new block storage device in the container image reading disk is that the number of block storage devices in the container image reading disk is equal to the number of block storage devices required to meet the maximum container image reading disk load requirement, or the current total device load corresponding to the multiple block storage devices is lower than 70% (or other proportion) of the total device load that can be supported by the multiple block storage devices.
[0067] When the current total device load reaches the first total load threshold of the corresponding configuration, adding a new block storage device to the container image reading disk can improve the container image concurrent reading capability supported by the container image reading disk when the concurrent reading demand of the cloud server instance for the container image increases.
[0068] In one embodiment, when determining the current total device load corresponding to the plurality of block storage devices according to the current device loads respectively corresponding to the plurality of block storage devices, the current total device load may be determined at a specified time interval. In this case, if the current total device load is continuously lower than the corresponding configured second total load threshold for a specified number of times within the specified time period, some block storage devices may be deleted from the container image reading disk.
[0069] Consistent with the first total load threshold, it is generally configured based on the total device load that multiple block storage devices can support. For example, the second total load threshold can be 50% of the total device load that multiple block storage devices can support. In addition, the specified number of times and the specified duration can be configured based on demand or a priori values, for example, the specified number of times is 5 times, and the specified duration is 30 minutes. When the second total load threshold is 50% of the total device load that multiple block storage devices can support, the specified number of times is 5 times, and the specified duration is 30 minutes, if within 30 minutes, the current total device load is continuously lower than 50% of the total device load that multiple block storage devices can support for more than or equal to 5 times, it can be determined that some block storage devices need to be deleted in the container image reading disk. For example, delete one of the block storage devices based on 6 block storage devices.
[0070] In the embodiment of the present application, the stopping condition for deleting some block storage devices in the container image reading disk is that the number of block storage devices in the container image reading disk is equal to the number of block storage devices required to meet the minimum container image reading disk load requirement, or the current total device load corresponding to the multiple block storage devices is higher than 70% (or other proportions) of the total device load that can be supported by the multiple block storage devices.
[0071] When the current total device load is lower than the corresponding configured second total load threshold for the specified number of times within the specified time, some block storage devices are deleted from the container image reading disk, which can ensure that the container image reading disk can provide the concurrent reading capability of the container image while reducing the storage resources required when the concurrent reading demand of the cloud server instance for the container image is reduced. This can not only save storage resources and reduce the reading cost of the container image, but also improve the utilization rate of the block storage device.
[0072] In one implementation, deleting some block storage devices in the container image reading disk may refer to first selecting block storage devices to be deleted whose current device loads are lower than a second current device load threshold from among the multiple block storage devices according to the current device loads corresponding to the multiple block storage devices, and then deleting at least some of the block storage devices to be deleted.
[0073] Consistent with the first current device load threshold, the second current device load threshold is also generally configured based on the maximum device load of the block storage device. For example, the maximum device load of the block storage device is that the block storage device can support up to 100 cloud server instances. In this case, the second current device load threshold can be set to mount 30 cloud server instances. For another example, the maximum device load of the block storage device is the maximum usage of the block storage device. In this case, the second current device load threshold can be set to 20% of the maximum usage.
[0074] Among multiple block storage devices, the block storage devices to be deleted whose current device load is lower than the second current device load threshold are screened out, and at least some of the block storage devices to be deleted are deleted from the block storage devices to be deleted, so that in the process of deleting some block storage devices in the container image reading disk, block storage devices with smaller device loads can be deleted preferentially. In this way, not only can the adverse effects of deleting some block storage devices be reduced as much as possible, but also the device load can be more concentrated, thereby improving the utilization rate of the remaining block storage devices.
[0075] In one example, if the current device load corresponding to at least part of the deleted block storage devices to be deleted is 0, then the deletion operation can be directly performed on the part of the deleted block storage devices. If the current device load corresponding to at least part of the deleted block storage devices to be deleted is not 0, before deleting at least part of the deleted block storage devices, it is necessary to first allocate the corresponding block storage device to the target cloud server instance in the remaining block storage devices of the container image reading disk. Then, the device path corresponding to the block storage device allocated to the target cloud server instance is sent to the target cloud server instance, and the target cloud server instance is instructed to read the container image from the corresponding block storage device according to the device path. In this way, it can be ensured that the target cloud server instance can read the container image from the corresponding block storage device according to the newly allocated device path. That is to say, if the current device load corresponding to at least part of the deleted block storage devices to be deleted is not 0, it is necessary to first redistribute the load of at least part of the block storage devices to other block storage devices that do not need to be deleted, so as to clear the load of at least part of the block storage devices to 0, and after clearing the load of at least part of the block storage devices to 0, the deletion operation is performed on at least part of the block storage devices. The remaining block storage devices include block storage devices other than at least a portion of the to-be-deleted block storage devices that need to be deleted among the multiple block storage devices, that is, other block storage devices that do not need to be deleted among the multiple block storage devices.
[0076] In one implementation, the access permissions of multiple block storage devices may also be configured as read-only. Since the cloud server instance only has image reading requirements for container image reading disks, if the access permissions of multiple block storage devices are configured as read-only, not only can the I / O operations processed in parallel by the block storage devices be reduced, but also when the access permissions of multiple block storage devices are configured as read-only, the container images stored in the multiple block storage devices will not be modified. In this case, there is no need to perform data consistency processing on the container images stored in the multiple block storage devices, thereby reducing the processing resources consumed by container image reading.
[0077] In addition, it should be noted that in addition to the method of allocating a corresponding block storage device to each container image read request provided in the above content, other methods can also be used in the embodiments of the present application to allocate a corresponding block storage device to each container image read request. For example, a network model for allocating corresponding block storage devices to image read requests can be trained first, and then, using the trained network model, a corresponding block storage device is allocated to each container image read request. Specifically, in the embodiments of the present application, the method of allocating a corresponding block storage device to each container image read request is not specifically limited.
[0078] The container image reading method provided in the embodiment of the present application, after receiving multiple container image reading requests provided by at least one cloud server instance for the container image reading disk, will allocate a corresponding block storage device to each container image reading request in multiple block storage devices of the container image reading disk, and will further send the device path matching each container image reading request to the corresponding cloud server instance, so that the cloud server instance can read the container image from the corresponding block storage device according to the device path. Compared with reading the container image from the object storage device, reading the container image from the block storage device will make the reading of the container image faster, therefore, compared with reading the container image from the object storage device, reading the container image from the block storage device will make the reading efficiency of the container image higher, and thus compared with reading the container image from the object storage device, reading the container image from the block storage device will make the creation and startup of the container instance more efficient.
[0079] In addition, since a corresponding block storage device is allocated to each container image read request among the multiple block storage devices of the container image reading disk, the multiple block storage devices of the container image reading disk are used to simultaneously support the reading of the container image, which can improve the concurrent reading capability of the container image. Therefore, by using multiple block storage devices to simultaneously support the reading of the container image, the reading efficiency of the container image can be improved when facing multiple container image read requests. In other words, based on the container image reading method provided in the embodiment of the present application, the reading efficiency of the container image can be improved when facing multiple container image read requests, and thus based on the container image reading method provided in the embodiment of the present application, when there is a need to concurrently create and start multiple container instances, and the container image needs to be read concurrently, the creation and startup efficiency of the container instance can be improved.
[0080] Embodiment 2
[0081] Corresponding to the application scenario provided in the embodiment of the present application and the method of the first embodiment, the second embodiment of the present application also provides another method for reading a container image. Figure 3 The flowchart of the second container image reading method provided in the embodiment of the present application is shown. The container image reading method can be applied to the target cloud server instance. Figure 3 As shown, the method for reading the container image may include the following steps:
[0082] Step S301: Send a target container image read request to the server for the container image read disk; the server is used to allocate a corresponding block storage device to each container image read request in the multiple block storage devices of the container image read disk for the multiple container image read requests received; send the device path of the block storage device to which each container image read request is allocated to the corresponding cloud server instance, so that the cloud server instance can read the container image from the corresponding block storage device according to the device path; wherein the multiple container image read requests are provided by at least one cloud server instance for the container image read disk, the at least one cloud server instance includes a target cloud server instance, the container images are respectively stored in each block storage device, the device path is used to identify the path of the block storage device in the container image read disk, and the target container image read request is correspondingly allocated to the target block storage device.
[0083] A cloud server instance is a virtual server created and run on a cloud computing platform. Specifically, a cloud server instance can be in the form of a virtual machine instance, an elastic cloud server instance, or a bare metal server instance.
[0084] Multiple container image read requests provided by at least one cloud server instance for a container image read disk may refer to one cloud server instance sending multiple container image read requests for a container image read disk. Multiple container image read requests provided by at least one cloud server instance for a container image read disk may also refer to multiple cloud server instances sending at least one container image read request for a container image read disk respectively.
[0085] The device path of the block storage device assigned to each container image read request specifically refers to the device path corresponding to the block storage device assigned to each container image read request in the container image read disk. In an embodiment of the present application, the device path of the block storage device assigned to each container image read request can be recorded as the device path that matches each container image read request. Sending the device path that matches each container image read request to the corresponding cloud server instance means that the device path corresponding to the block storage device assigned to each container image read request in the container image read disk is sent to the block storage device that provides each container image read request.
[0086] Step S302: Obtain a device path corresponding to a target block storage device provided by the server.
[0087] The device path corresponding to the target block storage device refers to the device path corresponding to the target block storage device in the container image reading disk.
[0088] Step S303: Read the container image stored in the target block storage device according to the device path corresponding to the target block storage device to create a container instance.
[0089] A container instance generally refers to an ECI, but can also be other types of container instances except for ECI.
[0090] The container image reading method provided in the second embodiment of the present application, after sending a target container image reading request to the server for the container image reading disk, obtains the device path corresponding to the target block storage device provided by the server, and reads the container image stored in the target block storage device according to the device path corresponding to the target block storage device, so as to create a container instance.
[0091] After receiving multiple container image read requests provided by at least one cloud server instance for the container image read disk, the server will allocate a corresponding block storage device to each container image read request in multiple block storage devices of the container image read disk, and will further send the device path of the block storage device allocated to each container image read request to the corresponding cloud server instance, so that the cloud server instance can read the container image from the corresponding block storage device according to the device path. Compared with reading the container image from the object storage device, the reading speed of the container image will be faster when reading the container image from the block storage device. Therefore, compared with reading the container image from the object storage device, reading the container image from the block storage device will make the reading efficiency of the container image higher, and thus compared with reading the container image from the object storage device, reading the container image from the block storage device will make the creation and startup efficiency of the container instance higher. It can be seen that the target cloud server instance can read the container image from the target block storage device more quickly and efficiently for creating the container instance, thereby improving the efficiency of the target cloud server instance in creating and starting the container instance.
[0092] In addition, since the server allocates a corresponding block storage device for each container image read request among multiple block storage devices of the container image reading disk, the concurrent reading capability of the container image can be improved by using multiple block storage devices of the container image reading disk to support the reading of the container image at the same time. Therefore, using multiple block storage devices to support the reading of container images at the same time can improve the reading efficiency of the container image when facing multiple container image read requests. When the reading efficiency of the container image is improved, the target cloud server instance can read the container image from the target block storage device more quickly and efficiently for creating a container instance, thereby improving the efficiency of the target cloud server instance in creating and starting the container instance.
[0093] Embodiment 3
[0094] Corresponding to the application scenario provided by the embodiment of the present application and the method of the first embodiment, the third embodiment of the present application also provides a container image reading device. The container image reading device may include: a block storage device allocation module, which is used to allocate a corresponding block storage device to each container image reading request among multiple block storage devices of the container image reading disk for multiple container image reading requests received; multiple container image reading requests are provided by at least one cloud server instance for the container image reading disk; container images are stored in each block storage device; a device path sending module, which is used to send the device path of the block storage device allocated to each container image reading request to the corresponding cloud server instance, so that the cloud server instance can read the container image from the corresponding block storage device according to the device path; the device path is used to identify the path of the block storage device in the container image reading disk.
[0095] In one implementation, the block storage device allocation module is specifically used to obtain current device loads corresponding to multiple block storage devices respectively; for the multiple container image read requests, according to the current device loads corresponding to the multiple block storage devices respectively, a corresponding block storage device is allocated to each container image read request among the multiple block storage devices.
[0096] In one embodiment, the block storage device allocation module is specifically used to screen out, from among the multiple block storage devices, block storage devices whose current device loads are not less than a first current device load threshold, based on the current device loads corresponding to the multiple block storage devices respectively; and allocate a corresponding block storage device to each container image read request among the block storage devices to be allocated.
[0097] In one embodiment, the device type of the block storage device includes an elastic block storage device; the apparatus further includes: a current device load acquisition module, used to acquire current device loads corresponding to a plurality of block storage devices; and a block storage device adjustment module, used to perform block storage device adjustment on the container image reading disk according to the current device loads corresponding to the plurality of block storage devices.
[0098] In one implementation, the block storage device adjustment module is specifically configured to determine the current total device load corresponding to the plurality of block storage devices based on the current device loads respectively corresponding to the plurality of block storage devices; when the current total device load reaches a first total load threshold of the corresponding configuration, add a new block storage device to the container image reading disk.
[0099] In one implementation, the block storage device adjustment module is specifically used to determine the current total device load at a specified time interval; the block storage device adjustment module is also used to delete some block storage devices in the container image reading disk when the current total device load is continuously lower than the corresponding configured second total load threshold for a specified number of times within a specified time period; the second total load threshold is less than the first total load threshold.
[0100] In one implementation, the block storage device adjustment module is specifically configured to screen out block storage devices to be deleted whose current device loads are lower than a second current device load threshold from among multiple block storage devices according to current device loads corresponding to the multiple block storage devices respectively; and delete at least some of the block storage devices to be deleted.
[0101] In one embodiment, at least part of the block storage devices are mounted on a target cloud server instance in at least one cloud server instance; the block storage device adjustment module is further used to allocate corresponding block storage devices to the target cloud server instance from the remaining block storage devices of the container image reading disk; the remaining block storage devices include block storage devices among the multiple block storage devices except for at least part of the to-be-deleted block storage devices that need to be deleted; a device path corresponding to the block storage device allocated to the target cloud server instance is sent to the target cloud server instance, and the target cloud server instance is instructed to read the container image from the corresponding block storage device according to the device path.
[0102] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and have corresponding beneficial effects, which will not be repeated here.
[0103] Embodiment 4
[0104] Corresponding to the application scenario provided in the embodiment of the present application and the method of the second embodiment, the fourth embodiment of the present application also provides another container image reading device. The container image reading device is applied to a target cloud server instance, and may include: a container image reading request sending module, which is used to send a target container image reading request to a server for a container image reading disk; the server is used to allocate a corresponding block storage device to each container image reading request in a plurality of block storage devices of the container image reading disk for a plurality of received container image reading requests; the device path of the block storage device allocated to each container image reading request is sent to the corresponding cloud server instance, so that the cloud server instance reads the container image from the corresponding block storage device according to the device path; wherein the plurality of container image reading requests are provided by at least one cloud server instance for a container image reading disk, the at least one cloud server instance includes a target cloud server instance, each block storage device stores a container image respectively, the device path is used to identify a path of the block storage device in the container image reading disk, and the target container image reading request is allocated to the target block storage device correspondingly; a device path obtaining module, which is used to obtain a device path corresponding to the target block storage device provided by the server; and a container image reading module, which is used to read the container image stored in the target block storage device according to the device path corresponding to the target block storage device, so as to create a container instance.
[0105] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and have corresponding beneficial effects, which will not be repeated here.
[0106] Embodiment 5
[0107] Corresponding to the application scenarios provided in the embodiments of the present application and the methods of Embodiment 1 and Embodiment 2, Embodiment 5 of the present application also provides a system for reading a container image. Figure 4 The structure block diagram of the container image reading system of the fifth embodiment of the present application is shown as follows: Figure 4 As shown, the container image reading system may include: at least one cloud server instance 401, a server 402, and multiple block storage devices 403 constituting a container image reading disk. The server 402 is used to execute the container image reading method provided in the first embodiment of the present application, the target cloud server instance in at least one cloud server instance 401 is used to execute the document processing method provided in the second embodiment of the present application, and the block storage device 403 is used to store and provide the cloud server instance 401 with the container image.
[0108] The functions of the server 402, cloud server instance 401, and block storage device 403 in the container image reading system provided in the embodiment of the present application can be respectively referred to the corresponding descriptions in the methods of the above-mentioned embodiments 1 and 2, and have corresponding beneficial effects, which will not be repeated here.
[0109] Embodiment 6
[0110] Figure 5 FIG. 1 is a block diagram of an electronic device used to implement an embodiment of the present application. Figure 5 As shown, the electronic device includes: a memory 501 and a processor 502. The memory 501 stores a computer program that can be run on the processor 502. When the processor 502 executes the computer program, the method in the above embodiment is implemented. The number of the memory 501 and the processor 502 can be one or more.
[0111] The electronic device also includes:
[0112] The communication interface 503 is used to communicate with external devices and perform data exchange transmission.
[0113] If the memory 501, the processor 502 and the communication interface 503 are implemented independently, the memory 501, the processor 502 and the communication interface 503 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0114] Optionally, in a specific implementation, if the memory 501, the processor 502 and the communication interface 503 are integrated on a chip, the memory 501, the processor 502 and the communication interface 503 can communicate with each other through an internal interface.
[0115] An embodiment of the present application provides a computer-readable storage medium storing a computer program, which implements the method provided in the embodiment of the present application when the program is executed by a processor.
[0116] An embodiment of the present application also provides a chip, which includes a processor for calling and executing instructions stored in the memory from the memory, so that a communication device equipped with the chip executes the method provided by the embodiment of the present application.
[0117] An embodiment of the present application also provides a chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided in the embodiment of the application.
[0118] It should be understood that the processor may be a CPU, or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), FPGAs or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the Advanced RISC Machines (ARM) architecture.
[0119] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of exemplary but not limiting description, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).
[0120] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
[0121] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0122] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0123] Any process or method described in the flow chart or otherwise described herein can be understood as a module, fragment or portion of a code representing one or more executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiment of the present application includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.
[0124] The logic and / or steps described in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or used in combination with these instruction execution systems, devices or apparatuses.
[0125] It should be understood that the various parts of the present application can be implemented with hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium, and when the program is executed, it includes one of the steps of the method embodiment or a combination thereof.
[0126] In addition, each functional unit in each embodiment of the present application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.
[0127] The above are only exemplary embodiments of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope recorded in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for reading a container image, comprising: For multiple container image read requests received, a corresponding block storage device is allocated to each container image read request in multiple block storage devices of a container image read disk; the multiple container image read requests are provided by at least one cloud server instance for the container image read disk; and container images are stored in each block storage device; Send the device path of the block storage device assigned to each container image read request to the corresponding cloud server instance, so that the cloud server instance can read the container image from the corresponding block storage device according to the device path; The device path is used to identify the path of the block storage device in the container image reading disk.
2. The method according to claim 1, wherein: The step of allocating a corresponding block storage device to each container image reading request among multiple block storage devices of the container image reading disk for the multiple container image reading requests includes: Obtaining current device loads corresponding to each of the plurality of block storage devices; For the multiple container image read requests, a corresponding block storage device is allocated to each container image read request from the multiple block storage devices according to current device loads respectively corresponding to the multiple block storage devices.
3. The method according to claim 2, wherein: The allocating a corresponding block storage device to each container image read request from the plurality of block storage devices according to the current device loads respectively corresponding to the plurality of block storage devices for the plurality of container image read requests comprises: According to the current device loads respectively corresponding to the plurality of block storage devices, a block storage device to be allocated whose current device load is not less than a first current device load threshold is screened out from the plurality of block storage devices; In the block storage devices to be allocated, a corresponding block storage device is allocated for each container image read request.
4. The method according to claim 1, wherein: The device type of the block storage device includes an elastic block storage device; and the method further includes: Obtaining current device loads corresponding to each of the plurality of block storage devices; According to current device loads respectively corresponding to the multiple block storage devices, block storage device adjustment is performed on the container image reading disk.
5. The method according to claim 4, wherein: The adjusting the block storage device of the container image reading disk according to the current device loads respectively corresponding to the plurality of block storage devices includes: Determine the current total device loads corresponding to the plurality of block storage devices according to the current device loads respectively corresponding to the plurality of block storage devices; When the current total device load reaches a first total load threshold configured accordingly, a new block storage device is added to the container image reading disk.
6. The method according to claim 5, wherein: The determining, based on the current device loads respectively corresponding to the multiple block storage devices, of the current total device loads corresponding to the multiple block storage devices comprises: Determining the current total device load at a specified time interval; The method further includes: when the current total device load is continuously lower than a corresponding configured second total load threshold for a specified number of times within a specified time period, deleting some block storage devices in the container image reading disk; the second total load threshold is less than the first total load threshold.
7. The method according to claim 6, wherein: Deleting some block storage devices in the container image reading disk includes: According to the current device loads respectively corresponding to the multiple block storage devices, filter out the block storage devices to be deleted whose current device loads are lower than a second current device load threshold from the multiple block storage devices; Delete at least part of the block storage devices to be deleted.
8. The method according to claim 7, wherein: The at least part of the block storage device is mounted on a target cloud server instance in the at least one cloud server instance; Before deleting at least part of the block storage devices, the method further includes: Among the remaining block storage devices of the container image reading disk, a corresponding block storage device is allocated to the target cloud server instance; the remaining block storage devices include block storage devices among the plurality of block storage devices except for at least part of the to-be-deleted block storage devices that need to be deleted; The device path corresponding to the block storage device allocated to the target cloud server instance is sent to the target cloud server instance, and the target cloud server instance is instructed to read the container image from the corresponding block storage device according to the device path.
9. A method for reading a container image, applied to a target cloud server instance, the method comprising: Send a target container image read request to the server for the container image read disk; The server is used to allocate a corresponding block storage device to each container image reading request among multiple block storage devices of the container image reading disk for the received multiple container image reading requests; Sending the device path of the block storage device assigned to each container image read request to the corresponding cloud server instance; wherein the multiple container image read requests are provided by at least one cloud server instance for the container image read disk, the at least one cloud server instance includes the target cloud server instance, each block storage device stores a container image respectively, the device path is used to identify the path of the block storage device in the container image read disk, and the target container image read request is correspondingly assigned to the target block storage device; Obtaining a device path corresponding to the target block storage device provided by the server; According to the device path corresponding to the target block storage device, the container image stored in the target block storage device is read to create a container instance.
10. A container image reading system, comprising: At least one cloud server instance, a server, and multiple block storage devices that constitute a container image reading disk; The server is used to execute the method according to any one of claims 1 to 8; The target cloud server instance in the at least one cloud server instance is used to execute the method according to claim 9; Block storage devices are used to store and read container images for cloud server instances.
11. An electronic device comprising a memory, a processor and a computer program stored in the memory, wherein the processor implements the method according to any one of claims 1 to 9 when executing the computer program.
12. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.