Distributed service topology automatic generation method and device based on network connection

By obtaining network connections and process metadata from the operating system level and building and optimizing the service topology structure, the problem of strong invasiveness, complex deployment and insufficient real-time performance of service topology generation methods in the existing technology is solved, and lightweight, real-time and general distributed service topology automatic generation is achieved.

CN119892641APending Publication Date: 2025-04-25BEIJING QINGSONG YIKANG INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411965492.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The existing service topology generation methods are highly invasive and complex in deployment, and cannot reflect changes in service call relationships in real time, resulting in topology data lag behind the actual operating state.

Method used

By obtaining network connection status information and process metadata from the operating system level, generating distributed service call relationships in association, building a service topology structure, and using graph theory algorithms for layout optimization to generate distributed service topology maps in real time.

Benefits of technology

It reduces the deployment complexity and system performance overhead of service topology generation tools, improves the real-time nature of service topology generation, and can dynamically reflect changes in service call relationships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892641A_ABST
    Figure CN119892641A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed service topology automatic generation method and device based on network connection, and the method comprises the steps: obtaining the network connection state information and process metadata of a host from an operating system level; associating the network connection state information with the process metadata to generate a distributed service calling relationship; constructing a service topological structure by taking each service process as a node of the service topological structure and taking the calling relationship between the two service processes as an edge of the service topological structure according to the distributed service calling relationship; and performing layout optimization on the service topological structure by using a graph theory algorithm to generate a distributed service topological graph. As the network connection state information and the process metadata can be continuously and directly acquired from the operating system level, the deployment is simple, the system performance overhead is reduced, and the distributed service topological graph can be generated in real time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of distributed systems, and in particular to a method and device for automatically generating a distributed service topology based on a network connection. Background Art

[0002] With the widespread application of distributed systems in cloud computing, the Internet of Things, and microservice architectures, the calling relationships between services are becoming increasingly complex. Dynamic visualization of service topology has become a key means of system monitoring and fault location.

[0003] Existing service topology generation methods require adding tracking points in the application code or using protocol analysis tools to collect traffic data, such as OpenTelemetry or specific log collection agents. Such methods usually require in-depth application code layer, are highly invasive, complex to deploy, and increase system performance overhead. In addition, such tools usually have delays, especially in large-scale systems, and cannot reflect changes in service call relationships in real time, causing topology data to lag behind the actual operating status. Summary of the invention

[0004] The embodiment of the present invention provides a method and device for automatically generating a distributed service topology based on a network connection, so as to reduce the deployment complexity of a service topology generation tool, reduce system performance overhead, and improve the real-time performance of service topology generation.

[0005] In a first aspect, an embodiment of the present invention provides a method for automatically generating a distributed service topology based on a network connection, the method comprising:

[0006] Obtain the host's network connection status information and process metadata from the operating system level;

[0007] Associating the network connection status information with the process metadata to generate a distributed service call relationship;

[0008] According to the distributed service calling relationship, each service process is regarded as a node of the service topology structure, and the calling relationship between two service processes is regarded as an edge of the service topology structure, to construct a service topology structure;

[0009] The service topology structure is optimized by using a graph theory algorithm to generate a distributed service topology graph.

[0010] Furthermore, the network connection status information includes a source IP address, a source port number, a target IP address, a target port number, a service connection status, and an associated service process identifier;

[0011] The process metadata includes the service process name, service startup parameters and port binding information.

[0012] Furthermore, obtaining the network connection status information and process metadata of the host from the operating system level includes:

[0013] Use operating system tools to obtain the host's network connection status information;

[0014] Use the operating system process management interface to obtain process metadata.

[0015] Furthermore, associating the network connection status information with the process metadata to generate a distributed service call relationship includes:

[0016] Grouping network connections having the same source IP address, source port number, target IP address, and target port number in the network connection status information into one group;

[0017] For each group of the network connections, determining in the process metadata a service process name corresponding to the network connection according to an associated service process label in the network connection status information;

[0018] Generate a distributed service call relationship with the service process name as the key and the corresponding network connection information as the value.

[0019] Further, according to the distributed service calling relationship, each service process is a node of the service topology structure, and the calling relationship between two service processes is an edge of the service topology structure, and constructing the service topology structure includes:

[0020] According to the distributed service call relationship, the service name is used as a topological node, and the node attributes include the service process name, IP address and port number;

