Container migration methods, apparatus, storage media, program products, and computer equipment

By acquiring N types of resources from multiple centers to predict the remaining resource quantity and selecting the preferred resources of the target container, the problem of frequent container migration is solved, thereby improving resource utilization and reducing migration costs.

CN122309033APending Publication Date: 2026-06-30CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
Filing Date
2026-04-16
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, frequent container migrations lead to problems such as low resource utilization, network spikes and GPU idleness, central node bottlenecks, prediction gaps, and high migration costs.

Method used

By acquiring N types of resources from multiple centers to predict the remaining resource quantity, generating an ordered sequence, selecting the preferred resources of the target container, and selecting the center to be migrated based on the preferred resources, a distributed triggering and parallel decision-making mechanism is adopted to reduce the synchronous oscillation of centralized scheduling and the bottleneck of the central node.

Benefits of technology

It improves resource utilization, reduces the probability of containers migrating out again, reduces latency or failure of migration tasks due to resource mismatch, and saves global bandwidth and migration energy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122309033A_ABST
    Figure CN122309033A_ABST
Patent Text Reader

Abstract

This application discloses a container migration method, apparatus, storage medium, program product, and computer device. The method includes: obtaining the predicted remaining resource amount of N types of resources in each of multiple centers based on current time information and migration time information of the target container, where N is a positive integer; for each type of resource in the N types of resources, generating an ordered sequence corresponding to that type of resource based on the predicted remaining resource amount of that type of resource in each of the multiple centers, the ordered sequence including the order in which the multiple centers are arranged according to the predicted remaining resource amount of that type of resource; selecting the preferred resources of the target container from the N types of resources based on the resource occupancy data of the target container related to the N types of resources; selecting a migration center from the multiple centers based on the preferred ordered sequence corresponding to the preferred resources in each ordered sequence, and migrating the target container to the migration center. In this way, the probability of frequent container migration can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing technology, and in particular to a container migration method, apparatus, storage medium, program product, and computer equipment. Background Technology

[0002] In cloud computing, a container is a lightweight, portable, self-contained software packaging and runtime technology that can be used to package applications and their dependencies (such as code, runtime, system tools, libraries, configuration files, etc.) together, enabling containers to run in any environment that supports container operation.

[0003] In heavy-load business scenarios such as large model training, scientific computing, and online inference, large-scale computing center clusters are usually deployed to provide relevant container load resources for the business.

[0004] In related technologies, in order to improve resource utilization, containers can be directly transferred from a central node with high pressure at the current moment to a central node with low load at the current moment through container hot migration and container cold migration. However, such technologies may lead to the problem of frequent container migration. Summary of the Invention

[0005] To address the aforementioned technical problems, embodiments of this application propose a container migration method, apparatus, storage medium, program product, and computer equipment, which can at least solve the problem of frequent container migration.

[0006] In a first aspect, embodiments of this application provide a container migration method, including: Based on the current time information and the migration time information of the target container, obtain the predicted remaining resource amount of N types of resources for each of the multiple centers, where N is a positive integer; For each of the N types of resources, based on the predicted remaining resource amount of each of the plurality of centers for that type of resource, an ordered sequence corresponding to that type of resource is generated, wherein the ordered sequence includes the order in which the plurality of centers are arranged according to the predicted remaining resource amount of that type of resource; Based on the resource occupancy data of the target container related to the N types of resources, select the preferred resources of the target container from the N types of resources; Based on the ordered sequence of preferences corresponding to the preferred resources in each ordered sequence, a center to be migrated is selected from the plurality of centers, and the target container is migrated to the center to be migrated.

[0007] Optionally, the N types of resources include two types of resources; The step of selecting preferred resources for the target container from the N types of resources based on the resource occupancy data related to the target container and the N types of resources includes: Based on the resource occupancy data of the target container related to the two types of resources, the ratio is calculated to obtain the resource occupancy ratio of the target container; Based on the resource occupancy data of each container related to the two types of resources, the average resource occupancy ratio of each container is determined, wherein each container is all containers contained in the target center where the target container is located; Based on the comparison between the resource occupancy ratio and the average resource occupancy ratio of the container, the preferred resource of the target container is selected from the two types of resources.

[0008] Optionally, the ordered sequence corresponding to each type of resource includes the multiple centers arranged in descending order of the predicted remaining resource quantity of that type of resource, and the multiple centers include the target center; The step of selecting a migration center from the plurality of centers based on the ordered sequence corresponding to the preferred resource in each ordered sequence, and migrating the target container to the migration center, includes: The first intermediate variable is determined based on the ratio between the resource occupancy ratio and the average resource occupancy ratio of the container; Get random numbers; For each center that is ranked before the target center in the ordered preference sequence, based on the respective index of the center and the target center in the ordered preference sequence, the first intermediate variable and the random number, it is determined whether the center is the center to be migrated. If so, the target container is migrated to the center to be migrated.

[0009] Optionally, determining whether a center is the center to be migrated based on the respective indices of the center and the target center in the ordered sequence of preferences, the first intermediate variable, and the random number includes: Add a preset value to the first intermediate variable to obtain the second intermediate variable, and calculate the ratio between the first intermediate variable and the second intermediate variable to obtain the variable ratio. Subtract the index of the target center from the index of the preferred ordered sequence to obtain the index difference. Calculate the ratio between the index difference and the index of the target center in the preferred ordered sequence to obtain the index ratio. Calculate the product between the variable ratio and the ordinal ratio, and based on the comparison between the product and the random number, determine whether the center is the center to be migrated.

