Call relation optimization method and apparatus
By acquiring the topology of microservices, identifying and deleting mismatched call relationships, and optimizing the topology, the problem of messy microservice call relationships is solved, and a more accurate and clear display of microservice calls is achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2025-07-22
- Publication Date
- 2026-07-30
AI Technical Summary
In a microservice architecture, as the number of microservices increases, the calling relationships between microservices in the topology become messy and cannot be effectively represented.
The topological relationships between microservices are obtained through computing devices, the hierarchical levels of calling and called microservices are determined, second call relationships with mismatched levels are deleted, and the topological relationships are optimized using evaluation strategies to ensure that the deleted topological relationships accurately and clearly show the call relationships between microservices.
It improves the accuracy and clarity of topology relationships, ensures the stability and security of call relationships between microservices, and avoids the complexity of call relationships.
Smart Images

Figure CN2025109975_30072026_PF_FP_ABST
Abstract
Description
A method and apparatus for optimizing call relationships
[0001] This application claims priority to Chinese Patent Application No. 202510117337.9, filed on January 23, 2025, entitled "A Method and Apparatus for Optimizing Call Relationships", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of computer technology, and in particular to a method and apparatus for optimizing call relationships. Background Technology
[0003] A topology relation refers to the relative positions and connections between elements or nodes in a system or network, describing the relationships between them. In a microservice architecture, topology relations are used to represent the dependencies or call relationships between microservices. As the number of microservices in a microservice architecture increases, the call relationships between them also grow, leading to a bloated topology. This results in a cluttered and ineffective representation of the call relationships between microservices. Summary of the Invention
[0004] This application provides a method and apparatus for optimizing call relationships, in order to solve the problem that the call relationships between microservices shown in the topology become very messy and the topology cannot effectively show the call relationships between microservices.
[0005] Firstly, this application provides a method for optimizing call relationships. This method can be applied to a computer system or to a computing device that supports the implementation of the method, such as a server or terminal. In one possible example, the call relationship is applied to a cluster of computing devices, which includes at least one computing device in which microservices are deployed. The method includes: the computing device acquiring a topological relationship between multiple microservices, which indicates a first call relationship between multiple groups of microservices; the computing device determining a second call relationship between at least one group of microservices based on the first call relationship between the multiple groups of microservices, and then deleting the second call relationships of N groups of microservices from the topological relationship. Wherein, one group of microservices in the multiple groups includes two microservices, and the at least one group includes a calling microservice and a called microservice, wherein the level of the calling microservice is greater than or equal to the level of the called microservice. The level of the calling microservice indicates the first position of the calling microservice in the topological relationship, and the level of the called microservice indicates the second position of the called microservice in the topological relationship. The at least one group of microservices includes N groups of microservices, where N is greater than or equal to 1.
[0006] In this application, because the level of the calling microservice shown in the second calling relationship is greater than or equal to the level of the called microservice, the second calling relationship in the topology relationship makes the calling relationships between microservices shown in the topology relationship very complex. The computing device removes the second calling relationship from the topology relationship, so that the topology relationship after removing the second calling relationship can accurately and clearly show the calling relationships between microservices.
[0007] In one possible scenario, the calling microservice and the called microservice are in a directed cycle within the topology.
[0008] In one possible scenario, the second calling relationship can also be called a reverse calling relationship.
[0009] In one possible example, the aforementioned multiple microservices include two microservices from a set of microservices.
[0010] In one possible example, the computing device outputs the topology after deleting the second call relationship of N groups of microservices.
[0011] For example, the computing device outputs the topology relationship after deleting the second call relationship of N groups of microservices to the front end, which is a display device or terminal connected to the computing device.
[0012] In one possible implementation, the computing device determines a second call relationship for at least one group of microservices based on a first call relationship among multiple groups of microservices. This includes: the computing device determining the position of multiple microservices in a topology based on the first call relationship among multiple groups of microservices, and then determining the second call relationship for at least one group of microservices based on the position of the multiple microservices in the topology. The position of the first microservice among the multiple microservices indicates the position of the first microservice in a first call chain within the topology, and the first call chain includes the first microservice.
[0013] In this application, since the call chain clearly shows the call path between multiple microservices, the computing device determines the level of a microservice based on its position in the call chain. This clearly expresses the position of multiple microservices in the topology, thereby accurately determining the second call relationship between the calling microservice and the called microservice. This improves the accuracy of deleting the second call relationship in the topology, making the topology after deleting the second call relationship more accurate and clear in showing the call relationship between microservices.
[0014] In one possible scenario, the first call chain indicates the call relationship between Q microservices, which include Q microservices, and Q microservices include the first microservice, where Q is greater than or equal to 2.
[0015] In one possible example, the position of the first microservice in the first call chain of the topology is used to indicate the arrangement position of the first microservice among the Q microservices, which is obtained by arranging them according to the call relationship between the Q microservices.
[0016] For example, Q microservices include microservice a, microservice b, and microservice c, where microservice a calls microservice b, and microservice b calls microservice c. Then, the computing device sorts the microservices according to the aforementioned two sets of first call relationships (microservice a calls microservice b, microservice b calls microservice c), resulting in microservice a → microservice b → microservice c. If it is further determined that microservice a is at level 0, microservice b is at level 1, and microservice c is at level 2...
[0017] If the sorting levels are numbered starting from L0(0), then microservice b is located in L1(1), that is, the position of the first microservice (microservice b) among multiple microservices is L1(1).
[0018] In another possible example, the above arrangement is obtained based on the call relationships between the Q microservices and the number of API calls.
[0019] In this example, the computing device sorts microservices not only based on the calling relationships between microservices, but also on the number of API calls between microservices. If the number of API calls between a group of microservices is less than or equal to a threshold 'a', then the two microservices in that group are at the same level. If the number of API calls between a group of microservices is greater than the threshold 'a', then the two microservices in that group are at different levels.
[0020] For example, microservice b calls microservice c, where microservice c has 10 interfaces, and microservice b only calls 2 of microservice c's interfaces. If threshold a is 4, then microservice a and microservice b are at the same level, such as both being at level 1. If threshold a is 1, then microservice a and microservice b are at different levels, such as microservice a being at level 1 and microservice b being at level 2.
[0021] In one possible implementation, before the computing device deletes the second calling relationship of N groups of microservices in the topology relationship, the calling relationship optimization method further includes: the computing device outputs the second calling relationship of N groups of microservices, and then receives a first request to confirm the deletion of the second calling relationship of N groups of microservices, and in response to the first request, deletes the second calling relationship of N groups of microservices in the topology relationship.
[0022] In this application, since topology is an important way to show the relationship between multiple microservices, modifications to topology (such as deletion, modification, etc.) need to be confirmed, which improves the stability and security of topology.
[0023] In one possible example, the computing device receives a first request from the user to confirm the deletion of a second call relationship of N groups of microservices.
[0024] In one possible example, the computing device outputs a second call relationship of N sets of microservices to the front end.
[0025] For example, the front end includes a terminal or a display device connected to a computing device. The terminal can display the second call relationship of the N groups of microservices received, and the display device can display the second call relationship of the N groups of microservices.
[0026] In one possible implementation, the score of the topology relationship after deleting the second call relationships of N groups of microservices is greater than the score of the topology relationship without deleting the second call relationships of N groups of microservices. The score of the topology relationship is obtained by quantifying the topology relationship using an evaluation strategy.
[0027] In this application, the computing device uses an evaluation strategy to predict the score of the topological relationship before and after deleting the second call relationship of N groups of microservices. If the score of the topological relationship after deleting the second call relationship of N groups of microservices is greater than the score of the topological relationship before deleting the second call relationship of N groups of microservices, the second call relationship of N groups of microservices in the topological relationship is deleted, ensuring that the topological relationship after deleting the second call relationship can more accurately and clearly show the call relationship between microservices compared to the topological relationship before deleting the second call relationship.
[0028] In one possible example, the computing device sequentially predicts the score of the topology relationship after deleting 1-X second call relationships, and the score of the topology relationship without deleting the second call relationships. From the scores of the topology relationships after deleting 1-X second call relationships, it determines the topology relationship with a score higher than the one without deleting the second call relationships. Then, based on the aforementioned determined score, the computing device identifies the corresponding N groups of microservice second call relationships, and deletes the second call relationships of the N groups of microservices from the topology relationship. X represents the number of second call relationships in the topology relationship.
[0029] In one possible implementation, the score of the topology relationship after deleting the second call relationships of N groups of microservices is greater than the score of the topology relationship after deleting the second call relationships of M groups of microservices from at least one group of microservices. Here, M groups of microservices are microservices other than the N groups of microservices in at least one group of microservices, M is greater than or equal to 0, and the score of the topology relationship is obtained by quantifying the topology relationship using an evaluation strategy.
[0030] In this application, the computing device uses an evaluation strategy to predict the score of the topology relationship after deleting the second call relationships of N groups of microservices, and the score of the topology relationship after deleting the second call relationships of M groups of microservices. If the score of the topology relationship after deleting the second call relationships of N groups of microservices is greater than the score of the topology relationship after deleting the second call relationships of M groups of microservices, the second call relationships of the N groups of microservices in the topology relationship are deleted. This ensures that the topology relationship after deleting the second call relationships of N groups of microservices more accurately and clearly shows the call relationships between microservices compared to the topology relationship before deleting the second call relationships of M groups of microservices.
[0031] For example, the above N groups of microservices may include M groups of microservices.
[0032] In one possible example, based on the above example, the computing device determines the score of the topology relationship that is greater than the score of the topology relationship without the deletion of the second call relationship from the scores of the topology relationships after deleting 1-X second call relationships, then determines the score with the largest value from the aforementioned scores, outputs the second call relationship corresponding to the score with the largest value, and receives a first request to confirm the deletion of the second call relationship corresponding to the score with the largest value. In response to the first request, the device deletes the second call relationship corresponding to the score with the largest value from the topology relationships.
[0033] In one possible scenario, the above evaluation strategy is used to indicate: quantifying the topological relationship by utilizing the hierarchy of microservices in the topological relationship, including clusters of P microservices; the topological relationship includes clusters, P is greater than or equal to 2, and the ratio of the number of first call relationships between P microservices to the number of first call relationships indicated by P microservices is greater than or equal to a threshold.
[0034] In this application, the evaluation strategy quantifies the topological relationship from two indicators: hierarchical (level) and cluster (clustering) to score the calling relationship between microservices shown by the topological relationship, so as to ensure that the topological relationship after deleting the second calling relationship can more accurately and clearly show the calling relationship between microservices.
[0035] In one possible example, the number of first call relationships indicated by P microservices is the number of first call relationships indicating any one of the P microservices.
[0036] For example, there are P microservices, including microservice d, microservice e, and microservice f. Microservice d calls microservice e, microservice e calls microservice f, microservice b calls microservice d, and microservice f calls microservice c. Therefore, the number of first call relationships between the P microservices is 2 (e.g., microservice d calls microservice e, microservice e calls microservice f), and the number of first call relationships indicated by the P microservices is 4 (e.g., microservice d calls microservice e, microservice e calls microservice f, microservice b calls microservice d, and microservice f calls microservice c).
[0037] In one possible example, the computing device uses a graph neural network to quantify the topological relationships by analyzing the hierarchy of microservices within the topological relationships, including clusters of P microservices. Alternatively, the computing device uses a graph neural network to quantize the topological relationships.
[0038] In another possible example, the computing device uses a metric to score topological relationships. This metric is a standard used by graph theory models to score topological relationships. Such metrics include one or more of the following: degree centrality, betweenness centrality, clustering coefficient, etc.
[0039] In one possible implementation, the above-mentioned call relationship optimization method further includes: the computing device obtains the interface of the called microservice, and then encapsulates the interface into a second microservice, and adjusts the second call relationship between the calling microservice that calls the interface and the called microservice in the topology relationship into a call relationship between the calling microservice that calls the interface and the second microservice.
[0040] In this application, the computing device can further encapsulate the interface of the called microservice into a second microservice in order to fully display the calling relationship between microservices in the topology. The second calling relationship between the calling microservice and the called microservice in the topology is adjusted to the calling relationship between the calling microservice and the second microservice, so as to avoid the situation of reverse calling between the calling microservice and the called microservice. The topology after adjusting the second calling relationship can more accurately and clearly show the calling relationship between microservices.
[0041] In one possible scenario, the score of the topological relationship before adjusting the second call relationship is lower than the score of the topological relationship after adjusting the second call relationship. The score of the topological relationship is obtained by quantifying the topological relationship using an evaluation strategy.
[0042] In this application, the computing device uses an evaluation strategy to predict the scores of the topology before and after adjusting the second calling relationship. If the score of the topology before adjusting the second calling relationship is lower than the score of the topology after adjusting the second calling relationship, the interface is encapsulated as a second microservice. The second calling relationship between the calling microservice and the called microservice in the topology is adjusted to a calling relationship between the calling microservice and the second microservice. This ensures that the topology after adjusting the second calling relationship more accurately and clearly shows the calling relationships between microservices compared to the topology before adjusting the second calling relationship.
[0043] In one possible example, the number of times the above interface is called is the number of times the interface is called first among the multiple interfaces included in the called microservice, arranged in ascending order.
[0044] In this application, the computing device encapsulates the interfaces corresponding to the number of times they are called in ascending order into a second microservice, and adjusts the second calling relationship between the calling microservice and the called microservice of the calling interface to the calling relationship between the calling microservice and the second microservice. This avoids the aforementioned second calling relationship between the calling microservice and the called microservice, which would complicate the calling relationship between microservices shown in the topology. The adjusted topology more accurately and clearly shows the calling relationship between microservices.
[0045] For example, the number of times the above interface is called is the number of times the interface is called first in ascending order among the number of times the multiple interfaces included in the called microservice are called.
[0046] In another possible example, the number of times the above interface is called is the number of times the interface is called in descending order among the number of times the multiple interfaces included in the called microservice are called.
[0047] The above call count indicates the number of microservices that invoked this interface.
[0048] For example, if the number of times an interface is called is 1, the computing device will remove the interface from the called microservice. Then, the computing device will perform the above-mentioned encapsulation of the interface into a second microservice, and adjust the second calling relationship between the calling microservice that calls the interface and the called microservice in the topology to the second calling relationship between the calling microservice that calls the interface and the second microservice.
[0049] In one possible implementation, before the computing device encapsulates the interface into a second microservice, the call relationship optimization further includes: the computing device outputting the interface of the called microservice and receiving a second request to confirm the splitting of the interface of the called microservice; in response to the second request, performing the encapsulation of the interface into a second microservice; and adjusting the second call relationship between the calling microservice of the calling interface and the called microservice to a second call relationship between the calling microservice of the calling interface and the second microservice.
[0050] In this application, since topology is an important way to show the relationship between multiple microservices, modifications to topology (such as deletion, modification, etc.) need to be confirmed, which improves the stability and security of topology.
[0051] In one possible example, the computing device outputs the interface of the microservice being invoked to the front end.
[0052] Secondly, this application provides a call relationship optimization apparatus. This call relationship optimization apparatus is applied to a computer system or to a computing device that supports the implementation of the call relationship optimization apparatus in the computer system. The call relationship optimization apparatus includes modules for executing the call relationship optimization method in the first aspect or any optional implementation of the first aspect. In one possible example, the call relationship optimization apparatus is applied to a cluster of computing devices, the cluster including at least one computing device, and microservices are deployed on the at least one computing device. Exemplarily, the call relationship optimization apparatus includes:
[0053] The acquisition module is used to obtain the topological relationships between multiple microservices. The topological relationship indicates the initial call relationship between multiple groups of microservices, where one group of microservices consists of two microservices.
[0054] The determination module is used to determine a second invocation relationship for at least one group of microservices based on a first invocation relationship among multiple groups of microservices. One group of microservices includes a calling microservice and a called microservice, where the calling microservice's hierarchy is greater than or equal to the called microservice's hierarchy. The hierarchy of the calling microservice indicates its first position in the topology, and the hierarchy of the called microservice indicates its second position in the topology.
[0055] The delete module is used to delete the second call relationship of N groups of microservices in the topology. At least one group of microservices includes N groups of microservices, where N is greater than or equal to 1.
[0056] For more detailed implementation details regarding the microservice call optimization device, please refer to the description of any of the implementation methods in the first aspect above, as well as the content of the specific implementation methods below, which will not be repeated here.
[0057] Thirdly, this application provides a chip, including: a processor and an interface circuit; the interface circuit is used to obtain the topological relationship between multiple microservices, and the processor is used to execute the method in the first aspect or any possible implementation of the first aspect according to the topological relationship.
[0058] Fourthly, this application provides a computing device cluster. The computing device cluster includes at least one computing device, which includes a memory and a processor. The memory stores computer instructions; when the processor executes the computer instructions, it implements the method described in the first aspect or any possible implementation of the first aspect.
[0059] Fifthly, this application provides a computer-readable storage medium storing a computer program or instructions that, when executed by a processing device, implement the method described in the first aspect or any possible implementation of the first aspect.
[0060] Sixthly, this application provides a computer program product comprising a computer program or instructions that, when executed by a processing device, implement the method in the first aspect or any possible implementation of the first aspect.
[0061] The beneficial effects of aspects two through six above can be referred to in the first aspect or any possible implementation of the first aspect, and will not be elaborated here. Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. Attached Figure Description
[0062] Figure 1 is a schematic diagram of the structure of a computer system provided in this application;
[0063] Figure 2 is a flowchart illustrating a method for optimizing call relationships provided in this application;
[0064] Figure 3 is a schematic diagram of a topological relationship provided in this application;
[0065] Figure 4 is a schematic diagram of a topological relationship provided in this application;
[0066] Figure 5 is a schematic diagram of a topological relationship provided in this application;
[0067] Figure 6 is a flowchart illustrating a method for adjusting call relationships provided in this application;
[0068] Figure 7A is a schematic diagram of a call relationship optimization device provided in this application;
[0069] Figure 7B is a schematic diagram of the structure of a call relationship optimization device provided in this application;
[0070] Figure 8 is a schematic diagram of the structure of a computing device provided in this application;
[0071] Figure 9 is a schematic diagram of the structure of a computing device cluster provided in this application;
[0072] Figure 10 is a schematic diagram of the connection between computing devices provided in this application. Detailed Implementation
[0073] To facilitate understanding, the technical terms used in this application will be introduced first.
[0074] Microservice architecture is an architectural style that breaks down a single application into a set of small, loosely coupled microservices. Each microservice runs independently, is typically designed around a specific business function, and can interoperate through lightweight communication mechanisms such as Hypertext Transfer Protocol (HTTP) or message queues.
[0075] A microservice refers to a specific microservice, which is the building block of a microservice architecture. Each microservice is responsible for a specific function in a system or application and can run and be managed independently. There are calling relationships between any two microservices, such as microservice A calling microservice B. By utilizing these calling relationships between the pairs of microservices, the topology of the multiple microservices can be obtained.
[0076] In a microservices architecture, microservices can be deployed in the cloud or on-premises, depending on the organization's needs, resources, and technology choices. For example, microservices deployed on cloud computing platforms (such as public, private, or hybrid clouds) provide elastic and scalable computing resources and support containerization and automated deployment, making them suitable for rapid microservice scaling. Cloud-based microservices can leverage the basic microservices provided by the cloud computing platform, such as databases, storage, and message queues, and can also better utilize the DevOps tools, monitoring, and log management features offered by the cloud.
[0077] For example, deploying microservices in a self-owned data center or on-premises server is considered an on-premises deployment (or cloud-based deployment). On-premises deployment of microservices is suitable for users with high data security requirements, strict requirements on network latency, or compliance requirements (such as regulations requiring data to be stored locally). On-premises deployment offers greater control, allowing users to manage hardware, network, and resource configurations themselves.
[0078] Another example is a hybrid deployment approach, where some microservices in a system are deployed in the cloud and others are deployed locally. This hybrid deployment approach combines the advantages of cloud and on-premises deployments, adapting to different business needs. For instance, some microservices process sensitive data locally, while other microservices can leverage the scalability of the cloud computing platform.
[0079] In this application, the following description uses the deployment of microservices in the cloud as an example. For the content of deploying microservices on-premises or using a hybrid deployment method, please refer to the description of deploying microservices in the cloud, which will not be repeated in this application.
[0080] To address the problem that as the topological relationships between multiple microservices become increasingly complex, the call relationships between microservices shown in the topological relationships become highly chaotic, and the topological relationships fail to effectively represent the call relationships between microservices, this application provides a call relationship optimization method. The call relationship is applied to a computing device cluster, which includes at least one computing device, on which microservices are deployed. The call relationship optimization method includes: the computing device acquiring the topological relationships between multiple microservices, which are used to indicate first call relationships between multiple groups of microservices; the computing device determining second call relationships for at least one group of microservices based on the first call relationships between the multiple groups of microservices, and then deleting the second call relationships of N groups of microservices from the topological relationships. Wherein, one group of microservices in the multiple groups of microservices includes two microservices, and the at least one group of microservices includes a calling microservice and a called microservice, where the level of the calling microservice is greater than or equal to the level of the called microservice. The level of the calling microservice indicates the first position of the calling microservice in the topological relationships, and the level of the called microservice indicates the second position of the called microservice in the topological relationships. The at least one group of microservices includes N groups of microservices, where N is greater than or equal to 1.
[0081] In this application, because the level of the calling microservice shown in the second calling relationship is greater than or equal to the level of the called microservice, the second calling relationship in the topology relationship makes the calling relationships between microservices shown in the topology relationship very complex. The computing device removes the second calling relationship from the topology relationship, so that the topology relationship after removing the second calling relationship can accurately and clearly show the calling relationships between microservices.
[0082] Next, the call relationship optimization method provided in this application will be described in detail with reference to the accompanying drawings.
[0083] The call relationship optimization method provided in this application can be applied to the computer system shown in Figure 1. Figure 1 is a schematic diagram of the structure of a computer system provided in this application. The computer system includes multiple computing devices, such as computing device 110, computing device 120, and computing device 130. These computing devices 110, 120, and 130 can be connected via channel 140. Channel 140 can be a wired channel or a wireless channel. Microservices, middleware, etc., are deployed on computing devices 110, 120, and 130.
[0084] For details regarding computing devices 110-130, please refer to the descriptions in Figures 8-10 below, which will not be repeated here.
[0085] The following are four possible examples of how microservices, middleware, and other similar technologies can be deployed in computer systems.
[0086] Example 1: Microservice a is deployed on computing device 120, and microservice b and middleware are deployed on computing device 130.
[0087] Example 2: Microservices a and b are deployed on computing device 110, microservice c is deployed on computing device 120, and middleware is deployed on computing device 130.
[0088] Example 3: Microservice a and second microservice b are deployed on computing device 110, and middleware is deployed on computing device 330.
[0089] Example 4: Two components of the same microservice are deployed on two different computing devices. For example, microservice b, a part of microservice a, is deployed on computing device 110, while the other part of microservice a, middleware, is deployed on computing device 120.
[0090] The above is merely an example and should not be construed as limiting this application. In other examples of this application, more or fewer microservices may be deployed on the same computing device, or more components of the same microservice may be deployed on multiple computing devices.
[0091] The aforementioned wired channels can include: Ethernet, fiber optic cables, cloud direct connects, and various peripheral component interconnect (PCIe) buses installed within the computer system to connect region A and region B. A cloud direct connect refers to a physical leased line that directly connects the local network to the data center or other regional networks of a cloud service provider, achieving a high-speed, low-latency, secure, and reliable connection.
[0092] The aforementioned wireless channels can include: the Internet, cloud connectivity, wireless fidelity (Wi-Fi), ultra-wideband (UWB) technology, and remote procedure call (RPC). Cloud connectivity refers to the technology and microservices that connect a local network to other cloud service providers or networks in other regions via the Internet. RPC is a technology used to enable communication between different computing devices or processes in a distributed system. RPC allows one program / microservice to call the procedure or method of another program / microservice as if calling a local procedure, hiding the details of the underlying communication.
[0093] It should be noted that the computer system architecture shown in Figure 1 is merely an example. The types or number of devices within the system can be configured according to actual needs, and this application embodiment does not limit this. For example, the computer system may also include more computing devices.
[0094] The call relationship optimization method shown in Figure 2 can be applied to the computer system (computing device cluster) shown in Figure 1. As shown in Figure 2, which is a flowchart of a call relationship optimization method provided in this application, the method shown in Figure 2 can be executed by any computing device included in the computer system. In this embodiment of the application, the call relationship optimization method is described using the computing device 110 in the computer system as an example. The call relationship optimization method shown in Figure 2 includes the following steps S210-S230.
[0095] S210 and computing device 110 obtain the topological relationships between multiple microservices.
[0096] The topology relationship is used to indicate the first calling relationship among multiple groups of microservices, where one group of microservices includes two microservices.
[0097] In one possible scenario, the topology relationship includes the initial call relationship between each pair of microservices.
[0098] In one possible example, as shown in Figure 3, which is a schematic diagram of a topology provided in this application, the topology shown in Figure 3 includes the first call relationship between microservice a and microservice u. The letters with circles represent the corresponding microservices; for example, □ represents microservice a. Used to represent microservice b. The microservice pointed to by the arrow is the microservice being called, and the microservice with the arrow pointing away is the microservice making the call. For example, □→□ is used to indicate that microservice a calls microservice b.
[0099] For example, the aforementioned groups of microservices include: microservice a and microservice b, microservice b and microservice c, microservice d and microservice e, microservice g and microservice h, etc. Furthermore, the topology illustrates the first call relationship between microservice a and microservice b (microservice a calls microservice b), the first call relationship between microservice b and microservice c (microservice b calls microservice c), the first call relationship between microservice d and microservice e (microservice d calls microservice e), and the first call relationship between microservice g and microservice h (microservice g calls microservice h), etc.
[0100] In one possible implementation, the computing device 110 obtains the topological relationship between multiple microservices, including: the computing device 110 obtains the first call relationship of multiple sets of microservices, and then constructs the topological relationship between multiple microservices based on the first call relationship of multiple sets of microservices.
[0101] In one possible example, since a microservice only stores information about the other microservices it calls, the computing device 110 constructs the topological relationship between multiple microservices through information about each microservice calling other microservices (such as a first call relationship).
[0102] For example, multiple microservices include microservice a, microservice b, and microservice c. The computing device 110 obtains the first call relationship between microservice a and microservice b (microservice a calls microservice b) and the first call relationship between microservice a and microservice b (microservice a calls microservice b), and then determines the topological relationship between microservice a, microservice b, and microservice c as follows: microservice a → microservice b → microservice c.
[0103] For example, multiple microservices include microservice a-microservice u. The computing device 110 constructs the topological relationship shown in Figure 3 based on the first relationship of multiple groups of microservices.
[0104] The following provides several possible examples of how computing device 110 obtains the first call relationship of multiple microservices.
[0105] Example 1: Computing device 110 retrieves the first call relationship from a log containing microservice information. For example, the log containing microservice information is: VPC flow logs (VPCLOG).
[0106] Example 2: Computing device 110 obtains the first call relationship from the microservice mesh in the microservice architecture. For example, the microservice mesh records one or more of the following: the first call relationship between microservices, a call chain recording the call relationship between multiple microservices, and topology relationships.
[0107] Example 3: The computing device 110 obtains the first call relationship or topology relationship through network + process scanning, container network + microservice (service) scanning, application configuration parsing, code parsing and other methods.
[0108] Example 4: Computing device 110 obtains the first call relationship or topology relationship from a microservice registry, a microservice configuration center, a gateway (such as an application programming interface (API) gateway, a middleware gateway, etc.), and configuration information (configuration information of microservices or middleware). For example, the configuration information records the first call relationship between microservices.
[0109] S220 and computing device 110 determine at least one set of microservices' second calling relationships based on the first calling relationships between multiple sets of microservices.
[0110] In one possible scenario, at least one set of microservices includes a calling microservice and a called microservice, wherein the calling microservice is at a level greater than or equal to the called microservice, the level of the calling microservice is used to indicate the first position of the calling microservice in the topology, and the level of the called microservice is used to indicate the second position of the called microservice in the topology.
[0111] In one possible implementation, the computing device 110 determines a second calling relationship of at least one group of microservices based on a first calling relationship among multiple groups of microservices, including: the computing device 110 determines the position of multiple microservices in the topology relationship based on the first calling relationship among multiple groups of microservices, and then determines the second calling relationship of at least one group of microservices based on the position of multiple microservices in the topology relationship.
[0112] Among the multiple microservices, the position of the first microservice is used to indicate the position of the first microservice in the first call chain in the topology relationship, which includes the first microservice.
[0113] In one possible example, the first call chain is the longest call chain in the topology where the first microservice resides. The length of the call chain is determined by the number of microservices it includes. For example, if the call chain is 3 in length, then it includes 3 microservices.
[0114] In one possible example, the position of the first microservice is used to indicate the number of microservices preceding the first microservice in the first call chain. This number of microservices preceding the first microservice in the first call chain is also the number of microservices that directly call the first microservice and the number of microservices that indirectly call the first microservice in the first call chain.
[0115] For example, the first call chain is: microservice a → microservice b → microservice c. In this first call chain, no other microservices call microservice a; only microservice a directly calls microservice b, microservice b directly calls microservice c, and microservice a indirectly calls microservice c through microservice b. Therefore, the hierarchy of microservice c is higher than that of microservice b, and the hierarchy of microservice b is higher than that of microservice a.
[0116] For example, if the microservices are numbered, then microservice a is at level 0, microservice b is at level 1, and microservice c is at level 2.
[0117] In another possible example, building on the example above, computing device 110 further determines the hierarchy of microservices based on the number of interfaces called between microservices.
[0118] For example, the computing device 110 determines the level of a microservice based on the calling relationship between microservices (such as microservice a→microservice b→microservice c shown in the first calling chain) and the number of calling interfaces between pairs of microservices.
[0119] The number of API calls between each pair of microservices indicates the number of API calls made by the first microservice to the second microservice. If the number of API calls made by the first microservice to the second microservice is greater than or equal to threshold 'a', then the level of the second microservice is higher than the level of the first microservice. If the number of API calls made by the first microservice to the second microservice is less than threshold 'a', then the level of the second microservice is equal to the level of the first microservice.
[0120] For example, microservice a has 4 APIs, microservice b has 2 APIs, and microservice c has 6 APIs, with a threshold of 1. If microservice a calls 1 API of microservice b, then the level of microservice a is equal to the level of microservice b; if microservice b calls 3 APIs of microservice c, then the level of microservice c is greater than the level of microservice c. The computing device 110 numbers the microservices according to their levels in the topology, thus obtaining: microservice a is at level 0, microservice b is at level 0, and microservice c is at level 1.
[0121] In yet another possible example, building upon the two examples described above, computing device 110 further determines the hierarchy of multiple microservices in the topology based on the priority of the application, which includes multiple microservices.
[0122] For example, computing device 110 determines the hierarchy of microservices based on the calling relationships between microservices, the number of calls between pairs of microservices, and the priority of the application to which the microservices belong.
[0123] The application priority to which a microservice belongs can be set by the user. The computing device 110 can determine the application to which the microservice belongs, or the priority of that application, from the attributes of the microservice. For example, the priority can be represented as T0, T1, T2, etc., where a higher number after T indicates a lower priority. The computing device 110 determines the starting level of the first call chain to which the microservice belongs based on the priority of the application to which the microservice belongs.
[0124] For example, microservices a, b, and c belong to application A, and microservice d belongs to application B. Application A has a higher priority than application B, and the first call chain of microservice d is microservice d → microservice c. The computing device determines that the level of microservice c is higher than the level of microservice d based on microservice d calling microservice c and microservice d calling an API of microservice c. Furthermore, based on the first possible example above, the level of microservice c is higher than the level of microservice b, and the level of microservice b is higher than the level of microservice a. Since the priority of application A is higher than the priority of application B, when determining the level of the microservices included in application A and application B, the computing device 110 explicitly states that the starting level of application A (e.g., the level of microservice a) is lower than the starting level of application B (e.g., the level of microservice d).
[0125] For example, computing device 110 determines that the starting level of application A is 0, the starting level of application B is 1, and then microservice a is at level 0, microservice b is at level 1, microservice c is at level 2, and microservice d is at level 1.
[0126] Furthermore, based on the content of this example, the computing device 110 determines the level of each microservice in the topology shown in Figure 3, resulting in a topology with level numbers as shown in Figure 4. Figure 4 is a schematic diagram of a topology provided in this application. In Figure 4, the level number of each microservice is represented by a 3-digit number. The first digit indicates the level of the microservice, and the second and third digits indicate the number of the microservice within that level.
[0127] It is worth noting that the hierarchical number of each microservice in Figure 4 can be used as the identifier of the microservice.
[0128] It is worth noting that the number of digits used in the above-mentioned hierarchical numbering is merely an example and should not be construed as limiting this application. In other embodiments of this application, hierarchical numbering may also be represented by more or fewer digits.
[0129] In one possible example, the computing device 110 determines a second calling relationship of at least one group of microservices based on the position of multiple microservices in the topology, including: the computing device 110 determines a group of microservices from the multiple groups of microservices where the level number of the calling microservice is greater than or equal to the level number of the called microservice, and the calling microservice and the called microservice are in a directed loop in the topology, and uses the first calling relationship of the group of microservices as the second calling relationship.
[0130] The aforementioned directed cycle between the calling microservice and the called microservice indicates a circular dependency between them.
[0131] For example, microservice a calls microservice b, microservice b calls microservice c, microservice c calls microservice d, microservice d calls microservice e, and microservice e calls microservice b. In the aforementioned first calling relationship of multiple sets of microservices, the level number of microservice e is greater than the level number of microservice a, and microservice e and microservice a are in a directed cycle (microservice b calls microservice c, microservice c calls microservice d, microservice d calls microservice e, and microservice e calls microservice b). Therefore, computing device 110 determines that at least one set of second calling relationships of microservices includes: microservice e calls microservice b.
[0132] For example, the calling microservice and the called microservice are in a directed cycle in the first call chain.
[0133] It is worth noting that the above description only illustrates the second call relationship of one group of microservices in the first call relationship of multiple groups of microservices. For the content of determining the second call relationship of other groups of microservices in at least one group of microservices, please refer to the description in the above example, which will not be repeated here.
[0134] S230, Computing device 110 deletes the second call relationship of N groups of microservices in the topology relationship.
[0135] The above-mentioned at least one group of microservices includes N groups of microservices, where N is greater than or equal to 1.
[0136] Regarding the deletion of the second call relationship of N groups of microservices in the topology relationship of computing device 110, three possible implementations are provided below.
[0137] In a first possible embodiment, the computing device 110 randomly deletes N sets of second call relationships of microservices from at least one set of second call relationships of microservices to obtain an optimized topology relationship.
[0138] In a second possible embodiment, before the computing device 110 deletes the second call relationship of N groups of microservices in the topology relationship, the computing device 110 outputs the second call relationship of at least one group of microservices, receives the second call relationship of N groups of microservices from the user in the second call relationship of at least one group of microservices, and deletes the second call relationship of N groups of microservices in the topology relationship.
[0139] In one possible implementation, the computing device 110 outputs at least one set of second call relationships for microservices to the front end, which then displays these at least one set of second call relationships and receives N sets of second call relationships for microservices from the at least one set of second call relationships. The front end sends the N sets of second call relationships for microservices from the at least one set of second call relationships to the computing device 110, and the computing device 110 then deletes the N sets of second call relationships for microservices from the topology.
[0140] The aforementioned front end is used to indicate the user-side terminal device or the display device connected to the computing device 110.
[0141] In a third possible embodiment, before the computing device 110 deletes the second calling relationship of N groups of microservices in the topology relationship, the computing device 110 outputs the second calling relationship of N microservices, receives a first request to confirm the deletion of the second calling relationship of N groups of microservices, and executes the above-described S230 in response to the first request.
[0142] In one possible implementation, computing device 110 outputs modification suggestion information including a second calling relationship of N groups of microservices. The front end then displays the modification suggestion information and receives confirmation from the user to delete the second calling relationship of the N groups of microservices. Based on the operation, the front end sends a first request to computing device 110 to confirm the deletion of the second calling relationship of the N groups of microservices. In response to the first request, computing device 110 deletes the second calling relationship of the N groups of microservices from the topology.
[0143] The above suggested modification information could be "Recommended deletion: Second call relationship of N groups of microservices". It is important to note that this suggested modification information is merely an example and should not be construed as limiting this application.
[0144] The computing device 110 determines N sets of second call relationships of microservices from at least one set of second call relationships of microservices, and then deletes the N sets of second call relationships of microservices from the topology relationship.
[0145] In one possible scenario, the score of the topology relationship after the computing device 110 deletes the second call relationship of N groups of microservices is greater than the score of the topology relationship without deleting the second call relationship.
[0146] In one possible example, computing device 110 sequentially predicts the scores of the topology relationships after deleting 1-X second call relationships, and the scores of the topology relationships without deleting the second call relationships. From the scores of the topology relationships after deleting 1-X second call relationships, it determines the topology relationship with a score higher than the one without deleting the second call relationships. Then, based on the aforementioned determined scores, computing device 110 determines the corresponding N groups of microservice second call relationships, and deletes the N groups of microservice second call relationships from the topology relationships.
[0147] X represents the number of second-level calling relationships in the topological relationships.
[0148] For example, computing device 110 determines that the second calling relationship in the topology includes: microservice 209 calling microservice 101, microservice 301 calling microservice 203, and microservice 207 calling microservice 206. Computing device 110 determines the following scores for the topology after deleting microservice 209 calling microservice 101: score a; score b; score c; score d; score e; score f; score f; and score g; and score g for the topology without deleting the second calling relationship.
[0149] The computing device 110 determines a score greater than score g from the scores a-f, such as score a, score b, and score e. Then, the computing device 110 outputs one or more of the following second calling relationships: microservice 209 corresponding to score a calls microservice 101, microservice 301 corresponding to score b calls microservice 203, and microservice 209 corresponding to score e calls microservice 101 and microservice 301 calls microservice 203.
[0150] For example, a user may select at least one second calling relationship from the above three second calling relationships, thereby computing device 110 receives a first request to confirm the deletion of at least one second calling relationship, and in response to the first request, deletes at least one second calling relationship in the topology.
[0151] In another possible scenario, the score of the topology relationship after deleting the second call relationships of N groups of microservices by computing device 110 is greater than the score of the topology relationship after deleting the second call relationships of M groups of microservices from at least one group of microservices. Here, M groups of microservices are microservices other than the N groups of microservices in at least one group of microservices, M is greater than or equal to 0, and the score of the topology relationship is obtained by quantifying the topology relationship using an evaluation strategy.
[0152] For example, based on the above example, the computing device 110 determines the score greater than the score g from the above scores a-f, then determines the score with the largest value from the above scores, outputs the second calling relationship corresponding to the score with the largest value, and receives a first request to confirm the deletion of the second calling relationship corresponding to the score with the largest value. In response to the first request, the second calling relationship corresponding to the score with the largest value in the topology relationship is deleted.
[0153] For example, computing device 110 determines the score with the largest value from the above scores a, b, and e as score e. Then, computing device 110 outputs the second calling relationship corresponding to the score with the largest value as follows: microservice 209 calls microservice 101, microservice 301 calls microservice 203, receives the user's confirmation to delete the first request of microservice 209 calling microservice 101 and microservice 301 calling microservice 203, and in response to the first request, deletes the microservice 209 calling microservice 101 and microservice 301 calling microservice 203 in the topology relationship.
[0154] The following provides a detailed explanation of how computing device 110 scores topological relationships.
[0155] The computing device 110 performs hierarchical and clustered processing on the topological relationships to obtain hierarchical and clustered topological relationship 1. Then, it uses an evaluation strategy to quantify the topological relationship 1 and obtain a score for the topological relationship 1.
[0156] In one possible example, computing device 110 hierarchically and clusters the topology relationship to obtain hierarchically and clustered topology relationship 1, including: computing device 110 hierarchically ...
[0157] Where P is greater than or equal to 2.
[0158] The number of first call relationships indicated by P microservices is the number of first call relationships indicating any of the P microservices.
[0159] As shown in Figure 4, there are P microservices, including microservice 201, microservice 208, and microservice 209. Microservice 201 calls microservice 208, and microservice 208 calls microservice 209. Microservice 202 calls microservice 201, microservice 208 calls microservice 301, microservice 101 calls microservice 201, microservice 209 calls microservice 101, and microservice 202 calls microservice 208. Therefore, the number of first call relationships between P microservices is 2 (e.g., microservice 201 calls microservice 208, microservice 208 calls microservice 209), and the number of first call relationships indicated by P microservices is 7 (e.g., microservice 201 calls microservice 208, microservice 208 calls microservice 209, microservice 202 calls microservice 201, microservice 208 calls microservice 301, microservice 101 calls microservice 201, microservice 209 calls microservice 101, and microservice 202 calls microservice 208).
[0160] For example, the aforementioned P microservices belong to the same application. The computing device 110 groups microservices at the same level (e.g., microservices with the same first digit of their level number) into one layer based on their level number, thus obtaining a layered topology. The computing device 110 scans the microservices included in different applications within the topology to identify the P microservices belonging to a cluster of microservices.
[0161] The computing device 110 performs layering and clustering on the topology shown in Figure 4, resulting in topology 1 as shown in Figure 5. Figure 5 is a schematic diagram of a topology provided in this application. The multiple microservices within the dashed boxes in Figure 5 belong to a cluster of microservices.
[0162] For example, computing device 110 uses an evaluation strategy to quantify topological relationship 1 and obtain a score for topological relationship 1, including: computing device 110 uses the hierarchy of microservices in topological relationship 1 and a cluster of P microservices (a cluster of microservices) to quantify the topological relationship and obtain a score for topological relationship 1.
[0163] Regarding the content of the scoring of topological relationship 1 determined by the computing device 110 mentioned above, two possible examples are provided below.
[0164] Example 1: Computing device 110 uses a graph theory model to score topological relation 1.
[0165] For example, computing device 110 uses evaluation metrics to score topological relation 1, which are metrics used by graph theory models to score topological relation 1. Evaluation metrics include any one or more of the following: degree centrality, betweenness centrality, clustering coefficient, graph diameter, modularity, and graph connectivity.
[0166] Degree centrality represents the number of nodes a node (microservice) is directly connected to in the network (topology). Betweenness centrality represents the frequency with which a node appears in the shortest path between other node pairs, i.e., it measures the degree to which a node acts as a mediator between other nodes; nodes with high betweenness centrality usually play an important role in transmitting information or traffic in the network. Clustering coefficient is used to measure the degree of connectivity between a node's neighbors; it reflects whether a node's neighbors are also interconnected, i.e., whether a node's neighbors tend to form a dense subgraph or triangle. Graph diameter describes the maximum value of the shortest path between any two nodes in the graph. Modularity reflects whether the nodes in the network are effectively divided into multiple closely related subgroups (clusters), i.e., the connection density is high within these subgroups, while the connections between different subgroups are low. Graph connectivity indicates whether there are path connections between nodes in the graph; it describes whether the graph structure is globally connected, or whether any two nodes can be connected by a series of edges.
[0167] For example, computing device 110 uses evaluation metrics to quantify the hierarchy of microservices in the topology and the clusters of P microservices to obtain a score for topology 1.
[0168] The computing device 110 uses each evaluation metric to quantify the hierarchy of microservices in the topological relationship, including the clusters of P microservices, and obtains a value. Then, the values corresponding to each evaluation metric are weighted and summed to obtain the score of topological relationship 1.
[0169] For example, computing device 110 uses evaluation indicators to quantify the topological relationship 1 after hierarchical and clustered division, and obtains a score for the topological relationship 1.
[0170] The clearer the hierarchical structure of the topology, the higher the score; the higher the clustering and the lower the cohesion and coupling of the topology, the higher the score. The degree of high cohesion and low coupling is determined by the ratio of the number of first call relationships between the P microservices included in the cluster to the number of first call relationships indicated by the P microservices. The higher the ratio, the higher the degree of high cohesion and low coupling of the cluster.
[0171] Example 2: Computing device 110 uses a graph neural network (GNN) to score topological relation 1.
[0172] For example, computing device 110 uses a graph neural network to quantify the hierarchy of microservices in the topological relationship, including clusters of P microservices, to obtain a score for topological relationship 1.
[0173] For example, computing device 110 uses graph neural network to quantify the topological relationship 1 after hierarchical and clustered processing to obtain a score for the topological relationship 1.
[0174] Based on the deletion of the second call relationships of N groups of microservices by the computing device 110 in the above embodiments, in order to ensure that the deleted second call relationships of N groups of microservices can still be displayed in the topology, this application provides a possible embodiment that can adjust the second call relationships of the above-mentioned N groups of microservices, and the score of the adjusted topology is higher than the score of the topology of the topology without the deletion of the second call relationships of N groups of microservices. As shown in Figure 6, Figure 6 is a flowchart of a call relationship adjustment method provided by this application. The content shown in Figure 6 includes the following steps S610-S630.
[0175] S610 and computing device 110 obtain the interface of the called microservice.
[0176] The interface of the microservice being called mentioned above is also the interface of the microservice being called in the second calling relationship. For example, this interface could be an API.
[0177] In one possible scenario, the number of times the above interface is called is either the number of times the multiple interfaces included in the called microservice are called in ascending order, or the number of times the multiple interfaces included in the called microservice are called in descending order.
[0178] In one possible example, the number of times the above interface is called is used to indicate the number of microservices that call that interface.
[0179] In one possible example, the number of times the above interface is called is the number of times the interface is called first in ascending order among the number of times the multiple interfaces included in the called microservice are called.
[0180] In one possible example, the number of times the above interface is called is the last number of times the interface is called among the multiple interfaces included in the called microservice, arranged in descending order.
[0181] For example, the above interface is called 1 time, that is, only one microservice calls the aforementioned interface.
[0182] In one possible implementation, the topology relationship includes at least one set of microservices in a second calling relationship. The following is an example of the computing device 110 determining the interface of the called microservice in a first calling relationship of a set of microservices. The computing device 110 obtains the interface of the called microservice by obtaining the number of times multiple interfaces included in the called microservice are called, and then determines the interface with the fewest calls from the multiple interfaces.
[0183] The S620 and computing device 110 encapsulate the interface as a second microservice.
[0184] In one possible implementation, the computing device 110 encapsulates the interface into a second microservice, including: the computing device 110 extracts the core business logic and data processing layer corresponding to the interface into independent modules, and then encapsulates the independent modules into microservices.
[0185] In one possible scenario, the computing device 110 will also configure a communication mechanism between the encapsulated microservice and other microservices in the microservice architecture to ensure that the encapsulated second microservice can collaborate efficiently with other microservices.
[0186] For details regarding how the computing device 110 encapsulates the interface into a second microservice, please refer to conventional techniques in this field; this application will not elaborate further.
[0187] S630, the computing device 110 adjusts the second calling relationship between the calling microservice and the called microservice in the topology relationship to the calling microservice that calls the interface and the second microservice.
[0188] Since the above-mentioned microservice call only calls one interface of the called microservice, the computing device 110 adjusts the second calling relationship between the calling microservice and the called microservice in the topology relationship to the calling relationship between the calling microservice and the second microservice.
[0189] In one possible example, the second microservice has a higher hierarchy in the topology than the called microservice. For instance, if the called microservice has a hierarchy of 1, then the second microservice has a hierarchy of 2.
[0190] As shown in Figure 6, the computing device 110 separates API 1 from microservice 101 and encapsulates API 1 into microservice 210. Then, the computing device 110 deletes the second call relationship: microservice 209 calling microservice 101, and constructs a new call relationship: microservice 209 calling microservice 210.
[0191] The computing device 110 separates API 2 from microservice 203 and encapsulates API 2 into microservice 305. Then, the computing device 110 deletes the second call relationship: microservice 301 calling microservice 203, and constructs a new call relationship: microservice 301 calling microservice 305.
[0192] In one possible scenario, the score of the topology before adjusting the second calling relationship is lower than the score of the topology after adjusting the second calling relationship.
[0193] In one possible implementation, computing device 110 determines the score of the topology relationship before adjusting the second calling relationship, and predicts the score of the topology relationship after adjusting 1-X second calling relationships. From the scores of the topology relationships after adjusting 1-X second calling relationships, it determines the score of the topology relationship that is greater than the score of the topology relationship without adjusting the second calling relationship. Then, based on the aforementioned determined score, computing device 110 determines the second calling relationship of the corresponding L groups of microservices, and adjusts the second calling relationship of the L groups of microservices in the topology relationship.
[0194] In one possible example, computing device 110 randomly selects a score from the scores of the topological relationships that are greater than those of the unadjusted second calling relationship, and then adjusts the second calling relationship corresponding to that score as in S630.
[0195] In another possible example, computing device 110 determines the interface of the called microservice in the second call relationship corresponding to each score in the above-mentioned topology relationship that is greater than the unadjusted second call relationship, and then outputs the interface of the called microservice to the front end, and calculates the second request of the user to determine the interface of the called microservice in the second call relationship of splitting L groups of microservices, and in response to the second request, performs the adjustment as in steps S620 and S630.
[0196] For example, the user determines the interface of the called microservice in the second call relationship of group L microservices from the scores of the topology relationship greater than the unadjusted second call relationship, and the interface of the called microservice in the second call relationship corresponding to each score.
[0197] For example, the computing device 110 will also output the score of the topology relationship that is greater than the one without adjusting the second calling relationship and / or the second calling relationship corresponding to the aforementioned score.
[0198] In another possible example, computing device 110 determines the highest score from the topology relationships that are greater than those without adjusted second call relationships, and adjusts the second call relationship corresponding to the highest score as described in steps S620 and S630. That is, in S610, computing device 110 obtains the interface of the called microservice indicated by the second call relationship with the highest score.
[0199] For example, computing device 110 determines the following scores: a) for adjusting the topology relationship after microservice 209 calls microservice 101; b) for adjusting the topology relationship after microservice 301 calls microservice 203; c) for adjusting the topology relationship after microservice 207 calls microservice 206; d) for adjusting the topology relationship after microservice 207 calls microservice 206 and microservice 209 calls microservice 101; e) for adjusting the topology relationship after microservice 301 calls microservice 203 and microservice 209 calls microservice 101; f) for adjusting microservice 209 calls microservice 101, microservice 301 calls microservice 203, and microservice 207 calls microservice 206; and g) for the topology relationship without adjusting the second call relationship.
[0200] The computing device 110 determines scores greater than score g from the scores a-f, such as score a, score b, and score e. Then, the computing device 110 determines scores greater than score g from the scores a-f, and identifies the score with the largest value from the aforementioned scores. It outputs the interface of the called microservice indicated by the second call relationship corresponding to the score with the largest value, and receives a second request to confirm the splitting of the second call relationship corresponding to the score with the largest value. In response to the second request, it executes the contents of S620 and S630 described above.
[0201] For example, computing device 110 determines the score with the largest value from the above scores a, b, and e as score e. Then, computing device 110 outputs the called microservices corresponding to the second call relationship of the score with the largest value as microservice 101 and microservice 203, receives the second request from the user to split microservice 209 to call microservice 101 and microservice 301 to call microservice 203, and in response to the second request, executes the contents of S620 and S630 above.
[0202] In one possible example, computing device 110 will also output the second call relationship corresponding to the score with the largest value and / or the score corresponding to the second call relationship. For example, computing device 110 outputs score e and the microservice 209 calling microservice 101 and microservice 301 calling microservice 203 corresponding to score e.
[0203] For the content of the scoring of the topological relationship before and after the adjustment of the second calling relationship determined by the computing device 110, please refer to the above description of the scoring of the topological relationship determined by the computing device 110, which will not be repeated here.
[0204] It is worth noting that the above topology indicates the calling relationship between microservices in the microservice architecture. Therefore, the above deletion or adjustment of the topology by the computing device 110 is to optimize the microservice architecture and / or optimize the microservices in the microservice architecture.
[0205] The call relationship optimization method provided by this application has been described in detail above with reference to Figures 2 to 6. The call relationship optimization device provided by this application will now be described with reference to Figure 7A, which is a schematic diagram of the structure of a call relationship optimization device provided by this application. The call relationship optimization device 700 can be used to implement the functions of the computer system in the above method embodiments, and therefore can also achieve the beneficial effects of the above method embodiments.
[0206] As shown in Figure 7A, the call relationship optimization device 700 includes an acquisition module 710, a determination module 720, and a deletion module 730. The call relationship optimization device 700 is used to implement the functions of the computing device 110 in the method embodiments corresponding to Figures 2 to 6. In one possible example, the specific process by which the call relationship optimization device 700 implements the above-described call relationship optimization method includes the following steps:
[0207] The acquisition module 710 is used to acquire the topological relationships between multiple microservices; the call relationship optimization topological relationship is used to indicate the first call relationship of multiple groups of microservices, and one group of microservices in the call relationship optimization includes two microservices. The determination module 720 is used to determine the second call relationship of at least one group of microservices based on the first call relationship among the multiple groups of microservices. One group of microservices in the call relationship optimization includes a calling microservice and a called microservice. The level of the calling microservice is greater than or equal to the level of the called microservice. The level of the calling microservice indicates the first position of the calling microservice in the call relationship optimization topological relationship, and the level of the called microservice indicates the second position of the called microservice in the call relationship optimization topological relationship. The deletion module 730 is used to delete the second call relationship of N groups of microservices in the call relationship optimization topological relationship, where the call relationship optimization at least one group of microservices includes N groups of microservices, and N is greater than or equal to 1.
[0208] To further realize the functions of the method embodiments shown in Figures 2 to 6 above, this application also provides a call relationship optimization device, as shown in Figure 7B. Figure 7B is a second structural schematic diagram of a call relationship optimization device provided by this application. The call relationship optimization device 700 further includes a first transceiver module 740, an adjustment module 750, and a second transceiver module 760.
[0209] The first transceiver module 740 is used to output the second call relationship of N groups of microservices and receive a first request to confirm the deletion of the second call relationship of N groups of microservices. In response to the first request, it deletes the second call relationship of N groups of microservices in the topology. The adjustment module 750 is used to obtain the interface of the called microservice, encapsulate the interface into a second microservice, and adjust the second call relationship between the calling microservice and the called microservice in the topology to the call relationship between the calling microservice and the second microservice. The second transceiver module 760 is used to output the interface of the called microservice and receive a second request to confirm the splitting of the interface of the called microservice. In response to the second request, it performs the encapsulation of the interface into a second microservice and adjusts the second call relationship between the calling microservice and the called microservice to the second call relationship between the calling microservice and the second microservice.
[0210] For more information on the functions of obtaining module 710, determining module 720, and deleting module 730, please refer to the description of the call relationship optimization method above, which will not be repeated here.
[0211] The acquisition module 710, determination module 720, and deletion module 730 can all be implemented in software or hardware. For example, the implementation of the acquisition module 710 will be described below. Similarly, the implementation of the determination module 720 and deletion module 730 can refer to the implementation of the acquisition module 710.
[0212] As an example of a software functional unit, module 710 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the aforementioned computing instance may be one or more. For example, module 710 may include code running on multiple hosts / virtual machines / containers.
[0213] It should be noted that the multiple hosts / virtual machines / containers used to run this code can be distributed within the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run this code can be distributed within the same availability zone (AZ) or in different AZs, each AZ comprising one or more geographically proximate data centers. Typically, a region can include multiple AZs.
[0214] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same VPC or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
[0215] As an example of a hardware functional unit, the acquisition module 710 may include at least one computing device, such as a server. Alternatively, the acquisition module 710 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.
[0216] The multiple computing devices included in the acquisition module 710 can be distributed in the same region or in different regions. Similarly, the multiple computing devices included in the acquisition module 710 can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the multiple computing devices included in the acquisition module 710 can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0217] It should be noted that, in other embodiments, the acquisition module 710 can be used to execute any step in the call relationship optimization method, the determination module 720 can be used to execute any step in the call relationship optimization method, and the deletion module 730 can be used to execute any step in the call relationship optimization method. The steps implemented by the acquisition module 710, the determination module 720, and the deletion module 730 can be specified as needed. The acquisition module 710, the determination module 720, and the deletion module 730 respectively implement different steps in the call relationship optimization method to achieve all the functions of the computing device 110.
[0218] It is worth noting that the computing device 110 in the aforementioned embodiment can correspond to the call relationship optimization device 700, and can correspond to the corresponding subject corresponding to the method in Figures 2 to 6 of the embodiments of this application. The operations and / or functions of each module in the call relationship optimization device 700 are respectively to implement the corresponding processes of each method in the corresponding embodiments in Figures 2 to 6. For the sake of brevity, they will not be described in detail here.
[0219] Alternatively, the call relationship optimization device 700 shown in Figure 7A or Figure 7B can also be implemented using a communication device, which can refer to the computing device 110 in the aforementioned embodiments. When the communication device is a chip or chip system applied to a processing device, the call relationship optimization device 700 can also be implemented using a chip or chip system.
[0220] This application embodiment also provides a chip system, which includes a control circuit and an interface circuit. The interface circuit is used to obtain the topological relationship between multiple microservices, and the control circuit is used to implement the function of the computing device 110 in the above method according to the topological relationship between multiple microservices.
[0221] In one possible design, the chip system also includes a memory for storing program instructions and / or data. This chip system can be composed of chips or may include chips and other discrete components.
[0222] This application also provides a computing device. Please refer to FIG8, which is a schematic diagram of the structure of a computing device provided in this application. The computing device 800 includes a bus 802, a processor 804, a memory 806, and a communication interface 808. The processor 804, the memory 806, and the communication interface 808 are interconnected via the bus 802. The computing device 800 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 800. For example, the computing device 800 can be the aforementioned computing device 110.
[0223] Bus 802 can be a PCIe bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, only one line is used in Figure 8, but this does not imply that there is only one bus or one type of bus. Bus 802 can include pathways for transmitting information between various components of computing device 800 (e.g., processor 804, memory 806, communication interface 808).
[0224] Processor 804 may include any one or more processors such as CPU, graphics processing unit (GPU), FPGA, microprocessor (MP), or digital signal processor (DSP).
[0225] The memory 806 may include volatile memory, such as random access memory (RAM). The processor 804 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard-disk drive (HDD), or solid-state drive (SSD).
[0226] The memory 806 stores executable program code, which the processor 804 executes to implement the functions of the aforementioned acquisition module 710, determination module 720, and deletion module 730, thereby realizing the call relationship optimization method. In other words, the memory 806 stores instructions for executing the call relationship optimization method.
[0227] The communication interface 808 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 800 and other devices or communication networks. The computing device 800 can be a computer (e.g., a server) in a cloud data center, a computer in an edge data center, or a terminal.
[0228] This application also provides a computing device cluster. The computing device cluster includes at least one computing device, which can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0229] Figure 9 is a schematic diagram of a computing device cluster provided in this application. The computing device cluster includes at least one computing device 800. The memory 806 of one or more computing devices 800 in the computing device cluster may store the same instructions for executing a call relationship optimization method.
[0230] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the call relationship optimization method. In other words, a combination of one or more computing devices 800 can jointly execute the instructions for executing the call relationship optimization method.
[0231] It should be noted that the memory 806 in different computing devices 800 within the computing device cluster can store different instructions, each used to execute a portion of the functions of the call relationship optimization method. That is, the instructions stored in the memory 806 of different computing devices 800 can implement the functions of one or more modules among the acquisition module 710, determination module 720, and deletion module 730.
[0232] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN). Figure 10 illustrates one possible implementation. As shown in Figure 10, which is a schematic diagram of a connection between computing devices according to this application, two computing devices 800A and 800B are connected via a network. Specifically, they are connected to the network through the communication interfaces in each computing device. In this type of possible implementation, the memory 806 in computing device 800A stores instructions for executing the functions of the acquisition module 710. Simultaneously, the memory 806 in computing device 800B stores instructions for executing the functions of the determination module 720 and the deletion module 730.
[0233] It should be understood that the functions of computing device 800A shown in Figure 10 can also be performed by multiple computing devices 800. Similarly, the functions of computing device 800B can also be performed by multiple computing devices 800.
[0234] This application also provides a computer program product containing instructions. This computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product runs on at least one computing device, it causes the at least one computing device to perform the aforementioned call relationship optimization method.
[0235] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute a call relationship optimization method.
[0236] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are performed entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a DVD; or it can be a semiconductor medium, such as an SSD.
[0237] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for optimizing call relationships, characterized in that, The method is applied to a computing device cluster, the computing device cluster including at least one computing device, wherein microservices are deployed on the at least one computing device, and the method includes: Obtain the topological relationship between multiple microservices; the topological relationship is used to indicate the first invocation relationship of multiple groups of microservices, one of which includes two microservices. Based on the first invocation relationship between the multiple groups of microservices, a second invocation relationship of at least one group of microservices is determined; one group of microservices in the at least one group of microservices includes a calling microservice and a called microservice, wherein the level of the calling microservice is greater than or equal to the level of the called microservice, the level of the calling microservice is used to indicate the first position of the calling microservice in the topology relationship, and the level of the called microservice is used to indicate the second position of the called microservice in the topology relationship; Delete the second call relationship of N groups of microservices in the topology relationship, where the at least one group of microservices includes the N groups of microservices, and N is greater than or equal to 1.
2. The method according to claim 1, characterized in that, Determining the second invocation relationship of at least one group of microservices based on the first invocation relationship among the multiple groups of microservices includes: Based on the first call relationship between the multiple groups of microservices, the position of the multiple microservices in the topology is determined; the position of the first microservice among the multiple microservices is used to indicate the position of the first microservice in the first call chain in the topology, and the first call chain includes the first microservice. The second invocation relationship of the at least one group of microservices is determined based on the position of multiple microservices in the topology.
3. The method according to claim 1 or 2, characterized in that, The calling microservice and the called microservice are located in a directed cycle within the topological relationship.
4. The method according to any one of claims 1 to 3, characterized in that, Before deleting the second call relationship of N groups of microservices in the topology relationship, the method further includes: Output the second call relationship of the N groups of microservices; Receive a first request confirming the deletion of the second invocation relationship of the N groups of microservices; In response to the first request, the second call relationship of the N groups of microservices in the topology is deleted.
5. The method according to any one of claims 1 to 4, characterized in that, The score of the topology relationship after deleting the second call relationship of the N groups of microservices is greater than the score of the topology relationship without deleting the second call relationship of the N groups of microservices; wherein, the score of the topology relationship is obtained by quantifying the topology relationship using an evaluation strategy.
6. The method according to any one of claims 1 to 5, characterized in that, The score of the topology relationship after deleting the second call relationship of the N groups of microservices is greater than the score of the topology relationship after deleting the second call relationship of M groups of microservices in the at least one group of microservices; wherein, the M groups of microservices are microservices other than the N groups of microservices in the at least one group of microservices, M is greater than or equal to 0, and the score of the topology relationship is obtained by quantifying the topology relationship using an evaluation strategy.
7. The method according to claim 5 or 6, characterized in that, The evaluation strategy is used to indicate that the topological relationship is quantified by utilizing the hierarchy of microservices in the topological relationship and including clusters of P microservices; the topological relationship includes the clusters, P is greater than or equal to 2, and the ratio of the number of first call relationships between the P microservices to the number of first call relationships indicated by the P microservices is greater than or equal to a threshold.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: Obtain the interface of the called microservice; The interface is encapsulated as a second microservice; The second calling relationship between the calling microservice that calls the interface and the called microservice in the topology is adjusted to the calling relationship between the calling microservice that calls the interface and the second microservice.
9. The method according to claim 8, characterized in that, The score of the topological relationship before the second call relationship is adjusted is lower than the score of the topological relationship after the second call relationship is adjusted. The score of the topological relationship is obtained by quantifying the topological relationship using an evaluation strategy.
10. The method according to claim 8 or 9, characterized in that, The number of times the interface is called is the number of times the interface is called, which is the highest number of times the interface is called among the multiple interfaces included in the called microservice, arranged in ascending order.
11. The method according to any one of claims 8 to 10, characterized in that, Before encapsulating the interface into a second microservice, the method further includes: Output the interface of the called microservice; Receive a second request confirming the splitting of the interface of the called microservice; In response to the second request, the interface is encapsulated as a second microservice, and the second calling relationship between the calling microservice that calls the interface and the called microservice is adjusted to a second calling relationship between the calling microservice that calls the interface and the second microservice.
12. A call relationship optimization device, characterized in that, The device includes: An acquisition module is used to acquire the topological relationship between multiple microservices; the topological relationship is used to indicate the first invocation relationship of multiple groups of microservices, one of the multiple groups of microservices includes two microservices, and the microservices are deployed on at least one computing device in a computing device cluster; A determining module is configured to determine a second calling relationship of at least one group of microservices based on a first calling relationship among the multiple groups of microservices; one group of microservices in the at least one group of microservices includes a calling microservice and a called microservice, wherein the level of the calling microservice is greater than or equal to the level of the called microservice, the level of the calling microservice is used to indicate the first position of the calling microservice in the topology relationship, and the level of the called microservice is used to indicate the second position of the called microservice in the topology relationship; The deletion module is used to delete the second call relationship of N groups of microservices in the topology relationship, wherein the at least one group of microservices includes the N groups of microservices, and N is greater than or equal to 1.
13. The apparatus according to claim 12, characterized in that, The determining module is specifically used to: determine the position of multiple microservices in the topology relationship based on the first calling relationship between the multiple groups of microservices, and determine the second calling relationship of the at least one group of microservices based on the position of multiple microservices in the topology relationship; The position of the first microservice among the plurality of microservices is used to indicate the position of the first microservice in the first call chain in the topology, and the first call chain includes the first microservice.
14. The apparatus according to claim 12 or 13, characterized in that, The calling microservice and the called microservice are located in a directed cycle within the topological relationship.
15. The apparatus according to any one of claims 12 to 14, characterized in that, The device further includes: a first transceiver module; The first transceiver module is used to output the second call relationship of the N groups of microservices, and receive a first request to confirm the deletion of the second call relationship of the N groups of microservices, and in response to the first request, delete the second call relationship of the N groups of microservices in the topology relationship.
16. The apparatus according to any one of claims 12 to 14, characterized in that, The score of the topology relationship after deleting the second call relationship of the N groups of microservices is greater than the score of the topology relationship without deleting the second call relationship of the N groups of microservices; wherein, the score of the topology relationship is obtained by quantifying the topology relationship using an evaluation strategy.
17. The apparatus according to any one of claims 12 to 16, characterized in that, The score of the topology relationship after deleting the second call relationship of the N groups of microservices is greater than the score of the topology relationship after deleting the second call relationship of the M groups of microservices in the at least one group of microservices; wherein, the M groups of microservices are microservices other than the N groups of microservices in the at least one group of microservices, M is greater than or equal to 0, and the score of the topology relationship is obtained by quantifying the topology relationship using an evaluation strategy.
18. The apparatus according to claim 16 or 17, characterized in that, The evaluation strategy is used to indicate that the topological relationship is quantified by utilizing the hierarchy of microservices in the topological relationship and including clusters of P microservices; the topological relationship includes the clusters, P is greater than or equal to 2, and the ratio of the number of first call relationships between the P microservices to the number of first call relationships indicated by the P microservices is greater than or equal to a threshold.
19. The apparatus according to any one of claims 12 to 18, characterized in that, The device further includes: an adjustment module; The adjustment module is used to obtain the interface of the called microservice, encapsulate the interface into a second microservice, and adjust the second calling relationship between the calling microservice that calls the interface and the called microservice in the topology to the calling relationship between the calling microservice that calls the interface and the second microservice.
20. The apparatus according to claim 19, characterized in that, The score of the topological relationship before the second call relationship is adjusted is lower than the score of the topological relationship after the second call relationship is adjusted. The score of the topological relationship is obtained by quantifying the topological relationship using an evaluation strategy.
21. The apparatus according to claim 19 or 20, characterized in that, The number of times the interface is called is the number of times the interface is called, which is the highest number of times the interface is called among the multiple interfaces included in the called microservice, arranged in ascending order.
22. The apparatus according to any one of claims 19 to 21, characterized in that, The device further includes: a second transceiver module; The second transceiver module is used to output the interface of the called microservice and receive a second request to confirm the splitting of the interface of the called microservice; in response to the second request, it performs the encapsulation of the interface into a second microservice and adjusts the second calling relationship between the calling microservice that calls the interface and the called microservice to the second calling relationship between the calling microservice that calls the interface and the second microservice.
23. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method as described in any one of claims 1 to 11.
24. A computer-readable storage medium, characterized in that, The storage medium stores a computer program or instructions, which, when executed by a computing device, implement the method of any one of claims 1 to 11.
25. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a computing device, the method of any one of claims 1 to 11 is implemented.