[0021] The calling relationship between two service processes is regarded as a directed edge, and the attributes of the edge include the calling direction;

[0022] The service topology structure is generated by combining the information of topological nodes and directed edges.

[0023] Furthermore, the use of a graph theory algorithm to optimize the layout of the service topology structure to generate a distributed service topology graph includes:

[0024] Using a force-directed layout algorithm to optimize the display effect of the service topology structure to obtain an optimized service topology structure;

[0025] Construct a call tree structure according to the service level of each service process;

[0026] According to the call tree structure, the optimized service topology results are grouped and laid out to obtain a distributed service topology diagram.

[0027] Furthermore, after optimizing the layout of the service topology structure by using a graph theory algorithm to generate a distributed service topology graph, the method further includes:

[0028] The distributed service topology map is converted into an interactive graphical interface for display using a visualization library, wherein the visualization library includes D3.js or Cytoscape.js.

[0029] Furthermore, after optimizing the layout of the service topology structure by using a graph theory algorithm to generate a distributed service topology graph, the method further includes:

[0030] Periodically obtain the host's network connection status information and process metadata from the operating system level, and regenerate the distributed service call relationship;

[0031] The distributed service call relationship and the regenerated distributed service call relationship are compared, and if there is a changed service call relationship, the distributed service topology map is regenerated.

[0032] In a second aspect, an embodiment of the present invention provides a device for automatically generating a distributed service topology based on a network connection, the device comprising:

[0033] The data collection module is used to obtain the host's network connection status information and process metadata from the operating system level;

[0034] A data processing module is used to associate the network connection status information with the process metadata to generate a distributed service call relationship; according to the distributed service call relationship, each service process is used as a node of the service topology structure, and the call relationship between two service processes is used as an edge of the service topology structure to construct a service topology structure;

[0035] The topology generation module is used to optimize the layout of the service topology structure using a graph theory algorithm to generate a distributed service topology graph.

[0036] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory is used to store program instructions, and the processor is used to implement the steps of the above-mentioned method for automatically generating a distributed service topology based on network connection when executing the computer program stored in the memory.

[0037] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for automatically generating a distributed service topology based on network connections.

[0038] In the embodiment of the present invention, the network connection status information and process metadata of the host are obtained from the operating system level; the network connection status information and process metadata are associated to generate a distributed service call relationship; according to the distributed service call relationship, each service process is used as a node of the service topology structure, and the call relationship between two service processes is used as an edge of the service topology structure to construct a service topology structure; the service topology structure is optimized by using a graph theory algorithm to generate a distributed service topology map. In this invention, the network connection status information and process metadata can be continuously and directly obtained from the operating system level, the deployment is simple, the system performance overhead is reduced, and a distributed service topology map can be generated in real time. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0040] Figure 1 A schematic diagram of a process of automatically generating a distributed service topology based on network connections provided by an embodiment of the present invention;

[0041] Figure 2 A schematic diagram of network connection status information provided by an embodiment of the present invention;

[0042] Figure 3 A schematic diagram of the structure of a device for automatically generating a distributed service topology based on network connection provided by an embodiment of the present invention;

[0043] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] In order to reduce the deployment complexity of service topology generation tools, reduce system performance overhead, and improve the real-time performance of service topology generation, an embodiment of the present invention provides a method and device for automatically generating a distributed service topology based on network connections.

[0046] Embodiment 1:

[0047] Figure 1 A schematic diagram of a method for automatically generating a distributed service topology based on a network connection provided by an embodiment of the present invention, the process comprising the following steps:

[0048] S101: Obtaining network connection status information and process metadata of the host from the operating system level.

[0049] S102: Associating the network connection status information with the process metadata to generate a distributed service call relationship.

[0050] S103: According to the distributed service calling relationship, a service topology structure is constructed with each service process as a node of the service topology structure and the calling relationship between two service processes as an edge of the service topology structure.

[0051] S104: Optimize the layout of the service topology structure using a graph theory algorithm to generate a distributed service topology graph.

[0052] Since the network connection status information and process metadata can be continuously and directly obtained from the operating system level in the embodiment of the present invention, the deployment is simple, the system performance overhead is reduced, and a distributed service topology map can be generated in real time.