[0010] Optionally, obtaining the predicted remaining resource quantity of N types of resources for each of the multiple centers based on the current time information and the migration time information of the target container includes: Based on the current time information and the migration time information, the predicted time point is determined; Using the remaining resource prediction curves of each center under the N types of resources, the predicted remaining resource amount of each center under the N types of resources is determined according to the prediction time point, wherein the remaining resource prediction curves are obtained by using a neural network model.

[0011] Optionally, the current time information includes the current moment, the migration time information includes the migration time step, and the method further includes: Obtain the resource surplus data related to the N types of resources for each center; For each type of resource, based on the resource surplus data of each of the multiple centers, the average center resource surplus under that type of resource is determined, and based on the average center resource surplus and the resource surplus data related to that type of resource in the target center where the target container is located, the migration estimation time information under that type of resource is determined. Based on the migration estimation time information of each of the N types of resources, the migration time step is determined; Obtain the migration history trigger time of the target center; Add the migration time step to the migration history trigger time to obtain the migration time point; If the migration time point is earlier than the current time, the steps are as follows: based on the current time information and the migration time information of the target container, the predicted remaining resource amount of N types of resources in each of the multiple centers is obtained, and then the subsequent steps are performed.

[0012] Secondly, embodiments of this application provide a container migration apparatus, comprising: The module for predicting remaining resource quantity is used to obtain the predicted remaining resource quantity of N types of resources for each of the multiple centers based on the current time information and the migration time information of the target container, where N is a positive integer; An ordered sequence generation module is used to generate an ordered sequence corresponding to each of the N types of resources based on the predicted remaining resource quantity of each of the plurality of centers for that type of resource. The ordered sequence includes the order in which the plurality of centers are arranged according to the predicted remaining resource quantity of that type of resource. The preferred resource selection module is used to select the preferred resources of the target container from the N types of resources based on the resource occupancy data of the target container related to the N types of resources; The migration processing module is used to select a center to be migrated from the plurality of centers based on the ordered sequence corresponding to the preferred resource in each ordered sequence, and migrate the target container to the center to be migrated.

[0013] Thirdly, embodiments of this application provide a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in any of the above-mentioned embodiments.

[0014] Fourthly, embodiments of this application provide a computer program product, including computer instructions that, when executed by a processor, implement the steps of the method described in any of the above-described embodiments.

[0015] Fifthly, embodiments of this application provide a computer device including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the steps of the method described in any of the preceding claims.

[0016] In summary, the embodiments of this application have at least the following beneficial effects: Using the embodiments of this application, based on the current time information and the migration time information of the target container, the predicted remaining resource amount of N types of resources in each of the multiple centers is obtained, where N is a positive integer; for each type of resource in the N types of resources, based on the predicted remaining resource amount of that type of resource in each of the multiple centers, an ordered sequence corresponding to that type of resource is generated, wherein the ordered sequence includes the order in which the multiple centers are arranged according to the predicted remaining resource amount of that type of resource; based on the resource occupancy data of the target container related to the N types of resources, the preferred resources of the target container are selected from the N types of resources; based on each of the N types of resources... The ordered sequence corresponding to the preferred resources in the ordered sequence is used to select a center to be migrated from the multiple centers, and the target container is migrated to the center to be migrated. In this way, the remaining resource prediction mechanism can detect the resource change trend of each center in advance, so as to reduce the probability of needing to migrate the container from the center again in the future. In addition, each center is sorted under each resource type according to the predicted remaining resource amount, combined with the preferred resources of the target container, to improve the fit between the selected center to be migrated and the target container, and reduce the probability of needing to migrate the container from the center again due to mismatch. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the container migration method provided in an embodiment of this application; Figure 2 This is a schematic diagram of container migration provided in an embodiment of this application; Figure 3 This is a schematic diagram of the container migration device provided in the embodiments of this application; Figure 4 This is a schematic diagram of the computer device provided in the embodiments of this application. Detailed Implementation

[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments / examples are only a part of the embodiments / examples of this application, and not all of the embodiments / examples. Based on the embodiments / examples in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0019] In the description of this application, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first," "second," "third," etc., may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "multiple" means two or more. In the description of this application, the term "comprising" and its variations are open-ended, meaning "including but not limited to." The term "based on" means "at least partially based on." The term "according to" means "at least partially according to." The term "one embodiment / example" means "at least one embodiment / example"; the term "another embodiment / example" means "at least one additional embodiment / example"; the term "some embodiments / examples" means "at least some embodiments / examples."

[0020] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0021] In the description of this application, it should be noted that, unless otherwise defined, all technical and scientific terms used in this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this application is for the purpose of describing specific embodiments only and is not intended to limit the application. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0022] In some cases, container migration serves as a core means to ensure global resource utilization, reduce task queuing time, and achieve green energy saving. It can be integrated into platforms such as Kubernetes, OpenStack, and Volcano, forming a closed-loop operation and maintenance paradigm of "dynamic scheduling - elastic scaling - automatic migration." Especially in heavy-load business scenarios such as large model training, scientific computing, and online inference, due to issues such as GPU (Graphics Processing Unit) scarcity, rigid energy consumption indicators, and significant business tidal effects, container hot migration and container cold migration can be used to directly transfer containers (loads) from the central node with high pressure at the current moment to the central node with low load at the current moment, shortening the business completion time.

[0023] However, the migration framework of related technologies generally relies on a tightly coupled architecture of "centralized scheduler + global lock + periodic global state synchronization". As the number of centers and the scale of a single center node (the scale of resources that a single center can provide) expand exponentially, it is prone to causing at least one of the following three problems.

