A Dynamic Sensing Method and Device Applying Topology

By monitoring the heartbeat response message of microservice applications, obtaining metadata, generating and aggregating local topology description information, it solves the problem of not being able to perceive global topology in the microservice architecture, and realizes efficient application topology awareness and reduces storage costs.

CN115714738BActive Publication Date: 2025-08-01ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211257142.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-14
Publication Date
2025-08-01
Estimated Expiration
2042-10-14

AI Technical Summary

Technical Problem

In the microservice architecture, when implementing topology awareness of microservice applications based on Trace data, if there is no traffic generated in the microservice call, the global topology relationship cannot be perceived, or only part of the link topology can be perceived, resulting in an increase in storage costs.

Method used

By listening to the connection heartbeat response message of the microservice application, metadata is obtained to generate local application topology description information and sent to preset nodes for aggregation to generate a global application topology, including the topological relationship between the microservice application and the connection target.

Benefits of technology

Even without traffic calls, complete application topology information can be analyzed, which improves topology perception efficiency and reduces storage costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115714738B_ABST
    Figure CN115714738B_ABST
Patent Text Reader

Abstract

The present application discloses a dynamic perception method and device for application topology. Among them, the method includes: listening to the heartbeat response messages of each connection of the microservice application in the microservice architecture, where the heartbeat response message includes the metadata of the connection target of the microservice application, and the metadata includes the address information of the connection target; obtaining the local application topology description information of the microservice application according to the metadata; sending the local application topology description information to a preset node for the preset node to generate the global application topology of the microservice architecture according to the local application topology description information, where the global application topology indicates the connection topology relationship between all microservice applications included in the microservice architecture and the corresponding connection targets. Through the present invention, the problem in the related art that when realizing microservice application topology perception based on Trace data, if there is no traffic generated in the microservice call, the application topology will not be perceived, or only the application topology of some links can be perceived is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of microservice governance. Specifically, it relates to a method and device for dynamically perceiving application topologies. Background Art

[0002] In a microservice architecture, as the complexity of microservice splitting increases, the ability to display the topology of the application architecture becomes particularly important in microservice governance. Traditional application topology capabilities are all realized based on tracing (Trace) data of the full link. This means that if there is no traffic call in the microservice application, or if there is only a partial dependency traffic call in the microservice application, then the global or hidden link application topology relationship cannot be seen. Additionally, based on Trace data, if there is a large amount of traffic, there is a certain cost for storing the large amount of Trace data.

[0003] Therefore, in view of the above technical problems existing in the related art, no effective solution has been proposed yet. Summary of the Invention

[0004] Embodiments of this application provide a method and device for dynamically perceiving application topologies, so as to at least solve the problem in the related art that if there is no traffic generated in the microservice call when realizing microservice application topology perception based on Trace data, then the application topology cannot be perceived, or only the application topology of some links can be perceived.

[0005] According to one aspect of this application, a method for dynamically perceiving application topologies is provided, including: listening for heartbeat response messages of each connection of a microservice application in a microservice architecture, where the heartbeat response message includes metadata of a connection target of the microservice application, and the metadata includes address information of the connection target; obtaining local application topology description information of the microservice application according to the metadata, where the local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target; and sending the local application topology description information to a preset node for the preset node to generate a global application topology of the microservice architecture according to the local application topology description information, where the global application topology is used to indicate the connection topology relationship between all microservice applications included in the microservice architecture and corresponding connection targets.

[0006] Optionally, the listening for heartbeat response messages of each connection of a microservice application in the microservice architecture includes: listening for heartbeat response messages of the connection between the microservice application and a registration center, and listening for heartbeat response messages of the connection between the microservice application and a service on which the microservice application depends.

[0007] Optionally, obtaining the local application topology description information of the microservice application according to the metadata includes: obtaining a first information list corresponding to the microservice application, where the first information list includes the connection relationship between the microservice application and the connection target; updating the address information of the connection target and the address information of the microservice application included in the metadata to the first information list to obtain the local application topology description information of the microservice application.

[0008] Optionally, the metadata further includes the attribute information of the connection target and the application information of the connection target.

[0009] Optionally, obtaining the local application topology description information of the microservice application according to the metadata further includes: obtaining a second information list corresponding to the microservice application, where the second information list includes the attribute information of the connection target and the application information of the connection target; updating the attribute information of the connection target and the application information of the connection target included in the metadata to the second information list to obtain the local application topology description information of the microservice application.