[0053] The method for automatically generating a distributed service topology based on network connection provided in an embodiment of the present invention is applied to a topology generation tool. As a lightweight tool, the topology generation tool can be simply deployed on a corresponding device, thereby realizing automatic generation of a topology. The topology generation tool includes a data acquisition module, a data processing module, and a topology generation module, and may optionally include a visualization module, a deployment and integration module, and an extended function module. The above steps will be described below in conjunction with each function module.

[0054] The main function of the data collection module is to collect network connection and service-related data from the operating system level to provide basic information for topology generation, that is, the data collection module can implement the above S101. In one implementation, the above S101 can be to use the operating system tool to obtain the host's network connection status information; and use the operating system process management interface to obtain process metadata.

[0055] For example, the network connection status information includes the source IP (Internet Protocol) address, source port number, target IP address, target port number, service connection status and associated service process identifier; the process metadata includes the service process name, service startup parameters and port binding information.

[0056] Taking a specific embodiment as an example, the data collection module can realize network connection information collection, process and service information collection, and dynamic update mechanism:

[0057] When collecting network connection information, you can use operating system tools to obtain the network connection status of the current host. The network connection status can be TCP (Transmission Control Protocol) / UDP (User Datagram Protocol) network connection status. The following key fields of network connection status information can be extracted from the network connection status: source IP address and port number, target IP address and port number, connection status, and associated service process ID (Identity Document). The operating system tool can be, for example, Linux netstat and / or ss, or Windows netstat and / or PowerShell commands.

[0058] When collecting process and service information, metadata such as service process name, service startup parameters, port binding information, etc. can be obtained from the operating system process management interface (such as the / proc file system or Windows API). In addition, it can also support the identification of predefined ports and custom ports for common services (such as HTTP (Hypertext Transfer Protocol) and MySQL).

[0059] In the dynamic update mechanism, data can be collected periodically (for example, once a second), or collection can be triggered based on network events to ensure that the topology map can dynamically reflect changes in service calls. Through the design of this mechanism, real-time acquisition of network connection status information and process metadata can be guaranteed.

[0060] For example, the data collection module uses operating system tools or interfaces (such as netstat, ss, lsof, etc.) to obtain TCP / UDP network connection information and process metadata to dynamically identify service call relationships. Usually, when a service calls another service, a call record can be seen through netstat, such as Figure 2 As shown in the figure, PID (Process Identifier) ​​represents the process ID of the current service. You can further use other commands such as ps to obtain the file path to determine the name of the service; Local Address is the IP address of the current service (corresponding to PID) and the port used to connect to the target service, such as Figure 2The port of the server 172.17.177.136 is 49248; Foreign Address is the address and port of the target service; through this record, we can get that the service with service ID 6994 called the service with port 3306 on the server 172.17.23.143.

[0061] The main function of the data processing module is to process and associate the collected original network connection and process information, and generate a distributed service call relationship, which can be represented by a service call relationship table. In one implementation method, the above S102 can be to group the network connections with the same source IP address, source port number, target IP address, and target port number in the network connection status information; for each group of network connections, determine the service process name corresponding to the network connection in the process metadata according to the associated service process identifier in the network connection status information; generate a distributed service call relationship with the service process name as the key and the corresponding network connection information as the value. The above S103 can be to use the service name as a topological node according to the distributed service call relationship, and the node attributes include the service process name, IP address, and port number; use the call relationship between two service processes as a directed edge, and the attributes of the edge include the call direction; and generate a service topology structure by combining the information of the topological node and the directed edge.

[0062] Taking a specific embodiment as an example, the data processing module can realize service identification, call relationship generation, and data structure organization:

[0063] When identifying services, the service type can be preliminarily identified based on the port mapping table (such as HTTP:80, MySQL:3306); for services with non-standard ports, the service name (i.e., service process name) can be supplemented by parsing the process startup parameters or service configuration files. For example, the service type can be preliminarily identified and the service process name can be located by identifying the associated service process identifier in the network connection status information based on the port mapping table. For services with non-standard ports, since they are not stored in the port mapping table, the service process name can be obtained by parsing the network connection status information and / or process metadata.

[0064] When generating a call relationship, the source IP, target IP and port information can be combined to generate a service call relationship (such as service A calling service B); irrelevant connections (such as local loopback connections and invalid state connections) can be filtered.

[0065] When organizing the data structure, you can generate a topological data structure with nodes (service instances) and edges (call relationships) as the core, and support JSON (JavaScript Object Notation) format output:

[0066] {

[0067] "nodes":[{"id":"ServiceA"},{"id":"ServiceB"}],

[0068] "links":[{"source":"ServiceA","target":"ServiceB","protocol":"TCP"}]

[0069] }; The topology data result in JSON format indicates that the nodes include service A and service B, and the edge includes service A as the source and service B as the target, that is, the protocol used by service A to call service B is TCP protocol.

[0070] Also the above Figure 2 Taking the example of the data processing module, the service call relationship based on the operating system network connection information is automatically identified, such as by parsing the process startup parameters and port mapping table, automatically associating the service name with the network connection to form a service call relationship table. In addition, the data processing module can also realize the dynamic generation and update of the service call topology, using nodes to represent service instances and edges to represent the call relationship between services, dynamically building the service topology structure, and using a real-time update mechanism to continuously monitor changes in network connections and automatically adjust the topology structure to ensure the real-time and accuracy of the service relationship.

[0071] The main function of the topology generation module is to construct a service call topology structure based on the processed data and optimize the display layout. In one implementation, the above S104 may be to optimize the display effect of the service topology structure using a force-directed layout algorithm to obtain an optimized service topology structure; construct a call tree structure according to the service level of each service process; and group and layout the optimized service topology results according to the call tree structure to obtain a distributed service topology map. In this implementation, the spatial coordinates of the topological nodes are calculated using a force-directed layout algorithm, so that the distance between related nodes is closer and the distance between non-related nodes is farther. The nodes are colored and grouped according to the different types of services or the levels they belong to, and the display styles of the nodes and edges are beautified to improve the readability of the topology map.

[0072] Taking a specific embodiment as an example, the topology generation module can realize node and edge definition and topology layout optimization:

[0073] When defining nodes and edges, nodes represent service instances. Each service instance, i.e., each node, is uniquely identified by a service name, IP address, and port number. Edges represent the calling relationship between two services and are accompanied by properties such as the communication protocol (such as TCP or UDP). For example, the meaning of nodes and edges in the topology data results in the above JSON format can correspond.

[0074] When optimizing the topology layout, graph theory algorithms (such as force-directed layout) can be used to optimize the topology display and reduce intersections and overlaps; it can also support grouping layout by service type, call frequency, or hierarchical architecture.

[0075] Also the above Figure 2 Taking the example of , the topology generation module provides a topology layout algorithm based on graph theory optimization, which can optimize the display effect of the service topology map by using graph theory algorithms such as force-directed layout, reduce node overlap and edge crossing methods, and group and layout the topology map according to service layering or call frequency, identify and give optimization strategies. The process of grouping and laying out the topology map according to service layering is explained. By constructing N call tree structures according to the level of the current service with all the collected call data, and by analyzing whether the level of the service in the tree structure matches the level where the service should be, the call link that should be optimized is identified. For example, the usual call sequence is: interface service facing the user interface (C end) --- call ---> A service ---》 B service ---》 C service --》 database or other middleware. Assuming that B service is usually in the third layer, but in the actual collected call data, it is in the second layer, it is necessary to analyze the rationality and then give the optimization strategy based on the analysis results.

[0076] In one implementation, after S104, a visualization library may be used to convert the distributed service topology map into an interactive graphical interface for display, and the visualization library includes D3.js or Cytoscape.js. This implementation can be implemented through a visualization module, and the main function of the visualization module is to provide a user-friendly interface and dynamically display the service call topology map. In this implementation, a visualization library such as D3.js and Cytoscape.js is used to convert the service topology structure data into an interactive graphical interface, which supports users to interact with the topology view through operations such as mouse dragging, zooming, and clicking, providing floating prompt information for nodes and edges, and displaying attribute information such as service name, IP address, and port.

[0077] Taking a specific embodiment as an example, the visualization module can realize front-end interaction, dynamic update, and view customization:

[0078] When interacting on the front end, it can support interactive graphics display based on frameworks such as D3.js and Cytoscape.js, and can also provide node dragging, zooming, filtering and highlighting functions to facilitate users to explore service relationships.

[0079] During dynamic updates, the topology map can be refreshed in real time to display the newly added or deleted service call relationships.

[0080] When customizing views, different views (such as request link diagrams, microservice grouping diagrams) can be generated according to service classification, hierarchy, or call path.