[0024] One issue is the state synchronization delay and synchronization oscillation. Since the global resource view of the centralized scheduler (real-time resource-related data of all centers) needs to converge in seconds, and cross-regional transmission delay can easily lead to decision lag, it is very easy to trigger the oscillation of "collective migration out → collective migration in", thereby causing network pulses and GPU idleness.

[0025] Secondly, there is the bottleneck of the central node. The centralized scheduler needs to maintain the real-time status of a large number of containers and nodes, while the CPU and memory overhead increases dramatically with the scale, and the risk of single point of failure is high, making it difficult to meet the expansion requirements.

[0026] Thirdly, there are issues with forecasting and migration costs. Most solutions in related technologies are usually based on the instantaneous resource reserves (the current load status of the center) and are triggered in a "greedy" manner. They lack forecasting of future load curves, which makes it easy for the center to become unbalanced again shortly after migration, forcing the center to migrate containers again. In addition, the migration of image layers and checkpoint files across centers often reaches several GB to tens of GB. Frequent migrations caused by inefficient decisions mean expensive WAN bandwidth usage and business downtime.

[0027] In view of the above, embodiments of this application provide a container migration method, apparatus, storage medium, program product, and computer device, which aim to at least partially solve the problems existing in the above-mentioned related technologies.

[0028] Firstly, see [the following] Figure 1The diagram shows a flowchart of a container migration method provided in an embodiment of this application. The container migration method can be applied to a computer device with data processing capabilities (for example, the method can be applied to the target center where the target container is located). The method includes S101-S104, as follows.

[0029] S101, based on the current time information and the migration time information of the target container, obtain the predicted remaining resource amount of N types of resources for each of the multiple centers, where N is a positive integer.

[0030] In some examples, the current time information may include the current moment, and the migration time information may include at least one of the migration time step (the duration required for migration) and the migration completion deadline. Thus, when the migration time information includes the migration completion deadline, the predicted remaining resource quantity for each type of resource in each center may include: the predicted remaining resource quantity for that type of resource in the center at the migration completion deadline and / or the moment before the migration completion deadline. When the migration time information includes the migration time step, a predicted time point can be obtained based on the current moment and the migration time step. The predicted remaining resource quantity for each type of resource in each center may include: the predicted remaining resource quantity for that type of resource in the center at that predicted time point. For example, the current moment can be added to the migration time step to obtain the predicted time point (in which case the predicted time point can be the predicted migration completion time point).

[0031] In some examples, multiple centers can be represented by a center list. To indicate, The number of centers in a multi-center system can be expressed as: , It can represent the first One center.

[0032] In some examples, the N types of resources may include at least one of computing resources and memory resources, where computing resources may include GPU resources. The remaining computing resources (GPU resources) on the GPU can be expressed as: , The remaining memory resources on the device can be expressed as: .

[0033] In some examples, the container migration method can be applied to the target center where the target container is located. The target container can refer to any one or more containers that need to be migrated. Thus, in this embodiment, there is no need for coordination by the scheduling center node, which can achieve non-blocking and linearly scalable characteristics. In addition, the distributed triggering and parallel decision-making mechanism executed by the center can replace the global lock and centralized scheduling to ensure that each center can initiate migration independently and asynchronously, thereby reducing the oscillation phenomenon caused by collective migration.

[0034] S102, for each of the N types of resources, based on the predicted remaining resource amount of each of the plurality of centers for that type of resource, an ordered sequence corresponding to that type of resource is generated, wherein the ordered sequence includes the order in which the plurality of centers are arranged according to the predicted remaining resource amount of that type of resource.

[0035] In some examples, for each type of resource, multiple centers can be arranged in descending or ascending order of the predicted remaining resource quantity for that type of resource to generate an ordered sequence corresponding to that type of resource.

[0036] S103, based on the resource occupancy data of the target container related to the N types of resources, select the preferred resources of the target container from the N types of resources.

[0037] In some examples, resource usage data may include resource usage percentages. Since resource usage percentages can indicate the degree to which a target container quantifies its resource usage, a higher resource usage percentage indicates a higher demand for the corresponding resource from the target container, meaning a higher preference for that resource. Therefore, the target container's preferred resources may include at least one of the following: at least one type of resource with the highest resource usage percentage, or resources with a resource usage percentage higher than a preset resource usage percentage threshold. Thus, in this embodiment, the target container's preferred resources can be selected solely based on resource usage data.

[0038] S104, based on the ordered sequence of preferences corresponding to the preferred resource in each ordered sequence, select a center to be migrated from the plurality of centers, and migrate the target container to the center to be migrated.

[0039] In some examples, since the ordered sequence corresponding to each type of resource contains multiple centers arranged according to the predicted remaining resource amount of that type of resource (e.g., arranged in descending or ascending order of the predicted remaining resource amount, taking the descending order as an example), after determining the preferred ordered sequence, the center ranked first in the sequence can be selected as the migration center, or the migration center can be randomly selected from the centers ranked before the target center where the target container is located in the sequence. This embodiment is not unique in this respect. Therefore, in this embodiment, the migration center can be selected from multiple centers solely based on the preferred ordered sequence.

