Terminal service migration method, system, device and medium under micro-service architecture

CN122934281APending Publication Date: 2026-10-16YUNNAN POWER GRID CO LTD ELECTRIC POWER RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611052787.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-15
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0004]本发明申请提供了一种微服务架构下的终端服务迁移方法、系统、设备及介质,以解决如何减小微服务架构下的终端服务迁移的整体延迟的技术问题

Benefits of technology

本发明申请提供了一种微服务架构下的终端服务迁移方法、系统、设备及介质,相比较现有技术在终端实际完成切换或服务质量已经恶化时才启动迁移的模式,本发明申请根据预部署数量决策,在预部署目标节点上提前创建对应数量的微服务实例,并在监测到终端发生跨基站移动时,直接将迁移请求发送至该节点以切换连接,在跨基站移动发生时仅需进行路由和连接的切换,彻底免去了微服务实例冷启动、环境初始化以及实时全量传输数据的漫长等待过程,显著降低了服务迁移的整体延迟;此外,结合服务功能链执行情况与相对位置构建状态向量,并通过强化学习算法进行策略求解,输出针对后继微服务的预部署数量决策,而非全量迁移所有微服务,相比较“为了避免单点滞后而对所有相关微服务进行全量、无差别部署以及迁移”的现有技术方案,本发明申请能够根据当前进度与位置按需决定预部署的实例个数,在保障服务连续性的前提下,最大程度地规避了无效部署,大幅节省了网络带宽开销与边缘节点的计算、存储资源,高度契合资源高度受限的边缘计算环境;再者,将终端当前请求的服务功能链执行情况作为关键分量,纳入当前时隙下马尔可夫决策过程的状态向量中进行统一建模,使得迁移决策过程能够实时、精确地感知到微服务之间复杂且动态的前后向协同依赖关系,有效避免了在微服务环境中因某个关键微服务实例的迁移滞后或缺失而导致整个服务流阻塞、中断或性能急剧下降的风险,充分发挥了边缘计算高连续性服务的优势。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122934281A_ABST
    Figure CN122934281A_ABST
Patent Text Reader

Abstract

The application provides a terminal service migration method, system, device and medium under a micro-service architecture. The method comprises the following steps: constructing a state vector of a Markov decision process in a current time slot according to a service function chain execution condition of a current request of a terminal and a relative position of the terminal and a current hosting edge server; identifying a cooperation relationship type of the terminal and determining a pre-deployment target node; inputting a preset migration decision model, solving a strategy of the migration decision model through a reinforcement learning algorithm, and obtaining a pre-deployment quantity decision for a subsequent micro-service in the service function chain; creating a corresponding number of micro-service instances on the pre-deployment target node, and sending a migration request to the pre-deployment target node to switch a connection when a cross-base station movement of the terminal is monitored, so as to realize service migration. The application can reduce the overall delay of terminal service migration under the micro-service architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention application relates to the field of power grid edge computing, and in particular to a method, system, device and medium for migrating terminal services under a microservice architecture. Background Technology

[0002] With the widespread application of Mobile Edge Computing (MEC) technology, the movement of mobile terminals such as smartphones, vehicles, and drones over large spatial areas leads to frequent cross-base station handovers, necessitating the switching and migration of computing services to ensure service continuity. Meanwhile, modern applications commonly adopt microservice architectures, where application functionality is no longer a single, monolithic entity but rather a Service Function Chain (SFC) composed of multiple interdependent microservices. Under a microservice architecture, mobile-aware service migration not only needs to address the traditional network switching issues caused by changes in terminal location but also faces significant challenges such as complex dependencies between microservices, dynamic routing planning, and workflow interruptions easily triggered by migration delays.

[0003] Currently, most existing service migration strategies follow the traditional monolithic application approach, typically initiating migration passively only when the terminal has actually switched over or service quality has deteriorated. This approach struggles to adapt to the complex and dynamic collaborative dependencies between microservices. In a microservice environment, a delay in the migration of any microservice instance can disrupt the integrity of the functional chain, leading to blocking, interruption, or a sharp performance degradation of the entire service flow, severely undermining the advantages of low latency and high continuity in edge computing. Therefore, reducing the overall latency of service migration and improving the quality of subsequent edge computing has become a pressing issue that needs to be addressed. Summary of the Invention

[0004] This invention application provides a method, system, device, and medium for migrating terminal services under a microservice architecture, in order to solve the technical problem of how to reduce the overall latency of terminal service migration under a microservice architecture.

[0005] To address the aforementioned technical problems, this invention provides a method for migrating terminal services under a microservice architecture, comprising: Based on the execution status of the service function chain currently requested by the terminal and the relative position of the terminal and the currently hosted edge server, construct the state vector of the Markov decision process in the current time slot; Identify the cooperation relationship type of the terminal, and determine the pre-deployment target node based on the cooperation relationship type; The state vector and the pre-deployed target node are input into a preset migration decision model. The migration decision model is then solved using a reinforcement learning algorithm to obtain a decision on the number of pre-deployed microservices in the service function chain. Based on the pre-deployment quantity decision, a corresponding number of microservice instances are created on the pre-deployment target node, and when the terminal is detected to move across base stations, a migration request is sent to the pre-deployment target node to switch connections, thereby realizing service migration.

[0006] As a preferred embodiment, the cooperative relationship types include end-to-end cooperative terminals and non-cooperative terminals; The step of determining the pre-deployment target node based on the cooperation relationship type includes: If the terminal is an edge-cooperative terminal, then the pre-deployment fitness of each available edge node is calculated based on the mobile information uploaded by the terminal, and the pre-deployment target node is determined based on the pre-deployment fitness. If the terminal is a non-cooperative terminal, the resource utilization rate of each available edge server is obtained, and the resource utilization rate is converted into a task acceptance probability through a preset mapping function. Then, the pre-deployment target node is determined based on the task acceptance probability.

[0007] As a preferred embodiment, the step of calculating the pre-deployment fitness of each available edge node based on the mobile information uploaded by the terminal, and determining the pre-deployment target node based on the pre-deployment fitness, includes: Obtain the current displacement direction of the terminal; and determine the connection direction vector from the terminal to each available edge node based on the current displacement direction; The angle between the moving direction vector and the connecting line direction vector is determined based on the azimuth angle between the moving direction vector and the connecting line. Calculate the expected dwell time of the terminal in the current time slot based on the straight-line distance between the terminal and each available edge node and the included angle; The pre-deployment fitness of each available edge node is calculated based on the expected dwell time and the average moving speed of the terminal in the current time slot. The available edge node with the highest pre-deployment adaptability is determined as the pre-deployment target node.

