A method, system and device for quickly querying application topology
By building the target depth range in complex application systems and querying application nodes that meet this range in database tables, the problem of not being able to quickly query local topological relationships in massive topological data is solved, and the effect of fast on-demand query and efficient generation of application topological relationships is achieved.
Patent Information
- Application Number
- CN202510029063.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-01-08
AI Technical Summary
In complex application systems, the existence of massive topological nodes and edges makes it difficult to quickly query local topological relationships, especially for query scenarios for "in-depth" and "out-depth" parameters. The local topological relationship query process in related technologies will return topological data with a very large amount of data, resulting in high database query pressure and low efficiency in generating topological relationships for local application.
A quick application topology query method is proposed. By obtaining the central node and the target depth, building the target depth range, querying the application nodes that meet the range in the preset database table, and pruning the topology diagram based on the central node to obtain the target application topology relationship.
It realizes the rapid on-demand query of local application topological relationships in massive topological data scenarios, reduces the pressure of database query, accelerates the generation of application topological relationships, avoids interference from irrelevant data, and ensures the accuracy and efficiency of query results.
Smart Images

Figure CN119441320B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data network technology, and in particular to a method, system and device for quickly querying application topology. Background Art
[0002] As technologies such as cloud computing and big data become increasingly mature, microservice architecture has gradually come into people's attention. Full-link performance monitoring plays an important role in microservice architecture. Full-link performance monitoring covers mobile terminals, network terminals, and service terminals, and comprehensively counts the performance indicators of business requests of applications on each terminal. The association relationship and call chain between applications are displayed through the topology map. Each node in the topology map represents a service or application instance, and the connection between nodes represents the call relationship between services or applications. With the help of the topology map, operation and maintenance personnel can quickly identify the performance bottlenecks, failure points, and dependencies of the application.
[0003] However, in complex application systems, the existence of massive topological nodes and edges makes it difficult to quickly query local topological relationships. Especially for the query scenarios of "entry depth" and "exit depth" parameters, the local topological relationship query process in related technologies will return a very large amount of topological data, which will involve a large number of irrelevant nodes and edges that need to be processed additionally, resulting in high database query pressure and low efficiency in generating local application topological relationships.
[0004] Therefore, it is urgent to propose a fast query method for application topology to solve the above problems. Summary of the invention
[0005] In view of this, the present invention proposes a method, system and device for rapid query of application topology, which solves the problem that local application topological relationships cannot be quickly queried on demand in scenarios with massive topological data, reduces database query pressure, accelerates the generation of application topological relationships, and achieves the purpose of rapid on-demand query.
[0006] Based on the above purpose, an embodiment of the present invention provides a method for quickly querying application topology, which specifically includes the following steps:
[0007] In response to receiving a topology query request, obtaining a central node and a target depth corresponding to the topology query request;
[0008] Acquire a central node depth corresponding to the central node, and determine an interval minimum value and / or an interval maximum value based on the central node depth and the target depth to construct a target depth range;
[0009] Querying a preset database table for all application nodes that meet the target depth range;
[0010] A topology map is constructed according to the query result, and the topology map is pruned based on the central node to obtain a target application topology relationship.
[0011] In some implementations, the topology fast query method further includes:
[0012] In response to receiving a number of request data sent by the probe, for each of the request data, using the corresponding tracking identifier as a key field and the request data as a value field, the request data is stored in the first cache, and a preset timer corresponding to the tracking identifier is triggered;
[0013] In response to the first cache receiving the tracking identifier, checking based on the preset timer whether all the request data corresponding to the tracking identifier are all cached;
[0014] In response to all the corresponding request data being cached, determining a target cache table based on all the corresponding request data;
[0015] Based on the target cache table, the preset database table is constructed.
[0016] In some implementations, the step of determining the target cache table based on all the corresponding request data includes:
[0017] Based on all the corresponding request data, determining a plurality of call relationships and a plurality of first application identifiers;
[0018] Based on all the calling relationships, determine all calling application identifiers and all called application identifiers corresponding to each of the first application identifiers;
[0019] For each of the first application identifiers, construct a first array based on all corresponding calling application identifiers, and construct a second array based on all corresponding called application identifiers;
[0020] The target cache table is constructed by using each of the first application identifiers as a key field and the first array and the second array corresponding thereto as value fields.
[0021] In some implementations, the step of constructing the preset database table based on the target cache table includes:
[0022] Searching the target cache table for all application identifiers whose first array is empty as second application identifiers, and taking application nodes corresponding to each second application identifier as starting nodes;
[0023] Based on all the starting nodes and their corresponding second arrays, generate a number of call chains;
[0024] The longest call chain among all call chains is used as the main application call chain, and the sequence number of each application node in the main application call chain is incremented starting from sequence number 1, wherein the sequence number of the starting node of the main application call chain is 1;
[0025] Based on the marked serial number of each application node in the main application call chain, recursively mark the serial number of each application node in other call chains except the main application call chain;
[0026] The marked serial number is used as the node depth of the corresponding application node, and the preset database table is constructed based on all the application nodes and their node depths.
[0027] In some embodiments, the step of obtaining the central node depth corresponding to the central node, and determining the interval minimum value and / or interval maximum value based on the central node depth and the target depth to construct a target depth range includes:
[0028] Based on the central node identifier corresponding to the central node, querying the central node depth corresponding to the central node in the preset database table;
[0029] Determine whether the target depth has a corresponding first node depth and / or second node depth;
[0030] If the target depth only has a corresponding first node depth, determining the interval minimum value based on the central node depth and the first node depth, and constructing the target depth range according to the interval minimum value;
[0031] If the target depth only has a corresponding second node depth, determining the interval maximum value based on the central node depth and the second node depth, and constructing the target depth range according to the interval maximum value;
[0032] If the target depth has a corresponding first node depth and second node depth, the interval minimum value is determined based on the central node depth and the first node depth, the interval maximum value is determined based on the central node depth and the second node depth, and the target depth range is constructed according to the interval minimum value and the interval maximum value.
[0033] In some implementations, the step of querying a preset database table for all application nodes that meet the target depth range includes:
[0034] If the target depth range has a corresponding interval minimum value and interval maximum value, query the preset database table for all application nodes whose node depth is greater than or equal to the interval minimum value and less than or equal to the interval maximum value;
[0035] If the target depth range only has the corresponding interval minimum value, query the preset database table for all application nodes whose node depth is greater than or equal to the interval minimum value;
[0036] If the target depth range only has the corresponding interval maximum value, all application nodes whose node depth is less than or equal to the interval maximum value are queried in the preset database table.
[0037] In some implementations, the step of pruning the topology graph based on the central node to obtain the target application topology relationship includes:
[0038] Starting from the central node, recursively access all nodes adjacent to the central node in the topology graph to obtain access results;
[0039] According to the access result, unvisited nodes in the topology map are removed to obtain the target application topology relationship.
[0040] In some implementations, the topology fast query method further includes:
[0041] In response to receiving the application node to be queried input by the user, determining whether there is a first node depth and / or a second node depth in the user input;
[0042] If the user input contains a first node depth and / or a second node depth, taking the first node depth and / or the second node depth as the target depth;
[0043] The application node to be queried is used as the central node, and the topology query request including the central node and the target depth is sent.
[0044] Another aspect of the embodiment of the present invention further provides an application topology fast query system, including:
[0045] An acquisition unit, configured to, in response to receiving a topology query request, acquire a central node and a target depth corresponding to the topology query request;
[0046] a range determination unit configured to obtain a central node depth corresponding to the central node, and determine an interval minimum value and / or an interval maximum value based on the central node depth and the target depth to construct a target depth range;
[0047] A query unit configured to query a preset database table for all application nodes that meet the target depth range;
[0048] The generating unit is configured to construct a topological map according to the query result, and prune the topological map based on the central node to obtain a target application topological relationship.
[0049] According to another aspect of an embodiment of the present invention, a computer device is provided, comprising: at least one processor; and a memory, wherein the memory stores a computer program executable on the processor, and the computer program implements the steps of the above method when executed by the processor.
[0050] The present invention has at least the following beneficial technical effects: the application topology fast query method of the present invention calculates the node depth of all related nodes in the entire distributed business request call transaction according to the call relationship in the topology data processing stage, generates a preset database table containing a node depth field, obtains the target depth range according to the central node and the target depth in the topology data query stage, and quickly queries the target application topology relationship required by the user by filtering the topology call relationship data whose node depth field values in the preset database table are within the target depth range. The above scheme solves the problem that local application topology relationships cannot be quickly queried on demand in scenarios with massive topological data, avoids interference from irrelevant topological data, and ensures that the final generated result only contains truly meaningful application topology relationships within the target depth range, thereby reducing database query pressure, accelerating the generation of application topology relationships, and achieving the purpose of fast on-demand query. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.
[0052] Figure 1 A schematic diagram of an embodiment of a complete application topology queried with node C as the central node;
[0053] Figure 2 A schematic diagram of an embodiment of a local application topology queried with node C as the central node;
[0054] Figure 3 A schematic diagram of another embodiment of a local application topology queried with node C as the central node;
[0055] Figure 4 A block diagram of an embodiment of the application topology fast query method provided by the present invention;
[0056] Figure 5 A schematic diagram of an embodiment of a system architecture provided by the present invention;
[0057] Figure 6A schematic diagram of an embodiment of a local application topology relationship query code provided by the present invention;
[0058] Figure 7 A schematic diagram of an embodiment of constructing a target cache table provided by the present invention;
[0059] Figure 8 A schematic diagram of an embodiment of building a call chain provided by the present invention;
[0060] Fig. 9 A schematic diagram of an embodiment of marking the main application call chain sequence number provided by the present invention;
[0061] Fig.10 A schematic diagram of an embodiment of marking other call chain sequence numbers provided by the present invention;
[0062] Fig.11 A schematic diagram of another embodiment of marking other call chain sequence numbers provided by the present invention;
[0063] Fig.12 A schematic diagram of an embodiment of a preset database table construction code provided by the present invention;
[0064] Fig.13 A schematic diagram of an embodiment of a topological diagram provided by the present invention;
[0065] Fig.14 A schematic diagram of an embodiment of a target application topology relationship provided by the present invention;
[0066] Fig.15 A schematic diagram of an embodiment of the execution process of the topology fast query method provided by the present invention;
[0067] Fig.16 A schematic diagram of an embodiment of the application topology fast query system provided by the present invention;
[0068] Fig.17 A schematic structural diagram of an embodiment of a computer device provided by the present invention. DETAILED DESCRIPTION
[0069] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0070] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. The subsequent embodiments will not explain this one by one.
[0071] In order to query the local application topology relationship in a complex application system, "out-depth" and "in-depth" are introduced to indicate the distance associated with the central node to be queried in the application topology relationship. "Out-depth" refers to the depth of the call hierarchy from the central node to another application node along the call relationship. For example, the central node is node C, and node C directly calls node D. In this case, the "out-depth" corresponding to node D is 1. For another example, node C calls node D, and node D calls node X. In this case, the "out-depth" corresponding to node X is 2. "In-depth" refers to the depth of the call hierarchy from another application node to the central node along the call relationship. For example, the central node is node C, and node B directly calls node C. In this case, the "in-depth" corresponding to node B is 1. For another example, node B calls node C, and node A calls node B. In this case, the "in-depth" corresponding to node A is 2.
[0072] The relevant technology is currently unable to quickly query the local application topology relationship based on the "out-depth" and "in-depth". The current relevant technology query process for local application topology relationships requires first loading all topology data and generating a complete application topology map, and then cutting the topology map based on the "out-depth" and "in-depth" parameters. For example, if the central node in the user's query requirement is node C, the "out-depth" is 2, and the "in-depth" is 1, the relevant technology query needs to process the full amount of data in the database to generate a complete application topology relationship for node C, such as Figure 1 As shown. Based on the complete application topology, the "out-depth" and "in-depth" of other nodes and node C are calculated, and then the application topology with "out-depth" of 2 and "in-depth" of 1 is trimmed. Figure 2 If the user's query requirement changes to the central node being node C, and the "out-depth" is 1 and the "in-depth" is 1, the relevant technology needs to traverse all the data in the database again, regenerate the complete application topology relationship of node C, and recalculate the "out-depth" and "in-depth" of each node, and trim the application topology relationship with node C with an "out-depth" of 1 and an "in-depth" of 1, as shown in the figure. Figure 3 shown.
[0073] It can be seen that the depth calculation of related technologies is performed after the application topology is generated. The depth calculation and application topology relationship generation are independent of each other. It is impossible to use the "out-depth" and "in-depth" parameters to directly filter and obtain the required topology data when querying the database, resulting in the need to process the full amount of data for each query, and the recursive processing and depth marking process will frequently traverse the complete topology data. There are problems such as high database query pressure, high algorithm complexity, and low efficiency in generating local application topology relationships.
[0074] In view of the above problems, the first aspect of the embodiment of the present invention provides a method for fast querying application topology. Figure 4 As shown, it includes the following steps:
[0075] Step S100, in response to receiving a topology query request, obtaining a central node and a target depth corresponding to the topology query request;
[0076] Step S200, obtaining the center node depth corresponding to the center node, and determining the interval minimum value and / or interval maximum value based on the center node depth and the target depth to construct a target depth range;
[0077] Step S300, querying a preset database table for all application nodes that meet the target depth range;
[0078] Step S400, constructing a topology map according to the query result, and pruning the topology map based on the central node to obtain the target application topology relationship.
[0079] In some embodiments, Figure 5 As shown, the execution process of the method for tracking topological node changes of the present invention involves a probe, an application topology data processing system, a database, and an application topology query system. A topology query request with a central node as a condition is received through the application topology query system, and the central node is the application to be queried input by the user. Optionally, the user can further input other nodes or target depths as filtering conditions to generate a topology query request to query the application topological relationship and its indicators. The target depth may include an "out-depth" parameter and / or an "in-depth" parameter. According to the application identifier corresponding to the topological node (such as the central node) included in the topological query request, the central node depth corresponding to the central node is queried in the preset database table, and the "out-depth" and / or "in-depth" restrictions in the central node depth and the target depth are combined to calculate the target depth range, and all application nodes that meet the target depth range in the preset database are queried, such as Figure 6 shown. Figure 6 In the table, "from_appid='djdy04'" indicates that the application ID of the central node is "djdy04", "dwm_apptopo" is the preset database table, and "in_depth" is the node depth field. That is, the row data with the application ID "djdy04" is filtered out from the preset database table, and the in_depth field in these row data is extracted and deduplicated to obtain a node depth array, that is, Figure 6"depth_rows". Because the calling relationships corresponding to application nodes in different business requests may be different, and the corresponding node depths in different calling relationships are also different, there may be a situation where one application node corresponds to multiple node depths. For each node depth x in the node depth array, determine the corresponding target depth range. For example, when the "out depth" is 3 and the "in depth" is 2, the target depth range can be expressed as [x-2, x+3]. After determining the target depth range, query the preset database table for all data rows whose in_depth field values meet the target depth range, so as to determine the application nodes that meet the target depth range, and generate the target application topology relationship based on the application nodes obtained by the query.
[0080] The application topology fast query method of the present invention calculates the target depth range according to the central node, "out depth" and "in depth" parameters, converts the topology calculation into an efficient database field query, and directly filters the target depth range to obtain the required topology data during database query, thus avoiding unnecessary node loading, reducing the number of database query scan rows and the amount of data returned by the query, reducing complexity, and significantly improving query efficiency.
[0081] In some embodiments, the topology fast query method of the present invention also includes: in response to receiving a number of request data sent by the probe, for each request data, using its corresponding tracking identifier as the key field and the request data as the value field, storing it in the first cache, and triggering a preset timer corresponding to the tracking identifier; in response to the first cache receiving the tracking identifier, checking whether all request data corresponding to the tracking identifier are all cached based on the preset timer; in response to all corresponding request data being all cached, determining the target cache table based on all corresponding request data; and constructing a preset database table based on the target cache table.
[0082] In some embodiments, the step of determining a target cache table based on all corresponding request data includes: determining a number of call relationships and a number of first application identifiers based on all corresponding request data; determining all calling application identifiers and all called application identifiers corresponding to each first application identifier based on all calling relationships; for each first application identifier, constructing a first array based on all corresponding calling application identifiers, and constructing a second array based on all corresponding called application identifiers; and constructing a target cache table using each first application identifier as a key field and its corresponding first array and second array as value fields.
[0083] In some implementations, after the probe collects the business request, it encapsulates the call relationship data (such as the calling node and the called node), traceid (i.e., tracing identifier) field, and appid (application identifier) field in the business request into request data (i.e., request data), and then sends the request data in batches to the application topology data processing system.
[0084] In some embodiments, a preset database table and a target cache table are constructed and maintained by an application topology data processing system. The application topology data processing system starts a topology-related thread pool and initializes a cache hashmap named in_out_hash (i.e., the target cache table). When the application topology data processing system ingests the request data sent by the probe, it extracts the traceid and appid fields in the request data. Since the data sent by multiple probes are sequential, in order to process the request data in an orderly manner, the topology-related thread adds the above-mentioned request data to the cache (i.e., the first cache) with traceid as the key, and sets a preset timer for the traceid. The preset timer duration can be configured according to actual application requirements, for example, set to 30 seconds. Every time the first cache receives a request data, it triggers the preset timer corresponding to the traceid in the request data. When the timer is triggered, check whether all the request data corresponding to the traceid in the cache have arrived. If there is still request data that has not arrived, reset the preset timer corresponding to the traceid and continue to wait for other timers to be triggered. If all request data corresponding to the traceid have arrived, all request data corresponding to the traceid are taken out from the first cache, and a target cache table is constructed according to the appid (ie, the first application identifier) and the call relationship in all request data.
[0085] In some embodiments, the construction process of the target cache table is described. According to the calling relationship in each request data, all calling appids and all called appids corresponding to each appid are determined and stored in in_out_hash. The key in in_out_hash is appid, and the value includes two array objects, one is the "in" array for storing the upstream calling node of the current node, that is, the first array, and the other is the "out" array for storing the downstream called node of the current node, that is, the second array. For example, when the calling relationship is that node A calls node B, node B is the called node of node A, and node A is the calling node of node B. Node B is added to the in_out_hash[A].out array, and node A is added to the in_out_hash[B].in array. For another example, when the calling relationship is that node B and node U call node C, and node C calls node D and node F, then add node D and node F to the in_out_hash[C].out array, add node B and node U to the in_out_hash[C].in array, add node C to the in_out_hash[B].out array and in_out_hash[U].out array, add node C to the in_out_hash[D].in array, and add node C to the in_out_hash[F].in array. Figure 7 As shown in the figure, in_out_hash[A].out represents the out array corresponding to node A in in_out_hash, in_out_hash[A].in represents the in array corresponding to node A in in_out_hash, and the rest are similar.
[0086] The application topology fast query method of the present invention converts the call relationship into in_out_hash, which is the key to optimizing complex call relationships. Through the in_out_hash structured storage and fast access mechanism, data redundancy can be reduced, query efficiency can be accelerated, subsequent node depth calculation can be facilitated, and subsequent operations such as topology construction and link analysis can be simplified.
[0087] In some embodiments, the step of constructing a preset database table based on the target cache table includes: querying the target cache table for all application identifiers whose first array is empty as second application identifiers, and taking the application nodes corresponding to each second application identifier as the starting node; generating several call chains based on all starting nodes and their corresponding second arrays; taking the longest call chain among all call chains as the main application call chain, and incrementally marking the sequence number of each application node in the main application call chain starting from sequence number 1, wherein the sequence number of the starting node of the main application call chain is 1; based on the marked sequence number of each application node in the main application call chain, recursively marking the sequence number of each application node in other call chains except the main application call chain; taking the marked sequence number as the node depth of the corresponding application node, and constructing the preset database table based on all application nodes and their node depths.
[0088] In some implementations, if the in array corresponding to each appid in in_out_hash is empty, it means that the appid is the starting node, and if the out array corresponding to each appid in in_out_hash is empty, it means that the appid is the ending node. Traverse in_out_hash to find all starting nodes, and start from each starting node, recursively find the next node through the appid in the out array in in_out_hash until the ending node is found, forming an application call chain, such as Figure 8 As shown. Traverse all application call chains and calculate their lengths. The application call chain with the longest length is the main application call chain, as shown Figure 8 The number in front of the call chain is its length. The call chain in the dotted box is the main application call chain, with a length of 6. First, mark the sequence number of each node in the main application call chain incrementally starting from sequence number 1. Specifically, mark the sequence number of the starting node of the main application call chain as 1, and then mark the sequence number of the next node of the starting node (that is, the called node) as 2 according to the out array of the starting node in in_out_hash, and mark the sequence number of the next node of the called node as 3 according to the out array of the called node. Based on this, recursively mark the sequence number of each node in the main application call chain in an incremental manner, as shown in the following example: Fig. 9 Then traverse the starting nodes of all other application chains, starting from the starting node to the node of the main application call chain, and recursively reversely mark the nodes of other application chains according to the nodes of the main application call chain, that is, according to the in array of the main application call chain node in in_out_hash, reduce the sequence number of its previous node (call node) by 1, and finally recursively mark the sequence number of each node in other call chains in a decreasing manner according to the in array of the call node, as shown. Fig.10 and Fig.11 shown.
[0089] In some implementations, the serial number of each application node is its node depth, which is used as the in_depth field value in the preset database table. Each topology call relationship corresponding to a business request is assembled in units, that is, multiple topology call relationships are assembled based on the same traceid and all corresponding request data. Each topology call relationship is stored as a row of data in the preset database table. Each row of data includes from_appid (calling node), to_appid (called node), other indicator data fields (such as average response time and throughput) and the in_depth field value corresponding to the from_appid, such as Fig.12 shown. Fig.12 "ts" indicates the timestamp field, "DateTime64(3)" indicates that the timestamp is accurate to milliseconds (3 decimal places), "dur" indicates the duration of the call, "count" indicates the number of calls, and "PARTITION BYtoYYYYMMDD(ts)" indicates that each row of data in the table is partitioned by the year, month, and day of the ts field. The preset database table constructed according to the above method is shown in Table 1 below.
[0090] Table 1
[0091]
[0092] The application topology fast query method of the present invention obtains the application call chain through in_out_hash conversion, so that the complex call topology is presented in the form of a link, which is convenient for marking the sequence number for each node and quickly obtaining the in_depth field value corresponding to each node. The in_depth field is used to make the application topology data processing system more efficient in processing and storing topology structure information, which is beneficial to quickly query the local application topology relationship on demand in the scenario of massive topology data.
[0093] In some embodiments, the steps of obtaining a center node depth corresponding to a center node, and determining an interval minimum and / or interval maximum based on the center node depth and a target depth to construct a target depth range include: querying a preset database table for a center node depth corresponding to the center node based on a center node identifier corresponding to the center node; determining whether a corresponding first node depth and / or second node depth exists for the target depth; if the target depth only has a corresponding first node depth, determining an interval minimum based on the center node depth and the first node depth, and constructing a target depth range according to the interval minimum; if the target depth only has a corresponding second node depth, determining an interval maximum based on the center node depth and the second node depth, and constructing a target depth range according to the interval maximum; if the target depth has a corresponding first node depth and a second node depth, determining an interval minimum based on the center node depth and the first node depth, determining an interval maximum based on the center node depth and the second node depth, and constructing a target depth range according to the interval minimum and the interval maximum.
[0094] In some embodiments, the first node depth is an "entry depth" parameter, and the second node depth is an "exit depth" parameter. The minimum value of the interval can be determined based on the difference between the center node depth and the "entry depth" parameter, and the maximum value of the interval can be determined based on the sum of the center node depth and the "exit depth" parameter. If the target depth only has an "entry depth" parameter, the target depth range can be a left-closed and right-open interval constructed according to the "entry depth" parameter. If the target depth only has an "exit depth" parameter, the target depth range can be a left-open and right-closed interval constructed according to the "entry depth" parameter. If the target depth has both an "exit depth" parameter and an "entry depth" parameter, the target depth range can be a closed interval constructed according to the "entry depth" parameter and the "entry depth" parameter.
[0095] The application topology fast query method of the present invention directly extracts qualified nodes and relationship data from a preset database table by constraining the query conditions with the upper and lower limits of the target depth range, avoiding full table scanning of massive topological data and only querying nodes and related call relationships within the target depth range, thereby significantly reducing the size of the query result set and improving the query response speed of the database.
[0096] In some embodiments, the step of querying a preset database table for all application nodes that meet the target depth range includes: if the target depth range has a corresponding interval minimum value and an interval maximum value, querying the preset database table for all application nodes whose node depth is greater than or equal to the interval minimum value and less than or equal to the interval maximum value; if the target depth range only has a corresponding interval minimum value, querying the preset database table for all application nodes whose node depth is greater than or equal to the interval minimum value; if the target depth range only has a corresponding interval maximum value, querying the preset database table for all application nodes whose node depth is less than or equal to the interval maximum value.
[0097] In some implementations, if the target depth range only has a corresponding interval minimum value, it means that the filtering condition in the topology query request input by the user only has the "entry depth" parameter. If the target depth range only has a corresponding interval maximum value, it means that the filtering condition in the topology query request input by the user only has the "exit depth" parameter. If the target depth range has both a corresponding interval minimum value and an interval maximum value, it means that the filtering condition in the topology query request input by the user includes both the "entry depth" parameter and the "exit depth" parameter.
[0098] The application topology quick query method of the present invention can quickly query the local application topology relationship on demand, achieve the purpose of quick on-demand query, and improve the query experience of users.
[0099] In some embodiments, the step of pruning the topology map based on the central node to obtain the target application topology relationship includes: recursively accessing all nodes adjacent to the central node in the topology map to obtain access results; based on the access results, removing unvisited nodes in the topology map to obtain the target application topology relationship.
[0100] In some implementations, after querying all application node data that meet the target depth range, the application topology is generated and the indicator data is aggregated and counted according to the call relationship between the nodes represented by from_appid and to_appid in the preset database table, that is, a topology map is constructed. The data obtained by filtering the query by the target depth range may have topological connections that are not related to the central node. In one example, when the central node is Fig.11 The Y node in the query has a corresponding central node depth of 5. The "entry depth" and "exit depth" parameters are both set to 1. At this time, the target depth range is [4,6]. After the query, the topology diagram is constructed as follows: Fig.13 As shown in the figure, there is a topological link FH that is not related to node Y. Therefore, it is necessary to perform pruning to remove redundant links and nodes. The pruning logic uses the breadth-first algorithm (BFS), starting from the central node, recursively searching all nodes connected to it according to the call relationship, retaining the nodes and edges directly or indirectly connected to the central node, and removing the nodes that are not connected to the central node, that is, removing nodes F and H, to obtain the correct application topology relationship and related indicator data, as shown in Fig.14 shown.
[0101] The application topology fast query method of the present invention uses pruning processing to make the finally generated application topology relationship include the call relationship related to the central node within the target depth range, effectively meeting the user's query needs and achieving the purpose of fast on-demand query.
[0102] In some embodiments, the topology quick query method of the present invention also includes: in response to receiving the application node to be queried input by the user, determining whether the first node depth and / or the second node depth exists in the user input; if the first node depth and / or the second node depth exists in the user input, using the first node depth and / or the second node depth as the target depth; using the application node to be queried as the central node, and sending a topology query request including the central node and the target depth.
[0103] In some embodiments, Fig.15 The figure shows a schematic diagram of an embodiment of the execution process of the topology fast query method provided by the present invention. The request data sent by the probe is processed by the application topology data processing system, and a preset database table including the in_depth field is constructed to store all application node data in the entire distributed business request. The application topology query system obtains the target depth range according to the central node and the "out depth" and / or "in depth" to quickly obtain the required application node data in the database according to the target depth range, and obtains the final application topology relationship by removing the application node data irrelevant to the central node.
[0104] The application topology fast query method of the present invention solves the problem that local application topology relationships cannot be quickly queried on demand in scenarios with massive topology data. When querying the database, the target depth range is used to directly filter the required topology data to generate application topology relationships, avoiding interference from irrelevant topology data, reducing database query pressure, and accelerating the generation of application topology relationships, thereby achieving the purpose of fast on-demand query.
[0105] Based on the same inventive concept, according to another aspect of the present invention, Fig.16 As shown, an embodiment of the present invention further provides an application topology fast query system, and the application topology fast query system includes:
[0106] The acquisition unit 110 is configured to, in response to receiving a topology query request, acquire a central node and a target depth corresponding to the topology query request;
[0107] A range determination unit 120 is configured to obtain a center node depth corresponding to the center node, and determine an interval minimum value and / or an interval maximum value based on the center node depth and the target depth to construct a target depth range;
[0108] A query unit 130, configured to query a preset database table for all application nodes that meet a target depth range;
[0109] The generating unit 140 is configured to construct a topology map according to the query result, and prune the topology map based on the central node to obtain a target application topology relationship.
[0110] The application topology quick query system of the present invention calculates the node depth of all related nodes in the entire distributed business request call transaction according to the call relationship in the topology data processing stage, generates a preset database table containing a node depth field, obtains the target depth range according to the central node and the target depth in the topology data query stage, and quickly queries the target application topology relationship required by the user by filtering the topology call relationship data whose node depth field values in the preset database table are within the target depth range. The above scheme solves the problem that local application topology relationships cannot be quickly queried on demand in scenarios with massive topological data, avoids interference from irrelevant topological data, and ensures that the final generated result only contains truly meaningful application topology relationships within the target depth range, thereby reducing the database query pressure, accelerating the generation of application topology relationships, and achieving the purpose of quick on-demand query.
[0111] Based on the same inventive concept, according to another aspect of the present invention, Fig.17 As shown, an embodiment of the present invention further provides a computer device 30, which includes a processor 310 and a memory 320. The memory 320 stores a computer program 321 that can be run on the processor. When the processor 310 executes the program, the steps of the above method are performed.
[0112] Finally, it should be noted that a person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program can be a disk, an optical disk, a read-only storage memory (ROM) or a random access memory (RAM), etc. The above-mentioned computer program embodiments can achieve the same or similar effects as the corresponding above-mentioned any method embodiments.
[0113] It will also be appreciated by those skilled in the art that various exemplary logic blocks, modules, circuits and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given to the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or hardware depends on specific applications and the design constraints imposed on the entire system. Those skilled in the art can implement the function in various ways for each specific application, but this implementation decision should not be interpreted as causing a departure from the disclosed scope of the embodiments of the present invention.
[0114] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope of the embodiments disclosed in the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. The serial numbers of the embodiments disclosed in the above embodiments of the present invention are for description only and do not represent the advantages and disadvantages of the embodiments. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.
[0115] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.
[0116] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the above embodiments of the present invention, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.
Claims
1. A method for fast querying application topology, characterized in that: include: In response to receiving a topology query request, obtaining a central node and a target depth corresponding to the topology query request; Acquire a central node depth corresponding to the central node, and determine an interval minimum value and / or an interval maximum value based on the central node depth and the target depth to construct a target depth range; Querying a preset database table for all application nodes that meet the target depth range; Construct a topology map according to the query results, and prune the topology map based on the central node to obtain the target application topology relationship; The step of obtaining the central node depth corresponding to the central node, and determining the interval minimum value and / or interval maximum value based on the central node depth and the target depth to construct a target depth range includes: Based on the central node identifier corresponding to the central node, querying the central node depth corresponding to the central node in the preset database table; Determine whether the target depth has a corresponding first node depth and / or second node depth; If the target depth only has a corresponding first node depth, determining the interval minimum value based on the central node depth and the first node depth, and constructing the target depth range according to the interval minimum value; If the target depth only has a corresponding second node depth, determining the interval maximum value based on the central node depth and the second node depth, and constructing the target depth range according to the interval maximum value; If the target depth has a corresponding first node depth and second node depth, the interval minimum value is determined based on the central node depth and the first node depth, the interval maximum value is determined based on the central node depth and the second node depth, and the target depth range is constructed according to the interval minimum value and the interval maximum value.
2. The topology fast query method according to claim 1, characterized in that: Also includes: In response to receiving a number of request data sent by the probe, for each of the request data, using the corresponding tracking identifier as a key field and the request data as a value field, the request data is stored in the first cache, and a preset timer corresponding to the tracking identifier is triggered; In response to the first cache receiving the tracking identifier, checking based on the preset timer whether all the request data corresponding to the tracking identifier are all cached; In response to all the corresponding request data being cached, determining a target cache table based on all the corresponding request data; Based on the target cache table, the preset database table is constructed.
3. The topology fast query method according to claim 2, characterized in that: The step of determining the target cache table based on all the corresponding request data includes: Based on all the corresponding request data, determining a plurality of call relationships and a plurality of first application identifiers; Based on all the calling relationships, determine all calling application identifiers and all called application identifiers corresponding to each of the first application identifiers; For each of the first application identifiers, construct a first array based on all corresponding calling application identifiers, and construct a second array based on all corresponding called application identifiers; The target cache table is constructed by using each of the first application identifiers as a key field and the first array and the second array corresponding thereto as value fields.
4. The topology fast query method according to claim 3 is characterized in that: The step of constructing the preset database table based on the target cache table includes: Searching the target cache table for all application identifiers whose first array is empty as second application identifiers, and taking application nodes corresponding to each second application identifier as starting nodes; Based on all the starting nodes and their corresponding second arrays, generate a number of call chains; The longest call chain among all call chains is used as the main application call chain, and the sequence number of each application node in the main application call chain is incremented starting from sequence number 1, wherein the sequence number of the starting node of the main application call chain is 1; Based on the marked serial number of each application node in the main application call chain, recursively mark the serial number of each application node in other call chains except the main application call chain; The marked serial number is used as the node depth of the corresponding application node, and the preset database table is constructed based on all the application nodes and their node depths.
5. The topology fast query method according to claim 1, characterized in that: The step of querying a preset database table for all application nodes that meet the target depth range includes: If the target depth range has a corresponding interval minimum value and interval maximum value, query the preset database table for all application nodes whose node depth is greater than or equal to the interval minimum value and less than or equal to the interval maximum value; If the target depth range only has the corresponding interval minimum value, query the preset database table for all application nodes whose node depth is greater than or equal to the interval minimum value; If the target depth range only has the corresponding interval maximum value, all application nodes whose node depth is less than or equal to the interval maximum value are queried in the preset database table.
6. The topology fast query method according to claim 5, characterized in that: The step of pruning the topology graph based on the central node to obtain the target application topology relationship includes: Starting from the central node, recursively access all nodes adjacent to the central node in the topology graph to obtain access results; According to the access result, unvisited nodes in the topology map are removed to obtain the target application topology relationship.
7. The topology fast query method according to claim 1, characterized in that: Also includes: In response to receiving the application node to be queried input by the user, determining whether there is a first node depth and / or a second node depth in the user input; If the user input contains a first node depth and / or a second node depth, taking the first node depth and / or the second node depth as the target depth; The application node to be queried is used as the central node, and the topology query request including the central node and the target depth is sent.
8. An application topology quick query system, characterized in that: include: An acquisition unit, configured to, in response to receiving a topology query request, acquire a central node and a target depth corresponding to the topology query request; a range determination unit configured to obtain a central node depth corresponding to the central node, and determine an interval minimum value and / or an interval maximum value based on the central node depth and the target depth to construct a target depth range; A query unit configured to query a preset database table for all application nodes that meet the target depth range; A generating unit configured to construct a topology map according to the query result, and prune the topology map based on the central node to obtain a target application topology relationship; The range determination unit is further configured to: query the central node depth corresponding to the central node in the preset database table based on the central node identifier corresponding to the central node; determine whether the target depth has a corresponding first node depth and / or second node depth; if the target depth only has a corresponding first node depth, determine the minimum value of the interval based on the central node depth and the first node depth, and construct the target depth range according to the minimum value of the interval; If the target depth only has a corresponding second node depth, determining the interval maximum value based on the central node depth and the second node depth, and constructing the target depth range according to the interval maximum value; If the target depth has a corresponding first node depth and second node depth, the interval minimum value is determined based on the central node depth and the first node depth, the interval maximum value is determined based on the central node depth and the second node depth, and the target depth range is constructed according to the interval minimum value and the interval maximum value.
9. A computer device comprising: at least one processor; as well as A memory storing a computer program executable on the processor, wherein the processor executes the steps of the method according to any one of claims 1 to 7 when executing the program.
Citation Information
Patent Citations
Intelligent relation-graph generating method based on port connection information of communication equipment
CN103905254A
Inter-node shortest path acquisition method
CN117668004A