[0040] In one optional implementation, the current time information includes the current moment, the migration time information includes the migration time step, and the method further includes: Obtain the resource surplus data related to the N types of resources for each center; For each type of resource, based on the resource surplus data of each of the multiple centers, the average center resource surplus under that type of resource is determined, and based on the average center resource surplus and the resource surplus data related to that type of resource in the target center where the target container is located, the migration estimation time information under that type of resource is determined. Based on the migration estimation time information of each of the N types of resources, the migration time step is determined; Obtain the migration history trigger time of the target center; Add the migration time step to the migration history trigger time to obtain the migration time point; If the migration time point is earlier than the current time, the steps are as follows: based on the current time information and the migration time information of the target container, the predicted remaining resource amount of N types of resources in each of the multiple centers is obtained, and then the subsequent steps are performed.

[0041] In some examples, taking N types of resources, including computing resources and memory resources, as an example, the first... individual centers The remaining computing resources (GPU resources) on the GPU can be expressed as: (Included in the resource balance data of computing resources). The remaining memory resources on the device can be expressed as: (Included in the resource availability data of memory resources). This indicates the number of centers across multiple centers. Resource reserve can be used to indicate the amount of resources available for containers to occupy on a center.

[0042] For computing resources, the formula can be used. The average central resource surplus under the computing resources is calculated. Furthermore, with This indicates the target center where the target container is located, and can be determined based on the resource availability data related to computing resources in the target center. Through formula The estimated migration time information under computing resources is calculated.

[0043] For memory resources, the formula can be used. Calculate the average remaining central resource under memory resource conditions. Furthermore, with This indicates the target center where the target container is located, and can be determined based on the resource availability data related to memory resources in the target center. Through formula The estimated migration time under memory resources is calculated.

[0044] In some examples, the migration estimation time information for each of the N types of resources can be compared to select the migration estimation time information with the shortest duration. The selected migration estimation time information is then time-mapped to obtain the migration time step. Taking N types of resources, including computing resources and memory resources, as an example, this embodiment can be represented by the following formula:

[0045] in This indicates the migration time step, and the unit can be seconds. This refers to the process of selecting the migration estimation time information with the shortest corresponding duration. It should be understood that multiplying the selected migration estimation time information by 300 is the process used to implement this duration mapping.

[0046] In some examples, see Figure 2 This diagram illustrates container migration provided in an embodiment of this application, and shows how to obtain the current moment (or current time information). ,by The target center where the target container is located, and its migration history trigger time can be represented as: , The initialization can be 0. The migration history trigger time will be used. Add migration time step The migration time point can be obtained. ,if If the migration time point is earlier than the current time, then the execution of the migration time information based on the current time information and the target container's migration time information can be triggered to obtain the predicted remaining resource amount of N types of resources in each of the multiple centers and subsequent steps. Furthermore, it can... Updated to (Right now ), which is also the current moment. As The new migration history is triggered at the specified time; otherwise, the process can continue by returning to the steps described above for obtaining the resource surplus data related to the N types of resources for each center, until... .

[0047] In this embodiment, the migration time step can be adaptively determined based on the resource availability data of each center. Through this adaptive step mechanism, the migration triggering cycle can dynamically scale with resource scarcity—more frequent when resources are scarce and quieter when resources are abundant. This improves resource utilization and reduces secondary migrations, saving global bandwidth and migration energy. Furthermore, by introducing migration estimation time information based on resource availability data, a distributed dynamic asynchronous migration triggering mechanism can be implemented, reducing the oscillation problems caused by synchronous migration.

[0048] In one optional implementation, the N types of resources include two types of resources; The step of selecting preferred resources for the target container from the N types of resources based on the resource occupancy data related to the target container and the N types of resources includes: Based on the resource occupancy data of the target container related to the two types of resources, the ratio is calculated to obtain the resource occupancy ratio of the target container; Based on the resource occupancy data of each container related to the two types of resources, the average resource occupancy ratio of each container is determined, wherein each container is all containers contained in the target center where the target container is located; Based on the comparison between the resource occupancy ratio and the average resource occupancy ratio of the container, the preferred resource of the target container is selected from the two types of resources.

[0049] In some examples, two types of resources are used: computing resources and memory resources. Indicates the target center where the target container is located. All included containers can be accessed through a container list. express, Represents the first in each container A container, The resource usage data of computing resources (GPU resources) is represented as follows: The resource usage data of memory resources is represented as follows: ,in, resource utilization ratio It can be done through formula The average resource utilization of a container can be expressed by the following formula:

[0050] in, express The average resource utilization ratio of containers, since the numerator of this formula is related to computing resources and the denominator is related to memory resources, therefore... The larger the value, the more it can represent The overall bias is towards computing resources, and the smaller the value, the better it represents. Overall, it is biased towards memory resources.

[0051] Following the previous example, with Taking the target container as an example, if the resource usage of the target container is higher than... Greater than the target center where the target container is located Average resource utilization of containers ,Right now If so, you can choose computing resources (GPU resources) as the preferred resource for the target container; otherwise, you can choose memory resources as the preferred resource for the target container. See [link to relevant documentation]. Figure 2 If the target container's preferred resource is memory, then the target container can be called a memory-preferred container, and thus a center with more memory (resource margin) can be selected first (such as an intelligent computing center); if the target container's preferred resource is GPU, then the target container can be called a GPU-preferred container, and thus a center with more GPU (resource margin) can be selected first (such as an intelligent computing center).

[0052] It is understood that the above-mentioned size relationship (size comparison result) is set based on the ratio of the above-mentioned resource occupancy ratio and the average resource occupancy ratio of the container. Those skilled in the art can change the above-mentioned size relationship by changing the ratio relationship (for example, taking the reciprocal of the occupancy ratio respectively). Therefore, the above-mentioned resource occupancy ratio, the average resource occupancy ratio of the container and the above-mentioned size relationship are not uniquely limited in the embodiments of this application.