[0008] As a preferred embodiment, the resource utilization rate is the maximum of the computing resource utilization rate and the storage resource utilization rate of the corresponding edge server; The mapping function is a cubic polynomial function that decreases as the resource utilization rate increases, and the cubic polynomial function satisfies the following conditions: when the resource utilization rate is at its minimum value, the task acceptance probability is the preset maximum task acceptance probability; when the resource utilization rate is at its maximum value, the task acceptance probability is the preset minimum task acceptance probability; and there is an inflection point at the preset resource utilization rate inflection point.

[0009] As a preferred embodiment, determining the pre-deployment target node based on the task acceptance probability includes: For each available edge server, probability experiments were conducted based on the corresponding task acceptance probability. Based on the results of the probability experiment, determine the available edge servers that accept pre-deployment and the available edge servers that reject pre-deployment; The available edge servers that accept pre-deployment are determined in a distributed manner as the pre-deployment target nodes, so that multiple available edge servers can be used as pre-deployment target nodes at the same time. If all available edge servers refuse pre-deployment in the probabilistic test, the available edge server with the most idle resources will be identified as the target node for pre-deployment.

[0010] As a preferred embodiment, the step of solving the transfer decision model using a reinforcement learning algorithm includes: The reward value of each decision step in the migration decision model is calculated based on a preset reward function, and the value function and policy function of the migration decision model are updated according to the reward value. The reward value is calculated each time the terminal calls a new successor microservice in the service function chain, and the preset reward function is determined based on the number of hits, the number of misses, and the storage resources occupied by the pre-deployed successor microservices.

[0011] As a preferred embodiment, the step of constructing the state vector of the Markov decision process in the current time slot based on the relative position of the terminal and the currently hosted edge server includes: The service coverage area of ​​the currently hosted edge server is divided into multiple ring intervals; each ring interval corresponds to a discrete state value, and the multiple ring intervals are divided according to a non-uniform division strategy. Based on the annular interval into which the terminal falls, determine the discrete state value corresponding to the relative position between the terminal and the currently hosted edge server, and construct the state vector based on the discrete state value.

[0012] Accordingly, this invention application also provides a terminal service migration system under a microservice architecture, including a vector construction module, a node determination module, a decision module, and a migration module; wherein, The vector construction module is used to construct the state vector of the Markov decision process in the current time slot based on the execution status of the service function chain currently requested by the terminal and the relative position of the terminal and the currently hosted edge server. The node determination module is used to identify the cooperation relationship type of the terminal and determine the pre-deployment target node based on the cooperation relationship type; The decision module is used to input the state vector and the pre-deployed target node into a preset migration decision model, and solve the migration decision model through a reinforcement learning algorithm to obtain a decision on the pre-deployment quantity of subsequent microservices in the service function chain. The migration module is used to create a corresponding number of microservice instances on the pre-deployment target node based on the pre-deployment quantity decision, and send a migration request to the pre-deployment target node to switch the connection when the terminal is detected to move across base stations, thereby realizing service migration.

[0013] As a preferred embodiment, the cooperative relationship types include end-to-end cooperative terminals and non-cooperative terminals; The step of determining the pre-deployment target node based on the cooperation relationship type includes: If the terminal is an edge-cooperative terminal, then the pre-deployment fitness of each available edge node is calculated based on the mobile information uploaded by the terminal, and the pre-deployment target node is determined based on the pre-deployment fitness. If the terminal is a non-cooperative terminal, the resource utilization rate of each available edge server is obtained, and the resource utilization rate is converted into a task acceptance probability through a preset mapping function. Then, the pre-deployment target node is determined based on the task acceptance probability.

[0014] As a preferred embodiment, the node determination module calculates the pre-deployment fitness of each available edge node based on the mobility information uploaded by the terminal, and determines the pre-deployment target node based on the pre-deployment fitness, including: The node determination module obtains the current displacement direction of the terminal; and determines the connection direction vector from the terminal to each available edge node based on the current displacement direction. The angle between the moving direction vector and the connecting line direction vector is determined based on the azimuth angle between the moving direction vector and the connecting line. Calculate the expected dwell time of the terminal in the current time slot based on the straight-line distance between the terminal and each available edge node and the included angle; The pre-deployment fitness of each available edge node is calculated based on the expected dwell time and the average moving speed of the terminal in the current time slot. The available edge node with the highest pre-deployment adaptability is determined as the pre-deployment target node.

[0015] As a preferred embodiment, the resource utilization rate is the maximum of the computing resource utilization rate and the storage resource utilization rate of the corresponding edge server; The mapping function is a cubic polynomial function that decreases as the resource utilization rate increases, and the cubic polynomial function satisfies the following conditions: when the resource utilization rate is at its minimum value, the task acceptance probability is the preset maximum task acceptance probability; when the resource utilization rate is at its maximum value, the task acceptance probability is the preset minimum task acceptance probability; and there is an inflection point at the preset resource utilization rate inflection point.

[0016] As a preferred embodiment, the node determination module determines the pre-deployment target node based on the task acceptance probability, including: The node determination module performs probability experiments for each available edge server based on the corresponding task acceptance probability. Based on the results of the probability experiment, determine the available edge servers that accept pre-deployment and the available edge servers that reject pre-deployment; The available edge servers that accept pre-deployment are determined in a distributed manner as the pre-deployment target nodes, so that multiple available edge servers can be used as pre-deployment target nodes at the same time. If all available edge servers refuse pre-deployment in the probabilistic test, the available edge server with the most idle resources will be identified as the target node for pre-deployment.

[0017] As a preferred embodiment, the decision module solves the transfer decision model using a reinforcement learning algorithm, including: The decision module calculates the reward value of each decision step of the migration decision model based on a preset reward function, and updates the value function and strategy function of the migration decision model according to the reward value; The reward value is calculated each time the terminal calls a new successor microservice in the service function chain, and the preset reward function is determined based on the number of hits, the number of misses, and the storage resources occupied by the pre-deployed successor microservices.

[0018] As a preferred embodiment, the vector construction module constructs the state vector of the Markov decision process in the current time slot based on the relative position of the terminal and the currently hosted edge server, including: The vector construction module divides the service coverage of the currently hosted edge server into multiple ring intervals; each ring interval corresponds to a discrete state value, and the multiple ring intervals are divided according to a non-uniform partitioning strategy. Based on the annular interval into which the terminal falls, determine the discrete state value corresponding to the relative position between the terminal and the currently hosted edge server, and construct the state vector based on the discrete state value.

