Processing method of virtual machine instance and creating method of container instance
By judging the reusability of virtual machine instances and putting them into the resource reuse pool, the problem of slow container instance creation and startup speed is solved, and faster creation and startup time and lower resource consumption is achieved.
Patent Information
- Application Number
- CN202311011389.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-10
- Publication Date
- 2025-02-25
AI Technical Summary
The creation and startup of container instances is slow, which affects the user experience, especially in container instances with shorter runtimes.
By determining whether the target virtual machine instance is a reusable resource, if it is a reusable resource, it is placed in the resource reuse pool to create a specific container instance, thereby reducing the time to reconfigure the virtual machine instance.
It greatly reduces the creation and startup time of container instances, improves speed, and reduces the consumption of processing resources.
Smart Images

Figure CN119512676A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a method for processing a virtual machine instance and a method for creating a container instance. Background Art
[0002] Container technology has been widely used due to its advantages such as light weight, portability, scalability and environmental isolation. In the application process of container technology, the speed of creating and starting container instances will greatly affect the user experience, especially for container instances with short running time. When the running time of container instances is short, the speed of creating and starting container instances will become an important factor affecting the user experience. Therefore, how to improve the speed of creating and starting container instances 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 for processing a virtual machine instance and a method for creating a container instance to solve one or more of the above-mentioned technical problems.
[0004] In a first aspect, an embodiment of the present application provides a method for processing a virtual machine instance, the method comprising:
[0005] In response to a deletion request for a target container instance, determining whether a target virtual machine instance used to support the operation of the target container instance is a reusable resource;
[0006] When the target virtual machine instance is a reusable resource, the target virtual machine instance is placed in a resource reuse pool so that the target virtual machine instance can be obtained from the resource reuse pool when creating a specific container instance, and a specific container instance can be created on the target virtual machine instance; the configuration requirements of the specific container instance for the virtual machine instance match the configuration of the target virtual machine instance.
[0007] In a second aspect, an embodiment of the present application provides a method for creating a container instance, the method comprising:
[0008] When it is determined that a virtual machine instance can be reused when creating a specific container instance, a target virtual machine instance matching a specific configuration requirement is obtained from at least one virtual machine instance stored in a resource reuse pool; the at least one virtual machine instance belongs to a reusable resource; and the specific configuration requirement is used to identify a configuration requirement of the specific container instance for the virtual machine instance.
[0009] Create a specific container instance on the target VM instance.
[0010] In a third aspect, an embodiment of the present application provides a system for creating a container instance, the system comprising: a resource storage node and a resource reuse node:
[0011] A resource storage node, used to execute the processing method of the virtual machine instance provided in the embodiment of the present application;
[0012] The resource reuse node is used to execute the container instance creation method provided in the embodiment of the present application.
[0013] 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.
[0014] 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.
[0015] Compared with the prior art, this application has the following advantages:
[0016] The technical solution of the present application, when deleting the target container instance, will first determine whether the target virtual machine instance used to support the operation of the target container instance belongs to a reusable resource, and when the target virtual machine instance belongs to a reusable resource, the target virtual machine instance will be placed in the resource reuse pool, so as to obtain the target virtual machine instance from the resource reuse pool when creating a specific container instance, and create a specific container instance on the target virtual machine instance. That is to say, if the target virtual machine instance belongs to a reusable resource, when deleting the target container instance, the target virtual machine instance is not deleted, but the target virtual machine instance is placed in the resource reuse pool as a reusable resource, and the target virtual machine instance is directly reused when creating a specific container instance to create a specific container instance on the target virtual machine instance. Directly reusing the target virtual machine instance when creating a specific container instance can avoid consuming a lot of time and processing resources to configure the virtual machine instance used to support the operation of the specific container instance when creating and starting the specific container instance. In this way, the time required to create and start a specific container instance can be greatly reduced, the creation and startup speed of the specific container instance can be improved, and at the same time, the processing resources required to create and start the specific container instance can be reduced.
[0017] 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
[0018] 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.
[0019] Figure 1 A schematic diagram showing an application process of a method for processing a virtual machine instance and a method for creating a container instance provided in an embodiment of the present application;
[0020] Figure 2 A flowchart showing a method for processing a virtual machine instance provided in an embodiment of the present application is shown;
[0021] Figure 3 A flowchart of a method for creating a container instance provided in an embodiment of the present application is shown;
[0022] Figure 4 A schematic diagram showing a training process of a container instance classification model provided in an embodiment of the present application is shown;
[0023] Figure 5 A schematic diagram showing a training process of a container instance classification model provided in an embodiment of the present application is shown;
[0024] Figure 6 A schematic diagram of a processing device for a virtual machine instance provided in an embodiment of the present application is shown;
[0025] Figure 7 A schematic diagram showing a device for creating a container instance provided in an embodiment of the present application; and
[0026] Figure 8 A block diagram of an electronic device used to implement an embodiment of the present application is shown. DETAILED DESCRIPTION
[0027] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other forms different from those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application. Therefore, the present application is not limited to the specific implementation disclosed below.
[0028] 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.
[0029] The embodiments of the present application involve a processing scheme for virtual machine instances and a creation scheme for container instances. Among them, the processing scheme for virtual machine instances will first respond to a deletion request for a target container instance, determine whether the target virtual machine instance used to support the operation of the target container instance is a reusable resource, and then, if the target virtual machine instance is a reusable resource, put the target virtual machine instance into a resource reuse pool, so as to obtain the target virtual machine instance from the resource reuse pool when creating a specific container instance, and create a specific container instance on the target virtual machine instance; the configuration requirements of the specific container instance for the virtual machine instance match the configuration of the target virtual machine instance.
[0030] A virtual machine (VM) instance is a virtual machine created and run in a virtualized environment. When creating a virtual machine instance, you often need to specify the configuration of the virtual machine instance first. For example, the configuration of the virtual machine instance includes the computing resources corresponding to the virtual machine instance and the container image stored in the virtual machine instance. Among them, computing resources include processor resources, memory resources, storage resources, and network resources. In other words, the virtual machine instance corresponds to the specified configuration.
[0031] It should be noted that when creating and running a container instance on a virtual machine instance, the virtual machine instance must first read the container image used to support the creation and startup of the container instance from the storage device used to store the container image, and will configure the virtual machine instance based on the read container image. It can be seen that the virtual machine instance running the container instance often stores the container image. Among them, the container image includes the application code, runtime environment, system tools, dependent libraries and other components required, as well as the configuration and parameters required to start and run the application.
[0032] In the embodiments of the present application, the container instance created on the virtual machine instance is generally a Pod (container group) level container instance, for example, ECI (Elastic Container Instance), or it can be a Container (container) level container instance.
[0033] The standard for determining whether the target virtual machine instance is a reusable resource may be whether the running time corresponding to the target container instance is lower than the running time threshold of the corresponding configuration. Specifically, if the running time corresponding to the target container instance is lower than the running time threshold of the corresponding configuration, the target virtual machine instance may be determined as a reusable resource, and if the running time corresponding to the target container instance is not lower than the running time threshold of the corresponding configuration, the target virtual machine instance may be determined as a non-reusable resource. In other words, when the running time corresponding to the target container instance is short, the target virtual machine instance may be used as a reusable resource. For container instances with short running times, there are often higher requirements for the creation and startup speed of the container instance. Based on this, if the standard for determining whether the target virtual machine instance is a reusable resource is determined as "whether the running time corresponding to the target container instance is lower than the running time threshold of the corresponding configuration", then there is a greater probability of ensuring that when the target container instance is created again, it can be directly reused to the target virtual machine instance, thereby having a greater probability of improving the creation and startup speed of the target virtual machine instance.
[0034] For container instances with shorter runtimes, although they often have higher requirements for the creation and startup speed of container instances, if the container instance with shorter runtime (target container instance) is created once, it will not be created again, or the frequency of being created again is very low. In this case, if the target virtual machine instance is placed in the resource reuse pool as a reusable resource, the probability of the target virtual machine instance being reused is often very small, which will cause a waste of storage resources and processing resources. Therefore, in order to avoid the waste of storage resources and processing resources, the standard for determining whether the target virtual machine instance belongs to a reusable resource can be further configured as: whether the runtime corresponding to the target container instance is lower than the runtime threshold of the corresponding configuration, and whether the creation frequency corresponding to the target container instance reaches the creation frequency threshold of the corresponding configuration. In other words, the standard for determining whether the target virtual machine instance belongs to a reusable resource, in addition to including whether the runtime corresponding to the target container instance is lower than the runtime threshold of the corresponding configuration, can also include whether the creation frequency corresponding to the target container instance reaches the creation frequency threshold of the corresponding configuration.
[0035] When determining whether the target virtual machine instance belongs to a reusable resource, the standard is whether the running time corresponding to the target container instance is lower than the running time threshold of the corresponding configuration, and whether the creation frequency corresponding to the target container instance reaches the creation frequency threshold of the corresponding configuration. If it is determined that the running time corresponding to the target container instance is not lower than the running time threshold of the corresponding configuration, it is directly determined that the target virtual machine instance does not belong to a reusable resource. If it is determined that the running time corresponding to the target container instance is lower than the running time threshold of the corresponding configuration, it is necessary to further determine whether the target virtual machine instance belongs to a reusable resource based on whether the creation frequency corresponding to the target container instance reaches the creation frequency threshold of the corresponding configuration. Specifically, when the running time corresponding to the target container instance is lower than the running time threshold of the corresponding configuration, if the creation frequency corresponding to the target container instance reaches the creation frequency threshold of the corresponding configuration, the target virtual machine instance is determined to be a reusable resource, otherwise, the target virtual machine instance is determined to be a non-reusable resource. That is to say, the target virtual machine instance is used as a reusable resource only when the running time corresponding to the target container instance is short and the corresponding creation frequency is high.
[0036] It should be noted that, when whether the running time is lower than the running time threshold is configured as the standard for determining whether the target virtual machine instance belongs to a reusable resource, other determination conditions can also be configured as the standard for determining whether the target virtual machine instance belongs to a reusable resource, for example, whether the creation frequency corresponding to the above-mentioned target container instance reaches the corresponding configured creation frequency threshold. However, in addition to processing other determination conditions, including whether the creation frequency corresponding to the target container instance reaches the corresponding configured creation frequency threshold, it can also be the container instance type corresponding to the target container instance. At this time, the standard for determining whether the target virtual machine instance belongs to a reusable resource is whether the running time corresponding to the target container instance is lower than the corresponding configured running time threshold, and whether the container instance type corresponding to the target container instance is the specified container instance type.
[0037] The standard for determining whether the target virtual machine instance belongs to a reusable resource is whether the running time corresponding to the target container instance is lower than the running time threshold of the corresponding configuration, and whether the container instance type corresponding to the target container instance is a specified container instance type. If it is determined that the running time corresponding to the target container instance is not lower than the running time threshold of the corresponding configuration, it is directly determined that the target virtual machine instance does not belong to a reusable resource. If it is determined that the running time corresponding to the target container instance is lower than the running time threshold of the corresponding configuration, it is necessary to further determine whether the target virtual machine instance belongs to a reusable resource based on whether the container instance type corresponding to the target container instance is a specified container instance type. Specifically, when the running time corresponding to the target container instance is lower than the running time threshold of the corresponding configuration, if the container instance type corresponding to the target container instance is a specified container instance type, the target virtual machine instance is determined to be a reusable resource, otherwise, the target virtual machine instance is determined to be a non-reusable resource. That is to say, the target virtual machine instance is used as a reusable resource only when the running time corresponding to the target container instance is shorter and is of a specified container instance type.
[0038] In addition, other determination conditions can also be personalized according to needs. In the embodiments of the present application, the types of other determination conditions are not specifically limited. If the target virtual machine instance is a reusable resource, when placing the target virtual machine instance into the resource reuse pool, the target container instance on the target virtual machine instance must be deleted first, and then the target virtual machine instance must be added to the resource reuse pool. In other words, only the target virtual machine instance is stored in the reused resource pool, and the target container instance is not included. In addition, since only the target container instance is deleted, the container image is still stored on the target virtual machine instance. In the embodiments of the present application, the container image stored in the target virtual machine instance is also used as the configuration of the target virtual machine instance.
[0039] In the embodiment of the present application, the configuration requirements of a specific container instance for a virtual machine instance are referred to as specific configuration requirements. Corresponding to the configuration of the virtual machine instance, the specific configuration requirements include the container image requirements of the specific container instance for the container image stored in the virtual machine instance, and the computing resource requirements of the specific container instance for the computing resources corresponding to the virtual machine instance. The configuration requirements of the specific container instance for the virtual machine instance and the configuration matching of the target virtual machine instance generally mean that the container image stored in the target virtual machine instance must match the container image requirements, and the computing resources corresponding to the target virtual machine instance must meet the computing resource requirements.
[0040] The container image stored in the target virtual machine instance must match the container image requirement, which means that the container image corresponding to the container image requirement is the same as the container image stored in the target virtual machine instance. For example, if the container image requirement is container image A, the container image stored in the target virtual machine instance is also required to be container image A. The computing resources corresponding to the target virtual machine instance must meet the computing resource requirements, which means that the computing resources corresponding to the target virtual machine instance must be greater than or equal to the computing resources corresponding to the computing resource requirements. For example, the computing resources corresponding to the computing resource requirements are: a dual-core processor and 4GB (Giga Byte) of running memory, then the computing resources corresponding to the target virtual machine instance can be a dual-core processor and 4GB of running memory, or a dual-core processor and 8GB of running memory, or even a quad-core processor and 8GB of running memory.
[0041] The container instance creation scheme involved in the embodiment of the present application, when determining that a virtual machine instance can be reused when creating a specific container instance, will first obtain a target virtual machine instance that matches the specific configuration requirement from at least one virtual machine instance stored in the resource reuse pool, and then create a specific container instance on the target virtual machine instance. Among them, at least one virtual machine instance belongs to a reusable resource, and the specific configuration requirement is used to identify the configuration requirement of the specific container instance for the virtual machine instance.
[0042] The basis for determining whether a virtual machine instance can be reused when creating a specific container instance is whether the predicted running time corresponding to the specific container instance is lower than the running time threshold of the corresponding configuration. Specifically, if the predicted running time corresponding to the specific container instance is lower than the running time threshold of the corresponding configuration, it can be determined that the virtual machine instance can be reused when creating the specific container instance. If the predicted running time corresponding to the specific container instance is not lower than the running time threshold of the corresponding configuration, it is determined that the virtual machine instance cannot be reused when creating the specific container instance. In other words, when the running time corresponding to the specific container instance is predicted to be short, it can be determined that the resource can be reused to create the specific container instance. For container instances with short running time, they often have higher requirements for the creation and startup speed of the container instance. Based on this, if the basis for determining whether a virtual machine instance can be reused when creating a specific container instance is determined as "whether the predicted running time corresponding to the specific container instance is lower than the running time threshold of the corresponding configuration", then there is a greater probability of ensuring that when creating a container instance with a short running time, the virtual machine instance stored in the resource reuse pool can be reused, thereby having a greater probability of improving the creation and startup speed of the container instance with a short running time.
[0043] In order to more clearly demonstrate the method for processing a virtual machine instance and the method for creating a container instance provided in the embodiment of the present application, an application example of the method for processing a virtual machine instance and the method for creating a container instance provided in the embodiment of the present application is first introduced. The method for processing a virtual machine instance and the method for creating a container instance provided in the embodiment of the present application can be applied to the process of creating an ECI. Figure 1 As shown, a schematic diagram of the application process of a method for processing a virtual machine instance and a method for creating a container instance provided in an embodiment of the present application is shown. The specific implementation process of this example includes a processing stage of a virtual machine instance and a creation stage of a container instance.
[0044] The processing stages of the virtual machine instance are as follows: After receiving the deletion request initiated by the user for the target ECI, the server will first respond to the deletion request for the target ECI and determine whether the target virtual machine instance used to support the operation of the target ECI is a reusable resource. Then, if the target virtual machine instance is a reusable resource, the target virtual machine instance will be placed in the resource reuse pool.
[0045] The creation phase of ECI is as follows: After the user sends a creation request to the server to create a specific ECI, the server will first respond to the creation request and determine whether a virtual machine instance can be reused when creating the specific ECI. Then, if it is determined that a virtual machine instance can be reused when creating the specific ECI, a target virtual machine instance matching the specific configuration requirement is obtained from at least one virtual machine instance stored in the resource reuse pool, and the specific ECI is created on the target virtual machine instance.
[0046] It should be noted that the above application examples of the method for processing virtual machine instances and the method for creating container instances provided in the embodiments of the present application are for ease of understanding and are not used to limit the method for processing virtual machine instances and the method for creating container instances provided in the embodiments of the present application. Specifically, the application scenarios of the method for processing virtual machine instances and the method for creating container instances provided in the embodiments of the present application are not specifically limited. For example, the method for processing virtual machine instances and the method for creating container instances provided in the embodiments of the present application can be applied to the creation process of ECI as well as to the creation process of other types of container instances.
[0047] In addition, the user end in the embodiment of the present application is a device terminal that needs to use a container instance to complete a specific task, and the server end is generally a cloud server. In other words, the execution subject of the processing method of the virtual machine instance and the creation method of the container instance provided in the embodiment of the present application is generally a cloud server.
[0048] In addition, 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 the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose or edit authorization or rejection.
[0049] 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 technical problems. The following related technologies can be combined arbitrarily with the technical solution 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. The same or similar concepts or processes may not be repeated in some embodiments.
[0050] Figure 2 A flowchart of a method 200 for processing a virtual machine instance provided in an embodiment of the present application is shown. The method may include steps S201-S202.
[0051] In step S201, in response to a deletion request for a target container instance, it is determined whether a target virtual machine instance used to support the running of the target container instance belongs to a reusable resource.
[0052] The target container instance generally refers to a container instance that has completed running. The type of the target container instance is generally ECI, but it can also be other types of container instances.
[0053] For container instances with shorter runtimes, there are often higher requirements for the creation and startup speed of container instances. Based on this, if the standard for determining whether the target virtual machine instance is a reusable resource is determined as "whether the runtime corresponding to the target container instance is lower than the runtime threshold of the corresponding configuration", then there is a high probability of ensuring that when the target container instance is created again, it can be directly reused to the target virtual machine instance, thereby increasing the creation and startup speed of the target virtual machine instance. When the standard for determining whether the target virtual machine instance is a reusable resource is "whether the runtime corresponding to the target container instance is lower than the runtime threshold of the corresponding configuration", when determining whether the target virtual machine instance used to support the operation of the target container instance is a reusable resource, the runtime corresponding to the target container instance can be obtained first. Then, when the runtime is lower than the runtime threshold of the corresponding configuration, it is determined whether the target virtual machine instance is a reusable resource.
[0054] In one example, if the runtime corresponding to the target container instance is lower than the runtime threshold of the corresponding configuration, the target virtual machine instance can be determined as a reusable resource, and if the runtime corresponding to the target container instance is not lower than the runtime threshold of the corresponding configuration, the target virtual machine instance will be determined as a non-reusable resource.
[0055] The operation time threshold can be determined based on a priori value or a pre-configured probability of reusable resources. For example, the operation time threshold can be 30 minutes. The probability of reusable resources refers to the probability of using a virtual machine instance as a reusable resource. Generally, the larger the operation time threshold, the greater the probability of using a virtual machine instance as a reusable resource. That is to say, in the embodiment of the present application, the probability of using a virtual machine instance as a reusable resource can be adjusted by pre-configuring the probability of reusable resources.
[0056] For container instances with shorter runtimes, although they often have higher requirements for the creation and startup speed of container instances, if the container instance with shorter runtime (target container instance) is created once, it will not be created again, or the frequency of being created again is very low. In this case, if the target virtual machine instance is placed in the resource reuse pool as a reusable resource, the probability of the target virtual machine instance being reused is often very small, which will cause a waste of storage resources and processing resources. Therefore, in order to avoid the waste of storage resources and processing resources, the standard for determining whether the target virtual machine instance belongs to a reusable resource can be further configured as whether the runtime corresponding to the target container instance is lower than the runtime threshold of the corresponding configuration, and whether the creation frequency corresponding to the target container instance reaches the creation frequency threshold of the corresponding configuration. In this case, when the runtime is lower than the runtime threshold of the corresponding configuration, when determining whether the target virtual machine instance belongs to a reusable resource, the creation frequency corresponding to the target container instance can be obtained when the runtime is lower than the runtime threshold, and then, when the creation frequency reaches the creation frequency threshold of the corresponding configuration, it is determined that the target virtual machine instance belongs to a reusable resource.
[0057] In one example, if the running time corresponding to the target container instance is lower than the running time threshold of the corresponding configuration, and at the same time, the creation frequency corresponding to the target container instance reaches the creation frequency threshold of the corresponding configuration, the target virtual machine instance is determined as a reusable resource, otherwise, the target virtual machine instance is determined as a non-reusable resource.
[0058] In a possible implementation, when whether the running time is lower than the running time threshold is configured as the standard for determining whether the target virtual machine instance belongs to a reusable resource, other determination conditions may also be configured as the standard for determining whether the target virtual machine instance belongs to a reusable resource, for example, whether the creation frequency corresponding to the above-mentioned target container instance reaches the corresponding configured creation frequency threshold. However, in addition to processing other determination conditions, including whether the creation frequency corresponding to the target container instance reaches the corresponding configured creation frequency threshold, it may also be the container instance type corresponding to the target container instance. In this case, the standard for determining whether the target virtual machine instance belongs to a reusable resource is whether the running time corresponding to the target container instance is lower than the corresponding configured running time threshold, and whether the container instance type corresponding to the target container instance is a specified container instance type.
[0059] In addition, other determination conditions can also be configured according to individual needs. In the embodiments of the present application, the types of other determination conditions are not specifically limited. In a possible implementation, obtaining the creation frequency corresponding to the target container instance means first obtaining the operation behavior log for the target container instance, then parsing the operation behavior log to obtain the historical creation behavior data for the target container instance, and then determining the creation frequency based on the historical creation behavior data.
[0060] The operation behavior log records historical deletion behavior data for container instances and historical creation behavior data for container instances. The historical deletion behavior data at least describes each deletion operation on the container instance and the deletion time point when each deletion operation occurred. The historical creation behavior data at least describes each creation operation on the container instance and the creation time point when each creation operation occurred. The creation frequency can be determined based on the number of times the target container is created within a specified time period. In one example, the creation frequency can be calculated by the number of times the target container is created within an hour.
[0061] The method for processing virtual machine instances provided in the embodiment of the present application, in response to a deletion request for a target container instance, determines whether the target virtual machine instance used to support the operation of the target container instance belongs to a reusable resource, and then further executes step S202. In step S202, when the target virtual machine instance belongs to a reusable resource, the target virtual machine instance is placed in a resource reuse pool, so as to obtain the target virtual machine instance from the resource reuse pool when creating a specific container instance, and create a specific container instance on the target virtual machine instance; the configuration requirements of the specific container instance for the virtual machine instance match the configuration of the target virtual machine instance.
[0062] The configuration of a virtual machine instance includes computing resources corresponding to the virtual machine instance and container images stored in the virtual machine instance. Among them, computing resources include processor resources, memory resources, storage resources, and network resources. Corresponding to the configuration of the virtual machine instance, the specific configuration requirements include container image requirements of a specific container instance for the container image stored in the virtual machine instance, and computing resource requirements of computing resources corresponding to the virtual machine instance. The configuration requirements of a specific container instance for a virtual machine instance and the configuration matching of a target virtual machine instance generally mean that the container image stored in the target virtual machine instance must match the container image requirements, and the computing resources corresponding to the target virtual machine instance must meet the computing resource requirements.
[0063] The container image stored in the target virtual machine instance must match the container image requirement, which means that the container image corresponding to the container image requirement is the same as the container image stored in the target virtual machine instance. For example, if the container image requirement is container image A, the container image stored in the target virtual machine instance is also required to be container image A. The computing resources corresponding to the target virtual machine instance must meet the computing resource requirement, which means that the computing resources corresponding to the target virtual machine instance must be greater than or equal to the computing resources corresponding to the computing resource requirement.
[0064] In one possible implementation, in order to ensure that only the target virtual machine instance is stored in the reused resource pool and not the target container instance, when the target virtual machine instance is placed in the resource reuse pool, the target container instance must first be deleted on the target virtual machine instance, and then the target virtual machine instance is added to the resource reuse pool.
[0065] In addition, if the target virtual machine instance is stored in the resource reuse pool for too long, it indicates that the target virtual machine instance has not been reused. If the target virtual machine instance is still stored in the resource reuse pool when it has not been reused for a long time, it will cause a waste of storage resources. In order to avoid this situation, after the target virtual machine instance is placed in the resource reuse pool, the continuous storage time of the target virtual machine instance in the resource reuse pool can be further monitored, and when the continuous storage time reaches the corresponding configured storage time threshold, the target virtual machine instance is deleted from the resource reuse pool. The storage time threshold can be configured according to a priori value. In one example, the storage time threshold is 30 minutes. That is, if the target virtual machine instance is stored in the resource reuse pool for 30 minutes continuously, the target virtual machine instance can be deleted from the resource reuse pool.
[0066] The processing method of the virtual machine instance provided in the embodiment of the present application, when deleting the target container instance, will first determine whether the target virtual machine instance used to support the operation of the target container instance belongs to a reusable resource, and when the target virtual machine instance belongs to a reusable resource, the target virtual machine instance will be placed in the resource reuse pool, so as to obtain the target virtual machine instance from the resource reuse pool when creating a specific container instance, and create a specific container instance on the target virtual machine instance. In other words, if the target virtual machine instance belongs to a reusable resource, when deleting the target container instance, the target virtual machine instance is not deleted, but the target virtual machine instance is placed in the resource reuse pool as a reusable resource, and the target virtual machine instance is directly reused when creating a specific container instance to create a specific container instance on the target virtual machine instance. Directly reusing the target virtual machine instance when creating a specific container instance can avoid consuming a lot of time and processing resources to configure the virtual machine instance used to support the operation of the specific container instance when creating and starting the specific container instance. In this way, the time required to create and start a specific container instance can be greatly reduced, the creation and startup speed of the specific container instance can be improved, and at the same time, the processing resources required to create and start the specific container instance can be reduced.
[0067] Corresponding to the application example of the method provided in the embodiment of the present application and the processing method of the virtual machine instance provided in the embodiment of the present application, the embodiment of the present application also provides a method for creating a container instance, such as Figure 3 As shown, it is a flowchart of a method 300 for creating a container instance provided in an embodiment of the present application. The method may include steps S301-S302.
[0068] In step S301, when it is determined that a virtual machine instance can be reused when creating a specific container instance, a target virtual machine instance matching the specific configuration requirement is obtained from at least one virtual machine instance stored in a resource reuse pool; at least one virtual machine instance belongs to a reusable resource; and the specific configuration requirement is used to identify the configuration requirement of the specific container instance for the virtual machine instance.
[0069] For container instances with shorter runtimes, there are often higher requirements for the creation and startup speed of container instances. Based on this, if the basis for determining whether a virtual machine instance can be reused when creating a specific container instance is determined as "whether the predicted runtime corresponding to the specific container instance is lower than the runtime threshold of the corresponding configuration", then there is a high probability of ensuring that the virtual machine instance stored in the resource reuse pool can be reused when creating a container instance with a shorter runtime, thereby having a high probability of improving the creation and startup speed of the container instance with a shorter runtime. When the basis for determining whether a virtual machine instance can be reused when creating a specific container instance is "whether the predicted runtime corresponding to the specific container instance is lower than the runtime threshold of the corresponding configuration", when determining whether the virtual machine instance can be reused when creating a specific container instance, it can be first predicted based on specific configuration requirements whether the runtime of the specific container instance is lower than the runtime threshold of the corresponding configuration. Then, when the runtime is lower than the runtime threshold of the corresponding configuration, it is determined that the virtual machine instance can be reused when creating the specific container instance, and when the runtime is not lower than the runtime threshold of the corresponding configuration, it is determined that the virtual machine instance cannot be reused when creating the specific container instance.
[0070] In one example, if the predicted runtime corresponding to a specific container instance is lower than the runtime threshold of the corresponding configuration, it can be determined that the virtual machine instance can be reused when creating the specific container instance. If the predicted runtime corresponding to the specific container instance is not lower than the runtime threshold of the corresponding configuration, it is determined that the virtual machine instance cannot be reused when creating the specific container instance.
[0071] The running time of a container instance is strongly related to some configurations in the creation configuration of the container instance. Therefore, when determining whether a virtual machine instance can be reused when creating a specific container instance, it is possible to predict whether the running time of a specific container instance is lower than the running time threshold of the corresponding configuration based on the creation configuration requirements corresponding to the specific container instance. Among them, the creation configuration requirements are used to identify the requirements of a specific container instance for the creation configuration, and the creation configuration requirements include specific configuration requirements. Specifically, in addition to the configuration requirements of a specific container instance for a virtual machine instance (i.e., specific configuration requirements), the creation configuration requirements also include the requirements of a specific container instance for a container instance restart policy (Restart_Policy), the requirements of a specific container instance for a manager (Managed_By), the requirements of a specific container instance for a container image pull policy (Ownerrefferrence), and the requirements of a specific container instance for a clone set (Cloneset). Correspondingly, the creation configuration required for a specific container instance includes, in addition to the virtual machine instance configuration required for a specific container instance, a container instance restart policy required for a specific container instance, a manager required for a specific container instance, a container image pull policy required for a specific container instance, and a clone set required for a specific container instance.
[0072] In one possible implementation, in order to be able to quickly and accurately predict whether the runtime is lower than the runtime threshold, when predicting whether the runtime of a specific container instance is lower than the runtime threshold of the corresponding configuration based on the creation configuration requirements corresponding to the specific container instance, the creation configuration requirements can be first parsed to obtain the creation configuration required for the specific container instance. Then, a feature vector corresponding to the creation configuration required for the specific container instance is obtained. Afterwards, the feature vector is input into the trained container instance classification model to obtain the container instance classification result output by the container instance classification model. Among them, the container instance classification result is used to identify whether the runtime is lower than the runtime threshold.
[0073] The training process of the container instance classification model can be as follows: Figure 4 As shown, it shows a schematic diagram of the training process of a container instance classification model. The training process of the container instance classification model is as follows:
[0074] First, for multiple container instance samples in the container instance sample set, the creation configuration of each container instance sample is obtained. Secondly, the creation configuration of each container instance sample is discretized. In the discretization process, the creation configuration of each container instance sample can be binned, and then the binned creation configuration is binarized to obtain the discrete features corresponding to the creation configuration of each container instance sample, and the discrete features corresponding to the creation configuration of each container instance sample are used as the feature vector corresponding to the creation configuration of each container instance sample. Thirdly, the container instance classification result annotated for each container instance sample is obtained. Finally, the feature vector corresponding to the creation configuration of each container instance sample and the container instance classification result annotated for each container instance sample are used to train the container instance classification model to be trained to obtain the trained container instance classification model. Among them, the binning process and the binarization process can be implemented according to the pre-configured binning process model for binning process and the binarization process model for binarization process, respectively.
[0075] Binning the creation configuration of each container instance sample means binning the creation configuration of each container instance sample according to positive samples and negative samples, and classifying the creation configuration of each container instance sample belonging to positive samples into one category, and classifying the creation configuration of each container instance sample belonging to negative samples into another category. The positive samples and negative samples are divided based on whether the running time of the container instance sample is lower than the running time threshold of the corresponding configuration, that is, the positive samples include the container instance samples whose running time is lower than the running time threshold, and the negative samples include the container instance samples whose running time is not lower than the running time threshold.
[0076] In addition, during the model training process of the container instance classification model to be trained, a correspondence analysis strategy can be used to determine the creation configuration that is highly correlated with the runtime, and use this creation configuration when predicting whether the runtime is lower than the runtime threshold to improve the accuracy of the container instance classification results.
[0077] In the embodiment of the present application, for some container instances, their corresponding running time is either lower than the running time threshold or not lower than the running time threshold. In this case, the container instance can be regarded as data noise, and it is necessary to exclude this part of the container instance when constructing the container instance sample set.
[0078] In one example, since the naive Bayes model has advantages such as robustness, timeliness, and short prediction time, the container instance classification model can be a model built based on the naive Bayes model and used to classify container instances.
[0079] It should be noted that the container instance classification result output by the container instance classification model may be whether the runtime is lower than the runtime threshold. The container instance classification result may also be whether a specific container can reuse a virtual machine instance. Specifically, if the runtime is lower than the runtime threshold, the container instance classification result is a reusable virtual machine instance for the specific container. If the runtime is not lower than the runtime threshold, the container instance classification result is a non-reusable virtual machine instance for the specific container. The form of the container instance classification result may also be configured in a personalized manner according to the requirements. In the embodiments of the present application, the form of the container instance classification result is not specifically limited.
[0080] In the embodiment of the present application, at least one virtual machine instance stores a corresponding container image, and the specific configuration requirements include the container image requirements of the specific container instance for the container image stored in the virtual machine instance, and the computing resource requirements of the computing resources corresponding to the virtual machine instance. The configuration of the virtual machine instance matches the specific configuration requirements, which means that the container image stored in the virtual machine instance must match the container image requirements, and the computing resources corresponding to the virtual machine instance must meet the computing resource requirements. Specifically, the container image stored in the virtual machine instance must match the container image requirements, which means that the container image corresponding to the container image requirements is the same as the container image stored in the virtual machine instance. For example, if the container image requirement is container image 1, the container image stored in the virtual machine instance is also required to be container image 1. The computing resources corresponding to the virtual machine instance must meet the computing resource requirements, which means that the computing resources corresponding to the virtual machine instance must be greater than or equal to the computing resources corresponding to the computing resource requirements. For example, the computing resources corresponding to the computing resource requirements are: the processor is dual-core and the running memory is 4GB, then the computing resources corresponding to the virtual machine instance can be a processor with dual cores and a running memory of 4GB, or a processor with dual cores and a running memory of 8GB, or even a processor with quad cores and a running memory of 8GB.
[0081] In order to ensure that the container image stored in the target virtual machine instance is the same as the container image corresponding to the container image requirement, when obtaining the target virtual machine instance that matches the specific configuration requirement from at least one virtual machine instance stored in the resource reuse pool, the candidate virtual machine instance that stores the container image that matches the container image requirement can be first screened out from at least one virtual machine instance. Then, the target virtual machine instance is obtained from the candidate virtual machine instances. That is, first, the virtual machine instance whose stored container image is the same as the container image corresponding to the container image requirement is screened out from at least one virtual machine instance, and then the target virtual machine instance is further screened out from the virtual machine instance whose stored container image is the same as the container image corresponding to the container image requirement. In this way, it can be ensured that the container image stored in the target virtual machine instance is the same as the container image corresponding to the container image requirement.
[0082] In order to ensure that the computing resources corresponding to the target virtual machine instance are greater than or equal to the computing resources corresponding to the computing resource requirements, when obtaining the target virtual machine instance from the candidate virtual machine instances, the specific configuration requirements can be read first to obtain the computing resource requirements of the specific container instance for the computing resources corresponding to the virtual machine instance. Then, from the candidate virtual machine instances, a virtual machine instance that meets the computing resource requirements is obtained as the target virtual machine instance.
[0083] The method for creating a container instance provided in the embodiment of the present application further performs step S302 after obtaining a target virtual machine instance matching a specific configuration requirement. In step S302, a specific container instance is created on the target virtual machine instance.
[0084] The type of a specific container instance is generally ECI, but can also be other types of container instances.
[0085] It should be noted that in the embodiment of the present application, before determining whether a specific container instance is a reusable virtual machine instance when it is created, it can be determined that the user end that initiates the container instance creation request will frequently create container instances. In the case where the user end frequently creates container instances, it will be further determined whether a specific container instance is a reusable virtual machine instance when it is created. Otherwise, the traditional path is taken to create a specific container instance, that is, first configure the virtual machine instance, and then create a specific container instance on the virtual machine instance. Among them, whether the user end frequently creates container instances can be determined based on the user end's operation behavior log for the container instance.
[0086] In addition, when it is determined that a specific container instance is to be created as a reusable virtual machine instance, it is generally necessary to take a traditional path to create the specific container instance.
[0087] The method for creating a container instance provided in an embodiment of the present application, when it is determined that a virtual machine instance can be reused when creating a specific container instance, will obtain a target virtual machine instance that matches the specific configuration requirements from at least one virtual machine instance stored in the resource reuse pool, and will create a specific container instance on the target virtual machine instance. That is to say, when it is determined that a virtual machine instance can be reused when creating a specific container instance, the target virtual machine instance will be directly reused when creating the specific container instance to create the specific container instance on the target virtual machine instance. Directly reusing the target virtual machine instance when creating a specific container instance can avoid consuming a lot of time and processing resources to configure the virtual machine instance used to support the operation of the specific container instance when creating and starting the specific container instance. In this way, the time required to create and start a specific container instance can be greatly reduced, the creation and startup speed of the specific container instance can be improved, and at the same time, the processing resources required to create and start the specific container instance can be reduced.
[0088] Corresponding to the application example of the method provided in the embodiment of the present application and the processing method of the virtual machine instance and the creation method of the container instance provided in the embodiment of the present application, the embodiment of the present application also provides a system for creating a container instance. Figure 5As shown, it is a structural block diagram of a system 500 for creating a container instance in an embodiment of the present application. The system 500 may include: a resource storage node 501 and a resource reuse node 502. Among them, the resource storage node 501 is used to execute the processing method of the virtual machine instance provided in the embodiment of the present application. The resource reuse node 502 is used to execute the method for creating a container instance provided in the embodiment of the present application. The resource storage node 501 and the resource reuse node 502 are generally functional modules, devices, etc. configured on the server.
[0089] The functions of each node in each device in the embodiment of the present application can be referred to the corresponding description in the above method, and have corresponding beneficial effects, which will not be repeated here.
[0090] Corresponding to the application example of the method provided in the embodiment of the present application and the method for processing a virtual machine instance provided in the embodiment of the present application, the embodiment of the present application also provides a processing device for a virtual machine instance. Figure 6 As shown, it is a structural block diagram of a processing device 600 of a virtual machine instance according to an embodiment of the present application. The device 600 may include:
[0091] A reusable resource determination module 601 is used to determine whether a target virtual machine instance used to support the operation of the target container instance is a reusable resource in response to a deletion request for the target container instance;
[0092] The reusable resource storage module 602 is used to place the target virtual machine instance into the resource reuse pool when the target virtual machine instance belongs to a reusable resource, so as to obtain the target virtual machine instance from the resource reuse pool when creating a specific container instance, and create a specific container instance on the target virtual machine instance; the configuration requirements of the specific container instance for the virtual machine instance match the configuration of the target virtual machine instance.
[0093] In a possible implementation, the reusable resource determination module 601 includes:
[0094] The runtime acquisition submodule is used to obtain the runtime corresponding to the target container instance;
[0095] The first reusable resource determination submodule is used to determine whether the target virtual machine instance belongs to a reusable resource when the running time is lower than the corresponding configured running time threshold.
[0096] In a possible implementation, the first reusable resource determination submodule includes:
[0097] A first creation frequency acquisition submodule is used to acquire a creation frequency corresponding to a target container instance when the running time is lower than a running time threshold;
[0098] The second reusable resource determination submodule is used to determine that the target virtual machine instance belongs to a reusable resource when the creation frequency reaches a corresponding configured creation frequency threshold.
[0099] In a possible implementation, the first creation frequency acquisition submodule includes:
[0100] An operation behavior log acquisition submodule is used to acquire the operation behavior log for the target container instance;
[0101] A historical creation behavior data acquisition submodule is used to parse the operation behavior log and obtain the historical creation behavior data for the target container instance;
[0102] The second creation frequency acquisition submodule determines the creation frequency according to the historical creation behavior data.
[0103] In a possible implementation, the reusable resource storage module 602 includes:
[0104] The reusable resource storage submodule is used to delete the target container instance on the target virtual machine instance and add the target virtual machine instance to the resource reuse pool.
[0105] In a possible implementation, the device 600 further includes:
[0106] A continuous storage duration acquisition module is used to monitor the continuous storage duration of the target virtual machine instance in the resource reuse pool after the target virtual machine instance is placed in the resource reuse pool;
[0107] The virtual machine instance deletion module is used to delete the target virtual machine instance from the resource reuse pool when the continuous storage time reaches the corresponding configured storage time threshold.
[0108] 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.
[0109] Corresponding to the application example of the method provided in the embodiment of the present application and the method for creating a container instance, the embodiment of the present application also provides a device for creating a container instance. Figure 7 As shown, it is a structural block diagram of a container instance creation device 700 according to an embodiment of the present application. The device 700 may include:
[0110] The target virtual machine instance acquisition module 701 is used to acquire a target virtual machine instance matching a specific configuration requirement from at least one virtual machine instance stored in a resource reuse pool when determining that a virtual machine instance can be reused when creating a specific container instance; the at least one virtual machine instance belongs to a reusable resource; and the specific configuration requirement is used to identify the configuration requirement of the specific container instance for the virtual machine instance.
[0111] The specific container instance creation module 702 is used to create a specific container instance on the target virtual machine instance.
[0112] In a possible implementation, the target virtual machine instance acquisition module 701 includes:
[0113] A first runtime prediction submodule is used to predict whether the runtime of a specific container instance is lower than a runtime threshold of a corresponding configuration based on a creation configuration requirement corresponding to the specific container instance; the creation configuration requirement is used to identify the requirement of the specific container instance for the creation configuration, and the creation configuration requirement includes a specific configuration requirement;
[0114] The reusable virtual machine instance determination submodule is used to determine a reusable virtual machine instance when creating a specific container instance when the running time is lower than the corresponding configured running time threshold.
[0115] In a possible implementation, the first running time prediction submodule includes:
[0116] Create a configuration acquisition submodule, which is used to parse the creation configuration requirements and obtain the creation configuration required for a specific container instance;
[0117] A feature vector acquisition submodule is used to obtain a feature vector corresponding to the creation configuration required for a specific container instance;
[0118] The second runtime prediction submodule is used to input the feature vector into the trained container instance classification model to obtain the container instance classification result output by the container instance classification model; the container instance classification result is used to identify whether the runtime is lower than the runtime threshold.
[0119] In a possible implementation, at least one virtual machine instance stores a corresponding container image, and the specific configuration requirement includes a container image requirement of the specific container instance for the container image stored in the virtual machine instance; the target virtual machine instance acquisition module 701 includes:
[0120] A candidate virtual machine instance acquisition submodule, used to screen out a candidate virtual machine instance storing a container image matching the container image requirement from at least one virtual machine instance;
[0121] The first target virtual machine instance acquisition submodule is used to acquire a target virtual machine instance from the candidate virtual machine instances.
[0122] In a possible implementation, the first target virtual machine instance acquisition submodule includes:
[0123] A computing resource requirement acquisition submodule is used to read specific configuration requirements and obtain the computing resource requirements of a specific container instance for a virtual machine instance;
[0124] The second target virtual machine instance acquisition submodule is used to acquire a virtual machine instance that meets the computing resource requirements from the candidate virtual machine instances as a target virtual machine instance.
[0125] 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.
[0126] 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.
[0127] Figure 8 FIG. 1 is a block diagram of an electronic device used to implement an embodiment of the present application. Figure 8 As shown, the electronic device includes: a memory 801 and a processor 802. The memory 801 stores a computer program that can be run on the processor 802. When the processor 802 executes the computer program, the method in the above embodiment is implemented. The number of the memory 801 and the processor 802 can be one or more.
[0128] The electronic device also includes:
[0129] The communication interface 803 is used to communicate with external devices and perform data exchange transmission.
[0130] If the memory 801, the processor 802 and the communication interface 803 are implemented independently, the memory 801, the processor 802 and the communication interface 803 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 8 Only 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.
[0131] Optionally, in a specific implementation, if the memory 801, the processor 802 and the communication interface 803 are integrated on a chip, the memory 801, the processor 802 and the communication interface 803 can communicate with each other through an internal interface.
[0132] 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.
[0133] 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.
[0134] 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.
[0135] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) 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.
[0136] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. 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 example but not limitation, 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).
[0137] 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 devices. 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.
[0138] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" 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.
[0139] 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. Therefore, 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.
[0140] Any process or method description in the flow chart or otherwise described herein can be understood to represent a module, fragment or portion of a code including 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.
[0141] The logic and / or steps represented 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 embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.
[0142] 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.
[0143] 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.
[0144] The above are only specific implementations 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 disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for processing a virtual machine instance, comprising: In response to a deletion request for a target container instance, determining whether a target virtual machine instance used to support the operation of the target container instance belongs to a reusable resource; When the target virtual machine instance belongs to a reusable resource, the target virtual machine instance is placed in a resource reuse pool, so as to obtain the target virtual machine instance from the resource reuse pool when creating a specific container instance, and create the specific container instance on the target virtual machine instance; the configuration requirements of the specific container instance for the virtual machine instance match the configuration of the target virtual machine instance.
2. The method according to claim 1, wherein: The step of determining, in response to a deletion request for a target container instance, whether a target virtual machine instance for supporting the operation of the target container instance belongs to a reusable resource comprises: Obtain the running time corresponding to the target container instance; When the running time is lower than a corresponding configured running time threshold, it is determined whether the target virtual machine instance belongs to a reusable resource.
3. The method according to claim 2, wherein: When the running time is lower than the running time threshold of the corresponding configuration, determining whether the target virtual machine instance belongs to a reusable resource includes: When the running time is lower than the running time threshold, obtaining a creation frequency corresponding to the target container instance; When the creation frequency reaches a corresponding configured creation frequency threshold, it is determined that the target virtual machine instance belongs to a reusable resource.
4. The method according to claim 3, wherein: The obtaining the creation frequency corresponding to the target container instance includes: Obtaining an operation behavior log for the target container instance; Parsing the operation behavior log to obtain historical creation behavior data for the target container instance; The creation frequency is determined according to the historical creation behavior data.
5. The method according to claim 1, wherein: When the target virtual machine instance belongs to a reusable resource, placing the target virtual machine instance into a resource reuse pool includes: The target container instance is deleted on the target virtual machine instance, and the target virtual machine instance is added to the resource reuse pool.
6. The method according to claim 1, wherein: After placing the target virtual machine instance into a resource reuse pool, the method further includes: Monitoring the continuous storage time of the target virtual machine instance in the resource reuse pool; When the continuous storage time reaches a corresponding configured storage time threshold, the target virtual machine instance is deleted from the resource reuse pool.
7. A method for creating a container instance, comprising: When it is determined that a virtual machine instance can be reused when creating a specific container instance, a target virtual machine instance matching a specific configuration requirement is obtained from at least one virtual machine instance stored in a resource reuse pool; the at least one virtual machine instance belongs to a reusable resource; and the specific configuration requirement is used to identify a configuration requirement of the specific container instance for the virtual machine instance; The specific container instance is created on the target virtual machine instance.
8. The method according to claim 7, wherein: The reusable VM instance when creating a specific container instance is determined by the following steps: Based on the creation configuration requirement corresponding to the specific container instance, predict whether the running time of the specific container instance is lower than the running time threshold of the corresponding configuration; the creation configuration requirement is used to identify the requirement of the specific container instance for the creation configuration, and the creation configuration requirement includes the specific configuration requirement; When the running time is lower than a corresponding configured running time threshold, it is determined that the virtual machine instance can be reused when creating the specific container instance.
9. The method according to claim 8, wherein: The predicting, based on the creation configuration requirement corresponding to the specific container instance, whether the running time of the specific container instance is lower than the running time threshold of the corresponding configuration includes: Parsing the creation configuration requirement to obtain the creation configuration required for the specific container instance; Obtain a feature vector corresponding to a creation configuration required for the specific container instance; The feature vector is input into a trained container instance classification model to obtain a container instance classification result output by the container instance classification model; the container instance classification result is used to identify whether the running time is lower than the running time threshold.
10. The method according to claim 7, wherein: A corresponding container image is respectively stored in the at least one virtual machine instance, and the specific configuration requirement includes a container image requirement of the specific container instance for the container image stored in the virtual machine instance; The step of obtaining a target virtual machine instance matching a specific configuration requirement from at least one virtual machine instance stored in the resource reuse pool includes: From the at least one virtual machine instance, select a candidate virtual machine instance storing a container image matching the container image requirement; The target virtual machine instance is obtained from the candidate virtual machine instances.
11. The method according to claim 10, wherein: The acquiring the target virtual machine instance from the candidate virtual machine instances comprises: Read the specific configuration requirement to obtain the computing resource requirement of the specific container instance for the virtual machine instance; Among the candidate virtual machine instances, a virtual machine instance that meets the computing resource requirement is obtained as the target virtual machine instance.
12. A system for creating a container instance, comprising: Resource storage nodes and resource reuse nodes; The resource storage node is used to execute the method according to any one of claims 1 to 6; The resource reuse node is used to execute the method described in any one of claims 7-11.
13. 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 11 when executing the computer program.
14. 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 11 is implemented.