[0081] Also the above Figure 2 Taking the example of this, the visualization module provides visualization and interactive design of service call topology, can provide dynamic and interactive service topology diagram, support node dragging, scaling, filtering, highlighting and customized view generation, and realize real-time display of service relationships through front-end tools (such as D3.js, Cytoscape.js), so that users can quickly locate and analyze service call links.

[0082] In one implementation, after S104, the network connection status information and process metadata of the host can be periodically obtained from the operating system level, and the distributed service call relationship can be regenerated; the distributed service call relationship and the regenerated distributed service call relationship can be compared, and if there is a changed service call relationship, the distributed service topology map can be regenerated. This implementation can be implemented by a data processing module. In this implementation, the network connection status collection and service identification process can be periodically executed, the service call relationship table generated twice before and after can be compared, and the newly added, deleted or changed service call relationship can be identified. For the changed service call relationship, the corresponding nodes and edges in the service topology structure can be added, deleted or updated.

[0083] The main function of the above deployment and integration module is to realize cross-platform deployment of tools and seamless integration with other systems or tools. The deployment and integration module can realize lightweight deployment and interface integration:

[0084] In lightweight deployment, you can use scripts or lightweight agents to run directly on the host without complex configuration, and can also support multiple operating systems such as Linux, Windows, and macOS.

[0085] During interface integration, a RESTful API can be provided to output service call relationship data, which is convenient for integration with monitoring tools (such as Prometheus and Grafana). It can also support data export functions (JSON, CSV (Comma-Separated Values)) for use by external analysis tools.

[0086] Also the above Figure 2For example, the deployment and integration module provides a cross-platform lightweight data collection and deployment method. It can collect network connection and service information based on native operating system tools without installing complex agents or modifying application code. It also supports general deployment technology running on different operating systems (such as Linux, Windows, and macOS). No need to install complex agents or modify application code means that by writing a script and periodically running the system's netstat command, the connection information on the current server can be reported without developing other programs.

[0087] The main functions of the above-mentioned extended function modules are to provide additional functions to enhance user experience or expand scenario applications, and to achieve historical data storage and backtracking, anomaly detection, and security policy support:

[0088] When storing and tracing back historical data, the topology data generated each time can be saved, supporting historical version tracing and comparison.

[0089] During anomaly detection, abnormal call relationships (such as unexpected service calls and potential circular dependencies) can be identified.

[0090] When supported by security policies, unauthorized service access can be detected and marked to assist in security audits.

[0091] Also the above Figure 2 Taking the example as an example, the extended function module provides abnormal call detection and analysis functions, which can detect abnormal call relationships (such as unknown service access, circular calls or unauthorized services) while generating service call topology, and provide security audit and abnormal alarm functions based on topology map. During the abnormal detection process, after running the script for a period of time, a complete service link call relationship data will be generated. In each subsequent scan, if a caller (IP and service PID) that does not exist in the previous call relationship data is found, it is considered abnormal and can be manually identified and processed. At the same time, the results of each scan can be compared with the previous call relationship data. If some services are missing, an alarm can be automatically issued.

[0092] The extended function module also provides interfaces and extended support for topology data, and can provide RESTful API or data export functions, integrate the real-time generated service call relationships into other monitoring platforms (such as Prometheus, Grafana) or analysis tools (for example, the collected topology relationship data can be integrated into other visual monitoring platforms through interfaces), and support historical data storage and backtracking to facilitate comparison and analysis of changes in service topology.

[0093] The embodiment of the present invention forms a complete and dynamic service call relationship generation and display system around the whole process from network connection collection to topology generation and display, which is real-time, lightweight and universal. It significantly improves the observability of distributed systems and provides efficient service monitoring and fault location capabilities.

[0094] Existing service topology generation methods have the following limitations:

[0095] 1. Rely on application tracking or protocol analysis

[0096] Many existing methods require adding tracking points in the application code or using protocol analysis tools to collect traffic data, such as OpenTelemetry or specific log collection agents. Such methods usually require deep application code layer, are highly invasive, complex to deploy, and increase system performance overhead.

[0097] 2. Lack of real-time performance

[0098] Log analysis or traffic collection tools usually have delays, especially in large-scale systems, and cannot reflect changes in service call relationships in real time, causing topology data to lag behind the actual operating status.

[0099] 3. Limited compatibility

[0100] Many current methods have insufficient support for different operating systems, network protocols or service types, lack a universal solution, and are difficult to adapt to complex and diverse distributed environments.