[0019] Accordingly, this application also provides a terminal 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 terminal service migration method under the microservice architecture.

[0020] Accordingly, this application also provides a computer-readable storage medium, which includes a stored computer program, wherein the computer program, when running, controls the device where the computer-readable storage medium is located to execute the terminal service migration method under the microservice architecture.

[0021] Compared with the prior art, this invention application has the following beneficial effects: This invention provides a terminal service migration method, system, device, and medium under a microservice architecture. Compared to existing technologies that only initiate migration when the terminal has actually completed the switch or the service quality has deteriorated, this invention, based on a pre-deployment quantity decision, pre-creates a corresponding number of microservice instances on the pre-deployment target node. When a terminal is detected to be moving across base stations, a migration request is directly sent to that node to switch connections. During cross-base station movement, only routing and connection switching are required, completely eliminating the long waiting process of microservice instance cold start, environment initialization, and real-time full data transmission, significantly reducing the overall latency of service migration. Furthermore, by constructing a state vector based on the service function chain execution status and relative position, and solving the strategy using a reinforcement learning algorithm, the pre-deployment quantity decision for subsequent microservices is output, rather than migrating all microservices in full. This approach avoids single points of failure. Compared to existing technologies that "deploy and migrate all related microservices in a delayed and indiscriminate manner," this invention can determine the number of pre-deployed instances as needed based on the current progress and location. While ensuring service continuity, it minimizes ineffective deployments, significantly saves network bandwidth overhead and computing and storage resources of edge nodes, and is highly suitable for resource-constrained edge computing environments. Furthermore, by taking the execution status of the service function chain currently requested by the terminal as a key component and incorporating it into the state vector of the Markov decision process in the current time slot for unified modeling, the migration decision process can perceive the complex and dynamic forward and backward collaborative dependencies between microservices in real time and accurately. This effectively avoids the risk of the entire service flow being blocked, interrupted, or experiencing a sharp decline in performance due to the delayed or missing migration of a key microservice instance in the microservice environment, and fully leverages the advantages of highly continuous edge computing services. Attached Figure Description

[0022] Figure 1 This is a flowchart illustrating an embodiment of the terminal service migration method under a microservice architecture provided in this invention application.

[0023] Figure 2 This is a schematic diagram illustrating the service range division of an embodiment of the edge server provided in this invention application.

[0024] Figure 3 This is a schematic diagram of state transitions for an embodiment of the Markov decision process provided in this application.

[0025] Figure 4 This is a schematic diagram illustrating the calculation principle of an embodiment of the expected dwell time of a terminal-edge collaborative terminal provided in this invention application.

[0026] Figure 5 This is a schematic diagram illustrating the effect of one embodiment of the influence of the value of c on the mapping function provided in this invention application.

[0027] Figure 6 This is a schematic diagram of the movement trajectory of one embodiment of the test case provided in this application.

[0028] Figure 7 This is a comparative schematic diagram of an embodiment of the average migration delay performance of different algorithms provided in this invention application.

[0029] Figure 8 This is a schematic diagram of an embodiment of the terminal service migration system under the microservice architecture provided in this application. Detailed Implementation

[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0031] Example 1 Please refer to Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the terminal service migration method under a microservice architecture provided in this invention application.

[0032] Figure 1 The illustrated embodiment includes steps S101 to S104; each step is described in detail below: Step S101: Based on the execution status of the service function chain currently requested by the terminal and the relative position of the terminal and the currently hosted edge server, construct the state vector of the Markov decision process in the current time slot.

[0033] Specifically, this embodiment models the service migration process of a (mobile) terminal as a Markov Decision Process (MDP). The MDP consists of states and transitions between states, and its state space is represented by a vector composed of two components: the services in the service function chain currently requested by the terminal that are in an active state, and the relative distance between the terminal and the currently hosted edge server. In this embodiment, the execution status of the service function chain is specifically represented by the services in the chain that are in an active state, and the relative position is specifically represented by the discrete state value of the relative distance after discretization.

[0034] The active service is defined as the microservice currently executing in the service function chain, as well as the pre-deployed successor microservices determined by the agent's decision. The agent can decide the number of pre-deployed successor microservices and adjust the number of pre-deployed successor microservices based on feedback from the reward function during the decision-making process.

[0035] For the relative distance, since it is a continuous quantity while the state space of the Markov decision process is discrete, it needs to be discretized. This involves dividing the service coverage area of ​​each edge server into multiple annular intervals, each corresponding to a discrete state value, such as... Figure 2 The diagram shown illustrates the partitioning in one embodiment. As a basic partitioning method, an equal-interval discretization strategy can be adopted. For example, if the service coverage area of ​​the server is d, the circular coverage area is evenly divided into several annular intervals. From the center of the server to the edge of the service coverage area, discrete state values ​​are sequentially assigned, thereby mapping the continuous relative distance between the terminal and the server into a discrete state space, which is suitable for the Markov decision process framework.

[0036] After discretizing the service distance intervals, the states of the Markov decision process for proactive pre-deployment and service migration can be defined. Each state is represented by a vector consisting of an active microservice and the aforementioned discrete distance, separated by a comma. Taking a service function chain consisting of three microservices as an example, the vector uniquely identifies the number of pre-deployed microservices and the relative distance between the terminal and the server.

[0037] Furthermore, the states in the Markov decision process can be divided into several blocks according to the number of pre-deployed microservices. The q-th block contains all the states in which the agent actively pre-deploys q consecutive successor microservices. Here, q = 0 corresponds to the on-demand microservice creation mode, where an instance of a service is created only when the microservice is called. This method saves edge resources but may increase service latency for users. q = k (where k represents the number of microservices constituting the service function chain) indicates that all microservice instances constituting the service function chain are deployed during service function chain initialization. This method consumes more service resources, but its service latency is relatively the lowest because all microservices are pre-created. Other values ​​of q (0 < q < k) indicate that the agent calls the first microservice and pre-deploys q successor microservices during initialization.

