Method and apparatus for displaying a topology relationship diagram
By using the sidecar pattern and an improved A* algorithm, the invasiveness of the Skywalking tool in displaying microservice calls and dependencies on the PaaS platform was resolved, achieving non-invasive data collection and efficient display of topology graphs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE GROUP JIANGSU
- Filing Date
- 2022-03-03
- Publication Date
- 2026-04-21
AI Technical Summary
Existing Skywalking tools are highly intrusive when displaying the number of calls to microservice interfaces and network latency analysis, cannot effectively utilize the platform's own dependency configuration static data, and are difficult to further extend the platform's business through topology graphs.
The sidecar mode is used to collect call and dependency data of the PaaS platform. Combined with the improved A* algorithm, the distribution of elements and relationship paths in the topology graph are determined to avoid path overlap and inflection points, thereby improving the display effect.
It enables non-intrusive acquisition of dynamic calls and static dependency data, improves the display effect of the topology graph, and meets the functional requirements of the PaaS platform.
Smart Images

Figure CN116737819B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for displaying topological relationship diagrams. Background Technology
[0002] With the rapid development of data visualization technology, its application in visualizing topology diagrams is becoming increasingly widespread.
[0003] Currently, existing technologies for relationship topology graphs rely on application integration call chain tools, such as Skywalking. Skywalking is an open-source observability platform for collecting, analyzing, aggregating, and visualizing data from services and cloud-native infrastructure. It provides a simple way to clearly observe distributed systems, even across multiple cloud platforms. Furthermore, Skywalking is a modern application performance monitoring system, specifically designed for cloud-native, container-based distributed systems.
[0004] Skywalking boasts powerful non-intrusive monitoring capabilities for microservice performance and tracing backlinks, but its performance in terms of log statistics for analyzing microservice interface call counts and network latency is somewhat limited. Furthermore, its ability to visualize the entire application backlink fails to meet the functional requirements of PaaS platforms. Skywalking's agent proxy mechanism is only effective for certain languages, with other languages requiring SDK support, which is highly intrusive to the access systems. Moreover, Skywalking cannot leverage the platform's own dependency configuration static data, making it difficult to further extend platform services through topology graphs. These issues have become pressing challenges in the industry. Summary of the Invention
[0005] To address the problems existing in the prior art, this application provides a method and apparatus for displaying topological relationship diagrams.
[0006] In a first aspect, this application provides a method for displaying a topological relationship diagram, including:
[0007] Based on the sidecar pattern, data on PaaS platform call relationships and application dependency relationships are collected to determine the corresponding set of elements and set of relationships.
[0008] Based on the size of different elements in the element set and the preset interval rules, the distribution of each element in the topological relationship graph is determined;
[0009] Based on the improved A* algorithm and the aforementioned set of relationships, the corresponding relationship paths between each element in the topological relationship graph are determined;
[0010] The improved A* algorithm includes a T value and a Y value, where the T value represents the cost of turning and the Y value represents the cost of overlapping with an existing path.
[0011] Optionally, the step of collecting data on PaaS platform call relationships and application dependency relationships based on the sidecar mode to determine the corresponding element set and relationship set includes:
[0012] Based on the sidecar mode, data on dynamic call relationships and static application dependency relationships of the PaaS platform are collected, and the data is classified into element sets or relationship sets.
[0013] The set of elements includes modules, units, and clusters; and a unit is a set of modules, and a cluster is a set of units; the set of relationships includes call relationships and dependency relationships, and a call relationship exists between any two modules, and a dependency relationship exists between any two units.
[0014] Optionally, determining the distribution of each element in the topological relationship graph based on the size of different elements in the element set and a preset interval rule includes:
[0015] Based on the optimal display rules, the maximum value of the corresponding module displayed in each row of the unit in the element set, the maximum value of the corresponding unit displayed in each row of the cluster in the element set, and the maximum value of the cluster displayed in each row of the topology graph are determined.
[0016] Based on the size of the modules in the element set, the maximum value of the corresponding modules displayed in each row of the unit, and the preset interval rules, the relative coordinates of each module in the corresponding unit are determined.
[0017] Based on the size of the cells in the element set, the maximum value of the corresponding cells displayed in each row of the cluster, and the preset interval rules, the relative coordinates of each cell in the corresponding cluster are determined.
[0018] Based on the size of the clusters in the element set, the maximum value of the clusters displayed in each row, and the preset interval rules, the coordinates of the clusters in the extended relationship graph are determined.
[0019] Optionally, determining the corresponding relationship paths between elements in the topological relationship graph based on the improved A* algorithm and the relationship set includes:
[0020] Based on the set of relationships and the set of elements, determine the initiating element and the target element among the two elements that have a corresponding relationship;
[0021] Based on the shortest Manhattan distance, determine the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element;
[0022] Based on the path generation rules in the improved A* algorithm, the relationship path between the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element in the topology graph is determined.
[0023] Optionally, determining the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element based on the shortest Manhattan distance includes:
[0024] Obtain a first set consisting of multiple evenly distributed points on the border corresponding to the initiating element, and a second set consisting of multiple evenly distributed points on the border corresponding to the target element.
[0025] Determine the Manhattan distance between any point in the first set and any point in the second set, and use the two points with the shortest Manhattan distance as the starting anchor point and the ending anchor point, respectively.
[0026] Optionally, the method for determining the relationship path between the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element in the topological graph based on the path generation rules in the improved A* algorithm includes:
[0027] The starting anchor point is determined as the starting point of the relationship path, and the ending anchor point is determined as the ending point of the relationship path;
[0028] Determine all walkable nodes of the starting point, wherein all walkable nodes are adjacent nodes of the starting point and are not within the range of elements in the topology graph;
[0029] Add all passable nodes to the first list, and add the starting point to the second list;
[0030] Take out each passable node in the first list in sequence and determine the F value of the passable node;
[0031] Compare the F values of all passable nodes in the first list. If there is a specific passable node that has the smallest F value and is not in the second list, then determine that specific passable node as the next node after the starting point and add the specific passable node to the second list.
[0032] Update the starting point to the specific passable section;
[0033] Determine the next node of the updated starting point, and continue until the next node is the ending point, then transfer the data in the second list to the third list;
[0034] The first list includes all nodes to be determined as being on the relationship path; the second list includes nodes already determined as being on the relationship path; and the third list includes all nodes on all generated relationship paths.
[0035] Optionally, the step of sequentially extracting each passable node from the first list and determining the F value of the passable node includes:
[0036] Take out each passable node in the first list in sequence, and determine the G value and H value corresponding to the passable node;
[0037] Based on the second list and the preset inflection point rules, after determining that the passable node has an inflection point, the T value of the passable node is updated.
[0038] If it is determined that the passable node is in the third list, update the Y value of the passable node;
[0039] The F value of the passable node is determined to be the sum of the G, H, T, and Y values corresponding to the communicable node;
[0040] The G value is the Manhattan distance between the starting anchor point and the passable node; the H value is the Manhattan distance between the passable node and the ending anchor point.
[0041] Optionally, the method further includes:
[0042] Based on the topology graph, the affinity configuration of the Pod corresponding to the application is generated; the affinity configuration of the Pod includes the affinity cooperation between Pods within the cluster and the configuration of cross-cluster calls; and the Pod and the sidecar mode correspond one-to-one.
[0043] Optionally, determining the maximum value of the corresponding module displayed in each row within a unit of the element set, the maximum value of the corresponding unit displayed in each row within a cluster of the element set, and the maximum value of the cluster displayed in each row of the topology graph based on the optimal display rules, includes:
[0044] Based on the maximum number of modules within a unit, the square root of the maximum number of modules, rounded up, is used as the maximum value of the corresponding modules displayed in each row within each unit.
[0045] Based on the maximum number of units in the cluster, the square root of the maximum number of units is rounded up and used as the maximum value of the corresponding unit displayed in each row of each cluster.
[0046] Based on the number of clusters, the square root of the number of clusters, rounded up, is determined as the maximum value of the clusters displayed in each row of the topology diagram.
[0047] Secondly, this application also provides an apparatus for displaying a topological relationship diagram, comprising:
[0048] The set determination module is used to collect data on PaaS platform call relationships and application dependency relationships based on the sidecar mode, and determine the corresponding element set and relationship set.
[0049] The element distribution module is used to determine the distribution of each element in the topological relationship graph based on the size of different elements in the element set and a preset interval rule.
[0050] The path determination module is used to determine the corresponding relationship paths between elements in the topological relationship graph based on the improved A* algorithm and the relationship set.
[0051] The improved A* algorithm includes a T value and a Y value, where the T value represents the cost of turning and the Y value represents the cost of overlapping with an existing path.
[0052] Optionally, determining the corresponding relationship paths between elements in the topological relationship graph based on the improved A* algorithm and the relationship set includes:
[0053] Based on the set of relationships and the set of elements, determine the initiating element and the target element among the two elements that have a corresponding relationship;
[0054] Based on the shortest Manhattan distance, determine the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element;
[0055] Based on the path generation rules in the improved A* algorithm, the relationship path between the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element in the topology graph is determined.
[0056] Optionally, determining the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element based on the shortest Manhattan distance includes:
[0057] Obtain a first set consisting of multiple evenly distributed points on the border corresponding to the initiating element, and a second set consisting of multiple evenly distributed points on the border corresponding to the target element.
[0058] Determine the Manhattan distance between any point in the first set and any point in the second set, and use the two points with the shortest Manhattan distance as the starting anchor point and the ending anchor point, respectively.
[0059] Optionally, the method for determining the relationship path between the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element in the topological graph based on the path generation rules in the improved A* algorithm includes:
[0060] The starting anchor point is determined as the starting point of the relationship path, and the ending anchor point is determined as the ending point of the relationship path;
[0061] Determine all walkable nodes of the starting point, wherein all walkable nodes are adjacent nodes of the starting point and are not within the range of elements in the topology graph;
[0062] Add all passable nodes to the first list, and add the starting point to the second list;
[0063] Take out each passable node in the first list in sequence and determine the F value of the passable node;
[0064] Compare the F values of all passable nodes in the first list. If there is a specific passable node that has the smallest F value and is not in the second list, then determine that specific passable node as the next node after the starting point and add the specific passable node to the second list.
[0065] Update the starting point to the specific passable section;
[0066] Determine the next node of the updated starting point, and continue until the next node is the ending point, then transfer the data in the second list to the third list;
[0067] The first list includes all nodes to be determined as being on the relationship path; the second list includes nodes already determined as being on the relationship path; and the third list includes all nodes on all generated relationship paths.
[0068] Optionally, the step of sequentially extracting each passable node from the first list and determining the F value of the passable node includes:
[0069] Take out each passable node in the first list in sequence, and determine the G value and H value corresponding to the passable node;
[0070] Based on the second list and the preset inflection point rules, after determining that the passable node has an inflection point, the T value of the passable node is updated.
[0071] If it is determined that the passable node is in the third list, update the Y value of the passable node;
[0072] The F value of the passable node is determined to be the sum of the G, H, T, and Y values corresponding to the communicable node;
[0073] The G value is the Manhattan distance between the starting anchor point and the passable node; the H value is the Manhattan distance between the passable node and the ending anchor point.
[0074] Optionally, the device further includes a configuration module for:
[0075] Based on the topology graph, the affinity configuration of the Pod corresponding to the application is generated; the affinity configuration of the Pod includes the affinity cooperation between Pods within the cluster and the configuration of cross-cluster calls; and the Pod and the sidecar mode correspond one-to-one.
[0076] Thirdly, this application also provides an electronic device, including a processor and a memory storing a computer program, wherein the processor executes the program to implement the method for displaying a topology diagram as described in the first aspect.
[0077] Fourthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the method for displaying a topology diagram as described in the first aspect.
[0078] The method and apparatus for displaying topology graphs provided in this application obtain element sets and relationship sets by collecting PaaS platform call and dependency data through sidecar mode. This does not change the original application, but can also obtain dynamic call relationship data and static dependency relationship data. Combined with the improved A* algorithm, it determines the distribution of elements in the element set of the topology graph and the relationship paths in the relationship set, which can avoid the problem of too many overlapping inflection points and paths, and improve the display effect of the topology graph. Attached Figure Description
[0079] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0080] Figure 1 This is a flowchart illustrating the method for displaying a topology diagram provided in an embodiment of this application;
[0081] Figure 2 This is a schematic diagram of the deployment of the sidecar provided in an embodiment of this application;
[0082] Figure 3 This is a schematic diagram illustrating the determination of start and end anchor points between two modules in a topological relationship diagram provided in this application embodiment;
[0083] Figure 4 This is a diagram illustrating the affinity configuration effect of Pods in the method for displaying topology diagrams provided in this application embodiment;
[0084] Figure 5 This is a schematic diagram of the overall process of the method for displaying a topology diagram provided in the embodiments of this application;
[0085] Figure 6 This is a comparison chart showing the improvement effect of introducing a T value in the method for displaying topological relationship diagrams provided in the embodiments of this application;
[0086] Figure 7 This is one of the improved effect diagrams after introducing the Y value in the method for displaying topological relationship diagrams provided in the embodiments of this application;
[0087] Figure 8 This is the second improved effect diagram after introducing the Y value in the method for displaying topological relationship diagrams provided in the embodiments of this application;
[0088] Figure 9 This is a schematic diagram illustrating the implementation of determining the calling relationship path in the method for displaying a topology diagram provided in this application embodiment;
[0089] Figure 10 This is a schematic diagram illustrating the display effect of the method for displaying a topology diagram provided in the embodiments of this application;
[0090] Figure 11 This is a schematic diagram of the structure of the device for displaying topology diagrams provided in the embodiments of this application;
[0091] Figure 12 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0092] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0093] To address the issues in existing data visualization technologies, such as significant intrusion into the access system, inability to utilize static data from the platform's own dependency configurations, and failure to further demonstrate platform services through topology diagrams, this application proposes a technical solution. This solution primarily addresses the visualization of dependencies and call relationships between applications on the PaaS platform and utilizes visualized topology diagrams to generate reasonable scheduling strategies for applications.
[0094] To help understand the solutions of the embodiments of this application, the following will briefly introduce the relevant concepts that may be involved in this application:
[0095] Platform as a Service (PaaS): This refers to delivering a software development platform (defined by CCID Consulting as a business infrastructure platform) as a service, using the Software as a Service (SaaS) model. Therefore, PaaS is also an application of the SaaS model. However, the emergence of PaaS can accelerate the development of SaaS, especially the development speed of SaaS applications. In 2007, domestic and international SaaS vendors launched their own PaaS platforms. The reason PaaS can promote the development of SaaS is mainly because it provides a middleware platform for enterprises to conduct customized development, while also encompassing databases and application servers. PaaS can increase the amount of resources utilized on the Web platform. For example, Data as a Service (DaaS) can be used through remote Web services, and visual Application Programming Interfaces (APIs) can also be used. Users or vendors can quickly develop the applications and products they need based on the PaaS platform. At the same time, applications developed on the PaaS platform can better build enterprise applications based on Service Oriented Architecture (SOA).
[0096] A Pod is the smallest deployable unit of computing that can be created and managed in a PaaS platform. A Pod is a group (or group of one or more) of containers that share storage, networking, and declarations of how to run them. The contents of a Pod are always co-located and scheduled together, running in a shared context.
[0097] Pod scheduling refers to placing a Pod onto an appropriate Node within a Cluster (a collection of multiple machine nodes).
[0098] Pod affinity is a Pod scheduling policy that constrains which nodes a Pod can be scheduled to based on the labels of Pods already running on those nodes. The rule format is "If one or more Pods satisfying rule Y are already running on node X, then this Pod should (or should not in the case of anti-affinity) run on node X." Y represents a LabelSelector with an optional list of associated command spaces. Conceptually, X is a topology domain, such as a node, rack, cloud provider availability zone, or cloud provider geographic region. It can be represented by a topologyKey, which is the key of the node label used by the system to represent such a topology domain.
[0099] Figure 1This is a flowchart illustrating the method for displaying a topology diagram provided in an embodiment of this application, such as... Figure 1 As shown, the method includes:
[0100] Step 101: Collect data on PaaS platform call relationships and application dependency relationships based on the sidecar mode, and determine the corresponding element set and relationship set;
[0101] Specifically, the PaaS platform integrates multiple applications, which have dependencies on each other, and modules within each application have corresponding calling relationships. The functions of each application are completed through calls between modules. Therefore, data collected from the PaaS platform may include dynamic calling relationship data as well as static data on inter-application dependencies. There are various methods for data collection; this application primarily adopts the sidecar model. The sidecar model is based on the idea of separating and decoupling control and logic, and collects the platform's topology non-intrusively without affecting the platform's normal business mechanisms.
[0102] A sidecar is another container within a Pod, coexisting directly with the microservice container. Sidecars can be injected into the Pod containing the microservice manually or automatically. This application primarily utilizes the sidecar's data collection capabilities to gather actual service call traces, topology data of inter-service calls, and application dependency configuration data. This dependency configuration data is static, potentially representing data from communication between applications via files, databases, or message queues. This inter-application dependency configuration data is manually configured when applications connect to the PaaS platform and can be directly retrieved from the platform's database. This data is written to the database to prepare for drawing the topology data graph.
[0103] It is worth noting that since the sidecar is a separate container deployed independently of the business microservices, it is non-intrusive to the business.
[0104] The sidecar mode focuses on collecting call-related data, including at least the upstream and downstream application identifiers, upstream call initiation time, downstream call reception time, call network latency, request message packets, response message packets, and downstream response time. Figure 2 This is a schematic diagram of the deployment of the sidecar provided in an embodiment of this application, as shown below. Figure 2 As shown, one Pod corresponds to one microservice container, one microservice container corresponds to one microservice (or application), and one Pod corresponds to one sidecar.
[0105] Based on the aforementioned call relationship data and dependency relationship data, the set of elements in the topological relationship graph is determined, that is, the data is classified, and the categories are not independent of each other; there is a corresponding relationship between any two categories of elements. Elements in different categories correspond to different sizes and are represented in different forms in the topological relationship graph. For example, symmetrical shapes such as triangles, quadrilaterals, and hexagons from polygons, or other asymmetrical shapes, can be used to represent different elements. Of course, for aesthetic purposes, symmetrical shapes are often used. Each type of element has a different size, which is represented by the area of different polygons. The size of the element with the smallest area is fixed. Furthermore, the relationships between any number of elements can be determined by the area size and distribution of elements from different categories. For example, if a small element is located inside a large element, it can be represented that the small element is contained within the large element, or that the large element is composed of small elements.
[0106] Step 102: Based on the size of different elements in the element set and the preset interval rules, determine the distribution of each element in the topological relationship graph;
[0107] Specifically, elements of different classes have different sizes, and there is an inclusion relationship between these classes. One class of elements occupies a fixed area, and other elements are composed of elements of that class. The size of other elements can be determined by how many of the smallest elements of that class are included in the other elements. Furthermore, the specific distribution of all elements in the topological graph can be defined by preset interval rules. For example, if the element set includes elements A, B, and C, and the sizes of these three classes of elements are: A < B, B < C, and A has a fixed size, then the size of element B and its relative coordinates within element B can be determined by defining the minimum distance between the fixed point of element A and each boundary of element B, the interval between two elements A, and the maximum number of elements A that can be placed in a row of element B. Similarly, the interval rules between elements B and C can be defined to determine the size of element C and its relative coordinates within element C. Finally, based on the interval rules between element C and the boundaries of the topological graph, the size of the topological graph and the distribution of all elements within it can be determined simultaneously.
[0108] Step 103: Based on the improved A* algorithm and the set of relationships, determine the corresponding relationship paths between each element in the topology graph; the improved A* algorithm includes T value and Y value, where the T value represents the cost of turning and the Y value represents the cost of overlapping with an existing path.
[0109] Specifically, using the improved A* algorithm, the relationship path between any two elements with a calling or dependency relationship can be determined, i.e., the coordinates of each node on the relationship path can be determined, and each node is represented by five values {G, H, T, Y, F}. By comparing these five values of each node with the corresponding three lists (first list, second list, and third list), the coordinates of each node are determined. The T value represents the cost of turning, i.e., the cost of turning from the last two nodes added in the second list to the current node. The second list records the determined nodes of the relationship path to be determined. The Y value represents the cost of overlapping with an existing path, i.e., the additional cost required when the current node is in the third list. The third list records all nodes of the determined relationship path. The first list records all nodes to be determined as being on a certain relationship path or records all walkable nodes on the relationship path to be determined.
[0110] The method for displaying a topology graph provided in this application collects the call and dependency data of the PaaS platform through the sidecar mode to obtain the element set and relationship set. It does not change the original application, but can also obtain dynamic call relationship data and static dependency relationship data. Combined with the improved A* algorithm, it determines the distribution of elements in the element set of the topology graph and the relationship paths in the relationship set, which can avoid the problem of too many inflection points and path overlaps and improve the display effect of the topology graph.
[0111] Optionally, the step of collecting data on PaaS platform call relationships and application dependency relationships based on the sidecar mode to determine the corresponding element set and relationship set includes:
[0112] Based on the sidecar mode, data on dynamic call relationships and static application dependency relationships of the PaaS platform are collected, and the data is classified into element sets or relationship sets.
[0113] The set of elements includes modules, units, and clusters; and a unit is a set of modules, and a cluster is a set of units; the set of relationships includes call relationships and dependency relationships, and a call relationship exists between any two modules, and a dependency relationship exists between any two units.
[0114] Specifically, data on dynamic call relationships between applications on the PaaS platform and data on static dependency relationships between applications are collected. The API is called to load the data into the front-end cache. After caching the data, the data is classified to determine the corresponding set of elements and set of relationships.
[0115] The element set specifically includes modules, units, and clusters.
[0116] Module: This is a specific running program. On the PaaS platform, it is represented as a process. It is the direct entity that has a calling relationship, and all calling relationships occur between modules.
[0117] Unit: A unit is a collection of modules. A unit contains one or more modules. The unit is the smallest scheduling entity in a PaaS platform, and all scheduling policies apply to units. Scheduling refers to selecting which host in the cluster to install a unit (multiple modules).
[0118] A cluster is a collection of host resources and is the target of the above-mentioned unit deployment. A cluster consists of one or more units, and each unit corresponds to one host. That is, a cluster is a collection of multiple hosts or a collection of units.
[0119] The aforementioned set of relationships includes call relationships and dependency relationships. Call relationships exist between any two modules, while dependency relationships exist between any two units. Call relationships are primarily determined based on the actual service call tracing and inter-service call relationship data, while dependency relationships are mainly determined by the dependency configuration data between various applications on the PaaS platform.
[0120] Optionally, determining the distribution of each element in the topological relationship graph based on the size of different elements in the element set and a preset interval rule includes:
[0121] Based on the optimal display rules, the maximum value of the corresponding module displayed in each row of the unit in the element set, the maximum value of the corresponding unit displayed in each row of the cluster in the element set, and the maximum value of the cluster displayed in each row of the topology graph are determined.
[0122] Based on the size of the modules in the element set, the maximum value of the corresponding modules displayed in each row of the unit, and the preset interval rules, the relative coordinates of each module in the corresponding unit are determined.
[0123] Based on the size of the cells in the element set, the maximum value of the corresponding cells displayed in each row of the cluster, and the preset interval rules, the relative coordinates of each cell in the corresponding cluster are determined.
[0124] Based on the size of the clusters in the element set, the maximum value of the clusters displayed in each row, and the preset interval rules, the coordinates of the clusters in the extended relationship graph are determined.
[0125] Specifically, after determining the set of elements and the set of relationships in the topological graph, it is necessary to determine the distribution of each element and the relationship path between any two elements. The following methods are mainly used to determine the distribution of each element:
[0126] To make the topology diagram look neater and more compact, a dynamic calculation method is used to determine the size and coordinates of all elements in the topology diagram.
[0127] (1) Determine the maximum number of modules displayed in each row within a unit, the maximum number of units displayed in each row within a cluster, and the maximum number of clusters displayed in each row of the topology diagram:
[0128] Obtain the number of modules in each unit, determine the maximum value, and take the square root of the maximum value and round it up to get the maximum value of the corresponding module displayed in each row of each unit; use the same method to determine the maximum value of the corresponding unit displayed in each row of each cluster.
[0129] Then, based on the total number of all clusters, determine the value of the square root rounded up, which will be used as the maximum value of the clusters displayed in each row of the topology diagram.
[0130] (2) Utilizing the property that the module size is determined, determine the coordinates of the module within the cell and the size of the cell:
[0131] Based on the fixed size of the modules, the number of modules within a unit, and the maximum number of modules displayed per row within a unit, the distribution of modules within the unit can be determined. Of course, preset spacing rules also need to be considered. For the unit element, the spacing rules include the minimum distance between the module boundary and the unit boundary, as well as the minimum distance between modules. Based on this information, the relative coordinates of the modules within the unit can be determined, thus determining the size of the unit. Here, the size of the unit can be understood as the area it occupies in the topology diagram. The specific form used to represent units and modules can be symmetrical polygons or asymmetrical shapes, but for aesthetic reasons, symmetrical polygons are often used; for example, units can be quadrilaterals and modules can be hexagons.
[0132] (3) Using the determined cell size, determine the coordinates of the cells within the cluster and the size of the cluster:
[0133] Based on the determined cell size, the number of cells within a cluster, and the maximum number of cells displayed per row within the cluster, the distribution of cells within the cluster is determined. Similarly, preset spacing rules need to be considered. For clusters, spacing rules include the minimum distance between the cell boundary and the cluster boundary, as well as the minimum distance between cells. Based on this information, the relative coordinates of cells within the cluster can be determined, thus determining the size of the cluster. Here, the size of the cluster can be understood as the area it occupies in the topology diagram. The specific form in which the cluster is represented can be a symmetrical polygon or an asymmetrical shape, but for aesthetic reasons, symmetrical polygons are often used; for example, a quadrilateral cluster.
[0134] (4) Using the determined cluster size, determine the cluster coordinates in the topology graph and the size of the topology graph:
[0135] Based on the determined cluster size, the number of clusters included in the topology graph, and the maximum number of clusters displayed in each row of the topology graph, the distribution of clusters in the topology graph is determined. Similarly, preset interval rules need to be considered. For the topology graph, the interval rules include the minimum distance between the cluster boundary and the topology graph boundary, as well as the minimum distance between clusters. Based on this information, the relative coordinates of the clusters in the topology graph can be determined, thereby determining the size of the topology graph. Regarding the specific form in which the size of the topology graph is represented, quadrilaterals are generally used for aesthetic purposes.
[0136] Building upon this, the positions of all clusters can be determined by considering the total number of call relationships and dependencies within a cluster and the frequency of call relationships between clusters. Clusters with the same total number of call relationships can be grouped together and sorted by call relationship frequency, or the cluster with the highest call relationship frequency can be placed in the position with the largest total number of cluster relationships, and so on. Alternatively, the absolute coordinates of a cluster in the topology graph can be determined based on its relative coordinates and the size of the topology graph. Then, the absolute coordinates of a unit in the topology graph can be determined based on its relative coordinates within a cluster; and the absolute coordinates of a module in the topology graph can be determined based on its relative coordinates within a unit.
[0137] In this way, the size and coordinates of all elements are determined, which means that the distribution of each element in the topological relationship graph is determined.
[0138] Optionally, determining the corresponding relationship paths between elements in the topological relationship graph based on the improved A* algorithm and the relationship set includes:
[0139] Based on the set of relationships and the set of elements, determine the initiating element and the target element among the two elements that have a corresponding relationship;
[0140] Based on the shortest Manhattan distance, determine the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element;
[0141] Based on the path generation rules in the improved A* algorithm, the relationship path between the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element in the topology graph is determined.
[0142] Specifically, after determining the distribution of each element in the topological relationship graph, it is also necessary to determine the relationship paths between elements that have calling or dependency relationships based on the relationship set, ensuring that the paths do not overlap and reducing the number of inflection points in the relationship paths.
[0143] The main mechanism is to identify the initiating module and the target module among two modules that have a calling relationship by examining the calling and dependency relationships in the relationship set. The calling relationship is directional, with the calling side being the initiating module and the called side being the target module. Similarly, the dependency relationship is also directional, with the dependent side being the initiating unit and the dependent side being the target unit.
[0144] The module has a corresponding border. Multiple evenly distributed points can be determined on the corresponding border of the module. For example, if a regular polygon is used, the midpoint of each side can be determined as an available anchor point. Or if a circle is used, multiple evenly distributed points can be determined on the circumference and used as available anchor points.
[0145] Calculate the Manhattan distance between all available anchor points of the initiating module and the target module, and select the two anchor points with the shortest Manhattan distance as the starting anchor point and the target anchor point, respectively.
[0146] Similarly, the same method can be used to determine the starting anchor point and target anchor point for two units that have a dependency relationship. Figure 3 This is a schematic diagram illustrating the determination of start and end anchor points between two units in a topological relationship diagram provided in this application embodiment, such as... Figure 3 As shown, the starting anchor point A3:(a3x,a3y) and the target anchor point B1:(b1x,b1y) are corresponding to two units with a dependency relationship.
[0147] Optionally, the method for determining the relationship path between the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element in the topological graph based on the path generation rules in the improved A* algorithm includes:
[0148] The starting anchor point is determined as the starting point of the relationship path, and the ending anchor point is determined as the ending point of the relationship path;
[0149] Determine all walkable nodes of the starting point, wherein all walkable nodes are adjacent nodes of the starting point and are not within the range of elements in the topology graph;
[0150] Add all passable nodes to the first list, and add the starting point to the second list;
[0151] Take out each passable node in the first list in sequence and determine the F value of the passable node;
[0152] Compare the F values of all passable nodes in the first list. If there is a specific passable node that has the smallest F value and is not in the second list, then determine that specific passable node as the next node after the starting point and add the specific passable node to the second list.
[0153] Update the starting point to the specific passable section;
[0154] Determine the next node of the updated starting point, and continue until the next node is the ending point, then transfer the data in the second list to the third list;
[0155] The first list records all nodes to be determined as being on the relationship path; the second list records nodes already determined as being on the relationship path; and the third list includes all nodes on all generated relationship paths.
[0156] Specifically, after determining the starting and ending anchor points corresponding to the elements, it is necessary to determine the specific relationship path. First, the starting anchor point is determined as the starting point of the relationship path, and the ending anchor point is the ending point of the relationship path. Three lists are also generated: the first list records all nodes to be determined as being on the relationship path, or records all walkable nodes on the relationship path to be determined; the second list records nodes already determined as being on the relationship path, or records nodes already determined on the relationship path to be determined; the third list records all nodes on all generated relationship paths, or records all nodes on determined relationship paths. Each node can be represented by a two-dimensional array, where the two indices represent the node's coordinates. Each position in the two-dimensional array can take a value of 0 or 1, where 0 indicates the node is unoccupied, and 1 indicates the node is occupied, meaning that an element already includes the node.
[0157] Determine all adjacent walkable nodes from the starting point, provided that the walkable node is not within the range of elements in the topology graph. All nodes within the range of elements in the topology graph are stored with a value of 1, indicating that the node is occupied, and each node's two-dimensional array index represents its coordinates.
[0158] Add the aforementioned starting point to the second list (closed list), that is, save the coordinates and value of the aforementioned starting point as 1. Add all the aforementioned passable nodes to the first list (open list), that is, save the coordinates and value of each passable node as 0;
[0159] Determine the F value for each passable node sequentially, where F value = G value + H value + T value + Y value, and the G, H, T, and Y values belong to the same passable node. The G value represents the estimated number of movement points from the starting point to the current passable node, which is the Manhattan distance between the two nodes; the H value represents the estimated number of movement points from the current passable node to the destination, which is also the Manhattan distance between the two nodes; the T value represents the cost of turning from the parent and grandparent nodes preceding the current passable node in the second list to the current passable node, and can be set according to actual needs, being a multiple of the number of movement points, such as 5 times the number of movement points; the T value is not fixed; the Y value represents the cost of overlapping with a node in the third list, which can also be set according to actual needs. To reduce overlap, a larger Y value can be set. If the overlap requirement is not high, a smaller Y value can be set.
[0160] Determine the F value of all traversable nodes in the first list, compare the F values of all traversable nodes, select the traversable node corresponding to the smallest F value, if the traversable node is not in the second list, that is, it is not a node that has been determined (visited) on the path to be determined, then take the traversable node as the next node corresponding to the starting point, add the traversable node to the second list, and update the starting point to the traversable node.
[0161] Starting from the updated starting point, repeat the above steps to determine the next node of the updated starting point, until the next node is the end point, at which point the loop terminates.
[0162] Optionally, the step of sequentially extracting each passable node from the first list and determining the F value of the passable node includes:
[0163] Take out each passable node in the first list in sequence, and determine the G value and H value corresponding to the passable node;
[0164] Based on the second list and the preset inflection point rules, after determining that the passable node has an inflection point, the T value of the passable node is updated.
[0165] If it is determined that the passable node is in the third list, update the Y value of the passable node;
[0166] The F value of the passable node is determined to be the sum of the G, H, T, and Y values corresponding to the communicable node;
[0167] The G value is the Manhattan distance between the starting anchor point and the passable node; the H value is the Manhattan distance between the passable node and the ending anchor point.
[0168] Specifically, when determining the F value of the passable node corresponding to the starting point, it is necessary to consider whether the passable node is in the second list and the third list, which are used to update the T value and Y value of the passable node.
[0169] Initialize the G, H, T, and Y values of all passable nodes to 0.
[0170] Next, the G value of the passable node is determined based on the Manhattan distance from the starting point to the current passable node.
[0171] The H value of a passable node is determined based on the Manhattan distance from the current passable node to the destination.
[0172] Based on the parent and grandparent nodes of the currently passable node in the second list, determine whether the corresponding coordinates are discontinuous. If they are discontinuous, it is determined that the passable node has an inflection point, and the T value of the passable node is updated to the preset T value. If they are continuous, the T value of the passable node is not changed and remains 0.
[0173] Determine if the current node is in the third list. If it is, update the Y value of the passable node to the preset Y value. If it is not, do not change the Y value of the passable node, which will remain 0.
[0174] Then, based on the updated G, H, T, and Y values, determine the F value of the passable node.
[0175] Optionally, the method further includes:
[0176] Based on the topology graph, the affinity configuration of the Pod corresponding to the application is generated; the affinity configuration of the Pod includes the affinity cooperation between Pods within the cluster and the configuration of cross-cluster calls; and the Pod and the sidecar mode correspond one-to-one.
[0177] Specifically, using the topology graph, affinity configurations for application Pods can be generated quickly. The generated Pod affinity configurations are mainly divided into two categories: 1. Affinity configurations between Pods within the cluster, ensuring that applications that frequently call each other are deployed on nodes within the same cluster, transforming cross-node access into intra-node access, reducing network consumption, and improving system stability. 2. For cross-cluster calls, the platform will schedule upstream and downstream applications to two nodes within the same cluster with low network bandwidth and latency, saving cross-cluster network consumption. Figure 4 This is a diagram illustrating the affinity configuration effect of Pods in the method for displaying topology diagrams provided in this application embodiment, such as... Figure 4As shown, the IP address of unit host A is 10.1.8.21, and the IP address of unit host B is 10.1.8.27. Pod A in unit host A and Pod B in unit host B call each other. Based on the Pod affinity configuration proposed in this application, the following is determined: Figure 4 As shown in 4-1, if Pod A and Pod B within the same cluster have the same or nearly the same call frequency, then deploying Pod A and Pod B in the same unit of the same cluster will result in the following: Figure 4 The deployment results are shown in 4-2.
[0178] The topology diagram displays all call relationship data by default. Users can select a specific interface of an application to obtain the call chain topology diagram for a single interface scenario.
[0179] When rendering the topology graph of a single interface scenario, the PaaS platform will simultaneously calculate affinity configuration suggestions.
[0180] 1. The user clicks on the relationship path corresponding to the call relationship and selects the call interface scenario. The system then filters out the call relationship data set for the selected scenario.
[0181] 2. Traverse the filtered relational data and use the product of the hourly call frequency between modules within the cluster and the average network latency (network latency is tiered, with 1 for less than 2ms, 2 for greater than 2ms and less than 5ms, and 3 for greater than 5ms) as the weight value for call consumption between modules.
[0182] 3. Use the "kubernetes.is / hostname" tag of the current cluster as the topologyKey. Retrieve the appName tags and their values for any two units. Generate Pod affinity configurations for the two units respectively.
[0183] 4. Traverse the filtered relationship data, generate Pod node selectors for the upstream and downstream units of the cross-cluster call relationship, and schedule the two units to the two nodes with good network performance to improve the network performance of inter-module calls.
[0184] 5. Obtain the clusters where the upstream and downstream units are located, and obtain the labels of the nodes (multiple nodes) with the best network links in the current two clusters through the platform's cluster management, and generate Pod node affinity configurations for the upstream and downstream Pods.
[0185] 6. Users can selectively adopt the affinity configurations provided by the platform based on the importance of the scenario.
[0186] The method for displaying a topology graph provided in this application collects the call and dependency data of the PaaS platform through the sidecar mode to obtain the element set and relationship set. It does not change the original application, but can also obtain dynamic call relationship data and static dependency relationship data. Combined with the improved A* algorithm, it determines the distribution of elements in the element set of the topology graph and the relationship paths in the relationship set, which can avoid the problem of too many inflection points and path overlaps and improve the display effect of the topology graph.
[0187] The method for displaying topological relationship diagrams provided in this application is illustrated below with specific examples. Figure 5 This is a schematic diagram of the overall process of the method for displaying a topology diagram provided in the embodiments of this application, such as... Figure 5 As shown:
[0188] Step 1, Topology Data Acquisition: A sidecar is another container within a Pod, coexisting directly with the microservice container. Sidecars can be injected manually or automatically into the Pod containing the microservice. The sidecar pattern is based on the idea of separating and decoupling control from logic.
[0189] The primary approach leverages the data collection capabilities of sidecars to gather actual link tracing data for service calls and topology data for inter-service calls. While the data collected by sidecars represents the actual network call relationships, some applications may communicate and call each other via files, databases, or message queues. In such cases, data collected solely by sidecars is insufficient to meet the solution's topology display requirements. Therefore, application dependency configuration data is needed as a supplement. This dependency data is manually configured when applications connect to the platform and can be directly retrieved from the platform's database.
[0190] Step 2: Topology Display. This step displays the call relationships between various applications on the PaaS platform collected in Step 1. The topology diagram mainly includes the following elements:
[0191] Module: A module is a specific running program, which is represented as a process in the system. It is the direct entity that has a calling relationship, and all calling relationships occur between modules.
[0192] Unit: A unit is a collection of modules. A unit contains one or more modules. The unit is the smallest scheduling entity of the PaaS platform, and all scheduling policies are applied to the unit.
[0193] Cluster: A collection of host resources, which is the target of application unit deployment.
[0194] Step 2-1: Load PaaS platform call chain relationship data:
[0195] The API call loads the data collected in step one into the front-end cache. After caching the data, it is categorized into either an element set or a relationship set.
[0196] Step 2-2: Calculation of element size and coordinates:
[0197] To make the overall topology graph look neat and compact, a dynamic calculation method is used to determine the size and coordinates of all elements in the graph.
[0198] 1. Classify the cached element collection data in the front end according to modules, units, and clusters.
[0199] 2. Calculate the size of all cells and the coordinates of all modules in the current relational topology graph based on the classification data (coordinates relative to the cell to which the module belongs).
[0200] 3. Calculate the size of the cell within its cluster and the cell's coordinates (relative to the cluster to which the cell belongs) using the determined cell size.
[0201] 4. Determine the maximum number of clusters to be displayed in each row: Take the square root of the number of cluster elements and round up to get the maximum number of clusters to be displayed in each row. Calculate the coordinates of the clusters based on the number of clusters that can be placed in each row.
[0202] 5. Write the calculated coordinate values into the coordinate attribute of the cluster element collection.
[0203] Steps 2-3: Calculate the relationship paths corresponding to the calling relationship and / or dependency relationship:
[0204] The improved A* algorithm is as follows:
[0205] The algorithm maintains three lists: an open list that records all points considered for finding the shortest path, a closed list that records visited points, and a yellow list that records points on generated paths.
[0206] Here, points (nodes) are represented by two-dimensional arrays. The first dimension of the array represents the x-coordinate of the node, and the second dimension represents the y-coordinate. Values in the array can be 0 or 1; 0 indicates the node is unoccupied, and 1 indicates it is occupied. Furthermore, each point (node) maintains five values: G (estimated number of points to move from the starting point S to the current point); H (estimated number of points to move from the current point to the destination E, using the Manhattan distance); T (cost of turning from the previous two nodes to the current node; T is not fixed and can be set as a multiple of the number of points to move, used in this application as a multiple of 5 points); and Y (cost of overlapping with an existing path, used in this application as a multiple of 3 points).
[0207] 1) Traverse the set of relations obtained in step 2-1.
[0208] 2) Obtain the calling initiating module and calling target module in the calling relationship, and obtain the coordinate values of the initiating module and target module from the element set, and represent the module using a quadrilateral.
[0209] 3) Take the midpoints of the four edges of the initiating module and the target module as available anchor points, calculate the Manhattan distance between all available anchor points of the initiating module and the target module, and select the two anchor points with the shortest Manhattan distance (the anchor point on the initiating module is the starting anchor point, as the starting point S, and the anchor point on the target module is the ending anchor point, as the ending point E) as the connection points of the call relationship line.
[0210] 4) Add the starting point S to the closed list and obtain all passable points M adjacent to S, wherein the passable points M satisfy the condition that they are adjacent to the starting point S and the corresponding two-dimensional array value of the adjacent points is not 1, and add all passable points M to the open list.
[0211] 5) Determine the G, H, T, and Y values for each passable point M (value 0 in the two-dimensional array) in the open list.
[0212] The G value is the Manhattan distance from the starting point S to the currently passable point M;
[0213] The H value is the Manhattan distance from the current passable point M to the destination point E;
[0214] T-value: Obtain the parent and grandparent nodes of point M, and get their coordinates. Determine if an inflection point has occurred based on the continuity of the G-values. If the G-values are continuous, the T-value of point M remains unchanged at its initial value of 0. If the G-values are discontinuous, the T-value of point M is updated to the preset T-value. If there are no parent or grandparent nodes, it is certain that no inflection point will occur, and the corresponding T-value is 0. (This can also be understood as obtaining the last two nodes added to the close list, which are the parent and grandparent nodes, and comparing the G-values of the parent and grandparent nodes with the G-value of the currently passable node M to determine if an inflection point has occurred.)
[0215] Y value: Determine whether point M is in the yellow list. If it is, update the Y value of the currently passable node M according to the preset Y value. If it is not, the Y value of the currently passable node M remains 0.
[0216] F value: The F value is obtained by adding the latest G value, H value, T value and Y value.
[0217] 6) Compare the F values of all the passable points M. If there is a passable point M with the smallest F value, then take that passable point M as the next node of the starting point S, add the next node to the close list, and clear the open list.
[0218] 7) Update the starting point S to the next node mentioned above, and repeat steps 4 to 6 in a loop until the determined next node and the ending point are the same, then the loop terminates.
[0219] 8) After adding all nodes from the final closed list to the yellow list, clear the closed list. The nodes in the closed list are ordered.
[0220] Figure 6 This is a comparison chart showing the improved effect of introducing a T-value in the method for displaying topological relationship diagrams provided in this application embodiment, such as... Figure 6 As shown, the dots with a black background represent the starting point A and the ending point B, while the dots with diagonal stripes represent the path between the starting point A and the ending point B. Figure 6 The statement in section 6-1 indicates that before the introduction of the T value, there is a certain probability that multiple inflection points will occur, which is not in line with expectations. Figure 6 6-2 in the figure indicates that the expected result was obtained after introducing the T value, and the path has only one inflection point.
[0221] In existing technologies, the absence of a Y-value leads to path overlap issues. For example, before introducing a Y-value, when determining the topology graph, if there are two types of relationships in the relationship set: module A calls module B, and module B calls module A, then existing algorithms will result in overlapping paths.
[0222] Figure 7 This is one of the improved effect diagrams after introducing the Y value in the method for displaying topological relationship diagrams provided in the embodiments of this application, such as... Figure 7 As shown, the dots with a black background represent the starting point A and the ending point B. The dots with a dotted background represent the established relationship path between the starting point A and the ending point B. All the two-dimensional arrays corresponding to the dots on this relationship path are in the yellow list. For example... Figure 7 As shown in 7-2, the dots in the vertical striped background represent the new relationship paths obtained based on the maintained yellow list after the introduction of Y values in this application, which can avoid overlapping with previously determined paths.
[0223] Figure 8 This is the second improved effect diagram after introducing the Y value in the method for displaying topological relationship diagrams provided in the embodiments of this application, as shown in the diagram. Figure 8As shown, the dots on the black background represent the starting point A and the ending point B. In 8-1 and 8-2, the dots in the dotted pattern background indicate that these points are all on a predetermined relationship path. It should be noted that the Y value can be adjusted based on the actual data. The improved A* algorithm determines whether lines overlap based on the Y value. If the Y value is set very large, the relationship path between the starting point A and the ending point B is calculated, as shown below. Figure 8 As shown in Figure 8-2, the points represented by the vertical stripe pattern background represent a loop around all points on the defined relationship path; if the Y value is set very small, the relationship path between the starting point A and the ending point B is calculated as follows. Figure 8 As shown in 8-1, the dots in the vertical striped pattern background overlap with the previously determined dotted pattern background relationship paths, rather than circling all the determined relationship paths.
[0224] Steps 2-4: Rendering of elements and relationship paths
[0225] 1. Map the topological relationship diagram to a two-dimensional array. Since dependencies only occur between cells, map the area of a cell in the canvas to 1 in the array, and map other areas to 0.
[0226] 2. Use the improved algorithm to calculate the call relationship connections. The calculation process is as follows: Figure 9 As shown. The passable point M corresponding to the starting point S includes adjacent nodes in three directions: upward, downward, and leftward. Each node corresponds to a box, maintaining 5 values: the top left corner of a box is the F value, the bottom left corner is the G value, the bottom right corner is the H value, and the top right corner is (T value, Y value). The relationship path between the starting point S and the ending point E is determined based on the minimum F value. Similarly, the relationship path of dependency can be determined using the same method as for calling relationships.
[0227] 3. Parse the values of the connecting lines in the array, find the inflection points, and generate path data.
[0228] After obtaining the list of connection points (close list) between the starting and ending anchor points, the set of inflection points is obtained by comparing the adjacent coordinate values using the data in the connection point list.<Z1,Z2,Z3......Zn> .
[0229] 4. Use the canvas's path data to draw relationship lines. For example... Figure 10 As shown, call relationships are represented by dashed lines with arrows, and dependency relationships are represented by solid lines with arrows.
[0230] Step 3: Topology Analysis
[0231] Users can quickly generate Pod affinity configurations using the topology graph. The generated Pod affinity configurations are mainly divided into two categories: 1. Intra-cluster Pod affinity configurations, which ensure that applications that frequently call each other are deployed on the same node within the same cluster, transforming cross-node access into intra-node access, reducing network consumption, and improving system stability. 2. For cross-cluster calls, the platform will schedule upstream and downstream applications to two nodes within the same cluster with low network bandwidth and latency, saving cross-cluster network consumption.
[0232] Figure 11 This is a schematic diagram of the structure of the device for displaying topology diagrams provided in the embodiments of this application, such as... Figure 11 As shown, the device for displaying the topology diagram includes:
[0233] The set determination module 1101 is used to collect data on PaaS platform call relationships and application dependency relationships based on the sidecar mode, and determine the corresponding element set and relationship set.
[0234] The element distribution module 1102 is used to determine the distribution of each element in the topological relationship diagram based on the size of different elements in the element set and the preset interval rules.
[0235] The path determination module 1103 is used to determine the corresponding relationship paths between elements in the topological relationship graph based on the improved A* algorithm and the relationship set.
[0236] The improved A* algorithm includes a T value and a Y value, where the T value represents the cost of turning and the Y value represents the cost of overlapping with an existing path.
[0237] In a further description of the above device, the set determination module 1101, in the process of collecting data on PaaS platform call relationships and application dependency relationships based on the sidecar mode, and determining the corresponding element set and relationship set, is specifically used for:
[0238] Based on the sidecar mode, data on dynamic call relationships and static application dependency relationships of the PaaS platform are collected, and the data is classified into element sets or relationship sets.
[0239] The set of elements includes modules, units, and clusters; and a unit is a set of modules, and a cluster is a set of units; the set of relationships includes call relationships and dependency relationships, and a call relationship exists between any two modules, and a dependency relationship exists between any two units.
[0240] In a further description of the above device, the element distribution module 1102, in the process of determining the distribution of each element in the topological relationship graph based on the size of different elements in the element set and preset interval rules, is specifically used for:
[0241] Based on the optimal display rules, the maximum value of the corresponding module displayed in each row of the unit in the element set, the maximum value of the corresponding unit displayed in each row of the cluster in the element set, and the maximum value of the cluster displayed in each row of the topology graph are determined.
[0242] Based on the size of the modules in the element set, the maximum value of the corresponding modules displayed in each row of the unit, and the preset interval rules, the relative coordinates of each module in the corresponding unit are determined.
[0243] Based on the size of the cells in the element set, the maximum value of the corresponding cells displayed in each row of the cluster, and the preset interval rules, the relative coordinates of each cell in the corresponding cluster are determined.
[0244] Based on the size of the clusters in the element set, the maximum value of the clusters displayed in each row, and the preset interval rules, the coordinates of the clusters in the extended relationship graph are determined.
[0245] In a further description of the above device, the path determination module 1103, in the process of determining the corresponding relationship paths between elements in the topological relationship graph based on the improved A* algorithm and the relationship set, is specifically used for:
[0246] Based on the set of relationships and the set of elements, determine the initiating element and the target element among the two elements that have a corresponding relationship;
[0247] Based on the shortest Manhattan distance, determine the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element;
[0248] Based on the path generation rules in the improved A* algorithm, the relationship path between the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element in the topology graph is determined.
[0249] In a further description of the above device, the path determination module 1103 also includes an anchor point determination unit. This anchor point determination unit is used to determine the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element based on the shortest Manhattan distance, including:
[0250] Obtain a first set consisting of multiple evenly distributed points on the border corresponding to the initiating element, and a second set consisting of multiple evenly distributed points on the border corresponding to the target element.
[0251] Determine the Manhattan distance between any point in the first set and any point in the second set, and use the two points with the shortest Manhattan distance as the starting anchor point and the ending anchor point, respectively.
[0252] In a further description of the above device, the path determination module 1103 also includes a relationship path generation unit. This relationship path generation unit is used to determine the relationship path between the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element in the topological relationship graph based on the path generation rules in the improved A* algorithm, including:
[0253] The starting anchor point is determined as the starting point of the relationship path, and the ending anchor point is determined as the ending point of the relationship path;
[0254] Determine all walkable nodes of the starting point, wherein all walkable nodes are adjacent nodes of the starting point and are not within the range of elements in the topology graph;
[0255] Add all passable nodes to the first list, and add the starting point to the second list;
[0256] Take out each passable node in the first list in sequence and determine the F value of the passable node;
[0257] Compare the F values of all passable nodes in the first list. If there is a specific passable node that has the smallest F value and is not in the second list, then determine that specific passable node as the next node after the starting point and add the specific passable node to the second list.
[0258] Update the starting point to the specific passable section;
[0259] Determine the next node of the updated starting point, and continue until the next node is the ending point, then transfer the data in the second list to the third list;
[0260] The first list includes all nodes to be determined as being on the relationship path; the second list includes nodes already determined as being on the relationship path; and the third list includes all nodes on all generated relationship paths.
[0261] In a further description of the above device, the relationship path generation unit, in the process of sequentially retrieving each passable node from the first list and determining the F value of the passable node, specifically includes:
[0262] Take out each passable node in the first list in sequence, and determine the G value and H value corresponding to the passable node;
[0263] Based on the second list and the preset inflection point rules, after determining that the passable node has an inflection point, the T value of the passable node is updated.
[0264] If it is determined that the passable node is in the third list, update the Y value of the passable node;
[0265] The F value of the passable node is determined to be the sum of the G, H, T, and Y values corresponding to the communicable node;
[0266] The G value is the Manhattan distance between the starting anchor point and the passable node; the H value is the Manhattan distance between the passable node and the ending anchor point.
[0267] In a further description of the above-described device, the device also includes a configuration module 1104, used for:
[0268] Based on the topology graph, the affinity configuration of the Pod corresponding to the application is generated; the affinity configuration of the Pod includes the affinity cooperation between Pods within the cluster and the configuration of cross-cluster calls; and the Pod and the sidecar mode correspond one-to-one.
[0269] In a further description of the above device, the element distribution module 1102 further includes a line break determination unit, used to determine, based on the optimal display rules, the maximum value of the module corresponding to each row within a unit in the element set, the maximum value of the unit corresponding to each row within a cluster in the element set, and the maximum value of the cluster corresponding to each row in the topology graph, specifically used for:
[0270] Based on the maximum number of modules within a unit, the square root of the maximum number of modules, rounded up, is used as the maximum value of the corresponding modules displayed in each row within each unit.
[0271] Based on the maximum number of units in the cluster, the square root of the maximum number of units is rounded up and used as the maximum value of the corresponding unit displayed in each row of each cluster.
[0272] Based on the number of clusters, the square root of the number of clusters, rounded up, is determined as the maximum value of the clusters displayed in each row of the topology diagram.
[0273] It should be noted that the apparatus for displaying topology diagrams provided in this application embodiment can implement all the methods implemented in the above-described method embodiment for displaying topology diagrams and can achieve the same technical effects. Therefore, the parts and beneficial effects that are the same as or corresponding to the method embodiment in this embodiment will not be described in detail here.
[0274] Figure 12This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 12 As shown, the electronic device may include: a processor 1210, a communications interface 1220, a memory 1230, and a communication bus 1240, wherein the processor 1210, the communications interface 1220, and the memory 1230 communicate with each other via the communication bus 1240. The processor 1210 can call logical instructions in the memory 1230 to execute a method for displaying a topology diagram, such as including:
[0275] Based on the sidecar pattern, data on PaaS platform call relationships and application dependency relationships are collected to determine the corresponding set of elements and set of relationships.
[0276] Based on the size of different elements in the element set and the preset interval rules, the distribution of each element in the topological relationship graph is determined;
[0277] Based on the improved A* algorithm and the aforementioned set of relationships, the corresponding relationship paths between each element in the topological relationship graph are determined.
[0278] Furthermore, the logical instructions in the aforementioned memory 1230 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the 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 to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0279] It should be noted that the electronic device provided in this application embodiment can implement all the steps of the method embodiment for displaying topological relationship diagrams and can achieve the same technical effect. Therefore, the parts and beneficial effects that are the same as those in the method embodiment will not be described in detail here.
[0280] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the methods for displaying topology diagrams provided by the above methods.
[0281] Specifically, the computer program products provided in this application embodiment can implement all the methods implemented in the above method embodiments and can achieve the same technical effects. Here, the parts that are the same as those in the method embodiments and the beneficial effects will not be described in detail.
[0282] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0283] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0284] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for displaying a topological relationship diagram, characterized in that, include: Based on the sidecar pattern, data on PaaS platform call relationships and application dependency relationships are collected to determine the corresponding set of elements and set of relationships. Based on the size of different elements in the element set and the preset interval rules, the distribution of each element in the topological relationship graph is determined; Based on the improved A* algorithm and the aforementioned set of relationships, the corresponding relationship paths between each element in the topological relationship graph are determined; The improved A* algorithm includes a T value and a Y value, where the T value represents the cost of turning and the Y value represents the cost of overlapping with an existing path. The determination of the corresponding relationship paths between elements in the topological relationship graph based on the improved A* algorithm and the relationship set includes: Based on the set of relationships and the set of elements, determine the initiating element and the target element among the two elements that have a corresponding relationship; Based on the shortest Manhattan distance, determine the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element; Based on the path generation rules in the improved A* algorithm, the relationship path between the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element in the topology graph is determined. The path generation rules based on the improved A* algorithm, which determine the relationship path between the starting anchor point of the initiating element and the ending anchor point of the target element in the topological graph, include: The starting anchor point is determined as the starting point of the relationship path, and the ending anchor point is determined as the ending point of the relationship path; Determine all walkable nodes of the starting point, wherein all walkable nodes are adjacent nodes of the starting point and are not within the range of elements in the topology graph; Add all passable nodes to the first list, and add the starting point to the second list; Take out each passable node in the first list in sequence and determine the F value of the passable node; Compare the F values of all passable nodes in the first list. If there is a specific passable node that has the smallest F value and is not in the second list, then determine that specific passable node as the next node after the starting point and add the specific passable node to the second list. Update the starting point to the specific passable node; Determine the next node of the updated starting point, and continue until the next node is the ending point, then transfer the data in the second list to the third list; The first list includes all nodes to be determined as being on the relationship path; the second list includes nodes already determined as being on the relationship path; and the third list includes all nodes on all generated relationship paths.
2. The method for displaying a topological relationship diagram according to claim 1, characterized in that, The process of collecting data on PaaS platform call relationships and application dependency relationships based on the sidecar mode, and determining the corresponding element set and relationship set, includes: Based on the sidecar mode, data on dynamic call relationships and static application dependency relationships of the PaaS platform are collected, and the data is classified into element sets or relationship sets. The set of elements includes modules, units, and clusters; and a unit is a set of modules, and a cluster is a set of units; the set of relationships includes call relationships and dependency relationships, and a call relationship exists between any two modules, and a dependency relationship exists between any two units.
3. The method for displaying a topological relationship diagram according to claim 1, characterized in that, The step of determining the distribution of each element in the topological relationship graph based on the size of different elements in the element set and a preset interval rule includes: Based on the optimal display rules, the maximum value of the corresponding module displayed in each row of the unit in the element set, the maximum value of the corresponding unit displayed in each row of the cluster in the element set, and the maximum value of the cluster displayed in each row of the topology graph are determined. Based on the size of the modules in the element set, the maximum value of the corresponding modules displayed in each row of the unit, and the preset interval rules, the relative coordinates of each module in the corresponding unit are determined; Based on the size of the cells in the element set, the maximum value of the corresponding cells displayed in each row of the cluster, and the preset interval rules, the relative coordinates of each cell in the corresponding cluster are determined. Based on the size of the clusters in the element set, the maximum value of the clusters displayed in each row, and the preset interval rules, the coordinates of the clusters in the extended relationship graph are determined.
4. The method for displaying a topological relationship diagram according to claim 1, characterized in that, The process of determining the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element based on the shortest Manhattan distance includes: Obtain a first set consisting of multiple evenly distributed points on the border corresponding to the initiating element, and a second set consisting of multiple evenly distributed points on the border corresponding to the target element. Determine the Manhattan distance between any point in the first set and any point in the second set, and use the two points with the shortest Manhattan distance as the starting anchor point and the ending anchor point, respectively.
5. The method for displaying a topological relationship diagram according to claim 1, characterized in that, The step of sequentially retrieving each passable node from the first list and determining the F value of the passable node includes: Take out each passable node in the first list in sequence, and determine the G value and H value corresponding to the passable node; Based on the second list and the preset inflection point rules, after determining that the passable node has an inflection point, the T value of the passable node is updated. If it is determined that the passable node is in the third list, update the Y value of the passable node; The F value of the passable node is determined to be the sum of the G, H, T, and Y values corresponding to the communicable node; The G value is the Manhattan distance between the starting anchor point and the passable node; the H value is the Manhattan distance between the passable node and the ending anchor point.
6. The method for displaying a topological relationship diagram according to claim 1, characterized in that, The method further includes: Based on the topology graph, the affinity configuration of the Pod corresponding to the application is generated; the affinity configuration of the Pod includes the affinity cooperation between Pods within the cluster and the configuration of cross-cluster calls; and the Pod and the sidecar mode correspond one-to-one.
7. The method for displaying a topological relationship diagram according to claim 3, characterized in that, The determination of the maximum value of the corresponding module displayed in each row within a unit of the element set, the maximum value of the corresponding unit displayed in each row within a cluster of the element set, and the maximum value of the cluster displayed in each row of the topology graph based on the optimal display rules includes: Based on the maximum number of modules within a unit, the square root of the maximum number of modules, rounded up, is used as the maximum value of the corresponding modules displayed in each row within each unit. Based on the maximum number of units in the cluster, the square root of the maximum number of units is rounded up and used as the maximum value of the corresponding unit displayed in each row of each cluster. Based on the number of clusters, the square root of the number of clusters, rounded up, is determined as the maximum value of the clusters displayed in each row of the topology diagram.
8. An apparatus for displaying a topological relationship diagram, characterized in that, include: The set determination module is used to collect data on PaaS platform call relationships and application dependency relationships based on the sidecar mode, and determine the corresponding element set and relationship set. The element distribution module is used to determine the distribution of each element in the topological relationship graph based on the size of different elements in the element set and a preset interval rule. The path determination module is used to determine the corresponding relationship paths between elements in the topological relationship graph based on the improved A* algorithm and the relationship set. The improved A* algorithm includes a T value and a Y value, where the T value represents the cost of turning and the Y value represents the cost of overlapping with an existing path. The determination of the corresponding relationship paths between elements in the topological relationship graph based on the improved A* algorithm and the relationship set includes: Based on the set of relationships and the set of elements, determine the initiating element and the target element among the two elements that have a corresponding relationship; Based on the shortest Manhattan distance, determine the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element; Based on the path generation rules in the improved A* algorithm, the relationship path between the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element in the topology graph is determined. The path generation rules based on the improved A* algorithm, which determine the relationship path between the starting anchor point of the initiating element and the ending anchor point of the target element in the topological graph, include: The starting anchor point is determined as the starting point of the relationship path, and the ending anchor point is determined as the ending point of the relationship path; Determine all walkable nodes of the starting point, wherein all walkable nodes are adjacent nodes of the starting point and are not within the range of elements in the topology graph; Add all passable nodes to the first list, and add the starting point to the second list; Take out each passable node in the first list in sequence and determine the F value of the passable node; Compare the F values of all passable nodes in the first list. If there is a specific passable node that has the smallest F value and is not in the second list, then determine that specific passable node as the next node after the starting point and add the specific passable node to the second list. Update the starting point to the specific passable section; Determine the next node of the updated starting point, and continue until the next node is the ending point, then transfer the data in the second list to the third list; The first list includes all nodes to be determined as being on the relationship path; the second list includes nodes already determined as being on the relationship path; and the third list includes all nodes on all generated relationship paths.
9. The apparatus for displaying a topological relationship diagram according to claim 8, characterized in that, The process of determining the starting anchor point corresponding to the initiating element and the ending anchor point corresponding to the target element based on the shortest Manhattan distance includes: Obtain a first set consisting of multiple evenly distributed points on the border corresponding to the initiating element, and a second set consisting of multiple evenly distributed points on the border corresponding to the target element. Determine the Manhattan distance between any point in the first set and any point in the second set, and use the two points with the shortest Manhattan distance as the starting anchor point and the ending anchor point, respectively.
10. The apparatus for displaying a topological relationship diagram according to claim 8, characterized in that, The step of sequentially retrieving each passable node from the first list and determining the F value of the passable node includes: Take out each passable node in the first list in sequence, and determine the G value and H value corresponding to the passable node; Based on the second list and the preset inflection point rules, after determining that the passable node has an inflection point, the T value of the passable node is updated. If it is determined that the passable node is in the third list, update the Y value of the passable node; The F value of the passable node is determined to be the sum of the G, H, T, and Y values corresponding to the communicable node; The G value is the Manhattan distance between the starting anchor point and the passable node; the H value is the Manhattan distance between the passable node and the ending anchor point.
11. The apparatus for displaying a topological relationship diagram according to claim 8, characterized in that, The device further includes a configuration module for: Based on the topology graph, the affinity configuration of the Pod corresponding to the application is generated; the affinity configuration of the Pod includes the affinity cooperation between Pods within the cluster and the configuration of cross-cluster calls; and the Pod and the sidecar mode correspond one-to-one.
12. An electronic device comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the method for displaying a topological relationship diagram as described in any one of claims 1 to 7.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method for displaying a topological relationship diagram as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Topological graph display method based on inter-station network connection of DCS platform of nuclear power plant
CN110442755A