[0010] Optionally, the method further includes: establishing heartbeat data for each connection during the startup process of the microservice application.

[0011] According to another aspect of the present application, a method for dynamically perceiving an application topology is provided, including: obtaining the local application topology description information of each microservice application in a microservice architecture, where the local application topology description information is determined by heartbeat response messages received by each microservice application, the heartbeat response messages carry the metadata of the connection target of the microservice application, the metadata includes the address information of the connection target, and the local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target; aggregating the local application topology description information of each microservice application to obtain the global application topology of the microservice architecture, where the global application topology is used to indicate the connection topology relationship between all microservice applications included in the microservice architecture and the corresponding connection targets.

[0012] According to another aspect of the present application, a dynamic perception device for application topology is provided, including: a listening module, configured to listen to the heartbeat response messages of each connection of the microservice applications in the microservice architecture, wherein the heartbeat response message includes metadata of the connection target of the microservice application, and the metadata includes the address information of the connection target; a first acquisition module, configured to acquire local application topology description information of the microservice application according to the metadata, wherein the local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target; a sending module, configured to send the local application topology description information to a preset node for the preset node to generate the global application topology of the microservice architecture according to the local application topology description information, wherein the global application topology is used to indicate the connection topology relationship between all microservice applications included in the microservice architecture and the corresponding connection targets.

[0013] According to yet another aspect of the present application, a dynamic perception device for application topology is provided, including: a second acquisition module, configured to acquire local application topology description information of each microservice application in the microservice architecture, wherein the local application topology description information is determined by the heartbeat response messages received by each microservice application, the heartbeat response message carries metadata of the connection target of the microservice application, the metadata includes the address information of the connection target, and the local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target; a third acquisition module, configured to aggregate the local application topology description information of each microservice application to obtain the global application topology of the microservice architecture, wherein the global application topology is used to indicate the connection topology relationship between all microservice applications included in the microservice architecture and the corresponding connection targets.

[0014] According to another aspect of the present application, an electronic device is further provided, including a memory and a processor; wherein, the memory is used to store one or more computer instructions, and when the one or more computer instructions are executed by the processor, the above method steps are implemented.

[0015] According to another aspect of the present application, a readable storage medium is further provided, on which computer instructions are stored, and when the computer instructions are executed by a processor, the above method steps are implemented.

[0016] In an embodiment of the present application, heartbeat response messages of each connection of a microservice application in a microservice architecture are monitored. The heartbeat response message includes metadata of a connection target of the microservice application, and the metadata includes address information of the connection target. Local application topology description information of the microservice application is obtained according to the metadata, where the local application topology description information is used to indicate a connection topology relationship between the microservice application and the connection target. The local application topology description information is sent to a preset node for the preset node to generate a global application topology of the microservice architecture according to the local application topology description information, where the global application topology is used to indicate a connection topology relationship between all microservice applications included in the microservice architecture and corresponding connection targets. That is to say, the microservice application in the embodiment of the present application obtains local application topology description information based on the information carried in the heartbeat response message, and then reports the local application topology description information to a preset node for aggregation to generate a global application topology. Even if there is no traffic call, complete application topology information can be analyzed, thereby solving the problem in the related art that if there is no traffic generated in the microservice call, the application topology will not be perceived, or only the application topology of part of the link can be perceived, and achieving the technical effect of improving the efficiency of application topology perception. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings constituting a part of this application are used to provide a further understanding of this application. The schematic embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation to this application. In the drawings:

[0018] Figure 1 FIG. 9 is a schematic diagram of a dynamic perception structure of an application topology according to an embodiment of the present application;

[0019] Figure 2 FIG. 13 is a flowchart of a method for dynamically perceiving an application topology according to an embodiment of the present application;

[0020] Figure 3 FIG. 17 is a schematic diagram of a dynamic perception of an application topology according to an embodiment of the present application;

[0021] Figure 4 FIG. 21 is a flowchart of another method for dynamically perceiving an application topology according to an embodiment of the present application;

[0022] Figure 5 FIG. 25 is a schematic diagram of another dynamic perception of an application topology according to an embodiment of the present application;

[0023] Figure 6 FIG. 29 is a schematic diagram of yet another dynamic perception of an application topology according to an embodiment of the present application;

[0024] Figure 7Schematic diagram of a dynamic perception device for application topology according to an embodiment of the present application;