[0101] 4. High implementation cost

[0102] Deploying and running existing monitoring solutions usually requires additional hardware resources or complex environment configuration, which imposes high technical barriers and cost pressure on the operation and maintenance team.

[0103] Therefore, how to automatically generate the calling topology of distributed services through a lightweight, real-time and universal method has become an urgent problem to be solved.

[0104] The present invention proposes a method for automatically generating distributed service topology based on operating system network connections, which directly obtains TCP network connection information between services from the operating system level, combines process and service metadata, and constructs a real-time service call relationship graph. The method has the following advantages:

[0105] 1. Lightweight and non-intrusive: No need to modify application code or deploy additional agents, network connection information is collected directly from the bottom layer of the operating system.

[0106] 2. Real-time and dynamic: Generate service call topology in real time by continuously collecting and updating network connection data.

[0107] 3. Strong versatility: supports multiple operating systems and multiple service types, and adapts to various distributed system architectures.

[0108] 4. Low cost and easy deployment: Use existing system tools and standard interfaces to simplify deployment and reduce the burden of operation and maintenance.

[0109] The present invention is not only suitable for monitoring and optimization of distributed services, but also can provide precise support for fault location, performance analysis and architecture optimization.

[0110] Embodiment 2:

[0111] Based on the above embodiments, Figure 3 A schematic diagram of a distributed service topology automatic generation device based on network connection provided by an embodiment of the present invention, the device includes:

[0112] The data collection module 301 is used to obtain the network connection status information and process metadata of the host from the operating system level;

[0113] The data processing module 302 is used to associate the network connection status information with the process metadata to generate a distributed service call relationship; according to the distributed service call relationship, each service process is regarded as a node of the service topology structure, and the call relationship between two service processes is regarded as an edge of the service topology structure, to construct a service topology structure;

[0114] The topology generation module 303 is used to optimize the layout of the service topology structure by using a graph theory algorithm to generate a distributed service topology graph.

[0115] Furthermore, the network connection status information includes a source IP address, a source port number, a target IP address, a target port number, a service connection status, and an associated service process identifier;

[0116] The process metadata includes the service process name, service startup parameters and port binding information.

[0117] Furthermore, the data acquisition module 301 is specifically used for:

[0118] Use operating system tools to obtain the host's network connection status information;

[0119] Use the operating system process management interface to obtain process metadata.

[0120] Furthermore, the data processing module 302 is specifically configured to:

[0121] Grouping network connections having the same source IP address, source port number, target IP address, and target port number in the network connection status information into one group;

[0122] For each group of the network connections, determining, in the process metadata, a service process name corresponding to the network connection according to an associated service process identifier in the network connection state information;

[0123] Generate a distributed service call relationship with the service process name as the key and the corresponding network connection information as the value.

[0124] Furthermore, the data processing module 302 is specifically configured to:

[0125] According to the distributed service call relationship, the service name is used as a topological node, and the node attributes include the service process name, IP address and port number;

[0126] The calling relationship between two service processes is regarded as a directed edge, and the attributes of the edge include the calling direction;

[0127] The service topology structure is generated by combining the information of topological nodes and directed edges.

[0128] Furthermore, the topology generation module 303 is specifically configured to:

[0129] Using a force-directed layout algorithm to optimize the display effect of the service topology structure to obtain an optimized service topology structure;

[0130] Construct a call tree structure according to the service level of each service process;

[0131] According to the call tree structure, the optimized service topology results are grouped and laid out to obtain a distributed service topology diagram.

[0132] Furthermore, a visualization module is included, which is used to:

[0133] The distributed service topology map is converted into an interactive graphical interface for display using a visualization library, wherein the visualization library includes D3.js or Cytoscape.js.

[0134] Furthermore, the data processing module is also used for:

[0135] Periodically obtain the host's network connection status information and process metadata from the operating system level, and regenerate the distributed service call relationship;

[0136] The distributed service call relationship and the regenerated distributed service call relationship are compared, and if there is a changed service call relationship, the distributed service topology map is regenerated.

[0137] Embodiment 3:

[0138] Figure 4A schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Based on the above embodiments, an electronic device is further provided in an embodiment of the present invention, including a processor 401, a communication interface 402, a memory 403 and a communication bus 404, wherein the processor 401, the communication interface 402, and the memory 403 communicate with each other through the communication bus 404;