[0053] In this embodiment, the preferred resources of the target container can be accurately selected from two types of resources. The preferred resources can be selected by comparing the resource utilization ratio with the average resource utilization ratio of the container to determine the GPU / memory preference branch of the target container. This allows GPU / memory intensive loads to be migrated in a directional manner along the matching dimension. For example, it can avoid migrating a container with high GPU demand to a node that is already memory intensive and GPU strained. This can effectively improve resource utilization and reduce the delay or failure of migration tasks caused by resource mismatch.

[0054] In some examples, in step S102 above, for each type of resource, multiple centers can be arranged in descending or ascending order of the predicted remaining resource quantity for that type of resource to generate an ordered sequence corresponding to that type of resource. Here, taking an order from largest to smallest, and assuming N types of resources include computing resources and memory resources, as an example, the ordered sequence corresponding to computing resources could be: , ,in, It can represent the first individual centers In sequence The serial number in, i.e. exist Corresponding subscript The ordered sequence corresponding to memory resources can be: , ,in, It can represent the first individual centers In sequence The serial number in, i.e. exist Corresponding subscript .

[0055] In one optional implementation, the ordered sequence corresponding to each type of resource includes the plurality of centers arranged in descending order of the predicted remaining resource quantity of that type of resource, and the plurality of centers includes the target center; The step of selecting a migration center from the plurality of centers based on the ordered sequence corresponding to the preferred resource in each ordered sequence, and migrating the target container to the migration center, includes: The first intermediate variable is determined based on the ratio between the resource occupancy ratio and the average resource occupancy ratio of the container; Get random numbers; For each center that is ranked before the target center in the ordered preference sequence, based on the respective index of the center and the target center in the ordered preference sequence, the first intermediate variable and the random number, it is determined whether the center is the center to be migrated. If so, the target container is migrated to the center to be migrated.

[0056] In this embodiment, the migration center can be determined based on the sequence number, the first intermediate variable, and the random number, thereby turning the traversal process into a lightweight perturbation. The random number is introduced to break the deterministic selection, so that it has a certain degree of randomness to break the synchronization consistency. This can effectively suppress the collective migration oscillation and achieve the removal of the scheduling center while suppressing the collective migration oscillation.

[0057] In some examples, if every center in the ordered preference sequence preceding the target center is determined not to be the center to be migrated, then: Determine the unpreferenced ordered sequence corresponding to the other resource among the two types of resources besides the preferred resource; For any center in the unbiased ordered sequence that is ordered before the target center, based on the index of the target center in the preferred ordered sequence, the first intermediate variable, and the random number, it is determined whether the center is the center to be migrated. If so, the target container is migrated to the center to be migrated.

[0058] In some examples, after determining the preference sequence of the target container, the preference order sequence corresponding to the preference resource can be determined from each ordered sequence.

[0059] In some examples, with Indicates the target container, Taking the target center where the target container is located as an example, we can define the first intermediate variable. For: resource utilization ratio and The corresponding average resource utilization of containers The ratio between them, that is, .

[0060] In some examples, obtaining a random number may include obtaining a random number from a preset value range. This preset value range can be determined according to the requirements. For example, it can be determined based on a preset value that is subsequently added to the first intermediate variable, so that the preset value range can be adapted to the preset value. This application embodiment is not the only one.

[0061] In one optional implementation, determining whether a center is the center to be migrated, based on the respective indices of the center and the target center in the ordered sequence of preferences, the first intermediate variable, and the random number, includes: Add a preset value to the first intermediate variable to obtain the second intermediate variable, and calculate the ratio between the first intermediate variable and the second intermediate variable to obtain the variable ratio. Subtract the index of the target center from the index of the preferred ordered sequence to obtain the index difference. Calculate the ratio between the index difference and the index of the target center in the preferred ordered sequence to obtain the index ratio. Calculate the product between the variable ratio and the ordinal ratio, and based on the comparison between the product and the random number, determine whether the center is the center to be migrated.

[0062] In some examples, it is assumed Represents the target container, using random numbers. For example, the preset numerical range is taken as follows: The default value can be 1, assuming Let represent the index of any center in the ordered preference sequence that is ranked before the target center. Taking computing resources and memory resources as examples, for computing resources as preference resources, the mathematical expression for determining whether a center is a center to be migrated can be:

[0063] That is, in the ratio of the variables Ratio to the serial number The product of the two is greater than the random number. In this case, the center can be determined as the center to be migrated and migration from the preferred ordered sequence (which is the ordered sequence corresponding to the computing resources at this time) can be stopped. Continue iterating through the target container. Relocating to this center (i.e., the current one) The center (represented by the product) is less than or equal to the random number. In this case, you can continue traversing another sequence within the preferred ordered sequence. The corresponding center is then reassessed to determine whether it is a center to be migrated. If in Each of the conditions is satisfied of If none of them are the migration centers, then we can continue traversing the ordered sequence corresponding to the memory resources. ,at this time As an unbiased ordered sequence corresponding to the target container, and for each satisfying the condition of ( This corresponds to any center in the unbiased ordered sequence that is ranked before the target center; however, it should be emphasized that this is only to characterize such a center, and the actual calculation still uses... In (to characterize the corresponding center), and the following expression can be used to determine whether a center is a center to be migrated:

[0064] Similarly, for memory resources as preferred resources, the mathematical expression for determining whether a center is a migration center can be:

[0065] That is, in the ratio of the variables Ratio to the serial number The product of the two is greater than the random number. In this case, the center can be determined as the center to be migrated and migration from the preferred ordered sequence (which is the ordered sequence corresponding to the memory resources at this time) can be stopped. Continue iterating through the target container. Relocating to this center (i.e., the current one) The center (represented by the product) is less than or equal to the random number. In this case, you can continue traversing another sequence within the preferred ordered sequence. The corresponding center is then reassessed to determine whether it is a center to be migrated. If in Each of the conditions is satisfied of If none of them are centers to be migrated, then we can continue traversing the ordered sequence corresponding to the computing resources. ,at this time As an unbiased ordered sequence corresponding to the target container, and for each satisfying the condition of ( This corresponds to any center in the unbiased ordered sequence that is ranked before the target center; however, it should be emphasized that this is only to characterize such a center, and the actual calculation still uses... In (to characterize the corresponding center), and the following expression can be used to determine whether a center is a center to be migrated:

[0066] That is, for any center in the unfavorable ordered sequence that is ranked before the target center, determining whether the center is the center to be migrated, based on the target center's index in the favored ordered sequence, the first intermediate variable, and the random number, may include: adding a preset value to the first intermediate variable to obtain a second intermediate variable, and calculating the ratio between the first intermediate variable and the second intermediate variable to obtain a variable ratio; calculating the ratio of this variable ratio to the index of the target center in the favored ordered sequence (i.e., Based on the comparison between this ratio and a random number, it is determined whether the center is the center to be migrated. The random number used for comparison with this ratio can be adjusted as needed. or Different, or at least partially Or at least part of They can correspond to the same random number, but this application is not unique in its embodiments.

[0067] Understandably, for an unbiased ordered sequence, after identifying any center whose order precedes the target center, it is not necessarily necessary to substitute the relevant parameters of that center into the formula for "determining whether the center is the target center" for calculation. For example, the above formula only needs to be related to the target center. , To participate, we only need to consider the relevant situation of the target center in the preferred ordered sequence. At this time, the traversal process for the unpreferred ordered sequence can be approximately regarded as a process for re-acquiring / updating random numbers.

[0068] In this embodiment, an implicit perturbation mechanism based on ordered table traversal can be implemented by calculating the product of the variable ratio and the sequence number ratio and comparing it with a random number. Furthermore, the rationality of the migration direction can be improved by calculating the ratio of the sequence number difference to the target center sequence number. In addition, combining random number judgment can introduce a light perturbation to further suppress the oscillations caused by synchronous migration.

[0069] In one optional implementation, obtaining the predicted remaining resource quantity of N types of resources for each of the multiple centers based on the current time information and the migration time information of the target container includes: Based on the current time information and the migration time information, the predicted time point is determined; Using the remaining resource prediction curves of each center under the N types of resources, the predicted remaining resource amount of each center under the N types of resources is determined according to the prediction time point, wherein the remaining resource prediction curves are obtained by using a neural network model.

[0070] In some examples, the current time information may include the current moment, and the migration time information may include the migration time step (the duration required for migration). Thus, the current moment can be added to the migration time step to obtain the predicted migration completion time, and the predicted time point can be determined based on the predicted migration completion time. For example, the predicted time point may include at least one of the following: the predicted migration completion time, or a time point later than the target duration of the predicted migration completion time.

[0071] In some examples, the remaining resource prediction curve for each center under each resource category can be used to indicate the mapping relationship between the predicted remaining resource quantity for that resource category at that center and time. Therefore, the predicted remaining resource quantity for each resource category at each center can be obtained by substituting the prediction time points into the remaining resource prediction curve for each center under each resource category.

[0072] Taking N types of resources, including computing resources and memory resources, as an example, It can represent the first individual centers The remaining resource prediction curve under computational resources can be obtained through... To indicate the first individual centers The predicted remaining resource quantity of computing resources; It can represent the first individual centers The remaining resource prediction curve under memory resources can be obtained through To indicate the first individual centers The predicted remaining amount of memory resources.

[0073] In some examples, the neural network model may include an LSTM (Long Short-Term Memory) model, such as a lightweight LSTM model. This neural network model can be deployed at the target center where the target container is located. Thus, in this embodiment, each center can implement localized LSTM prediction, enabling independent decision-making by each center. This reduces problems such as synchronization oscillations, central node bottlenecks, and instantaneous decision failures caused by centralized scheduling, thereby reducing synchronization latency, scheduling overhead, and the risk of single points of failure.

[0074] Secondly, correspondingly, this application also provides a container migration apparatus capable of implementing all the processes of the container migration method provided in the above embodiments.

[0075] See Figure 3 The diagram shows a schematic of the structure of a container migration device 300 provided in an embodiment of this application. The container migration device 300 includes: The predicted remaining resource quantity acquisition module 301 is used to acquire the predicted remaining resource quantity of N types of resources in each of the multiple centers based on the current time information and the migration time information of the target container, where N is a positive integer; The ordered sequence generation module 302 is used to generate an ordered sequence corresponding to each type of resource in the N types of resources, based on the predicted remaining resource amount of each of the plurality of centers for that type of resource. The ordered sequence includes the order in which the plurality of centers are arranged according to the predicted remaining resource amount of that type of resource. The preferred resource selection module 303 is used to select the preferred resources of the target container from the N types of resources based on the resource occupancy data of the target container related to the N types of resources; The migration processing module 304 is used to select a center to be migrated from the plurality of centers based on the ordered sequence corresponding to the preferred resource in each ordered sequence, and migrate the target container to the center to be migrated.

[0076] In one optional implementation, the N types of resources include two types of resources; The step of selecting preferred resources for the target container from the N types of resources based on the resource occupancy data related to the target container and the N types of resources includes: Based on the resource occupancy data of the target container related to the two types of resources, the ratio is calculated to obtain the resource occupancy ratio of the target container; Based on the resource occupancy data of each container related to the two types of resources, the average resource occupancy ratio of each container is determined, wherein each container is all containers contained in the target center where the target container is located; Based on the comparison between the resource occupancy ratio and the average resource occupancy ratio of the container, the preferred resource of the target container is selected from the two types of resources.

[0077] In one optional implementation, the ordered sequence corresponding to each type of resource includes the plurality of centers arranged in descending order of the predicted remaining resource quantity of that type of resource, and the plurality of centers includes the target center; The step of selecting a migration center from the plurality of centers based on the ordered sequence corresponding to the preferred resource in each ordered sequence, and migrating the target container to the migration center, includes: The first intermediate variable is determined based on the ratio between the resource occupancy ratio and the average resource occupancy ratio of the container; Get random numbers; For each center that is ranked before the target center in the ordered preference sequence, based on the respective index of the center and the target center in the ordered preference sequence, the first intermediate variable and the random number, it is determined whether the center is the center to be migrated. If so, the target container is migrated to the center to be migrated.

[0078] In one optional implementation, determining whether a center is the center to be migrated, based on the respective indices of the center and the target center in the ordered sequence of preferences, the first intermediate variable, and the random number, includes: Add a preset value to the first intermediate variable to obtain the second intermediate variable, and calculate the ratio between the first intermediate variable and the second intermediate variable to obtain the variable ratio. Subtract the index of the target center from the index of the preferred ordered sequence to obtain the index difference. Calculate the ratio between the index difference and the index of the target center in the preferred ordered sequence to obtain the index ratio. Calculate the product between the variable ratio and the ordinal ratio, and based on the comparison between the product and the random number, determine whether the center is the center to be migrated.

[0079] In one optional implementation, obtaining the predicted remaining resource quantity of N types of resources for each of the multiple centers based on the current time information and the migration time information of the target container includes: Based on the current time information and the migration time information, the predicted time point is determined; Using the remaining resource prediction curves of each center under the N types of resources, the predicted remaining resource amount of each center under the N types of resources is determined according to the prediction time point, wherein the remaining resource prediction curves are obtained by using a neural network model.

[0080] In one optional implementation, the current time information includes the current moment, the migration time information includes the migration time step, and the device further includes a migration time step determination module and a migration trigger judgment module. The migration time step determination module is used for: Obtain the resource surplus data related to the N types of resources for each center; For each type of resource, based on the resource surplus data of each of the multiple centers, the average center resource surplus under that type of resource is determined, and based on the average center resource surplus and the resource surplus data related to that type of resource in the target center where the target container is located, the migration estimation time information under that type of resource is determined. Based on the migration estimation time information of each of the N types of resources, the migration time step is determined; The migration trigger judgment module is used for: Obtain the migration history trigger time of the target center; Add the migration time step to the migration history trigger time to obtain the migration time point; If the migration time point is earlier than the current time, the steps are as follows: based on the current time information and the migration time information of the target container, the predicted remaining resource amount of N types of resources in each of the multiple centers is obtained, and then the subsequent steps are performed.

[0081] Thirdly, embodiments of this application provide a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in any of the above-mentioned embodiments.

[0082] Fourthly, embodiments of this application provide a computer program product, including computer instructions that, when executed by a processor, implement the steps of the method described in any of the above-described embodiments.

[0083] Fifthly, embodiments of this application provide a computer device including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the steps of the method described in any of the preceding claims.

[0084] See Figure 4 The computer device in this embodiment includes a processor 401, a memory 402, and a computer program, such as a container migration program, stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program, it implements the steps in the various container migration method embodiments described above, for example... Figure 1 The steps S101-S104 are shown.

[0085] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 402 and executed by the processor 401 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the computer device.

[0086] The computer device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will understand that the schematic diagram is merely an example of a computer device and does not constitute a limitation on the computer device. It may include more or fewer components than shown, or combine certain components, or different components. For example, the computer device may also include input / output devices, network access devices, buses, etc.

[0087] The processor 401 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor, or the processor 401 can be any conventional processor. The processor 401 is the control center of the computer device, connecting various parts of the entire computer device through various interfaces and lines.

[0088] The memory 402 can be used to store the computer programs and / or modules. The processor 401 implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory 402 and calling the data stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0089] Wherein, if the modules / units integrated into the computer device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a non-transitory computer-readable storage medium. When the computer program is executed by the processor 401, it can implement the steps of the various method embodiments described above. Wherein, the computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.

[0090] In summary, the embodiments of this application have at least the following beneficial effects: Using the embodiments of this application, based on the current time information and the migration time information of the target container, the predicted remaining resource amount of N types of resources in each of the multiple centers is obtained, where N is a positive integer; for each type of resource in the N types of resources, based on the predicted remaining resource amount of that type of resource in each of the multiple centers, an ordered sequence corresponding to that type of resource is generated, wherein the ordered sequence includes the order in which the multiple centers are arranged according to the predicted remaining resource amount of that type of resource; based on the resource occupancy data of the target container related to the N types of resources, the preferred resources of the target container are selected from the N types of resources; based on each of the N types of resources... The ordered sequence corresponding to the preferred resources in the ordered sequence is used to select a center to be migrated from the multiple centers, and the target container is migrated to the center to be migrated. In this way, the remaining resource prediction mechanism can detect the resource change trend of each center in advance, so as to reduce the probability of needing to migrate the container from the center again in the future. In addition, each center is sorted under each resource type according to the predicted remaining resource amount, combined with the preferred resources of the target container, to improve the fit between the selected center to be migrated and the target container, and reduce the probability of needing to migrate the container from the center again due to mismatch.

[0091] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary hardware platforms, or it can be implemented entirely by hardware. Based on this understanding, all or part of the technical solutions of this application that contribute to the background technology can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM (Read-Only Memory) / RAM (Random Access Memory), magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.

[0092] The above description is the preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications are also considered to be within the scope of protection of this application.

Claims

1. A container migration method, characterized in that, include: Based on the current time information and the migration time information of the target container, obtain the predicted remaining resource amount of N types of resources for each of the multiple centers, where N is a positive integer; For each of the N types of resources, based on the predicted remaining resource amount of each of the plurality of centers for that type of resource, an ordered sequence corresponding to that type of resource is generated, wherein the ordered sequence includes the order in which the plurality of centers are arranged according to the predicted remaining resource amount of that type of resource; Based on the resource occupancy data of the target container related to the N types of resources, select the preferred resources of the target container from the N types of resources; Based on the ordered sequence of preferences corresponding to the preferred resources in each ordered sequence, a center to be migrated is selected from the plurality of centers, and the target container is migrated to the center to be migrated.

2. The method according to claim 1, characterized in that, The N types of resources include two types of resources; The step of selecting preferred resources for the target container from the N types of resources based on the resource occupancy data related to the target container and the N types of resources includes: Based on the resource occupancy data of the target container related to the two types of resources, the ratio is calculated to obtain the resource occupancy ratio of the target container; Based on the resource occupancy data of each container related to the two types of resources, the average resource occupancy ratio of each container is determined, wherein each container is all containers contained in the target center where the target container is located; Based on the comparison between the resource occupancy ratio and the average resource occupancy ratio of the container, the preferred resource of the target container is selected from the two types of resources.

3. The method according to claim 2, characterized in that, The ordered sequence corresponding to each type of resource includes the multiple centers arranged in descending order of the predicted remaining resource quantity of that type of resource, and the multiple centers include the target center; The step of selecting a migration center from the plurality of centers based on the ordered sequence corresponding to the preferred resource in each ordered sequence, and migrating the target container to the migration center, includes: The first intermediate variable is determined based on the ratio between the resource occupancy ratio and the average resource occupancy ratio of the container; Get random numbers; For each center that is ranked before the target center in the ordered preference sequence, based on the respective index of the center and the target center in the ordered preference sequence, the first intermediate variable and the random number, it is determined whether the center is the center to be migrated. If so, the target container is migrated to the center to be migrated.

4. The method according to claim 3, characterized in that, The step of determining whether a center is the center to be migrated, based on the respective indices of the center and the target center in the ordered sequence of preferences, the first intermediate variable, and the random number, includes: Add a preset value to the first intermediate variable to obtain the second intermediate variable, and calculate the ratio between the first intermediate variable and the second intermediate variable to obtain the variable ratio. Subtract the index of the target center from the index of the preferred ordered sequence to obtain the index difference. Calculate the ratio between the index difference and the index of the target center in the preferred ordered sequence to obtain the index ratio. Calculate the product between the variable ratio and the ordinal ratio, and based on the comparison between the product and the random number, determine whether the center is the center to be migrated.

5. The method according to claim 1, characterized in that, The step of obtaining the predicted remaining resource quantity of N types of resources for each of the multiple centers based on the current time information and the migration time information of the target container includes: Based on the current time information and the migration time information, the predicted time point is determined; Using the remaining resource prediction curves of each center under the N types of resources, the predicted remaining resource amount of each center under the N types of resources is determined according to the prediction time point, wherein the remaining resource prediction curves are obtained by using a neural network model.

6. The method according to any one of claims 1-5, characterized in that, The current time information includes the current moment, the migration time information includes the migration time step, and the method further includes: Obtain the resource surplus data related to the N types of resources for each center; For each type of resource, based on the resource surplus data of each of the multiple centers, the average center resource surplus under that type of resource is determined, and based on the average center resource surplus and the resource surplus data related to that type of resource in the target center where the target container is located, the migration estimation time information under that type of resource is determined. Based on the migration estimation time information of each of the N types of resources, the migration time step is determined; Obtain the migration history trigger time of the target center; Add the migration time step to the migration history trigger time to obtain the migration time point; If the migration time point is earlier than the current time, the steps are as follows: based on the current time information and the migration time information of the target container, the predicted remaining resource amount of N types of resources in each of the multiple centers is obtained, and then the subsequent steps are performed.

7. A container migration device, characterized in that, include: The module for predicting remaining resource quantity is used to obtain the predicted remaining resource quantity of N types of resources for each of the multiple centers based on the current time information and the migration time information of the target container, where N is a positive integer; An ordered sequence generation module is used to generate an ordered sequence corresponding to each of the N types of resources based on the predicted remaining resource quantity of each of the plurality of centers for that type of resource. The ordered sequence includes the order in which the plurality of centers are arranged according to the predicted remaining resource quantity of that type of resource. The preferred resource selection module is used to select the preferred resources of the target container from the N types of resources based on the resource occupancy data of the target container related to the N types of resources; The migration processing module is used to select a center to be migrated from the plurality of centers based on the ordered sequence corresponding to the preferred resource in each ordered sequence, and migrate the target container to the center to be migrated.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1-6.

9. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the method described in any one of claims 1-6.

10. A computer device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the method of any one of claims 1-6.