[0025] Figure 8 Schematic diagram of another dynamic perception device for application topology according to an embodiment of the present application. Detailed implementation manners

[0026] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.

[0027] It should be noted that the steps shown in the flowchart of the accompanying drawings may be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than here.

[0028] Embodiment 1

[0029] The embodiments of the present application are mainly proposed based on application topology perception in a microservices architecture, where the application topology reflects the invocation relationships between multiple microservices applications, the invocation relationships between microservices applications and the registration center, and the invocation relationships between microservices applications and the services (such as databases, caches, message queue services) on which the microservices applications depend. As Figure 1 shown, the microservices architecture includes a registration center, microservices application 1, microservices application 2, microservices application 3, a database, a cache, and a message queue service. When the governance center performs application analysis and governance, it is necessary to know the invocation relationships in the above microservices architecture. The invocation relationships can be regarded as Figure 1 various connection relationships in, and the topology of the microservices architecture can be finally determined through these connection relationships. Based on this, a dynamic perception method for application topology is provided in this embodiment. Figure 2 It is a flowchart of the dynamic perception method for application topology according to an embodiment of the present application. As Figure 2 shown, the method includes the following steps:

[0030] S202, listen for the heartbeat response messages of each connection of the microservices application in the microservices architecture, where the heartbeat response message includes the metadata of the connection target of the microservices application, and the metadata includes the address information of the connection target;

[0031] It should be noted that the above address information may be an Internet Protocol (IP) address. The above microservices architecture is a way of developing a single application program as a suite composed of many small services, where each service has its own process and uses lightweight mechanisms to achieve communication.

[0032] In addition, it should be noted that the above connections are in the connection pool, and the connection pool may include: call connection pool, registry connection pool, etc. The above connection targets may include: microservice applications, registries, databases, caches, message queue services, etc. The above S202 can inject a heartbeat monitoring program into the microservice application through Java Agent technology, and monitor the heartbeat response messages of each connection of the microservice application in the microservice architecture through this heartbeat monitoring program.

[0033] Optionally, the above S202 may include the following steps:

[0034] S11, monitor the heartbeat response message of the connection between the microservice application and the registry, and

[0035] S12, monitor the heartbeat response message of the connection between the microservice application and the services it depends on.

[0036] It should be noted that the services that the above microservice application depends on include but are not limited to: other microservice applications other than this microservice application, third-party components (such as caches), databases, etc.

[0037] By monitoring the heartbeat response message of the connection between the microservice application and the registry through the above S11, the local application topology description information between the microservice applications and between the microservice application and the registry can be further obtained based on this heartbeat response message, and through S12, by monitoring the heartbeat response message of the connection between the microservice application and the services it depends on, the local application topology description information between the microservice application and the services it depends on can be further obtained based on this heartbeat response message.

[0038] S204, obtain the local application topology description information of the microservice application according to the metadata, where the local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target;

[0039] The above S204 can inject a heartbeat information analysis program into the microservice application through Java Agent technology, and obtain the local application topology description information of the microservice application through this heartbeat information analysis program.

[0040] Optionally, the above S204 may include:

[0041] S21, obtain the first information list corresponding to the microservice application, where the first information list includes the connection relationship between the microservice application and the connection target;

[0042] S22. Update the address information of the connection target and the address information of the microservice application included in the metadata to the first information list to obtain the local application topology description information of the microservice application.

[0043] It should be noted that each microservice application corresponds to an information list, and the information list includes the connection relationship between the microservice application and the connection target. For example, if microservice application A calls microservice application B, then the above first information list can include the connection relationship from microservice application A to microservice application B (A - B). Another example, if microservice application A calls microservice application B and microservice application B calls microservice application C, then the above first information list can include the connection relationship from microservice application A to microservice application B and the connection relationship from microservice application B to microservice application C (A - B - C).

[0044] Optionally, the above metadata may further include the attribute information of the connection target and the application information of the connection target. For example, assuming the connection target is a microservice application, the above attribute information may be the type of the microservice application, the name of the type, etc. When the connection target is a registry, the above application information may be the services listened to by the registry. When the connection target is a database, the above application information may be the database tables that can be accessed, etc. In this way, the information of the application topology is more complete, which can further improve the user experience.

[0045] When the above metadata includes the attribute information of the connection target and the application information of the connection target, obtaining the local application topology description information of the microservice application according to the metadata further includes:

[0046] S23. Obtain the second information list corresponding to the microservice application, where the second information list includes the attribute information of the connection target and the application information of the connection target;

[0047] S24. Update the attribute information of the connection target and the application information of the connection target included in the metadata to the second information list to obtain the local application topology description information of the microservice application.

[0048] Through the above S21 - S22 and S23 - S24, the connection relationship between the microservice application and the connection target can be obtained according to the metadata, and the connection relationship is updated to the first information list corresponding to the microservice application, and the attribute information of the connection target and the application information of the connection target are updated to the second information list. The backend only needs to maintain these two tables, namely the first information list and the second information list, and can analyze the topological relationship without making calls. Compared with the related art, only when a call is generated can the topological relationship be analyzed, and in order to display the topological relationship, calls are made, which will result in the need to store a large amount of Trace data and an increase in storage costs. However, the embodiment of the present application has nothing to do with the call volume. Even for an extremely complex topological relationship of hundreds of microservice applications, the storage cost is almost zero.

[0049] S206. Send the local application topology description information to a preset node for the preset node to generate the global application topology of the microservice architecture according to the local application topology description information, where the global application topology is used to indicate the connection topology relationship between all microservice applications included in the microservice architecture and the corresponding connection targets.

[0050] Optionally, in the embodiment of the present application, the above - mentioned preset node has the function of aggregating and generating the global application topology (for example, an application topology generation program), and can aggregate the local application topology description information of multiple microservice applications, and then obtain the global application topology of the microservice architecture. For example, taking a shopping - type system as an example for illustration, as Figure 3 shown, the system includes a registration center, an ecological cloud gateway (Spring Cloud Gateway, abbreviated as SCG), a shopping cart, a transaction center, an inventory center, a database, a cache, and a message queue service. Among them, the ecological cloud gateway, the shopping cart, the transaction center, and the inventory center can all be microservice applications. For the shopping cart, the shopping cart determines that there is a connection relationship 1 between the shopping cart and the registration center, a connection relationship 2 between the shopping cart and the transaction center, and a connection relationship 3 between the shopping cart and the database through the address information of the connection target carried in each connected heartbeat response message. Then these 3 connection relationships can be regarded as the local application topology description information A of the shopping cart. By analogy, the transaction center and the inventory center will also obtain the corresponding local application topology description information B and local application topology description information C. Aggregating the local application topology description information A, local application topology description information B, and local application topology description information C can obtain Figure 3 the global application topology composed of all the connecting lines as shown.

[0051] Through the above S202 - S206, heartbeat response messages of each connection of the microservice application in the microservice architecture are monitored. Among them, the heartbeat response message includes metadata of the connection target of the microservice application, and the metadata includes address information of the connection target; local application topology description information of the microservice application is obtained according to the metadata, where the local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target; the local application topology description information is sent to a preset node for the preset node to generate the global application topology of the microservice architecture according to the local application topology description information, where the global application topology is used to indicate the connection topology relationship between all microservice applications included in the microservice architecture and corresponding connection targets. That is to say, the microservice application in the embodiment of this application obtains local application topology description information based on the information carried in the heartbeat response message, and then reports the local application topology description information to the preset node for aggregation to generate the global application topology. Even if there is no traffic call, the complete application topology information can be analyzed, thus solving the problem in the related technology that based on Trace data to realize microservice application topology perception, if there is no traffic generated in the microservice call, then the application topology will not be perceived, or only part of the application topology of the link can be perceived, achieving the technical effect of improving the efficiency of application topology perception.

[0052] In an optional implementation manner, the above method further includes:

[0053] S41, during the startup process of the microservice application, heartbeat data of each connection is established.

[0054] Optionally, the above method may further include: during the operation of the microservice, heartbeat data of each connection is dynamically established.

[0055] [[ID=I12]]Through the above S41, even if the microservice application does not have any calls, but the connection and heartbeat will be established in advance during the startup process of the microservice application. Therefore, even if there is no business call, the complete microservice application topology information can be analyzed.

[0056] In this embodiment, a method for dynamically perceiving the application topology is further provided. Figure 4 It is a flowchart of another method for dynamically perceiving the application topology according to the embodiment of this application, as Figure 4 shown. The method includes the following steps:

[0057] S402. Obtain the local application topology description information of each microservice application in the microservice architecture. The local application topology description information is determined by the heartbeat response messages received by each microservice application. The heartbeat response message carries the metadata of the connection target of the microservice application. The metadata includes the address information of the connection target. The local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target.

[0058] S404. Aggregate the local application topology description information of each microservice application to obtain the global application topology of the microservice architecture. The global application topology is used to indicate the connection topology relationship between all microservice applications included in the microservice architecture and the corresponding connection targets.

[0059] Through the above S402 - S404, obtain the local application topology description information determined based on the heartbeat response messages reported by each microservice application, and then aggregate the local application topology description information of each microservice application to obtain the global application topology of the microservice architecture. Even without any traffic calls, the complete application topology information can be analyzed, thereby solving the problem in the related technology that if there is no traffic generated in the microservice call when implementing microservice application topology awareness based on Trace data, the application topology will not be perceived, or only the application topology of part of the link can be perceived, achieving the improvement of the application topology awareness efficiency.

[0060] Next, specific examples are combined to describe the embodiments of the present application.

[0061] Example 1

[0062] In this Example 1, it mainly describes the application topology awareness between microservice applications.

[0063] As Figure 5 shown, inject a heartbeat monitoring program and a heartbeat information analysis program into the framework of each microservice application. The heartbeat monitoring program will monitor the heartbeat response messages of the connection with the registration center in the service framework. The heartbeat response message includes metadata information such as, but not limited to, the address of the registration center, the services monitored in the registration center, and the server addresses in the services. After the heartbeat monitoring program collects the above metadata, it will hand it over to the heartbeat information analysis program. The heartbeat information analysis program will analyze the metadata information and abstract the local application topology description information required to display the global topology information, such as the first information list and the second information list involved in the current microservice application. The heartbeat information analysis program reports the analysis results to the global application topology generation program at the backend. The application topology generation program will perform global aggregation and display of the analysis results collected from each microservice application within a period of time.

[0064] Example 2

[0065] In this Example 2, it mainly describes the application topology awareness between a microservice application and the services it depends on.

[0066] As Figure 6 shown, the topological relationship between a microservice application and the dependencies required by the microservice application is realized by a heartbeat listener monitoring the heartbeat of the connections in the connection pool. The heartbeat listener collects the heartbeat response messages of each connection, and the heartbeat response message includes the metadata of the target connection (richer metadata such as the cached address, the address of the database, the database tables accessed, etc.). After collecting these metadata information, the heartbeat listener will hand them over to the heartbeat information analysis program. The heartbeat information analysis program will analyze the metadata information and abstract the local application topology description information such as the first information list and the second information list required to display the global topology information involved in the current microservice application. The heartbeat information analysis program reports the analysis results to the global application topology generation program at the backend. The application topology generation program will globally aggregate and display the analysis results reported by each microservice application collected over a period of time.

[0067] Example Two

[0068] Based on the application scenario of the above Example One, in this example, a device for dynamically perceiving application topology is provided. Figure 7 It is a schematic structural diagram of the device for dynamically perceiving application topology according to the embodiments of the present application. As Figure 7 shown, the device includes:

[0069] A monitoring module 72, configured to monitor the heartbeat response messages of each connection of a microservice application in a microservice architecture, wherein the heartbeat response message includes the metadata of the connection target of the microservice application, and the metadata includes the address information of the connection target;

[0070] It should be noted that the above address information may be an Internet Protocol (IP) address. The above microservice architecture is a way of developing a single application program as a suite composed of many small services, where each service has its own process and uses lightweight mechanisms to achieve communication.

[0071] In addition, it should be noted that the above connections are in the connection pool, and the connection pool may include: a call connection pool, a registration center connection pool, etc. The above connection targets may include: microservice applications, registration centers, databases, caches, message queue services, etc. The above monitoring module 72 may inject a heartbeat listener into the microservice application through the Java Agent technology, and monitor the heartbeat response messages of each connection of the microservice application in the microservice architecture through the heartbeat listener.

[0072] Optionally, the above monitoring module 72 is further configured to monitor the heartbeat response message of the connection between the microservice application and the registration center, and monitor the heartbeat response message of the connection between the microservice application and the services relied on by the microservice application.

[0073] It should be noted that the services relied on by the microservice application include but are not limited to: other microservice applications other than the microservice application, third-party components (such as caches), databases, etc.