[0139] The memory 403 stores a computer program. When the program is executed by the processor 401, the processor 401 executes the steps of the method for automatically generating a distributed service topology based on network connection in the above embodiment.

[0140] For the specific implementation process, please refer to the above embodiment, and the similarities are not repeated here.

[0141] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0142] The communication interface 402 is used for communication between the electronic device and other devices.

[0143] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0144] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0145] Embodiment 4:

[0146] Based on the above embodiments, an embodiment of the present invention further provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the steps of the method for automatically generating a distributed service topology based on network connections as in the above embodiments.

[0147] For the specific implementation process, please refer to the above embodiment, and the similarities are not repeated here.

[0148] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0149] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0150] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0152] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for automatically generating a distributed service topology based on network connections, characterized in that: The method comprises: Obtain the host's network connection status information and process metadata from the operating system level; Associating the network connection status information with the process metadata to generate a distributed service call relationship; According to the distributed service calling relationship, each service process is regarded as a node of the service topology structure, and the calling relationship between two service processes is regarded as an edge of the service topology structure, to construct a service topology structure; The service topology structure is optimized by using a graph theory algorithm to generate a distributed service topology graph.

2. The method according to claim 1, characterized in that The network connection status information includes the source IP address, source port number, target IP address, target port number, service connection status and associated service process identifier; The process metadata includes the service process name, service startup parameters and port binding information.

3. The method according to claim 1 or 2, characterized in that The obtaining of the host's network connection status information and process metadata from the operating system level includes: Use operating system tools to obtain the host's network connection status information; Use the operating system process management interface to obtain process metadata.

4. The method according to claim 2, characterized in that The associating the network connection status information with the process metadata to generate a distributed service call relationship includes: Grouping network connections having the same source IP address, source port number, target IP address, and target port number in the network connection status information into one group; For each group of the network connections, determining, in the process metadata, a service process name corresponding to the network connection according to an associated service process identifier in the network connection state information; Generate a distributed service call relationship with the service process name as the key and the corresponding network connection information as the value.

5. The method according to claim 1 or 2, characterized in that: According to the distributed service calling relationship, each service process is a node of the service topology structure, and the calling relationship between two service processes is an edge of the service topology structure, and constructing the service topology structure includes: According to the distributed service call relationship, the service name is used as a topological node, and the node attributes include the service process name, IP address and port number; The calling relationship between two service processes is regarded as a directed edge, and the attributes of the edge include the calling direction; The service topology structure is generated by combining the information of topological nodes and directed edges.

6. The method according to claim 1 or 2, characterized in that: The optimizing the layout of the service topology structure by using a graph theory algorithm to generate a distributed service topology graph comprises: Using a force-directed layout algorithm to optimize the display effect of the service topology structure to obtain an optimized service topology structure; Construct a call tree structure according to the service level of each service process; According to the call tree structure, the optimized service topology results are grouped and laid out to obtain a distributed service topology diagram.

7. The method according to claim 1 or 2, characterized in that: After optimizing the layout of the service topology structure by using a graph theory algorithm to generate a distributed service topology graph, the method further includes: The distributed service topology map is converted into an interactive graphical interface for display using a visualization library, wherein the visualization library includes D3.js or Cytoscape.js.

8. The method according to claim 1 or 2, characterized in that: After optimizing the layout of the service topology structure by using a graph theory algorithm to generate a distributed service topology graph, the method further includes: Periodically obtain the host's network connection status information and process metadata from the operating system level, and regenerate the distributed service call relationship; The distributed service call relationship and the regenerated distributed service call relationship are compared, and if there is a changed service call relationship, the distributed service topology map is regenerated.

9. A distributed service topology automatic generation device based on network connection, characterized in that: The device comprises: The data collection module is used to obtain the host's network connection status information and process metadata from the operating system level; A data processing module is used to associate the network connection status information with the process metadata to generate a distributed service call relationship; according to the distributed service call relationship, each service process is used as a node of the service topology structure, and the call relationship between two service processes is used as an edge of the service topology structure to construct a service topology structure; The topology generation module is used to optimize the layout of the service topology structure using a graph theory algorithm to generate a distributed service topology graph.

10. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory is used to store program instructions, and the processor is used to implement the steps of the method for automatically generating a distributed service topology based on network connection according to any one of claims 1 to 8 when executing the computer program stored in the memory.