[0038] The state transitions in the Markov decision process include intra-block transitions, inter-block transitions, and service migration state transitions. Intra-block transitions occur when a terminal moves from one geographical location to another, or when it moves from a completed microservice to the next microservice to be executed in a service function chain workflow. These transitions allow a state to transition back to its own state. Inter-block transitions always occur when the microservice workflow completes the current microservice, i.e., when the next microservice is called. This represents the agent's decision to change the number of pre-deployed microservices based on the terminal's geographical location. Transitions that increase or decrease the number of pre-deployed microservices are allowed, but there are no transitions that redeploy microservice instances that have already been initialized and started executing. Service migration state transitions occur when a terminal moves from one service region to another. If the new service region has only one available server, the microservice migrates to that server. After the terminal enters the new service region, the Markov decision process still behaves in the same form as before. It should be noted that the relative distance in the state vector only represents the distance between the terminal and the edge server currently providing the service, and is independent of which target nodes are pre-deployed to or the number of pre-deployed microservices.

[0039] In some preferred embodiments, constructing the state vector of the Markov decision process in the current time slot based on the relative position of the terminal and the currently hosted edge server includes: The service coverage area of ​​the currently hosted edge server is divided into multiple ring intervals; each ring interval corresponds to a discrete state value, and the multiple ring intervals are divided according to a non-uniform division strategy. Based on the annular interval into which the terminal falls, determine the discrete state value corresponding to the relative position between the terminal and the currently hosted edge server, and construct the state vector based on the discrete state value.

[0040] Specifically, considering that the edge areas of the server service coverage are often more sensitive and important for service migration, equal-interval division may not be able to capture the characteristics of the edge areas. Therefore, this embodiment preferably adopts a non-uniform interval division strategy. As an implementation method, a logarithmic function is used for division, which can provide a more refined division in areas farther from the center while maintaining the same coverage area.

[0041] If the service coverage area of ​​the server is known, the dividing points of each interval can be generated by the following formula: ; In the formula, β is a parameter that controls the distribution of points within the interval. Is it an edge node (or server) b? j The maximum distance from the center of each service interval (which can be represented as the distance from the edge node to the center of the circle) q (the proportion of each interval point to the entire edge node service coverage area), d j It is a server (or edge node). Service coverage, Q dp Indicates the number of intervals divided. A set representing interval indices. Discretization granularity Q. dp The number of intervals (as defined above) needs to be weighed based on the specific requirements of the problem; a larger Q... dp It can improve the accuracy of state representation, but it increases computational complexity; conversely, a smaller Q... dp Discretization can reduce the number of states and computational load, but it may reduce the precision of state representation. Therefore, in practical applications, it is necessary to choose an appropriate discretization granularity based on the complexity of the problem and the available computing power.

[0042] As another approach, in areas with more pronounced geographical boundaries, such as logistics parks and industrial production workshops, a non-uniform partitioning strategy based on importance can be designed according to actual needs. This involves determining the threshold of edge areas by analyzing road distribution or geographical characteristics, and increasing the interval density near these thresholds to define the service range boundaries of edge nodes. Satisfy the following formula: ; In the formula, the function f is a monotonically increasing function designed based on the importance of edge regions. It should be noted that the granularity of discretization needs to be weighed according to the specific problem requirements: a larger number of intervals can improve the accuracy of state representation, but increase computational complexity; a smaller number of intervals can reduce the number of states and reduce computational load, but may reduce the accuracy of state representation. Therefore, in practical applications, an appropriate discretization granularity can be selected based on the complexity of the problem and the available computing power. Based on the annular intervals obtained from the above non-uniform division, the discrete state value corresponding to the relative position of the terminal can be determined according to the annular interval it falls into, and the state vector can be constructed accordingly.

[0043] In some embodiments, the state transition diagram of a Markov decision process is as follows: Figure 3 As shown in the figure, this diagram illustrates Q. dp =4 and is a state transition diagram of a service function chain consisting of three microservices. Each rounded rectangle in the diagram represents a state. State 0 represents the initial state. When the service function chain has not started execution or has finished execution, it is defined as being in the initial state.

[0044] In this state transition diagram, the application includes three microservices, represented as follows: , and Assuming the terminal u The geographical location is at the server b Within the interval 1 of 1, and the agent is on the server b 1. The above is the terminal. u The service was initialized. And the terminal's geographical location is in interval 2, then the terminal u In MDP, the state is represented as a vector. If the agent is on the server b 1. The above is the terminal. u initialization At the same time, If pre-deployment is performed, then the terminal u In MDP, the state is represented as a vector. Similarly, state This indicates that the intelligent agent is on the server. b 1. The above is the terminal. u initialization ms At the same time as 1, and Pre-deployment was carried out. Therefore, vectors It uniquely identifies the number of pre-deployed microservices and the relative distance between the endpoint and the server, among which A service that indicates its activity status.

[0045] Step S102: Identify the cooperation relationship type of the terminal and determine the pre-deployment target node based on the cooperation relationship type.

[0046] Specifically, a terminal may be within the service range of at least one edge server while in motion, so the target node for pre-deployment needs to be determined before microservice pre-deployment.

[0047] This embodiment uses the terminal's willingness to upload and share detailed mobile information data such as its geographical location, speed, and direction of movement as the basis for classification. It identifies the cooperative relationship type of the terminal and adopts an appropriate pre-deployment target node determination method for different cooperative relationship types, thereby meeting the needs of different types of users and improving the overall system performance and reliability.

[0048] In some preferred embodiments, the cooperative relationship type includes end-to-end cooperative terminals and non-cooperative terminals; The step of determining the pre-deployment target node based on the cooperation relationship type includes: If the terminal is an edge-cooperative terminal, then the pre-deployment fitness of each available edge node is calculated based on the mobile information uploaded by the terminal, and the pre-deployment target node is determined based on the pre-deployment fitness. If the terminal is a non-cooperative terminal, the resource utilization rate of each available edge server is obtained, and the resource utilization rate is converted into a task acceptance probability through a preset mapping function. Then, the pre-deployment target node is determined based on the task acceptance probability.

[0049] Specifically, the edge-cooperative terminal can cooperate with edge nodes to upload mobile information data to improve the service migration experience, enabling the pre-deployment strategy to be optimized based on accurate location and mobility data, thereby improving the accuracy of service migration. On the other hand, the non-cooperative terminal is unwilling to share the above detailed mobile information data due to privacy protection, data security or energy consumption limitations. In this case, a probability determination method based on edge server resource utilization is adopted. When edge resources are sufficient, the number of pre-deployment node targets is increased to improve the pre-deployment hit rate, and the number of pre-deployment targets is reduced when resources are scarce.