[0074] By monitoring the heartbeat response message of the connection between the microservice application and the registration center through the above monitoring module 72, local application topology description information between the microservice application and the microservice application, and between the microservice application and the registration center can be further obtained based on the heartbeat response message, and by monitoring the heartbeat response message of the connection between the microservice application and the services relied on by the microservice application, local application topology description information between the microservice application and the services relied on by the microservice application can be further obtained based on the heartbeat response message.

[0075] The first obtaining module 74 is configured to obtain the local application topology description information of the microservice application according to the metadata, where the local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target;

[0076] The above first obtaining module 74 can inject a heartbeat information analysis program into the microservice application through the Java Agent technology, and obtain the local application topology description information of the microservice application through the heartbeat information analysis program.

[0077] Optionally, the above first obtaining module 74 is further configured to obtain a first information list corresponding to the microservice application, where the first information list includes the connection relationship between the microservice application and the connection target; update the address information of the connection target included in the metadata and the address information of the microservice application to the first information list to obtain the local application topology description information of the microservice application.

[0078] It should be noted that each microservice application corresponds to an information list, and the information list includes the connection relationship between the microservice application and the connection target. For example, if microservice application A calls microservice application B, then the above first information list can include the connection relationship from microservice application A to microservice application B (A - B). Another example is that if microservice application A calls microservice application B and microservice application B calls microservice application C, then the above first information list can include the connection relationship from microservice application A to microservice application B and the connection relationship from microservice application B to microservice application C (A - B - C).

[0079] Optionally, the above metadata may further include attribute information of the connection target and application information of the connection target. For example, assuming the connection target is a microservice application, the above attribute information may be the type of the microservice application, the name of the type, etc. When the connection target is a registry center, the above application information may be the services listened by the registry center. When the connection target is a database, the above application information may be the database tables that can be accessed. In this way, the information of the application topology is more complete, which can further improve the user experience.

[0080] When the above metadata includes the attribute information of the connection target and the application information of the connection target, the first acquisition module 74 is further configured to acquire a second information list corresponding to the microservice application, where the second information list includes the attribute information of the connection target and the application information of the connection target; update the attribute information of the connection target and the application information of the connection target included in the metadata to the second information list to obtain the local application topology description information of the microservice application.

[0081] Through the above first acquisition module 7, the connection relationship between the microservice application and the connection target can be acquired according to the metadata, and the connection relationship is updated to the first information list corresponding to the microservice application, and the attribute information of the connection target and the application information of the connection target are updated to the second information list. The backend only needs to maintain these two tables, namely the first information list and the second information list, and can analyze the topology relationship without making calls. Compared with the related art, only when a call is generated can the topology relationship be analyzed, and in order to display the topology relationship, calls are made, which will result in the need to store a large amount of Trace data and increase the storage cost. However, the embodiment of the present application is independent of the call volume. Even for the extremely complex topology relationships of hundreds of microservice applications, the storage cost is almost zero.

[0082] The sending module 76 is configured to send the local application topology description information to a preset node for the preset node to generate the global application topology of the microservice architecture according to the local application topology description information, where the global application topology is used to indicate the connection topology relationship between all microservice applications included in the microservice architecture and the corresponding connection targets.

[0083] Optionally, in the embodiment of the present application, the above preset node has the function of aggregating and generating the global application topology (for example, an application topology generation program), and can aggregate and process the local application topology description information of multiple microservice applications to obtain the global application topology of the microservice architecture. For example, taking a shopping system as an example for illustration, such as Figure 3As shown in the figure, the system includes a registration center, an ecological cloud gateway (Spring Cloud Gateway, abbreviated as SCG), a shopping cart, a transaction center, an inventory center, a database, a cache, and a message queue service. Among them, the ecological cloud gateway, the shopping cart, the transaction center, and the inventory center can all be microservice applications. For the shopping cart, the shopping cart determines that there is a connection relationship 1 between the shopping cart and the registration center, a connection relationship 2 between the shopping cart and the transaction center, and a connection relationship 3 between the shopping cart and the database through the address information of the connection target carried in the heartbeat response messages of each connection. Then these 3 connection relationships can be regarded as the local application topology description information A of the shopping cart. By analogy, the transaction center and the inventory center will also obtain the corresponding local application topology description information B and local application topology description information C. Aggregating the local application topology description information A, local application topology description information B, and local application topology description information C can obtain Figure 3 The global application topology formed by all the connection lines shown in the figure.

