Function node migration method and related device
A function node migration method includes obtaining access related information of at least one call chain, where the access related information includes at least one of the following information: a delay of each of N intervals included in the at least one call chain, and a quantity of interaction times between function nodes in each of the N intervals, where N is a positive integer greater than or equal to 1; determining, based on the access related information, P key nodes from a plurality of function nodes that form the N intervals; and migrating the P key nodes. Accordingly, a to-be-migrated function node is determined based on actual data of the call chain. Therefore, the to-be-migrated function node meets a migration requirement.
1 . A method implemented by a computer device, wherein the method comprises:
obtaining access related information of at least one call chain, wherein the at least one call chain comprises function nodes and N intervals among the functions nodes, wherein the access related information comprises a time delay of each of the N intervals and a quantity of interactions of each of the N intervals, wherein the quantity of interactions of each of the N intervals comprises an average quantity of interaction times in a plurality of statistical periods between two function nodes forming one interval, wherein each interaction time is counted when a first function node of the two function nodes sends a processing result to a second function node of the two function nodes, wherein statistics of the quantity of interaction times are periodically collected within predetermined time intervals that define the plurality of statistical periods, wherein the average quantity of interaction times is calculated across the plurality of statistical periods, and wherein N is a positive integer greater than or equal to 1; and
migrating, based on the access related information, P key nodes from the function nodes, wherein P is a positive integer greater than or equal to 1.
2 . The method of claim 1 , further comprising:
determining, based on the access related information, N migration degrees, wherein the N migration degrees are in a one-to-one correspondence with the N intervals and are positively correlated with the time delay of each of the N intervals and the quantity of interactions;
determining, based on the N migration degrees, M intervals in the N intervals, wherein a first migration degree of any interval in the M intervals is greater than a second migration degree of any interval in the N intervals other than the M intervals; and
determining, based on the M intervals, the P key nodes, wherein the P key nodes belong to the M intervals.
3 . The method of claim 2 , wherein determining the N migration degrees comprises:
determining a weight (W ij ) corresponding to a delay of an N ij th interval in the N intervals, wherein the N ij th interval is a j th interval of an i th call chain in the at least one call chain, wherein i and j are positive integers greater than or equal to 1, and wherein N ij =1, 2, . . . , or N; and
determining, based on the W ij and the average quantity of interaction times between function nodes in the N ij th interval, an N ij th migration degree in the N migration degrees.
4 . The method of claim 2 , wherein migrating the P key nodes comprises:
determining a destination server from a plurality of servers;
determining whether the destination server meets a migration requirement of an x th key node in the P key nodes, wherein x=1, . . . , or P;
migrating the x th key node to the destination server when the destination server meets the migration requirement; and
determining another destination server from the plurality of servers when the destination server does not meet the migration requirement.
5 . The method of claim 4 , wherein determining whether the destination server meets the migration requirement comprises:
determining whether a function node running on the destination server is in an anti-affinity relationship with the x th key node;
determining that the destination server does not meet the migration requirement of the x th key node when the function node running on the destination server is in the anti-affinity relationship; and
determining that the destination server meets the migration requirement of the x th key node when the function node running on the destination server is not in the anti-affinity relationship.
6 . The method of claim 4 , wherein determining whether the destination server meets the migration requirement comprises:
determining that the destination server does not meet the migration requirement of the x th key node when first hardware information of the x th key node conflicts with second hardware information of the destination server; and
determining that the destination server meets the migration requirement of the x th key node when the first hardware information of the x th key node does not conflict with the second hardware information.
7 . The method of claim 4 , wherein determining whether the destination server meets the migration requirement comprises:
determining whether a computing resource of the destination server meets the migration requirement;
determining that the destination server does not meet the migration requirement when the computing resource does not meet the migration requirement; and
determining that the destination server meets the migration requirement when the computing resource meets the migration requirement.
8 . The method of claim 4 , wherein the destination server is either a first server on which a reference function node corresponding to the x th key node is located or a second server adjacent to the first server, and wherein the reference function node and the x th key node are two function nodes in one of the M intervals.
9 . The method of claim 2 , further comprising determining, based on the N migration degrees and a connection relationship between the N intervals, a topology diagram, wherein the topology diagram represents the connection relationship and a migration degree corresponding to each of the N intervals.
10 . A computer device, comprising:
a memory configured to store instructions; and
a processor coupled to the memory and configured to execute the instructions to cause the computer device to:
obtain access related information of at least one call chain, wherein the at least one call chain comprises function nodes and N intervals among the function nodes, wherein the access related information comprises a time delay of each of the N intervals and a quantity of interactions of each of the N intervals, wherein the quantity of interactions of each of the N intervals comprises an average quantity of interaction times in a plurality of statistical periods between two function nodes forming one interval, wherein each interaction time is counted when a first function node of the two function nodes sends a processing result to a second function node of the two function nodes, wherein statistics of the quantity of interaction times are periodically collected within predetermined time intervals that define the plurality of statistical periods, wherein the average quantity of interaction times is calculated across the plurality of statistical periods, and wherein N is a positive integer greater than or equal to 1; and
migrate, based on the access related information, P key nodes from the function nodes, wherein P is a positive integer greater than or equal to 1.
11 . The computer device of claim 10 , wherein the processor is further configured to execute the instructions to cause the computer device to:
determine, based on the access related information, N migration degrees, wherein the N migration degrees are in a one-to-one correspondence with the N intervals and are positively correlated with the time delay of each of the N intervals and the quantity of interactions;
determine, based on the N migration degrees, M intervals in the N intervals, wherein a first migration degree of any interval in the M intervals is greater than a second migration degree of any interval in the N intervals other than the M intervals; and
determine, based on the M intervals, the P key nodes, wherein the P key nodes belong to the M intervals.
12 . The computer device of claim 11 , wherein the processor is further configured to execute the instructions to cause the computer device to:
determine a weight (W ij ) corresponding to a delay of an N ij th interval in the N intervals, wherein the N ij th interval is a j th interval of an i th call chain in the at least one call chain, wherein i and j are positive integers greater than or equal to 1, and wherein N ij =1, 2, . . . , or N; and
determine, based on the W ij and the average quantity of interaction times between function nodes in the N ij th interval, an N ij th migration degree in the N migration degrees.
13 . The computer device of claim 11 , wherein the processor is further configured to execute the instructions to cause the computer device to:
determine a destination server from a plurality of servers;
determine whether the destination server meets a migration requirement of an x th key node in the P key nodes, wherein x=1, . . . , or P;
migrate the x th key node to the destination server when the destination server meets the migration requirement; and
determine another destination server from the plurality of servers when the destination server does not meet the migration requirement.
14 . The computer device of claim 13 , wherein the processor is further configured to execute the instructions to cause the computer device to:
determine whether a function node running on the destination server is in an anti-affinity relationship with the x th key node;
determine that the destination server does not meet the migration requirement of the x th key node when the function node running on the destination server is in the anti-affinity relationship; and
determine that the destination server meets the migration requirement of the x th key node when the function node running on the destination server is not in the anti-affinity relationship.
15 . The computer device of claim 13 , wherein the processor is further configured to execute the instructions to cause the computer device to:
determine that the destination server does not meet the migration requirement of the x th key node when first hardware information of the x th key node conflicts with second hardware information of the destination server; and
determine that the destination server meets the migration requirement of the x th key node when the first hardware information of the x th key node does not conflict with the second hardware information.
16 . The computer device of claim 13 , wherein the processor is further configured to execute the instructions to cause the computer device to:
determine whether a computing resource of the destination server meets the migration requirement;
determine that the destination server does not meet the migration requirement when the computing resource does not meet the migration requirement; and
determine that the destination server meets the migration requirement when the computing resource meets the migration requirement.
17 . The computer device of claim 13 , wherein the destination server is either a first server on which a reference function node corresponding to the x th key node is located or a second server adjacent to the first server, and wherein the reference function node and the x th key node are two function nodes in one of the M intervals.
18 . The computer device of claim 11 , wherein the processor is further configured to execute the instructions to cause the computer device to determine, based on the N migration degrees and a connection relationship between the N intervals, a topology diagram, wherein the topology diagram represents the connection relationship and a migration degree corresponding to each of the N intervals, and wherein the computer device further comprises a display configured to display the topology diagram.
19 . A computer program product comprising instructions stored on a non-transitory computer-readable medium that, when executed by a processor, cause a computer device to:
obtain access related information of at least one call chain, wherein the at least one call chain comprises function nodes and N intervals among the functions nodes, wherein the access related information comprises a time delay of each of the N intervals and a quantity of interactions of each of the N intervals, wherein the quantity of interactions of each of the N intervals comprises an average quantity of interaction times in a plurality of statistical periods between two function nodes forming one interval, wherein each interaction time is counted when a first function node of the two function nodes sends a processing result to a second function node of the two function nodes, wherein statistics of the quantity of interaction times are periodically collected within predetermined time intervals that define the plurality of statistical periods, wherein the average quantity of interaction times is calculated across the plurality of statistical periods, and wherein N is a positive integer greater than or equal to 1; and
migrate, based on the access related information, P key nodes from the function nodes, wherein P is a positive integer greater than or equal to 1.
20 . The computer program product of claim 19 , wherein the instructions further cause the computer device to:
determine, based on the access related information, N migration degrees, wherein the N migration degrees are in a one-to-one correspondence with the N intervals and are positively correlated with the time delay of each of the N intervals and the quantity of interactions;
determine, based on the N migration degrees, M intervals in the N intervals, wherein a first migration degree of any interval in the M intervals is greater than a second migration degree of any interval in the N intervals other than the M intervals; and
determine, based on the M intervals, the P key nodes, wherein the P key nodes belong to the M intervals.