[0050] As a preferred embodiment, the step of calculating the pre-deployment fitness of each available edge node based on the mobile information uploaded by the terminal, and determining the pre-deployment target node based on the pre-deployment fitness, includes: Obtain the current displacement direction of the terminal; and determine the connection direction vector from the terminal to each available edge node based on the current displacement direction; The angle between the moving direction vector and the connecting line direction vector is determined based on the azimuth angle between the moving direction vector and the connecting line. Calculate the expected dwell time of the terminal in the current time slot based on the straight-line distance between the terminal and each available edge node and the included angle; The pre-deployment fitness of each available edge node is calculated based on the expected dwell time and the average moving speed of the terminal in the current time slot. The available edge node with the highest pre-deployment adaptability is determined as the pre-deployment target node.

[0051] Specifically, this embodiment proposes the concept of pre-deployment fitness for edge-cooperative terminals to evaluate the availability of pre-deployment targets. First, direction vectors are used... Indicates terminal u i The direction of movement, and using This represents the direction vector of the line connecting the terminal and the edge node hosting its task, where the direction vector is determined by the direction of the user equipment's current displacement and can be calculated using the following formula: ; In the formula, Represents edge node b j The x-coordinate of the position, Represents edge node b j The y-coordinate of the position, Indicates terminal u i exist t The x-axis of the time slot, Indicates terminal u i exist t The vertical axis at the time slot.

[0052] From the aforementioned movement direction vector and the connecting line direction vector, the azimuth angle between them can be calculated, thereby determining the angle between the terminal's movement direction and the connecting line. The calculation is shown in the following formula: ; Furthermore, recording the straight-line distance between the terminal and the edge node hosting its task, and combining this with the aforementioned included angle (azimuth), the terminal u... i The expected distance traveled within the current time slot t satisfies the following equation: ; In the formula, This indicates the expected stay time (see the calculation diagram below). Figure 4 As shown), terminal u i The straight-line distance between the edge node hosting its task and the edge node is , Indicates terminal u i The distance between the position reached at the end of the current time slot and the edge node.

[0053] Finally, based on the expected dwell time and the terminal's average moving speed within the current time slot, the pre-deployment fitness is defined as follows: ; in, For the aforementioned pre-deployment adaptability, For the terminal i In the time slot t Average internal moving speed.

[0054] When the reinforcement learning agent makes a pre-deployment decision, it calculates the pre-deployment fitness of each available edge node in the current time slot by combining the above formulas, and takes the available edge node with the largest pre-deployment fitness as the pre-deployment target node of the edge-end cooperative terminal.

[0055] Preferably, the resource utilization rate is the maximum of the computing resource utilization rate and the storage resource utilization rate of the corresponding edge server; The mapping function is a cubic polynomial function that decreases as the resource utilization rate increases, and the cubic polynomial function satisfies the following conditions: when the resource utilization rate is at its minimum value, the task acceptance probability is the preset maximum task acceptance probability; when the resource utilization rate is at its maximum value, the task acceptance probability is the preset minimum task acceptance probability; and there is an inflection point at the preset resource utilization rate inflection point.

[0056] Specifically, for non-cooperative terminals, since they cannot provide detailed mobile information data, this embodiment improves the service migration quality of such terminals by redundant deployment of microservice instances, and proposes a probability determination method based on edge server resource utilization. Let edge server b... j resource utilization rate Take the computational resource utilization rate With storage resource utilization The maximum value in is shown in the following formula: ; To encourage more nodes with abundant edge resources to participate in pre-deployment and fewer nodes with scarce resources, this embodiment uses a mapping function to map the resource utilization of edge nodes to the task acceptance probability, causing the task acceptance probability to decrease as resource utilization increases. This embodiment employs a cubic polynomial for nonlinear mapping design. Leveraging the concavity and convexity of the cubic polynomial, it rapidly increases the acceptance probability when resource utilization is low and quickly decreases it when resource utilization is high. The polynomial mapping function to be solved is expressed as follows: ; To determine the coefficients to be found in the above mapping function, the maximum and minimum task acceptance probabilities of the edge nodes are denoted as 1 and 0.1, respectively. In this embodiment, these probabilities are preferably set to 1 and 0.1, respectively. Combining this with the resource utilization rate, which ranges from 0 to 1, we can obtain that the task acceptance probability when the resource utilization rate is at its minimum is equal to the maximum task acceptance probability P. max When resource utilization reaches its maximum value, the task acceptance probability is at its minimum, P. min These two constraints; additionally, a third constraint is obtained by setting the resource utilization inflection point to 0.7. Substituting these three constraints, the following equations are obtained: ; ; ; In the formula, a , b and c Since there are three unknowns, we can see from the above equation that there are three unknowns. a , b , c In addition to the two equations, an independent equation is needed to uniquely determine all unknowns, where d is an intermediate variable. Taking the boundary conditions in the above equations, we can derive the value of d as P. max .

[0057] Since the total number of coefficients to be determined exceeds the number of independent equations, there exists one degree of freedom. In this embodiment, one coefficient can be selected as a variable, and the remaining coefficients can be represented by an expression containing that variable. This allows for visualization through graphing, observing the behavior of the mapping function graph as a function of that variable, thus reducing the subjective factors of manually determining conditions and providing a more intuitive understanding. Since the total number of unknowns is three, and the two equations have one more degree of freedom, one of these can be selected... c As variables, a and b Use containing c The expression is expressed so that the mapping function is reduced to only [the expression]. c An unknown quantity can be observed by plotting the graph of the mapping function. c Changeable properties. Figure 5 The graph of the mapping function is shown. c The varying series of values, as tested experimentally, when c Satisfactory results can be obtained when the value is [-2, 1.25].

[0058] As another preferred embodiment, determining the pre-deployment target node based on the task acceptance probability includes: For each available edge server, probability experiments were conducted based on the corresponding task acceptance probability. Based on the results of the probability experiment, determine the available edge servers that accept pre-deployment and the available edge servers that reject pre-deployment; The available edge servers that accept pre-deployment are determined in a distributed manner as the pre-deployment target nodes, so that multiple available edge servers can be used as pre-deployment target nodes at the same time. If all available edge servers refuse pre-deployment in the probabilistic test, the available edge server with the most idle resources will be identified as the target node for pre-deployment.

[0059] Specifically, the probability-based determination method is executed in a distributed manner for each edge server when service migration occurs at the terminal. This means that multiple edge servers may perform pre-deployment simultaneously, increasing the pre-deployment hit rate and improving service quality. Thus, when an edge server has sufficient resources, that node is more likely to pre-deploy instances to fully utilize idle resources and improve the pre-deployment hit rate. Conversely, when resources are scarce, the probability of not pre-deploying is higher, and the pre-deployment task is instead assigned to nodes with more abundant resources. Furthermore, to avoid pre-deployment failure, if all available edge servers refuse pre-deployment in the probabilistic trial, a greedy strategy is used to deploy the instance to the node with the most idle resources. The above pre-deployment steps establish the initial state for subsequent reinforcement learning and select the target pre-deployment node, which is then input into the subsequent reinforcement learning algorithm to address the issue of pre-deploying several microservices on the target node.