[0084] Through Figure 7 The device shown in the figure listens to the heartbeat response messages of each connection of the microservice application in the microservice architecture. Among them, the heartbeat response message includes the metadata of the connection target of the microservice application, and the metadata includes the address information of the connection target; obtaining the local application topology description information of the microservice application according to the metadata, where the local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target; sending the local application topology description information to a preset node for the preset node to generate the global application topology of the microservice architecture according to the local application topology description information, where the global application topology is used to indicate the connection topology relationship between all the microservice applications included in the microservice architecture and the corresponding connection targets. That is to say, the microservice application in the embodiment of the present application obtains the local application topology description information based on the information carried in the heartbeat response message, and then reports the local application topology description information to the preset node for aggregation to generate the global application topology. Even if there is no traffic call, the complete application topology information can be analyzed, thereby solving the problem in the related technology that based on Trace data to realize microservice application topology perception, if there is no traffic generated in the microservice call, then the application topology will not be perceived, or only part of the application topology of the link can be perceived, and the technical effect of improving the application topology perception efficiency is achieved.

[0085] In an optional embodiment, the above device is further configured to establish the heartbeat data of each connection during the startup process of the microservice application.

[0086] Optionally, the above device is further configured to dynamically establish the heartbeat data of each connection during the operation of the microservice.

[0087] With the above device, even if there is no call in the microservice application, the connection and heartbeat will be established in advance during the startup process of the microservice application. Therefore, even without any business calls, the complete microservice application topology information can be analyzed.

[0088] In this embodiment, a dynamic perception device for application topology is also provided. Figure 8 It is a schematic structural diagram of another dynamic perception device for application topology according to an embodiment of the present application. As Figure 8 shown, the device includes:

[0089] A second acquisition module 82, configured to acquire local application topology description information of each microservice application in the microservice architecture. The local application topology description information is determined by heartbeat response messages received by each microservice application. The heartbeat response message carries metadata of the connection target of the microservice application. The metadata includes address information of the connection target. The local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target.

[0090] A third acquisition module 84, configured to aggregate the local application topology description information of each microservice application to obtain the global application topology of the microservice architecture. The global application topology is used to indicate the connection topology relationship between all microservice applications included in the microservice architecture and the corresponding connection targets.

[0091] By Figure 8 the device shown, acquiring the local application topology description information determined based on the heartbeat response messages reported by each microservice application, and then aggregating the local application topology description information of each microservice application to obtain the global application topology of the microservice architecture. Even without any traffic calls, the complete application topology information can be analyzed, thereby solving the problem in the related art that if there is no traffic generated in the microservice call when implementing microservice application topology perception based on Trace data, the application topology will not be perceived or only the application topology of part of the link can be perceived, achieving the improvement of the application topology perception efficiency.

[0092] Embodiment III

[0093] An embodiment of the present invention also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein, the processor is configured to execute the steps of any one of the above methods.

[0094] Embodiment IV

[0095] An embodiment of the present invention also provides a computer-readable storage medium, on which instructions are stored. When the instructions are executed by a processor, the steps of any one of the above methods are implemented.

[0096] In the above embodiments of the present invention, the descriptions of the various embodiments have their own emphases. For the parts not elaborated in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0097] In the several embodiments provided in the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of units or modules can be in an electrical or other form.

[0098] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0099] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0100] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The foregoing storage medium includes: USB flash drives, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disks, magnetic disks or optical disks and other various media that can store program codes.

[0101] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can still be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.

Claims

1. A dynamic perception method applying topology, characterized in that, Including: Monitoring heartbeat response messages of each connection of a microservice application in a microservice architecture, where the heartbeat response message includes metadata of a connection target of the microservice application, and the metadata includes address information of the connection target, attribute information of the connection target, and application information of the connection target; Obtaining local application topology description information of the microservice application according to the metadata, where the local application topology description information is used to indicate a connection topology relationship between the microservice application and the connection target; Sending the local application topology description information to a preset node for the preset node to generate a global application topology of the microservice architecture according to the local application topology description information, where the global application topology is used to indicate a connection topology relationship between all microservice applications included in the microservice architecture and corresponding connection targets; The monitoring of heartbeat response messages of each connection of a microservice application in the microservice architecture includes: Monitoring heartbeat response messages of a connection between the microservice application and a registration center, and Monitoring heartbeat response messages of a connection between the microservice application and a service on which the microservice application depends; Each microservice application correspondingly includes a first information list and a second information list. The first information list includes connection relationships between the microservice application and connection targets, and the second information list includes attribute information of the connection targets and application information of the connection targets.

