Adaptive container migration method and system
Through the adaptive container migration method, combined with vehicle location prediction and traffic fluctuation calculation, the RIME algorithm with loop detection is used to optimize container migration, which solves the problems of low resource utilization and high task latency in traditional strategies and achieves more efficient resource management and task processing.
Patent Information
- Application Number
- CN202510057942.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2045-01-14
AI Technical Summary
Traditional edge computing container migration strategies suffer from low resource utilization, high task latency, and insufficient flexibility when faced with the high mobility of vehicles and complex task requirements. Especially in multi-tasking scenarios, existing solutions fail to effectively address performance bottlenecks caused by resource contention, uneven server load, and task dependencies.
An adaptive container migration method is proposed. By obtaining vehicle position predictions and traffic fluctuation calculations, a container migration optimization model is constructed. The RIME algorithm based on loop detection is used to solve the problem and generate a migration strategy to optimize the migration of containers between servers, thereby improving resource utilization and task completion rate.
It improves the system's resource utilization and task completion rate, reduces unnecessary migration frequency, enhances the adaptability and robustness of migration strategies, avoids performance bottlenecks caused by static configuration, and improves the system's flexibility and responsiveness.
Smart Images

Figure CN120034907B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet of Vehicles and edge computing technologies, and more specifically, to an adaptive container migration method and system. Background Art
[0002] Mobile Edge Computing (MEC) provides low-latency and high-efficiency computing capabilities for intelligent vehicles in connected vehicle scenarios, effectively complementing traditional cloud computing. With the rapid development of autonomous driving technology, vehicles must perform latency-sensitive and complex tasks in real time while maintaining communication with surrounding infrastructure. However, traditional edge computing container migration strategies still face significant challenges when faced with the high mobility of vehicles and the diverse demands of complex tasks. For example, how to dynamically adjust container locations while vehicles are moving to meet latency requirements and how to efficiently handle complex tasks with dependencies remain key issues that need to be addressed. Furthermore, the lack of container resource sharing and multi-tasking support limits the overall efficiency of the system.
[0003] Existing research has proposed a variety of solutions for container migration strategies. For example, Xu et al. proposed a container scheduling strategy based on model predictive control to achieve cluster load balancing, but by default, the container is bound to a single task and does not support multi-task sharing scenarios, resulting in resource waste. Kim et al. proposed a solution to optimize container migration based on user mobility, but did not consider the resource contention and uneven server load that may be caused by the simultaneous migration of multiple containers, thereby affecting the timely completion of tasks and system efficiency. In addition, Cheng et al. optimized task scheduling through a task splitting strategy, but ignored task dependencies and server computing power limitations, which may cause tasks to queue or have circular dependencies, further increasing delays and reducing system reliability. Summary of the Invention
[0004] To overcome the shortcomings of existing container migration technologies, such as low resource utilization and flexibility, and high task latency, the present invention proposes the following technical solutions:
[0005] In a first aspect, the present invention provides an adaptive container migration method, comprising:
[0006] Get the current position of the car and predict the position of the car in the next time step;
[0007] Calculate the vehicle flow fluctuation value based on the current position and predicted position of the car;
[0008] Determine whether the vehicle flow fluctuation value is less than the migration threshold; if so, maintain the current deployment; if not, build a container migration optimization model and use the RIME algorithm based on loop detection to solve the container migration optimization model and generate a migration strategy;
[0009] Migrate the container from the current server to the target server according to the migration strategy.
[0010] As a preferred technical solution, the expression of the container migration optimization model is as follows:
[0011]
[0012]
[0013] in, and is the weight coefficient, is the task completion rate, which indicates the proportion of tasks completed on time within a specific time window. Indicates the degree of server imbalance; is a binary variable, representing the container k Whether it has been migrated to the server n , is a binary variable representing the task i Whether it is offloaded to the server n , It is an indicator function. When the condition in the brackets is met, the value is 1, otherwise it is 0. For container k The set of tasks you are responsible for, tasks For task collection part of For Server n The number of queues, Indicates a task i On the server n queue p The execution location in is the total number of servers; Indicates the total number of tasks, Representation Server n In the queue p Maximum capacity on K Indicates the total number of containers, Represents a container k Required storage resources, Representation Server n storage capacity.
[0014] As a preferred technical solution, the vehicle flow fluctuation value is calculated according to the following formula:
[0015]
[0016] in, Indicates the number of active servers in the current or next time slot, Indicates then Changes in the number of vehicles on active servers, The average of the change in vehicle count across all active servers.
[0017] As a preferred technical solution, the method further includes determining the migration threshold by Bayesian optimization, including:
[0018] Construct an evaluation function, whose expression is as follows:
[0019]
[0020] in, and is a non-negative weight coefficient, is the migration frequency, is the task completion rate;
[0021] According to the evaluation function, the Gaussian process is used to fit the posterior distribution of the observation data of the current migration threshold parameter, and based on the expected improvement as the acquisition function, the optimal adjustment direction of the migration threshold parameter in each iteration is calculated according to the following formula;
[0022] By iteratively optimizing the evaluation function and adjusting the migration threshold parameters, the optimal migration threshold that minimizes the evaluation function value is finally found.
[0023] As a preferred technical solution, the RIME algorithm based on loop detection is used to solve the container migration optimization model and generate a migration strategy, including:
[0024] Initialize the population set R , the variables in the container migration optimization model As a population R i ;
[0025] Perform loop detection on each population individual. If no loop is detected, calculate each population individual R i The initial fitness value F ( R i ), if a loop is detected, the current population individual is assigned a positive infinity as a penalty term;
[0026] Generate random numbers b 2 ,when b 2< hour, is the current iteration number, A is the maximum iteration number, and the soft frost strategy is used to update the individual positions of the population;
[0027] Recalculate the fitness values of the updated population individuals and update the individual with the best fitness value as the new global optimal solution;
[0028] Repeat the above steps until the maximum number of iterations is reached or the convergence condition is met, output the current global optimal solution, and generate a migration strategy.
[0029] As a preferred technical solution, loop detection is performed on each individual in the population, including:
[0030] Traverse the tasks in each population individual, if the current task is already in the node set used to store the current recursive path R p In the process, it is determined whether there is a loop; if the current task is already used to store the set of nodes that have been visited V s If the current task is not in the set, then the task is judged to have been detected; R p and collection V s , add the tasks to V s and R p middle;
[0031] Traverse the dependent tasks of the current task. If there is no loop in the dependent tasks of the current task, remove the current task from the set. R p Removed.
[0032] As a preferred technical solution, the soft frost strategy is used to update the individual positions of the population. Its expression is as follows:
[0033]
[0034] in, Indicates in a In the iteration i The dimensions of a population are j Updated position; Indicates that the current global optimal solution is in dimension j Position on For the interval Random numbers within; is the direction factor, is the angle parameter that is dynamically adjusted with the number of iterations; For environmental factors, is a preset constant value; For the interval Random numbers within; For the i The upper limit of the search space of individuals in the population in dimension j, Indicates the i The lower bound of the search space of individuals in the population in dimension j.
[0035] As a preferred technical solution, after the soft frost strategy is adopted to update the positions of the individuals in the population, the method further includes:
[0036] Normalize the current fitness value of the current population individual to obtain the normalized fitness value ;
[0037] Generate random numbers b 3 ,when b 3< When , the hard frost strategy is adopted to update the individual positions of the population to the global optimal value, which is expressed as follows:
[0038] .
[0039] As a preferred technical solution, the method further includes:
[0040] The average system performance of the current migration strategy is calculated using the following formula:
[0041]
[0042] in, express Average system performance over the time period, Indicates The objective function of the container migration optimization model at each moment, Indicates the time period The number of migrations within .
[0043] In a second aspect, the present invention further provides an adaptive container migration system, which is applied to the adaptive container migration method as described in any solution of the first aspect, comprising:
[0044] The prediction module is used to obtain the current position of the car and predict the position of the car in the next time step;
[0045] A calculation module, used to calculate the vehicle flow fluctuation value based on the current position and predicted position of the car;
[0046] The judgment module is used to determine whether the vehicle flow fluctuation value is less than the migration threshold. If so, the current deployment is maintained. If not, a container migration optimization model is constructed and solved using the RIME algorithm based on loop detection to generate a migration strategy.
[0047] The migration module is used to migrate the container from the current server to the target server according to the migration strategy.
[0048] The beneficial effects of the present invention include at least:
[0049] This invention optimizes the container migration process, combines the acquired vehicle location predictions and traffic fluctuation calculations, and constructs a dynamic and adaptive migration optimization model. This model can more accurately assess the server load and task allocation status, and determine whether to trigger the migration operation. By introducing the RIME algorithm based on loop detection, the adaptability and robustness of the migration strategy are enhanced, enabling faster response and dynamic resource adjustment in multi-tasking scenarios, thereby improving flexibility. At the same time, it avoids the performance bottlenecks caused by traditional reliance on static configuration, effectively reduces the frequency of unnecessary migrations, and improves the resource utilization of the entire system. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A schematic diagram of a flow chart of an adaptive container migration method provided by an embodiment of the present invention.
[0051] Figure 2 This is an example diagram of the task dependency graph model based on the extended AOE provided in an embodiment of the present invention.
[0052] Figure 3 This is an example diagram of a deadlock caused by a loop in task dependency provided by an embodiment of the present invention.
[0053] Figure 4 (a) is a comparison chart of the task completion rates of the RIME algorithm based on loop detection provided by an embodiment of the present invention and other solutions.
[0054] Figure 4 (b) is a comparison chart of the load balancing effects of the RIME algorithm based on loop detection provided by an embodiment of the present invention and other solutions.
[0055] Figure 4 (c) is a comparison chart of the objective function values of the RIME algorithm based on loop detection provided by an embodiment of the present invention and other schemes.
[0056] Figure 5 This is an example diagram comparing the effects of the adaptive migration method provided by an embodiment of the present invention and other methods.
[0057] Figure 6 This is an architecture diagram of an adaptive container migration system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The following will describe embodiments of the present invention with reference to the accompanying drawings and preferred technical solutions. Those skilled in the art will readily understand other advantages and benefits of the present invention from the contents disclosed in this specification. The present invention may also be implemented or applied through different specific embodiments, and the details in this specification may be modified or altered based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred technical solutions are intended only to illustrate the present invention and are not intended to limit the scope of protection of the present invention.
[0059] It should be noted that the illustrations provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. Therefore, the illustrations only show components related to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be changed arbitrarily, and the component layout may also be more complex.
[0060] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it will be apparent to those skilled in the art that the embodiments of the present invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring the embodiments of the present invention.
[0061] Example 1
[0062] This embodiment proposes an adaptive container migration method, such as Figure 1 As shown, Figure 1 A flow chart of an adaptive container migration method provided by an embodiment of the present invention includes the following steps:
[0063] S1: Get the current position of the car and predict the position of the car in the next time step;
[0064] S2: Calculate the vehicle flow fluctuation value based on the current position and predicted position of the car;
[0065] S3: Determine whether the vehicle flow fluctuation value is less than the migration threshold; if so, maintain the current deployment; if not, build a container migration optimization model and use the RIME algorithm based on loop detection to solve the container migration optimization model and generate a migration strategy;
[0066] S4: Migrate the container from the current server to the target server according to the migration strategy;
[0067] As an example, the current location of a vehicle is acquired in real time, and its path and location in the next time step are predicted. The vehicle flow fluctuation value within the area is calculated. This flow fluctuation value is compared with a preset migration threshold. If the flow fluctuation value exceeds the threshold, a container migration optimization model for the vehicle is constructed, taking into account task completion and server load balancing. This model is solved using the RIME algorithm with loop detection to generate an optimal migration strategy. Based on this migration strategy, the vehicle's task processing container is migrated from the current server (e.g., server X) to a target server (e.g., server Y) with a lower load and that meets the task's computational latency requirements.
[0068] It is understandable that by optimizing the container migration process, combining the obtained vehicle location predictions and traffic fluctuation calculations, and building a dynamic and adaptive migration optimization model, it is possible to more accurately assess the server load and task allocation status, and decide whether to trigger the migration operation. By introducing the RIME algorithm based on loop detection, the adaptability and robustness of the migration strategy are enhanced, enabling faster response and dynamic resource adjustment in multi-tasking scenarios, thereby improving flexibility. At the same time, it avoids the performance bottlenecks caused by traditional reliance on static configuration, effectively reduces the frequency of unnecessary migrations, and improves the resource utilization of the overall system.
[0069] Example 2
[0070] This embodiment improves the adaptive container migration method proposed in Example 1.
[0071] As an example, this embodiment describes in detail the process of building a container migration optimization model:
[0072] In the Internet of Vehicles scenario, consider the system has edge servers, whose set is denoted as , each server has a certain amount of computing resources. At the same time, there are The vehicle set is represented as The vehicle request is defined as a workflow, each workflow contains several dependent tasks, and each task can be processed by a corresponding container. The collection of containers is , where the container The set of tasks that can be processed is , the task set in the vehicle workflow is Each container consumes CPU, memory, and storage resources during execution. express.
[0073] In order to describe the relationship between container migration and task offloading, a binary variable is introduced and .in, Represents a container Whether to migrate to the server , Indicates a task Whether to uninstall to the server Execution, specifically defined as follows:
[0074]
[0075]
[0076] To ensure that tasks can only be assigned to the server where the container is located, , the constraints must be met .
[0077] Assuming that each task can only be processed by a specific container, for To ensure the uniqueness of container deployment, add constraints ,This constraint ensures that the set of tasks processed by the same container will be offloaded to the same server.
[0078] Additionally, the storage consumption of containers migrated to a server must not exceed the storage capacity limits of that server, namely:
[0079]
[0080] in, Representation Server storage capacity limitations.
[0081] Using a multi-queue execution model, tasks can be executed on a specific queue of the server. Represents the execution order in the queue on each server, where .server It is possible to have multiple parallel execution queues ,gather The elements in the task represent On the server queue The position or execution order in a queue. Tasks assigned to the same queue are executed sequentially, that is, a task must wait for the previous task in the queue to complete before it can be executed.
[0082] To ensure reasonable task allocation and efficient management of server resources, the following basic constraints are introduced:
[0083]
[0084] Each task must be assigned to one and only one queue on the server to ensure that it will not be assigned to multiple queues at the same time. The task assignment constraint can be expressed as: is an indicator function used Is it greater than 0? On the server queue There is a position (i.e. ), the instruction function returns 1; otherwise, it returns 0. This constraint ensures that each task can occupy only one non-zero queue position.
[0085] server Each queue on Has limited capacity , which limits the number of tasks that can be processed in parallel in the queue. The queue capacity constraint is This constraint ensures that the queue is allocated The number of tasks does not exceed the maximum capacity .
[0086] To ensure that tasks are executed in the correct order in the same queue, we introduce constraints , to ensure that the position index in the queue is unique and ordered. This formula ensures that in the same queue, the queue position index of different tasks and Different, thus avoiding conflicts in execution order.
[0087] A task graph model based on extended AOE is constructed to represent the inherent dependencies between tasks due to the execution logic of vehicle requests and the delayed dependencies caused by multi-queue execution. Define the task dependency matrix To describe the logical dependency between tasks, if a task must wait for the task to be completed before it can be started, then ;otherwise, .
[0088] In the extended AOE graph, there are two special vertices " "and" ", respectively, represent the start and completion of the entire task set. The directed edges between tasks indicate both logical dependencies and the execution order in the server queue. Figure 2 As shown, Figure 2 An example diagram of a task dependency graph model based on extended AOE provided in an embodiment of the present invention is shown in Figure 2 Medium Server In five different cohorts ( ; ; ; ; ) processes tasks from top to bottom, with a workflow of two vehicles, tasks Must wait for a predecessor task in the same workflow Completed while waiting for tasks from another workflow , because in the server queue, the task Scheduled tasks Before, it resulted in a lagged dependency.
[0089] In large-scale task scheduling, due to the complex dependencies between tasks and the order of server execution queues, circular waiting problems are prone to occur, leading to deadlocks. Figure 3 As shown, Figure 3 This is an example diagram of a deadlock caused by a loop in task dependency provided by an embodiment of the present invention, wherein 、 、 、 A loop is formed. Server Process tasks from top to bottom in five different queues ; ; ; ; .Task Depends on the previous task The completion of Waiting for the server to complete the task In turn, the task depending on The completion of Must wait Done. In this case, It must wait for its own completion, forming a circular dependency, which seriously affects the efficiency of task scheduling and reduces the overall system performance. To solve this problem, a loop detection algorithm will be proposed in the solution to handle this situation.
[0090] For the calculation delay, let Indicates the CPU clock frequency of the edge server. Indicates the number of CPU cycles required to process each bit of data. The computational latency of a task can be expressed as:
[0091]
[0092] in, Indicates a task With the task The dependencies between Represents a container Processing tasks The amount of data generated. Indicates all predecessor tasks to the task Total data input.
[0093] Regarding transmission latency, the complete task processing process involves the vehicle sending a service request to the edge server located at the nearest base station, which then receives and processes the request. Because a service consists of multiple components, the edge server may not deploy all relevant containers simultaneously. Therefore, communication between containers on different servers is required, and the server containing the last container finally returns the result to the vehicle. Because feedback information is typically small, the time required for the edge server to send the computational result back to the vehicle is ignored. In this case, communication latency primarily consists of the communication delay between the vehicle and server, as well as the communication delay between containers.
[0094] The vehicle transmits the input data to the edge server in the base station through the wireless uplink channel. Indicates vehicle At the current location and with the edge server The channel gain between the given vehicle's transmission power In this case, the uplink data transmission rate from vehicle to base station can be defined as:
[0095]
[0096] in is the system bandwidth, is the noise power, For Server The inter-cell interference power of the base station where the vehicle is located. The data transmission between the vehicle and the base station adopts the IEEE802.11p protocol. To simplify the analysis, we assume that by assigning an orthogonal frequency channel to each vehicle, the co-channel interference between vehicles can be ignored, that is, .
[0097] Channel gain Expressed as:
[0098]
[0099] in Indicates vehicle With edge servers The distance between is the path loss exponent, represents the path loss, is the Rayleigh fading channel coefficient. To accurately capture the signal propagation characteristics, we use the free space path loss model to represent large-scale fading and the Rayleigh fading model to represent small-scale fading.
[0100] vehicle The size is The data is sent to the edge server The transmission delay is:
[0101]
[0102] in, Indicates the uplink data transmission rate from the vehicle to the base station.
[0103] If the base station closest to the vehicle does not contain the first required container, the receiving base station forwards the information to the corresponding base station. Assuming the channel bandwidth between base stations is Fixed, set represents the number of hops between base stations, then the inter-container communication delay can be expressed as:
[0104]
[0105] vehicle To the person in charge of handling the task The total communication delay of the container transmitting data can be expressed as:
[0106]
[0107] in, Indicates the closest vehicle base station.
[0108] In summary, for the task and If the task Depends on the task , then the delay Expressed as:
[0109]
[0110] in Indicates communication delay. and If they are located on different servers, there will be transmission delays ; If they are on the same server, the transmission delay is zero because no cross-server communication is required and the delay depends only on the execution order. Indicates a task processing delay.
[0111] For vehicles The total delay in task completion can be calculated by summing the delays of all critical tasks using the following formula:
[0112]
[0113] in, Represents all tasks on the critical path.
[0114] In order to reasonably allocate the resource requirements of containers, a resource usage model based on computing resources (CPU and memory) is introduced. Each container on the server The resource consumption of a is expressed as the weighted sum of its CPU and memory usage:
[0115]
[0116] in, and Is a non-negative weight coefficient used to balance the importance of different resource types. For CPU-intensive tasks, Can be given higher weights; for memory-intensive tasks, It can be given priority.
[0117] Single edge server The total load is the sum of the loads of all deployed containers on the server, and its expression is:
[0118]
[0119] To reflect the degree to which the server load deviates from the average value, the load variance is introduced and defined as:
[0120]
[0121] in, Indicates the total number of edge servers and the average load Expressed as
[0122] This method can evaluate the load balancing degree between servers. Indicates a more even load distribution, while a larger This indicates that some servers are overloaded while other server resources are idle.
[0123] In an edge computing environment, the goal of the system is to optimally allocate network and computing resources to efficiently schedule user-generated tasks. To ensure that tasks are completed on time, tasks must meet Here, we define container migration in the Internet of Vehicles as a constrained optimization problem, where the goal is to complete as many tasks as possible on time while ensuring load balancing among servers, and satisfying the constraints of server storage availability and consistency requirements between tasks and containers.
[0124] Task completion rate It is defined as the ratio of the number of tasks completed on time within a given time window to the total number of assigned tasks, that is:
[0125]
[0126] If the condition is satisfied (i.e. the task is completed within its deadline), then Takes 1, otherwise 0.
[0127] To simplify the model and reduce solution complexity, try changing the variables and Represented as a queue decision variable First, the task offloading variable is reset to Rewritten as:
[0128]
[0129] If the task Assigned to the server Any queue on .
[0130] Next, re-migrate the container variables Rewrite as
[0131]
[0132] If the container Any tasks in the , then the container Migrated to the server .
[0133] Through the above transformation, the traditional task-container mapping and container-server mapping are transformed into a unified task-server mapping, reducing the number of decisions that need to be made.
[0134] In summary, the container migration optimization model can be written as:
[0135]
[0136]
[0137] in, and is the weight coefficient, is the task completion rate, which indicates the proportion of tasks completed on time within a specific time window. Indicates the degree of server imbalance; is a binary variable, representing the container k Whether it has been migrated to the server n , is a binary variable representing the task i Whether it is offloaded to the server n , It is an indicator function. When the condition in the brackets is met, the value is 1, otherwise it is 0. For container k The set of tasks you are responsible for, tasks For task collection part of For Server n The number of queues, Indicates a task i On the server n queue p The execution location in is the total number of servers; Indicates the total number of tasks, Representation Server n In the queue p Maximum capacity on K Indicates the total number of containers, Represents a container k Required storage resources, Representation Server n storage capacity.
[0138] This model represents the maximum task completion rate and minimize load imbalance , thereby improving the overall effect of container migration and task offloading in edge computing environments. and Used to weight task completion rate and system load fluctuation and balance their impact during the optimization process.
[0139] In this embodiment, although the proposed optimization model aims to maximize the task completion rate and minimize the load imbalance, it is equally important to balance the benefits of container migration and its associated costs over a longer time frame. Frequent migrations may bring additional overhead without generating corresponding benefits. Therefore, container migration does not need to occur in every time slot. In the long run, the balance between the migration frequency and its benefits is crucial to evaluating the overall effectiveness of the container migration strategy. Mathematically, it is necessary to consider the system's performance over time. Based on the performance above, the average system performance of the current migration strategy is calculated according to the following formula:
[0140]
[0141] in, express Average system performance over the time period, Indicates The objective function of the container migration optimization model at each moment, Indicates the time period The number of migrations within .
[0142] The performance of the migration solution shows the system performance over a longer period of time, whether it can bring performance improvements when container migration is needed, and whether it can reduce the costs caused by ineffective migration.
[0143] In this embodiment, the vehicle flow fluctuation value is calculated according to the following formula:
[0144]
[0145] in, Indicates the number of active servers in the current or next time slot, Indicates the n Changes in the number of vehicles on active servers, The average of the change in vehicle count across all active servers.
[0146] It should be noted that active servers refer to the set of servers that actually provide services to vehicles and participate in task processing within a specific time period. Their status will be dynamically adjusted due to changes in vehicle movement and task distribution, and is used to reflect the distribution of vehicles at different locations at current or future times.
[0147] During the specific implementation process, through real-time monitoring of vehicle locations and trajectory prediction, the changes in the number of vehicles within the coverage area of each active server are counted, so as to calculate the location-based vehicle flow fluctuation value, and the vehicle flow fluctuation value and migration threshold are used to determine whether the task container needs to be migrated, thereby optimizing server load balancing while maintaining service continuity.
[0148] In this embodiment, the migration threshold is determined by Bayesian optimization, including:
[0149] Construct an evaluation function, whose expression is as follows:
[0150]
[0151] in, and is a non-negative weight coefficient, is the migration frequency, is the task completion rate;
[0152] According to the evaluation function, the Gaussian process is used to fit the posterior distribution of the observation data of the current migration threshold parameter, and based on the expected improvement as the acquisition function, the optimal adjustment direction of the migration threshold parameter in each iteration is calculated according to the following formula;
[0153] By iteratively optimizing the evaluation function and adjusting the migration threshold parameters, the optimal migration threshold that minimizes the evaluation function value is finally found.
[0154] In this embodiment, the RIME algorithm based on loop detection is used to solve the container migration optimization model and generate a migration strategy. However, the RIME algorithm is designed for minimization tasks. To solve this problem, the original maximization problem is converted into a minimization problem by taking the opposite of the objective function as the fitness value. During the optimization process, the algorithm approaches the maximum value of the original objective function by minimizing the converted fitness value. In addition, a loop detection mechanism is introduced into the algorithm to ensure that the task dependencies are solvable, thereby avoiding potential deadlock problems. This mechanism improves the efficiency of the heuristic algorithm by excluding infeasible solutions and guiding the search to feasible candidate solutions. Specifically:
[0155] Initialize the population set R , the variables in the container migration optimization model As a population R i ;
[0156] Perform loop detection on each population individual. If no loop is detected, calculate each population individual R i The initial fitness value F ( R i ), if a loop is detected, the current population individual is assigned a positive infinity as a penalty term;
[0157] Generate random numbers b 2 ,when b 2< hour, is the current iteration number, A is the maximum iteration number, and the soft frost strategy is used to update the individual positions of the population;
[0158] Recalculate the fitness values of the updated population individuals and update the individual with the best fitness value as the new global optimal solution;
[0159] Repeat the above steps until the maximum number of iterations is reached or the convergence condition is met, output the current global optimal solution, and generate a migration strategy.
[0160] In this embodiment, in order to solve the circular dependency problem, a loop detection mechanism is proposed, which can effectively identify circular dependencies in the task graph and promptly eliminate infeasible scheduling solutions. Loop detection is performed on each individual in the population:
[0161] Traverse the tasks in each population individual, if the current task is already in the node set used to store the current recursive path R p In the process, it is determined whether there is a loop; if the current task is already used to store the set of nodes that have been visited Vs If the current task is not in the set, then the task is judged to have been detected; R p and collection V s , add the tasks to V s and R p middle;
[0162] Traverse the dependent tasks of the current task. If there is no loop in the dependent tasks of the current task, remove the current task from the set. R p Removed.
[0163] In this embodiment, the soft frost strategy is used to update the position of individuals in the population. The expression is as follows:
[0164]
[0165] in, Indicates in a In the iteration i The dimensions of a population are j Updated position; Indicates that the current global optimal solution is in dimension j Position on For the interval Random numbers within; is the direction factor, is the angle parameter that is dynamically adjusted with the number of iterations; For environmental factors, is a preset constant value; For the interval Random numbers within; For the i The upper limit of the search space of individuals in the population in dimension j, Indicates the i The lower bound of the search space of individuals in the population in dimension j.
[0166] In this embodiment, after the soft frost strategy is adopted to update the positions of the individuals in the population, the following steps are further included:
[0167] Normalize the current fitness value of the current population individual to obtain the normalized fitness value ;
[0168] Generate random numbers b 3 ,when b 3< When , the hard frost strategy is adopted to update the individual positions of the population to the global optimal value, which is expressed as follows:
[0169] .
[0170] The RIME algorithm based on loop detection is used to solve the optimization model, which greatly improves the solution quality and enables each container migration to achieve a higher level under different vehicle scales. Figure 4 As shown, Figure 4 (a) is a comparison chart of the task completion rates of the RIME algorithm based on loop detection provided by an embodiment of the present invention and other solutions, Figure 4 (b) is a comparison diagram of the load balancing effect of the RIME algorithm based on loop detection provided by an embodiment of the present invention and other solutions, Figure 4 (c) is a comparison chart of the objective function values of the RIME algorithm based on loop detection provided by an embodiment of the present invention and other solutions. Compared with the baseline method, the RIME algorithm can improve system performance by up to 47%, and its advantages are obvious at a glance.
[0171] like Figure 5 As shown, Figure 5 This is an example diagram comparing the effects of the adaptive migration method provided by the embodiment of the present invention with other methods. The bar chart shows the performance indicators of continuous migration, geographic-aware migration, fixed-interval migration (time intervals of 5 and 10), and adaptive migration solutions. The present invention not only excels in maintaining average system performance but also ensures that each migration significantly improves system performance, fully demonstrating its flexibility and efficiency. The adaptive container migration strategy based on traffic flow changes can effectively balance the number of migrations with system benefits, accurately identifying the appropriate migration time regardless of traffic flow changes. Containers are no longer limited to providing an operating environment for a single task, and this shift significantly improves system resource utilization.
[0172] At the same time, traditional container migration strategies based on a single vehicle trajectory are no longer suitable for new scenarios where containers support multiple tasks. To address this, we have proposed an adaptive container migration strategy based on traffic flow and the overall perspective of the connected vehicle system. This strategy has proven to be significantly more effective and provides a more optimal solution for container migration in connected vehicle environments.
[0173] Example 3
[0174] like Figure 6 As shown, this embodiment proposes an adaptive container migration system, which is applied to the adaptive container migration method as described in the above embodiment, and includes: a prediction module 100, a calculation module 200, a judgment module 300 and a migration module 400.
[0175] Among them, the prediction module 100 is used to construct and obtain the current position of the car and predict the position of the car in the next time step; the calculation module 200 is used to calculate the vehicle flow fluctuation value based on the current position and predicted position of the car; the judgment module 300 is used to judge whether the vehicle flow fluctuation value is less than the migration threshold; if so, maintain the current deployment; if not, build a container migration optimization model, and use the RIME algorithm based on loop detection to solve the container migration optimization model to generate a migration strategy; the migration module 400 is used to migrate the container from the current server to the target server according to the migration strategy.
[0176] It should be noted that the aforementioned explanation of the embodiment of the adaptive container migration method is also applicable to the adaptive container migration system of this embodiment and will not be repeated here.
[0177] 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 invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples without contradiction.
[0178] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Thus, a feature specified as "first" or "second" may explicitly or implicitly include at least one of such features. In the description of the present invention, "N" means at least two, such as two, three, etc., unless otherwise specifically defined.
[0179] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing a custom logical function or step of a process, and the scope of the preferred embodiments of the invention includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of the invention pertain.
[0180] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiment, the N steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having logic gate circuits for implementing logical functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array, a field programmable gate array, etc.
[0181] Those skilled in the art will appreciate that all or part of the steps in the method for implementing the above-mentioned embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.
[0182] Obviously, the above embodiments of the present invention are merely examples for the purpose of clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. Those skilled in the art will appreciate that other variations or modifications can be made based on the above description. It is not necessary and impossible to enumerate all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the claims of the present invention.
Claims
1. An adaptive container migration method, characterized in that: include: Get the current position of the car and predict the position of the car in the next time step; Calculate the vehicle flow fluctuation value based on the current position and predicted position of the car; Determine whether the vehicle flow fluctuation value is less than the migration threshold; if so, maintain the current deployment; If not, a container migration optimization model is constructed and the RIME algorithm based on loop detection is used to solve the container migration optimization model and generate a migration strategy. The RIME algorithm based on loop detection is used to solve the container migration optimization model and generate a migration strategy, including: Initialize the population set R , the variables in the container migration optimization model As a population R i ; Perform loop detection on each population individual. If no loop is detected, calculate each population individual R i The initial fitness value F ( R i ), if a loop is detected, the current population individual is assigned a positive infinity as a penalty term; Generate random numbers b 2 ,when b 2< hour, is the current iteration number, A is the maximum iteration number, and the soft frost strategy is used to update the individual positions of the population; Recalculate the fitness values of the updated population individuals and update the individual with the best fitness value as the new global optimal solution; Repeat the above steps until the maximum number of iterations is reached or the convergence condition is met, output the current global optimal solution, and generate a migration strategy; Migrate the container from the current server to the target server according to the migration strategy.
2. The adaptive container migration method according to claim 1, characterized in that: The expression of the container migration optimization model is as follows: in, and is the weight coefficient, is the task completion rate, which indicates the proportion of tasks completed on time within a specific time window. Indicates the degree of server imbalance; is a binary variable, representing the container k Whether it has been migrated to the server n , is a binary variable representing the task i Whether it is offloaded to the server n , It is an indicator function. When the condition in the brackets is met, the value is 1, otherwise it is 0. For container k The set of tasks you are responsible for, tasks For task collection part of For Server n The number of queues, Indicates a task i On the server n queue p The execution location in is the total number of servers; Indicates the total number of tasks, Representation Server n In the queue p Maximum capacity on K Indicates the total number of containers, Represents a container k Required storage resources, Representation Server n storage capacity.
3. The adaptive container migration method according to claim 1, characterized in that: The vehicle flow fluctuation value is calculated according to the following formula: in, Indicates the number of active servers in the current or next time slot, Indicates the n Changes in the number of vehicles on active servers, The average of the change in vehicle count across all active servers.
4. The adaptive container migration method according to claim 1, characterized in that: The method further includes determining a migration threshold by Bayesian optimization, comprising: Construct an evaluation function, whose expression is as follows: in, and is a non-negative weight coefficient, is the migration frequency, is the task completion rate; According to the evaluation function, the Gaussian process is used to fit the posterior distribution of the observation data of the current migration threshold parameter, and based on the expected improvement as the acquisition function, the optimal adjustment direction of the migration threshold parameter in each iteration is calculated according to the following formula; By iteratively optimizing the evaluation function and adjusting the migration threshold parameters, the optimal migration threshold that minimizes the evaluation function value is finally found.
5. The adaptive container migration method according to claim 1, characterized in that: Perform loop detection on each population individual, including: Traverse the tasks in each population individual, if the current task is already in the node set used to store the current recursive path R p In the process, it is determined whether there is a loop; if the current task is already used to store the set of nodes that have been visited V s If the current task is not in the set, then the task is judged to have been detected; R p and collection V s , add the tasks to V s and R p middle; Traverse the dependent tasks of the current task. If there is no loop in the dependent tasks of the current task, remove the current task from the set. R p Removed.
6. The adaptive container migration method according to claim 1, characterized in that: The soft frost strategy is used to update the individual positions of the population. Its expression is as follows: in, Indicates in a In the iteration i The dimensions of a population are j Updated position; Indicates that the current global optimal solution is in dimension j Position on For the interval Random numbers within; is the direction factor, is the angle parameter that is dynamically adjusted with the number of iterations; For environmental factors, is a preset constant value; For the interval Random numbers within; For the i The upper limit of the search space of individuals in the population in dimension j, Indicates the i The lower bound of the search space of individuals in the population in dimension j.
7. The adaptive container migration method according to claim 1, characterized in that: After updating the positions of the individuals in the population using the soft frost strategy, the method further includes: Normalize the current fitness value of the current population individual to obtain the normalized fitness value ; Generate random numbers b 3 ,when b 3< When , the hard frost strategy is adopted to update the individual positions of the population to the global optimal value, which is expressed as follows: 。 8. The adaptive container migration method according to claim 1, further comprising: The average system performance of the current migration strategy is calculated using the following formula: in, express Average system performance over the time period, Indicates The objective function of the container migration optimization model at each moment, Indicates the time period The number of migrations within .
9. An adaptive container migration system, applied to the adaptive container migration method according to any one of claims 1 to 8, characterized in that: include: The prediction module is used to obtain the current position of the car and predict the position of the car in the next time step; A calculation module, used to calculate the vehicle flow fluctuation value based on the current position and predicted position of the car; A judgment module is used to judge whether the vehicle flow fluctuation value is less than the migration threshold; if so, maintain the current deployment; If not, a container migration optimization model is constructed and the RIME algorithm based on loop detection is used to solve the container migration optimization model and generate a migration strategy. The migration module is used to migrate the container from the current server to the target server according to the migration strategy.