[0060] Step S103: Input the state vector and the pre-deployed target node into a preset migration decision model, and solve the migration decision model by reinforcement learning algorithm to obtain the pre-deployment quantity decision for the subsequent microservices in the service function chain.

[0061] Specifically, the aforementioned Markov decision process model provides the underlying logic for solving the service migration problem. It includes all possible states and transitions in a mobile terminal scenario. The states reflect the deployment status of microservices in the microservice workflow, and the transitions between states are jointly determined by the movement of the terminal over time, changes in the microservice workflow, and the decisions of the agent.

[0062] Based on this, the migration decision model can learn the value function and policy function by the reinforcement learning agent during the exploration of the environment. It can also adjust the proactive pre-deployment strategy in real time by taking into account the location of the terminal, the execution status of the service function chain, and the utilization of edge resources. This results in the output of the pre-deployment quantity decision for the subsequent microservices in the service function chain, i.e., the number of microservices pre-deployed on the selected pre-deployment target node, in order to obtain the best strategy for long-term cumulative rewards.

[0063] In some preferred embodiments, the step of solving the transfer decision model using a reinforcement learning algorithm includes: The reward value of each decision step in the migration decision model is calculated based on a preset reward function, and the value function and policy function of the migration decision model are updated according to the reward value. The reward value is calculated each time the terminal calls a new successor microservice in the service function chain, and the preset reward function is determined based on the number of hits, the number of misses, and the storage resources occupied by the pre-deployed successor microservices.

[0064] Specifically, the reinforcement learning reward function r defined in this embodiment is as follows: ; In the formula, v hit The number of microservices pre-deployed after each time slot ends. For v hit The complement of the set represents the number of pre-deployed microservices that were not hit. To deploy microservices The storage resources used. The reward value is calculated each time the terminal calls a new microservice in the service function chain, and the value function (Q value) and strategy function are updated accordingly. It should be noted that when calculating the number of missed pre-deployed microservices, if multiple edge servers are pre-deployed and ultimately not called, the number of missed services is only counted once and not counted repeatedly; the reward is only related to whether it is a hit or not, whether the deployment is wasted, and the resources consumed, and is not related to which nodes it is pre-deployed to or how many nodes it is pre-deployed to.

[0065] Furthermore, as a specific implementation of the reinforcement learning algorithm, this embodiment employs a Dyna-Q+-based reinforcement learning method to solve the policy for the transfer decision model. The Dyna-Q+ method is an improved version of the Dyna-Q algorithm, introducing an exploration incentive mechanism for unvisited states to address the problem of Dyna-Q potentially getting trapped in local optima. In each iteration, Dyna-Q+ first interacts with the environment and updates the value function and policy function, then performs a specified number of model simulation predictions, similarly updating the value function and policy function, thereby simultaneously utilizing real-world experience from interacting with the environment and the model's predictive sampling.

[0066] The formula for updating the Q value using real-world experience is shown below: ; In the formula, This represents the updated Q value. This represents the Q value before the update. Represents a state-action pair.

[0067] The formula includes a learning rate and a discount factor, where the discount factor takes a value between 0 and 1. During the update process, the transition results and rewards for state-action pairs need to be recorded, along with the time of the last visit to that state. For each state-action pair, the time difference since the last visit is calculated, and the exploration reward is generated accordingly. As shown in the following formula: ; In the formula, It is a positive adjustment parameter used to control the intensity of the exploration stimulus. This indicates the time when the state was last accessed.

[0068] Then, random samples are taken from the model to obtain the predicted next state and reward, and the Q value is updated in combination with the exploration reward, as shown in the following formula: ; In the formula, It's the learning rate. It is a discount factor (with a value between 0 and 1); It is the action chosen during the exploration process. It refers to the state during the exploration process, rather than the actions and states in actual experience.

[0069] The actions and states used in the formula are those selected during the exploration process, rather than those from actual experience. Through the dual Q-value update mechanism that combines updates based on real experience with model sampling updates, the migration decision model can accelerate the convergence of the optimal Q-function and more effectively handle uncertainties and potential unvisited states in the edge environment, thereby quickly and accurately outputting the optimal microservice pre-deployment quantity decision in scenarios where terminals move across base stations.

[0070] Step S104: Based on the pre-deployment quantity decision, create a corresponding number of microservice instances on the pre-deployment target node, and when the terminal is detected to move across base stations, send a migration request to the pre-deployment target node to switch connections, thereby realizing service migration.

[0071] In this embodiment, based on the pre-deployment quantity decision output in step S103, a corresponding number of successor microservice instances are pre-created on the pre-deployment target node determined in step S102. When the terminal is detected to be moving across base stations, the edge coordination controller promptly sends a migration request to the pre-deployment target node to switch routes and connections. Thus, when moving across base stations occurs, only the switching of routes and connections is required, eliminating the waiting process of cold start of microservice instances, environment initialization, and real-time full data transmission, thereby achieving low-latency service migration.

[0072] To evaluate the performance of the proposed solution in this embodiment, a real-world motion trajectory dataset can be used for verification. For example, in one application instance, a GPS trajectory dataset of taxis in a certain city is used to synthesize test data to simulate the motion trajectory of the terminal in the real world. Figure 6 (This is a schematic diagram of the movement trajectory of the test cases). 250 movement trajectories were selected as mobile terminal test cases. The movement trajectories were converted into location coordinates and limited to a service scenario range of 10×10km. Service function chains were assigned to each mobile terminal, and microservice call times were evenly distributed according to the distance of the movement trajectory. Among them, about 60% of the terminals had a movement speed of 3-12m / s to simulate faster-moving terminals such as vehicles and drones, and about 40% of the terminals had a movement speed of 0.3-3m / s to simulate terminals such as handheld devices. In each type of terminal, edge-cooperative terminals and non-cooperative terminals each accounted for 50%. The k-means algorithm was used to generate the location of each edge server, so that all trajectory points in the scenario were covered by at least one server.