2. The method according to claim 1, wherein Obtaining local application topology description information of the microservice application according to the metadata includes: Obtaining the first information list corresponding to the microservice application; Updating the address information of the connection target included in the metadata and the address information of the microservice application to the first information list to obtain local application topology description information of the microservice application.

3. The method according to claim 1, wherein Obtaining local application topology description information of the microservice application according to the metadata further includes: Obtaining the second information list corresponding to the microservice application; Updating the attribute information of the connection target and the application information of the connection target included in the metadata to the second information list to obtain local application topology description information of the microservice application.

4. The method according to claim 1, wherein The method further includes: Establishing heartbeat data of each connection during the startup process of the microservice application.

5. A dynamic perception method applying topology, characterized in that, Including: Obtaining local application topology description information of each microservice application in a microservice architecture, where the local application topology description information is determined by heartbeat response messages received by each microservice application. The heartbeat response message carries metadata of a connection target of the microservice application, and the metadata includes address information of the connection target, attribute information of the connection target, and application information of the connection target. The local application topology description information is used to indicate a connection topology relationship between the microservice application and the connection target. The heartbeat response messages received by each microservice application include: heartbeat response messages of a connection between the microservice application and a registration center, and heartbeat response messages of a connection between the microservice application and a service on which the microservice application depends; Aggregate the local application topology description information of each of the microservice applications to obtain the global application topology of the microservice architecture, where the global application topology is used to indicate the connection topology relationship between all the microservice applications included in the microservice architecture and the corresponding connection targets; Each of the microservice applications includes a first information list and a second information list. The first information list includes the connection relationships between the microservice application and the connection targets, and the second information list includes the attribute information of the connection targets and the application information of the connection targets.

6. A dynamic perception device applying topology, characterized in that, Comprising: A monitoring module, configured to monitor the heartbeat response messages of each connection of the microservice applications in the microservice architecture, where the heartbeat response message includes the metadata of the connection targets of the microservice application, and the metadata includes the address information of the connection target, the attribute information of the connection target, and the application information of the connection target; A first acquisition module, configured to acquire the local application topology description information of the microservice application according to the metadata, where the local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target; A sending module, configured to send the local application topology description information to a preset node for the preset node to generate the global application topology of the microservice architecture according to the local application topology description information, where the global application topology is used to indicate the connection topology relationship between all the microservice applications included in the microservice architecture and the corresponding connection targets; The monitoring module is specifically configured to monitor the heartbeat response messages of the connection between the microservice application and the registration center, and monitor the heartbeat response messages of the connection between the microservice application and the services on which the microservice application depends; Each of the microservice applications includes a first information list and a second information list. The first information list includes the connection relationships between the microservice application and the connection targets, and the second information list includes the attribute information of the connection targets and the application information of the connection targets.

7. A dynamic perception device applying topology, characterized in that, Comprising: A second acquisition module, configured to acquire the local application topology description information of each microservice application in the microservice architecture, where the local application topology description information is determined by the heartbeat response messages received by each microservice application. The heartbeat response message carries the metadata of the connection targets of the microservice application, and the metadata includes the address information of the connection target, the attribute information of the connection target, and the application information of the connection target, and the local application topology description information is used to indicate the connection topology relationship between the microservice application and the connection target. The heartbeat response messages received by each microservice application include: the heartbeat response messages of the connection between the microservice application and the registration center, and the heartbeat response messages of the connection between the microservice application and the services on which the microservice application depends; A third acquisition module, configured to aggregate the local application topology description information of each of the microservice applications to obtain the global application topology of the microservice architecture, where the global application topology is used to indicate the connection topology relationship between all the microservice applications included in the microservice architecture and the corresponding connection targets; Each of the microservice applications includes a first information list and a second information list. The first information list includes the connection relationship between the microservice application and the connection target, and the second information list includes the attribute information of the connection target and the application information of the connection target.

8. An electronic device, comprising a memory and a processor; wherein, The memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method steps described in any one of claims 1 to 5.

9. A readable storage medium having computer instructions stored thereon, wherein, When the computer instructions are executed by the processor, the method steps described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Network topology building method

    CN103763172A

  • Topological diagram drawing method and device

    CN112615743A