[0073] like Figure 7 As shown, the method of this embodiment is compared with the passive migration strategy of on-demand creation and the probability-based PDMA migration method. When the total resources are 100%, the average migration latency of the method of this embodiment is reduced by about 10.34% on average compared with PDMA and by about 23.32% on average compared with on-demand creation. At the same time, as the total resources of the edge server decrease, the available pre-deployed resources decrease accordingly, and the average latency increases accordingly. This corresponds to the state in which the agent tends to make fewer active pre-deployments (i.e., a smaller number of pre-deployments) when resources are limited. This verifies the effectiveness of the method of this embodiment in reducing service migration latency and improving pre-deployment hit rate and resource utilization.

[0074] Accordingly, such as Figure 8 As shown, this application also provides a terminal service migration system 800 under a microservice architecture, including a vector construction module 801, a node determination module 802, a decision module 803, and a migration module 804; wherein, The vector construction module 801 is used to construct the state vector of the Markov decision process in the current time slot based on the execution status of the service function chain currently requested by the terminal and the relative position of the terminal and the currently hosted edge server. The node determination module 802 is used to identify the cooperation relationship type of the terminal and determine the pre-deployment target node based on the cooperation relationship type; The decision module 803 is used to input the state vector and the pre-deployed target node into a preset migration decision model, and solve the migration decision model by reinforcement learning algorithm to obtain a decision on the pre-deployment quantity of subsequent microservices in the service function chain. The migration module 804 is used to create a corresponding number of microservice instances on the pre-deployment target node based on the pre-deployment quantity decision, and send a migration request to the pre-deployment target node to switch the connection when the terminal is detected to move across base stations, thereby realizing service migration.

[0075] As a preferred embodiment, the cooperative relationship types include end-to-end cooperative terminals and non-cooperative terminals; The step of determining the pre-deployment target node based on the cooperation relationship type includes: If the terminal is an edge-cooperative terminal, then the pre-deployment fitness of each available edge node is calculated based on the mobile information uploaded by the terminal, and the pre-deployment target node is determined based on the pre-deployment fitness. If the terminal is a non-cooperative terminal, the resource utilization rate of each available edge server is obtained, and the resource utilization rate is converted into a task acceptance probability through a preset mapping function. Then, the pre-deployment target node is determined based on the task acceptance probability.

[0076] As a preferred embodiment, the node determination module 802 calculates the pre-deployment fitness of each available edge node based on the mobile information uploaded by the terminal, and determines the pre-deployment target node based on the pre-deployment fitness, including: The node determination module 802 obtains the current displacement direction of the terminal; and determines the connection direction vector from the terminal to each available edge node based on the current displacement direction. The angle between the moving direction vector and the connecting line direction vector is determined based on the azimuth angle between the moving direction vector and the connecting line. Calculate the expected dwell time of the terminal in the current time slot based on the straight-line distance between the terminal and each available edge node and the included angle; The pre-deployment fitness of each available edge node is calculated based on the expected dwell time and the average moving speed of the terminal in the current time slot. The available edge node with the highest pre-deployment adaptability is determined as the pre-deployment target node.

[0077] As a preferred embodiment, the resource utilization rate is the maximum of the computing resource utilization rate and the storage resource utilization rate of the corresponding edge server; The mapping function is a cubic polynomial function that decreases as the resource utilization rate increases, and the cubic polynomial function satisfies the following conditions: when the resource utilization rate is at its minimum value, the task acceptance probability is the preset maximum task acceptance probability; when the resource utilization rate is at its maximum value, the task acceptance probability is the preset minimum task acceptance probability; and there is an inflection point at the preset resource utilization rate inflection point.

[0078] As a preferred embodiment, the node determination module 802 determines the pre-deployment target node based on the task acceptance probability, including: The node determination module 802 performs probability tests for each available edge server based on the corresponding task acceptance probability. Based on the results of the probability experiment, determine the available edge servers that accept pre-deployment and the available edge servers that reject pre-deployment; The available edge servers that accept pre-deployment are determined in a distributed manner as the pre-deployment target nodes, so that multiple available edge servers can be used as pre-deployment target nodes at the same time. If all available edge servers refuse pre-deployment in the probabilistic test, the available edge server with the most idle resources will be identified as the target node for pre-deployment.

[0079] As a preferred embodiment, the decision module 803 solves the policy for the transfer decision model using a reinforcement learning algorithm, including: The decision module 803 calculates the reward value of each step of the migration decision model based on a preset reward function, and updates the value function and strategy function of the migration decision model according to the reward value; The reward value is calculated each time the terminal calls a new successor microservice in the service function chain, and the preset reward function is determined based on the number of hits, the number of misses, and the storage resources occupied by the pre-deployed successor microservices.

[0080] As a preferred embodiment, the vector construction module 801 constructs the state vector of the Markov decision process in the current time slot based on the relative position of the terminal and the currently hosted edge server, including: The vector construction module 801 divides the service coverage of the currently hosted edge server into multiple ring intervals; wherein each ring interval corresponds to a discrete state value, and the multiple ring intervals are divided according to a non-uniform division strategy; Based on the annular interval into which the terminal falls, determine the discrete state value corresponding to the relative position between the terminal and the currently hosted edge server, and construct the state vector based on the discrete state value.

[0081] Accordingly, this application also provides a terminal 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 terminal service migration method under the microservice architecture.

[0082] The processor 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. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal, connecting various parts of the terminal via various interfaces and lines.

[0083] The memory can be used to store the computer program. The processor implements various functions of the terminal by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory 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 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.

[0084] Accordingly, this application also provides a computer-readable storage medium, which includes a stored computer program, wherein the computer program, when running, controls the device where the computer-readable storage medium is located to execute the terminal service migration method under the microservice architecture.

[0085] Wherein, if the modules of the device / terminal equipment / system integration 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 of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, 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.

[0086] Compared with the prior art, this invention application has the following beneficial effects: This invention provides a terminal service migration method, system, device, and medium under a microservice architecture. Compared to existing technologies that only initiate migration when the terminal has actually completed the switch or the service quality has deteriorated, this invention, based on a pre-deployment quantity decision, pre-creates a corresponding number of microservice instances on the pre-deployment target node. When a terminal is detected to be moving across base stations, a migration request is directly sent to that node to switch connections. During cross-base station movement, only routing and connection switching are required, completely eliminating the long waiting process of microservice instance cold start, environment initialization, and real-time full data transmission, significantly reducing the overall latency of service migration. Furthermore, by constructing a state vector based on the service function chain execution status and relative position, and solving the strategy using a reinforcement learning algorithm, the pre-deployment quantity decision for subsequent microservices is output, rather than migrating all microservices in full. This approach avoids single points of failure. Compared to existing technologies that "deploy and migrate all related microservices in a delayed and indiscriminate manner," this invention can determine the number of pre-deployed instances as needed based on the current progress and location. While ensuring service continuity, it minimizes ineffective deployments, significantly saves network bandwidth overhead and computing and storage resources of edge nodes, and is highly suitable for resource-constrained edge computing environments. Furthermore, by taking the execution status of the service function chain currently requested by the terminal as a key component and incorporating it into the state vector of the Markov decision process in the current time slot for unified modeling, the migration decision process can perceive the complex and dynamic forward and backward collaborative dependencies between microservices in real time and accurately. This effectively avoids the risk of the entire service flow being blocked, interrupted, or experiencing a sharp decline in performance due to the delayed or missing migration of a key microservice instance in the microservice environment, and fully leverages the advantages of highly continuous edge computing services.

[0087] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.

Claims

1. A method for migrating terminal services under a microservice architecture, characterized in that, include: Based on the execution status of the service function chain currently requested by the terminal and the relative position of the terminal and the currently hosted edge server, construct the state vector of the Markov decision process in the current time slot; Identify the cooperation relationship type of the terminal, and determine the pre-deployment target node based on the cooperation relationship type; The state vector and the pre-deployed target node are input into a preset migration decision model. The migration decision model is then solved using a reinforcement learning algorithm to obtain a decision on the number of pre-deployed microservices in the service function chain. Based on the pre-deployment quantity decision, a corresponding number of microservice instances are created on the pre-deployment target node, and when the terminal is detected to move across base stations, a migration request is sent to the pre-deployment target node to switch connections, thereby realizing service migration.

2. The terminal service migration method under a microservice architecture as described in claim 1, characterized in that, The types of cooperative relationships include end-to-end cooperative terminals and non-cooperative terminals; The step of determining the pre-deployment target node based on the cooperation relationship type includes: If the terminal is an edge-cooperative terminal, then the pre-deployment fitness of each available edge node is calculated based on the mobile information uploaded by the terminal, and the pre-deployment target node is determined based on the pre-deployment fitness. If the terminal is a non-cooperative terminal, the resource utilization rate of each available edge server is obtained, and the resource utilization rate is converted into a task acceptance probability through a preset mapping function. Then, the pre-deployment target node is determined based on the task acceptance probability.

3. The terminal service migration method under a microservice architecture as described in claim 2, characterized in that, The step of calculating the pre-deployment fitness of each available edge node based on the mobile information uploaded by the terminal, and determining the pre-deployment target node based on the pre-deployment fitness, includes: Obtain the current displacement direction of the terminal; and determine the connection direction vector from the terminal to each available edge node based on the current displacement direction; The angle between the moving direction vector and the connecting line direction vector is determined based on the azimuth angle between the moving direction vector and the connecting line. Calculate the expected dwell time of the terminal in the current time slot based on the straight-line distance between the terminal and each available edge node and the included angle; The pre-deployment fitness of each available edge node is calculated based on the expected dwell time and the average moving speed of the terminal in the current time slot. The available edge node with the highest pre-deployment adaptability is determined as the pre-deployment target node.

4. The terminal service migration method under a microservice architecture as described in claim 2, characterized in that, The resource utilization rate is the maximum of the computing resource utilization rate and the storage resource utilization rate of the corresponding edge server; The mapping function is a cubic polynomial function that decreases as the resource utilization rate increases, and the cubic polynomial function satisfies the following conditions: when the resource utilization rate is at its minimum value, the task acceptance probability is the preset maximum task acceptance probability; when the resource utilization rate is at its maximum value, the task acceptance probability is the preset minimum task acceptance probability; and there is an inflection point at the preset resource utilization rate inflection point.

5. The terminal service migration method under a microservice architecture as described in claim 2, characterized in that, The step of determining the pre-deployment target node based on the task acceptance probability includes: For each available edge server, probability experiments were conducted based on the corresponding task acceptance probability. Based on the results of the probability experiment, determine the available edge servers that accept pre-deployment and the available edge servers that reject pre-deployment; The available edge servers that accept pre-deployment are determined in a distributed manner as the pre-deployment target nodes, so that multiple available edge servers can be used as pre-deployment target nodes at the same time. If all available edge servers refuse pre-deployment in the probabilistic test, the available edge server with the most idle resources will be identified as the target node for pre-deployment.

6. The terminal service migration method under a microservice architecture as described in claim 1, characterized in that, The step of solving the transfer decision model using a reinforcement learning algorithm includes: The reward value of each decision step in the migration decision model is calculated based on a preset reward function, and the value function and policy function of the migration decision model are updated according to the reward value. The reward value is calculated each time the terminal calls a new successor microservice in the service function chain, and the preset reward function is determined based on the number of hits, the number of misses, and the storage resources occupied by the pre-deployed successor microservices.

7. A terminal service migration method under a microservice architecture as described in any one of claims 1 to 6, characterized in that, The step of constructing the state vector of the Markov decision process in the current time slot based on the relative position of the terminal and the currently hosted edge server includes: The service coverage area of ​​the currently hosted edge server is divided into multiple ring intervals; each ring interval corresponds to a discrete state value, and the multiple ring intervals are divided according to a non-uniform division strategy. Based on the annular interval into which the terminal falls, determine the discrete state value corresponding to the relative position between the terminal and the currently hosted edge server, and construct the state vector based on the discrete state value.

8. A terminal service migration system under a microservice architecture, characterized in that, It includes a vector construction module, a node determination module, a decision-making module, and a transition module; among which, The vector construction module is used to construct the state vector of the Markov decision process in the current time slot based on the execution status of the service function chain currently requested by the terminal and the relative position of the terminal and the currently hosted edge server. The node determination module is used to identify the cooperation relationship type of the terminal and determine the pre-deployment target node based on the cooperation relationship type; The decision module is used to input the state vector and the pre-deployed target node into a preset migration decision model, and solve the migration decision model through a reinforcement learning algorithm to obtain a decision on the pre-deployment quantity of subsequent microservices in the service function chain. The migration module is used to create a corresponding number of microservice instances on the pre-deployment target node based on the pre-deployment quantity decision, and send a migration request to the pre-deployment target node to switch the connection when the terminal is detected to move across base stations, thereby realizing service migration.

9. A terminal device, characterized in that, The system includes 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 terminal service migration method under a microservice architecture as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the terminal service migration method under a microservice architecture as described in any one of claims 1 to 7.