CN110417574B - Topology analysis method and device and storage medium - Google Patents

Topology analysis method and device and storage medium Download PDF

Info

Publication number
CN110417574B
CN110417574B CN201910423761.0A CN201910423761A CN110417574B CN 110417574 B CN110417574 B CN 110417574B CN 201910423761 A CN201910423761 A CN 201910423761A CN 110417574 B CN110417574 B CN 110417574B
Authority
CN
China
Prior art keywords
function
distributed system
functional unit
topology
function module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910423761.0A
Other languages
Chinese (zh)
Other versions
CN110417574A (en
Inventor
白广元
侯世莹
李鑫
周俊
王鹏程
范刚
唐闻生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910423761.0A priority Critical patent/CN110417574B/en
Publication of CN110417574A publication Critical patent/CN110417574A/en
Application granted granted Critical
Publication of CN110417574B publication Critical patent/CN110417574B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/12Discovery or management of network topologies
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention discloses a topology analysis method, a device and a storage medium; the embodiment can receive an analysis request, determine a target distributed system which needs to perform topology analysis according to the analysis request, where the target distributed system includes a plurality of functional units, perform static analysis on the functional units included in the target distributed system to obtain a static analysis result, identify function modules included in the functional units according to the static analysis result corresponding to the functional units, identify pairs of functional units having a call relationship according to the function modules included in the functional units, and finally generate a call topology corresponding to the target distributed system according to the determined pairs of functional units, thereby implementing efficient discovery of the call topology of the functional units in the distributed system. And then, when the management requirement of the target distributed system exists, the management can be correspondingly carried out according to the generated calling topology.

Description

Topology analysis method and device and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a topology analysis method, an apparatus, and a storage medium.
Background
In recent years, with the development of the internet, distributed systems such as service platforms, online malls, and the like, which rely on networks, are gradually scaled up and adopted. The method divides different functional units (or called services) and distributes the units, and the functional units are connected by well-defined interfaces and contracts, the granularity of the functional units becomes thinner and thinner under the requirement of high cohesive loose coupling, the number of the functional units becomes more and more, and the management of the functional units becomes more and more complex. In order to realize the association of the functional units, it is important to grasp the calling topology of the internal functional units of the distributed system.
Disclosure of Invention
Embodiments of the present invention provide a topology analysis method, an apparatus, and a storage medium, which can efficiently discover a call topology of an internal functional unit of a distributed system.
The embodiment of the invention provides a topology analysis method, which comprises the following steps:
receiving an analysis request, and determining a target distributed system which needs topology analysis according to the analysis request, wherein the target distributed system comprises a plurality of functional units;
performing static analysis on the functional unit to obtain a static analysis result;
identifying a function module included in the function unit according to a static analysis result corresponding to the function unit;
identifying a functional unit pair with a calling relation according to a function module included in each functional unit;
and generating a calling topology corresponding to the target distributed system according to the determined functional unit pair.
An embodiment of the present invention further provides a topology analysis apparatus, including:
the request receiving component is used for receiving an analysis request and determining a target distributed system which needs topology analysis according to the analysis request, and the target distributed system comprises a plurality of functional units;
the static analysis component is used for carrying out static analysis on the functional unit to obtain a static analysis result;
the module identification component is used for identifying the function module included in the functional unit according to the static analysis result corresponding to the functional unit;
the relationship identification component is used for identifying the functional unit pair with the calling relationship according to the function module included in each functional unit;
and the topology analysis component is used for generating a calling topology corresponding to the target distributed system according to the determined functional unit pair.
In addition, an embodiment of the present invention further provides a storage medium, where the storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to perform steps in any topology analysis method provided in the embodiment of the present invention.
The embodiment of the invention can receive an analysis request, determine a target distributed system which needs topology analysis according to the analysis request, wherein the target distributed system comprises a plurality of functional units, then perform static analysis on the functional units included in the target distributed system to obtain a static analysis result, identify the function modules included in the functional units according to the static analysis result corresponding to the functional units, identify the functional unit pairs with calling relations according to the function modules included in the functional units, and finally generate the calling topology corresponding to the target distributed system according to the determined functional unit pairs, thereby realizing efficient discovery of the calling topology of the functional units in the distributed system. And then, when the management requirement of the target distributed system exists, the management can be correspondingly carried out according to the generated calling topology.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a scene schematic diagram of a topology analysis method provided in an embodiment of the present invention;
FIG. 2a is a schematic flowchart of a topology analysis method according to an embodiment of the present invention;
FIG. 2b is a schematic diagram of a topology analysis interface provided by an embodiment of the invention;
FIG. 2c is a schematic diagram of a selection sub-interface provided by an embodiment of the present invention;
FIG. 2d is a diagram illustrating the calling relationship of the internal function of the C functional unit according to the embodiment of the present invention;
FIG. 2e is a diagram of a first function block and a second function block of a C function unit according to an embodiment of the present invention;
FIG. 2f is a schematic diagram of a call topology involved in an embodiment of the present invention;
FIG. 3 is another schematic flow chart diagram of a topology analysis method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a topology analysis apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a topology analysis method, a topology analysis device and a storage medium.
For example, referring to fig. 1, the electronic device may receive an analysis request, determine a target distributed system that needs to perform topology analysis according to the analysis request, where the target distributed system includes a plurality of functional units, perform static analysis on the functional units included in the target distributed system to obtain a static analysis result, identify function modules included in the functional units according to the static analysis result corresponding to the functional units, identify pairs of functional units having a call relationship according to the function modules included in the functional units, and finally generate a call topology corresponding to the target distributed system according to the determined pairs of functional units. And then, when the management requirement of the target distributed system exists, the management can be correspondingly carried out according to the generated calling topology.
The following are detailed below. The order of the following examples is not intended to limit the preferred order of the examples.
The first embodiment,
In the present embodiment, description will be made from the perspective of a topology analysis apparatus, which may be specifically integrated in an electronic device such as a terminal or a server.
The embodiment of the invention provides a topology analysis method, which comprises the following steps: receiving an analysis request, and determining a target distributed system which needs topology analysis according to the received analysis request, wherein the target distributed system comprises a plurality of functional units; performing static analysis on functional units included in the target distributed system to obtain a static analysis result; identifying a function module included in the function unit according to a static analysis result corresponding to the function unit; identifying a functional unit pair with a calling relation according to a function module included in each functional unit; and generating a calling topology corresponding to the target distributed system according to the determined functional unit pair.
As shown in fig. 2a, the specific process of the topology analysis method may be as follows:
in 201, an analysis request is received, and a target distributed system requiring topology analysis is determined according to the analysis request, where the target distributed system includes a plurality of functional units.
Among them, the topology analysis is to analyze the topology of calls of functional units included in the distributed system. It should be noted that the target distributed system is a distributed system that includes a plurality of functional units, each deployed at a different network address. It should be understood by those skilled in the art that the functional units of the target distributed system may be deployed on a plurality of different physical servers, or may be deployed on the same physical server.
In the present invention, the topology analysis device can receive the analysis request in a variety of different ways.
For example, the topology analysis apparatus may provide a topology analysis interface to a technician through an electronic device where the topology analysis apparatus is located, where the topology analysis interface includes a request input interface, as shown in fig. 2b, the request input interface may be in the form of an input box, and the technician may enter identification information of a distributed system that needs to perform topology analysis into the request input interface in the form of the input box and input confirmation information (e.g., directly pressing an enter key of a keyboard) to input an analysis request, where the analysis request carries the identification information of the distributed system that needs to perform topology analysis. Correspondingly, when the topology analysis device determines the target distributed system to be subjected to topology analysis according to the received analysis request, the distributed system indicated by the identification information carried in the analysis request can be used as the target distributed system to be subjected to topology analysis.
For another example, the topology analysis interface shown in fig. 2B further includes an "open" control, on one hand, when the topology analysis device detects the trigger of the open control, a selection sub-interface (as shown in fig. 2C) is displayed on the topology analysis interface in an overlapping manner, and the selection sub-interface provides an icon of a distributed system capable of performing topology analysis, such as icons of distributed systems, such as distributed system a, distributed system B, distributed system C, distributed system D, distributed system E, and distributed system F, for a technician to search for and select an icon of the distributed system requiring topology analysis; on the other hand, after selecting the icon of the distributed system needing to be analyzed, the technician may trigger the confirmation control provided by the selection sub-interface to input an analysis request to the topology analysis device, where the analysis request is associated with the icon of the distributed system selected by the technician, and instruct the topology analysis device to use the distributed system selected by the technician as the target distributed system.
In addition, a person skilled in the art may set other specific implementation manners of inputting the analysis request according to actual needs, and the present invention is not limited to this specific implementation manner.
In 202, static analysis is performed on the functional units included in the target distributed system to obtain a static analysis result.
In the embodiment of the present invention, after receiving the analysis request and determining the target distributed system that needs to be subjected to topology analysis, the topology analysis device invokes the static analysis tool to perform static analysis on the functional units included in the target distributed system to obtain a static analysis result, for example, if the target distributed system includes N functional units, the topology analysis device invokes the static analysis tool to perform static analysis on the N functional units included in the target distributed system, and obtains N static analysis results through analysis. For different functional units, the topology analysis device can respectively call the static analysis tools corresponding to the functional units to perform static analysis.
As an alternative embodiment, "performing static analysis on the functional units included in the target distributed system" includes:
and performing static analysis on the source code of the functional unit included in the target distributed system.
For example, when performing static analysis on a functional unit included in a target distributed system, taking a functional unit a as an example, at this time, the topology analysis device first obtains a source code of the functional unit a, then calls a static analysis tool to perform semantic analysis on the source code of the functional unit a, that is, performs analysis on context-related properties on the source code of the functional unit a, and identifies elements such as classes, functions, and variables in the source code.
As another alternative implementation, "performing static analysis on the functional units included in the target distributed system" includes:
and statically analyzing the compiling process file of the functional unit included in the target distributed system.
The compiling process file includes, but is not limited to, a compiling script, a header file, a compiling log, and the like of the source code of the functional unit at the time of compiling.
For example, when performing static analysis on a functional unit included in a target distributed system, taking a B functional unit as an example, at this time, the topology analysis apparatus does not perform static analysis on the source code itself of the B functional unit, but performs static analysis on a compilation process file of the source code of the B functional unit. The topology analysis device firstly acquires a compiling script, a header file and a compiling log corresponding to a source code of the B function unit, then performs static analysis on the acquired compiling script, the header file and the compiling log, and analyzes a call relation among different functions of the B function unit to serve as a static analysis result.
At 203, the function modules included in the functional units are identified according to the static analysis results corresponding to the functional units.
In the embodiment of the present invention, after completing the static analysis of the functional units included in the target distributed system, the topology analysis device further identifies the functional modules included in the functional units according to the static analysis result corresponding to the functional units.
For example, taking C function unit as an example, according to the static analysis result of C function unit, the internal function call relationship can be obtained as shown in fig. 2d, where function 1 can call function 2, function 2 can call functions 3 and 4, function 3 can call function 6 and 8, function 4 can call function 5 and 8, function 5 can call function 7, and function 6 can call function 9, and based on the call relationship of the internal function of C function unit, the function in which other functions can be called and the function called by other functions are identified as the function module of C function unit.
At 204, the functional unit pairs having call relationships are identified according to the functional modules included in the functional units.
The functional unit pair with the calling relationship refers to that one functional unit remotely calls the other functional unit, or one functional unit is remotely called by the other functional unit.
In the embodiment of the present invention, after identifying and obtaining the function modules included in the function units of the target distributed system, the topology analysis apparatus further identifies the function unit pairs having a call relationship according to the function modules included in each function unit. Specifically, "identifying a functional unit pair having a call relationship according to a function module included in each functional unit" includes:
(1) identifying a first function module which realizes a remote call interface function in function modules included in each function unit, and identifying a second function module which realizes a remote call client function in the function modules included in each function unit;
(2) combining the first function module and the second function module of different function identification units in pairs to establish a function module pair;
(3) and identifying a matched target function module pair from the established function module pair, and taking the two function units corresponding to the target function module pair as the function unit pair.
When the topology analysis device identifies a function unit pair having a call relationship according to function modules included in each function unit pair, first, a function module that implements a remote call interface function among the function modules included in each function unit is identified and recorded as a first function module, and a function module that implements a remote call client function among the function modules included in each function unit is identified and recorded as a second function module.
For example, the remote invocation must be performed through a network Protocol (such as a TCP/IP Protocol, Transmission Control Protocol/Internet Protocol), and the topology analysis device may identify a first function module that implements a remote invocation interface function in the function modules included in the function units and a second function module that implements a remote invocation client function in the function modules included in the function units according to whether the function modules use a basic API of the TCP/IP Protocol.
For example, referring to fig. 2e, continuing to take C function unit as an example, where the function module 1 is identified as a first function module implementing the remote call Interface function and identified by using an Interface, and the function module 7, the function module 8, and the function module 9 are identified as a second function module implementing the remote call Client function and identified by using a Client.
After identifying the first function module and the second function module of each functional unit included in the target distributed system, the topology analysis device further combines the first function module and the second function module of different functional units in pairs to establish a function module pair.
For example, the target distributed system includes a function unit a, a function unit B, a function unit C, and a function unit D, and the topology analysis device combines the first function module of the function unit a with the second function modules of the function unit B, the function unit C, and the function unit D, respectively, to obtain 3 function module pairs; combining the first function module of the B function unit with the second function modules of the A function unit, the C function unit and the D function unit respectively to obtain 3 function module pairs; combining the first function module of the C function unit with the second function modules of the A function unit, the B function unit and the D function unit to obtain 3 function module pairs; and combining the first function module of the D function unit with the second function modules of the A function unit, the B function unit and the C function unit to obtain 3 function module pairs. Thus, a total of 12 function module pairs are established.
After the function module pair is established, the topology analysis device further identifies a target function module pair matched with the first function module and the second function module from the established function module pair, so that two functional units corresponding to the identified target function module pair are used as functional unit pairs with calling relations. Wherein. The first function module and the second function module are matched, namely that the data which can be provided by the first function module is the same as the data which needs to be called by the second function module.
For example, a function module pair is composed of a first function module of the a function unit and a second function module of the D function unit, and if the first function module of the a function unit can provide the a data and the second function module of the D function unit needs to call the a data, the topology analysis device determines that the first function module of the a function unit and the second function module of the D function unit are matched. Correspondingly, the a functional unit and the D functional unit are a functional unit pair having a call relationship, and the a functional unit is called by the D functional unit, or the D functional unit calls the a functional unit.
Specifically, the "identifying a matching target function module pair from the established function module pairs" includes:
(1) acquiring a protocol definition of a first function module in a pair of function modules;
(2) and judging whether the second function module in the function module pair has the code characteristics defined by the corresponding protocol, if so, judging that the function module pair is the target function module pair, and otherwise, judging that the function module pair is not the target function module pair.
It should be noted that the remote call of a remote call interface must conform to the protocol definition of the remote call interface, and the remote call interface can be correctly routed to the remote call interface, for example, a fixed URL is used for convention in the REST protocol, for example, in the protobuf protocol, a proto file is used for describing the protocol. Correspondingly, the code characteristics corresponding to the protocol definition of the called end must exist in the source code of the calling end of the remote call, so that the data which can be provided by the called end is ensured to be the same as the data which needs to be called by the calling end.
For example, a function module pair is composed of a first function module of the a function unit and a second function module of the D function unit, the topology analysis device firstly analyzes the first function module of the a function unit to obtain the protocol definition of the first function module of the a function unit, then, the code analyzer is used for analyzing the code characteristics of the second function module of the D function unit, and whether the second function module of the D function unit has the code characteristics defined by the protocol of the first function module corresponding to the A function unit is judged, if yes, then the function module pair consisting of the first function module of the a function unit and the second function module of the D function unit is determined as the objective function module pair, and if not, it is determined that the pair of function blocks composed of the first function block of the a function unit and the second function block of the D function unit is not the pair of objective function blocks.
In 205, a call topology corresponding to the target distributed system is generated according to the determined pair of functional units.
In the embodiment of the present invention, after identifying all the functional unit pairs having a call relationship in the functional units of the target distributed system, the topology analysis device further summarizes the call relationship of each functional unit pair according to the determined functional unit pair to generate a call topology of the functional units included in the target distributed system, where the call topology describes the call relationship between the functional units in the target distributed system.
For example, the target distributed system includes a functional unit a, a functional unit B, a functional unit C, and a functional unit D, and the generated call topology is as shown in fig. 2f, according to which the functional unit a and the functional unit B both call the functional unit C, and in addition, the functional unit B also calls the functional unit D.
Optionally, after "generating a call topology corresponding to the target distributed system according to the determined pair of functional units", the method further includes:
and if the service flow corresponding to the target distributed system is received, distributing the service flow according to the calling topology.
It should be noted that, a distributed system deployed in a distributed manner generally provides services for a large number of clients at the same time, and if the service traffic from the clients cannot be effectively distributed, the distributed system may be crashed and cannot provide services continuously.
Therefore, in the embodiment of the present invention, when receiving the service traffic corresponding to the target distributed system, the service traffic may be distributed among the functional units of the target distributed system according to the call topology corresponding to the target distributed system, for example, load balancing of the job traffic in the functional units of the target distributed system, so as to implement effective distribution of the service traffic, and enable the target distributed system to efficiently provide services to the user side.
Optionally, after "generating a call topology corresponding to the target distributed system according to the determined pair of functional units", the method further includes:
and if the abnormal functional unit in the target distributed system is detected, generating an evaluation report according to the influence range of the abnormal functional unit in the calling topology evaluation.
It should be noted that, a distributed system deployed in a distributed manner generally includes a large number of functional units, and when an exception occurs in a functional unit, the functional unit will affect other functional units, and in order to be able to remove the exception well, it is necessary to quickly evaluate the scope of the exception.
Therefore, in the embodiment of the invention, when the functional unit is detected to be abnormal, the influence range can be evaluated according to the corresponding calling topology of the target distributed system, and a corresponding evaluation report is generated for technicians to accurately eliminate the abnormality.
Optionally, after "generating a call topology corresponding to the target distributed system according to the determined pair of functional units", the method further includes:
if the changed functional unit in the target distributed system is detected, other functional units having a calling relation with the changed functional unit are identified according to the calling topology, and the other functional units are correspondingly changed.
It should be noted that, in order to better provide services to the user terminal, the functional units of the distributed system deployed in a distributed manner are usually iterated continuously, and when one functional unit is changed, if the functional units on the upstream and downstream sides (i.e., other functional units called by the changed functional unit and other functional units calling the changed functional unit) are not changed correspondingly, the distributed system cannot provide services to the user terminal normally.
Therefore, in the embodiment of the present invention, when the changed functional unit in the target distributed system is detected, other functional units called by the changed functional unit and calling the changed functional unit may be identified according to the calling topology corresponding to the target distributed system, and then the identified other functional units may be changed accordingly.
As can be seen from the above, this embodiment may receive an analysis request, determine, according to the analysis request, a target distributed system that needs to perform topology analysis, where the target distributed system includes a plurality of functional units, then perform static analysis on the functional units included in the target distributed system to obtain a static analysis result, identify, according to the static analysis result corresponding to the functional units, function modules included in the functional units, identify, according to the function modules included in the functional units, a pair of functional units having a call relationship, and finally generate, according to the determined pair of functional units, a call topology corresponding to the target distributed system, thereby implementing efficient discovery of the call topology of the functional units in the distributed system. And then, when the management requirement of the target distributed system exists, the management can be correspondingly carried out according to the generated calling topology.
Example II,
The method according to the preceding embodiment is illustrated in further detail below by way of example.
In this embodiment, the topology analysis apparatus will be described by taking an example in which the topology analysis apparatus is specifically integrated in an electronic device.
As shown in fig. 3, the specific process of the topology analysis method may be as follows:
in 301, the electronic device receives an analysis request, and determines a target distributed system that needs to perform topology analysis according to the analysis request, where the target distributed system includes a plurality of functional units.
Among them, the topology analysis is to analyze the topology of calls of functional units included in the distributed system. It should be noted that the target distributed system is a distributed system that includes a plurality of functional units, each deployed at a different network address. It should be understood by those skilled in the art that the functional units of the target distributed system may be deployed on a plurality of different physical servers, or may be deployed on the same physical server.
In the present invention, the electronic device may receive the analysis request in a number of different ways.
For example, the electronic device may provide a topology analysis interface to the technician, where the topology analysis interface includes a request input interface, as shown in fig. 2b, the request input interface may be in the form of an input box, and the technician may enter identification information of the distributed system that needs to perform topology analysis in the request input interface in the form of the input box and input confirmation information (e.g., directly pressing an enter key of a keyboard) to input an analysis request, where the analysis request carries the identification information of the distributed system that needs to perform topology analysis. Correspondingly, when the electronic device determines the target distributed system to be subjected to topology analysis according to the received analysis request, the distributed system indicated by the identification information carried in the analysis request can be used as the target distributed system to be subjected to topology analysis.
For another example, the topology analysis interface shown in fig. 2B further includes an "open" control, on one hand, when the electronic device detects that the open control is triggered, a selection sub-interface (as shown in fig. 2C) is displayed on the topology analysis interface in an overlapping manner, and the selection sub-interface provides an icon of a distributed system capable of performing topology analysis, such as icons of distributed systems, such as distributed system a, distributed system B, distributed system C, distributed system D, distributed system E, and distributed system F, for a technician to search for and select an icon of the distributed system requiring topology analysis; on the other hand, after selecting the icon of the distributed system needing to be analyzed, the technician may trigger the confirmation control provided by the selection sub-interface to input an analysis request to the electronic device, where the analysis request is associated with the icon of the distributed system selected by the technician, and instruct the electronic device to use the distributed system selected by the technician as the target distributed system.
In addition, a person skilled in the art may set other specific implementation manners of inputting the analysis request according to actual needs, and the present invention is not limited to this specific implementation manner.
In 302, the electronic device performs static analysis on the source code of the functional unit included in the target distributed system to obtain a static analysis result.
In the embodiment of the present invention, after receiving the analysis request and determining the target distributed system that needs to perform topology analysis, the electronic device invokes the static analysis tool to perform static analysis on the functional units included in the target distributed system to obtain a static analysis result, for example, if the target distributed system includes N functional units, the electronic device invokes the static analysis tool to perform static analysis on the N functional units included in the target distributed system, and then obtains N static analysis results through analysis. For different functional units, the electronic device can respectively call the static analysis tools corresponding to the functional units to perform static analysis.
For example, when performing static analysis on a functional unit included in a target distributed system, taking a functional unit a as an example, at this time, the electronic device first acquires a source code of the functional unit a, then invokes a static analysis tool to perform semantic analysis on the source code of the functional unit a, that is, performs analysis on context-related properties on the source code of the functional unit a, and identifies elements such as classes, functions, and variables in the source code of the functional unit a.
In 303, the electronic device identifies a function module included in the function unit according to the static analysis result corresponding to the function unit.
In the embodiment of the invention, after the electronic device completes the static analysis of the functional units included in the target distributed system, the function modules included in the functional units are further identified according to the static analysis results corresponding to the functional units.
For example, taking C function unit as an example, according to the static analysis result of C function unit, the internal function call relationship can be obtained as shown in fig. 2d, where function 1 can call function 2, function 2 can call functions 3 and 4, function 3 can call function 6 and 8, function 4 can call function 5 and 8, function 5 can call function 7, and function 6 can call function 9, and based on the call relationship of the internal function of C function unit, the function in which other functions can be called and the function called by other functions are identified as the function module of C function unit.
In 304, the electronic device identifies a first function module, which implements the remote call interface function, among the function modules included in each function unit, and identifies a second function module, which implements the remote call client function, among the function modules included in each function unit.
The electronic equipment identifies a function module for realizing the remote call interface function in the function modules included in the function units and records the function module as a first function module, and identifies a function module for realizing the remote call client function in the function modules included in the function units and records the function module as a second function module.
For example, the remote invocation must be performed through a network Protocol (such as a TCP/IP Protocol, Transmission Control Protocol/Internet Protocol), and the electronic device may find that the remote invocation occurs according to whether the function module uses a basic API of the TCP/IP Protocol, so as to identify a first function module that implements a remote invocation interface function in the function modules included in the function units, and identify a second function module that implements a remote invocation client function in the function modules included in the function units.
For example, referring to fig. 2e, continuing to take C function unit as an example, where the function module 1 is identified as a first function module implementing the remote call Interface function and identified by using an Interface, and the function module 7, the function module 8, and the function module 9 are identified as a second function module implementing the remote call Client function and identified by using a Client.
In 305, the electronic device combines the first function module and the second function module of different function identification units two by two to establish a function module pair.
For example, the target distributed system includes a function unit a, a function unit B, a function unit C, and a function unit D, and the electronic device combines the first function module of the function unit a with the second function modules of the function unit B, the function unit C, and the function unit D, respectively, to obtain 3 function module pairs; combining the first function module of the B function unit with the second function modules of the A function unit, the C function unit and the D function unit respectively to obtain 3 function module pairs; combining the first function module of the C function unit with the second function modules of the A function unit, the B function unit and the D function unit to obtain 3 function module pairs; and combining the first function module of the D function unit with the second function modules of the A function unit, the B function unit and the C function unit to obtain 3 function module pairs. Thus, a total of 12 function module pairs are established.
In 306, the electronic device takes the function module pair having the code feature corresponding to the protocol definition of the first function module as the target function module pair in the second function module, and takes the two function units corresponding to the target function module pair as the function unit pair having the call relation.
After the electronic device establishes the function module pair, a target function module pair matched with the first function module and the second function module is further identified from the established function module pair, so that two function units corresponding to the identified target function module pair are used as a function unit pair with a calling relation. Wherein. The first function module and the second function module are matched, namely that the data which can be provided by the first function module is the same as the data which needs to be called by the second function module.
It should be noted that the remote call of a remote call interface must conform to the protocol definition of the remote call interface, and the remote call interface can be correctly routed to the remote call interface, for example, a fixed URL is used for convention in the REST protocol, for example, in the protobuf protocol, a proto file is used for describing the protocol. Correspondingly, the code characteristics corresponding to the protocol definition of the called end must exist in the source code of the calling end of the remote call, so that the data which can be provided by the called end is ensured to be the same as the data which needs to be called by the calling end.
For example, a function module pair is composed of a first function module of the a function unit and a second function module of the D function unit, the electronic device first analyzes the first function module of the a function unit to obtain the protocol definition of the first function module of the a function unit, then, the code analyzer is used for analyzing the code characteristics of the second function module of the D function unit, and whether the second function module of the D function unit has the code characteristics defined by the protocol of the first function module corresponding to the A function unit is judged, if yes, then the function module pair consisting of the first function module of the a function unit and the second function module of the D function unit is determined as the objective function module pair, and if not, it is determined that the pair of function blocks composed of the first function block of the a function unit and the second function block of the D function unit is not the pair of objective function blocks.
At 307, the electronic device generates a call topology corresponding to the target distributed system according to the determined pair of functional units.
In the embodiment of the invention, after identifying all the functional unit pairs with calling relations in the functional units of the target distributed system, the electronic device further integrates the calling relations of all the functional unit pairs according to the determined functional unit pairs to generate the calling topology of the functional units included in the target distributed system, wherein the calling topology describes the calling relations among the functional units in the target distributed system.
For example, the target distributed system includes a functional unit a, a functional unit B, a functional unit C, and a functional unit D, and the generated call topology is as shown in fig. 2f, according to which the functional unit a and the functional unit B both call the functional unit C, and in addition, the functional unit B also calls the functional unit D.
At 308, if a management requirement for the target distributed system is detected, the electronic device manages the target distributed system according to the calling topology of the target distributed system.
For example, the electronic device may determine that a management requirement for the target distributed system exists when detecting a service traffic corresponding to the target distributed system, and distribute the service traffic among the functional units of the target distributed system according to the call topology, so as to implement management of the target distributed system,
For another example, the electronic device may determine that a management requirement for the target distributed system exists when detecting that the functional unit in the target distributed system is abnormal, and generate an evaluation report according to an influence range of the functional unit with the abnormal topology evaluation, thereby implementing management of the target distributed system.
For another example, when detecting that a functional unit in the target distributed system is changed, the electronic device may determine that a management requirement for the target distributed system exists, identify, according to the call topology, another functional unit having a call relationship with the changed functional unit, and correspondingly change the other functional unit, thereby implementing management of the target distributed system.
Example III,
In order to better implement the above method, an embodiment of the present invention further provides a topology analysis apparatus, which may be specifically integrated in an electronic device, such as a terminal or a server, for example, a mobile phone, a tablet computer, a notebook computer, or a PC.
For example, as shown in fig. 4, the topology analysis apparatus can include a request receiving component 401, a static analysis component 402, a module identification component 403, a relationship identification component 404, and a topology analysis component 405 as follows:
(1) a request receiving component 401;
the request receiving component 401 is configured to receive an analysis request, and determine a target distributed system that needs to perform topology analysis according to the analysis request, where the target distributed system includes a plurality of functional units.
Among them, the topology analysis is to analyze the topology of calls of functional units included in the distributed system. It should be noted that the target distributed system is a distributed system that includes a plurality of functional units, each deployed at a different network address. It should be understood by those skilled in the art that the functional units of the target distributed system may be deployed on a plurality of different physical servers, or may be deployed on the same physical server.
In the present invention, the request receiving component 401 may receive the analysis request in a number of different ways.
For example, the request receiving component 401 may provide, to the technician through the electronic device where the request receiving component is located, a topology analysis interface that includes a request input interface, as shown in fig. 2b, where the request input interface may be in the form of an input box, and the technician may enter identification information of a distributed system that needs to be subjected to topology analysis into the request input interface in the form of the input box and input confirmation information (e.g., directly pressing an enter key of a keyboard) to input an analysis request, where the analysis request carries the identification information of the distributed system that needs to be subjected to topology analysis. Correspondingly, when determining the target distributed system that needs to be subjected to topology analysis according to the received analysis request, the request receiving component 401 may use the distributed system indicated by the identification information carried in the analysis request as the target distributed system that needs to be subjected to topology analysis.
For another example, in the topology analysis interface shown in fig. 2B, an "open" control is further included, on one hand, when the request receiving component 401 detects that the open control is triggered, a selection sub-interface (as shown in fig. 2C) is superimposed and displayed on the topology analysis interface, and the selection sub-interface provides an icon of a distributed system capable of performing topology analysis, such as icons of distributed systems, e.g., distributed system a, distributed system B, distributed system C, distributed system D, distributed system E, and distributed system F, for a technician to search for and select an icon of the distributed system that needs to perform topology analysis; on the other hand, after selecting the icon of the distributed system that needs to be analyzed, the technician can trigger a confirmation control provided by the selection sub-interface to input an analysis request to the request receiving component 401, the analysis request being associated with the icon of the distributed system selected by the technician, instructing the request receiving component 401 to treat the distributed system selected by the technician as the target distributed system.
In addition, a person skilled in the art may set other specific implementation manners of inputting the analysis request according to actual needs, and the present invention is not limited to this specific implementation manner.
(2) A static analysis component 402;
and the static analysis component 402 is configured to perform static analysis on the functional units included in the target distributed system to obtain a static analysis result.
In the embodiment of the present invention, after receiving the analysis request and determining the target distributed system that needs to perform topology analysis, the static analysis component 402 invokes a static analysis tool to perform static analysis on the functional units included in the target distributed system to obtain a static analysis result, for example, if the target distributed system includes N functional units, the static analysis component 402 invokes the static analysis tool to perform static analysis on the N functional units included in the target distributed system, and obtains N static analysis results through analysis. Wherein, for different functional units, the static analysis component 402 can respectively call the static analysis tool for each functional unit to perform static analysis.
As an alternative embodiment, in performing static analysis on the functional units included in the target distributed system, the static analysis component 402 may be configured to:
and performing static analysis on the source code of the functional unit included in the target distributed system.
For example, when performing static analysis on a functional unit included in a target distributed system, taking a functional unit a as an example, at this time, the static analysis component 402 first obtains a source code of the functional unit a, then calls a static analysis tool to perform semantic analysis on the source code of the functional unit a, that is, performs analysis on context-related properties on the source code of the functional unit a, and identifies elements such as classes, functions, and variables in the source code, in addition, the static analysis component 402 also compiles the source code of the functional unit a by using a compiler to obtain an output in a compiling process, and further analyzes a call relationship between different functions in the functional unit a as a static analysis result in combination with a previous identification result of elements such as classes, functions, and variables in the source code of the functional unit a.
As another optional implementation, in performing static analysis on the functional units included in the target distributed system, the static analysis component 402 may further be configured to:
and statically analyzing the compiling process file of the functional unit included in the target distributed system.
The compiling process file includes, but is not limited to, a compiling script, a header file, a compiling log, and the like of the source code of the functional unit at the time of compiling.
For example, when performing static analysis on a functional unit included in a target distributed system, taking B functional unit as an example, at this time, the static analysis component 402 does not perform static analysis on the source code itself of the B functional unit, but performs static analysis on the compilation process file of the source code of the B functional unit. The static analysis component 402 first obtains the compilation script, the header file, and the compilation log corresponding to the source code of the B function unit, then performs static analysis on the obtained compilation script, the header file, and the compilation log, and analyzes a call relationship between different functions of the B function unit as a static analysis result.
(3) A module identification component 403;
and a module identification component 403, configured to identify a function module included in the functional unit according to the static analysis result corresponding to the functional unit.
In this embodiment of the present invention, after the static analysis component 402 completes the static analysis on the functional units included in the target distributed system, the module identification component 403 further identifies the function modules included in the functional units according to the static analysis result corresponding to the functional units.
For example, taking C function unit as an example, according to the static analysis result of C function unit, the internal function call relationship can be obtained as shown in fig. 2d, where function 1 can call function 2, function 2 can call functions 3 and 4, function 3 can call function 6 and 8, function 4 can call function 5 and 8, function 5 can call function 7, and function 6 can call function 9, and based on the call relationship of the internal function of C function unit, the function in which other functions can be called and the function called by other functions are identified as the function module of C function unit.
(4) A relationship identification component 404;
the relationship identifying component 404 is configured to identify a functional unit pair having a calling relationship according to a function module included in each functional unit.
The functional unit pair with the calling relationship refers to that one functional unit remotely calls the other functional unit, or one functional unit is remotely called by the other functional unit.
In this embodiment of the present invention, after the module identification component 403 identifies and obtains the function modules included in the function units of the target distributed system, the relationship identification component 404 further identifies the function unit pairs having a call relationship according to the function modules included in each function unit. Specifically, when identifying a functional unit pair having a call relationship according to a function module included in each functional unit, the relationship identifying component 404 may be configured to:
identifying a first function module which realizes a remote call interface function in function modules included in each function unit, and identifying a second function module which realizes a remote call client function in the function modules included in each function unit;
combining the first function module and the second function module of different function identification units in pairs to establish a function module pair;
and identifying a matched target function module pair from the established function module pair, and taking the two function units corresponding to the target function module pair as the function unit pair.
When identifying a function unit pair having a call relationship according to the function modules included in each function unit pair, the relationship identification component 404 first identifies a function module that implements a remote call interface function among the function modules included in each function unit, and records the function module as a first function module, and identifies a function module that implements a remote call client function among the function modules included in each function unit, and records the function module as a second function module.
For example, the remote call must be performed through a network Protocol (such as a TCP/IP Protocol, Transmission Control Protocol/Internet Protocol), and the relationship identifying component 404 may identify a first function module that implements a remote call interface function in function modules included in each functional unit and a second function module that implements a remote call client function in function modules included in each functional unit according to whether the function module uses a basic API of the TCP/IP Protocol.
For example, referring to fig. 2e, continuing to take C function unit as an example, where the function module 1 is identified as a first function module implementing the remote call Interface function and identified by using an Interface, and the function module 7, the function module 8, and the function module 9 are identified as a second function module implementing the remote call Client function and identified by using a Client.
After identifying the first function module and the second function module of each functional unit included in the target distributed system, the relationship identification component 404 further combines the first function module and the second function module of different functional units two by two to establish a function module pair.
For example, the target distributed system includes a function unit a, a function unit B, a function unit C, and a function unit D, and the relationship identification component 404 combines the first function module of the function unit a with the second function modules of the function unit B, the function unit C, and the function unit D, respectively, to obtain 3 function module pairs; combining the first function module of the B function unit with the second function modules of the A function unit, the C function unit and the D function unit respectively to obtain 3 function module pairs; combining the first function module of the C function unit with the second function modules of the A function unit, the B function unit and the D function unit to obtain 3 function module pairs; and combining the first function module of the D function unit with the second function modules of the A function unit, the B function unit and the C function unit to obtain 3 function module pairs. Thus, a total of 12 function module pairs are established.
After the function module pair is established, the relationship identifying component 404 further identifies a target function module pair in which the first function module and the second function module are matched from the established function module pair, so as to take two function units corresponding to the identified target function module pair as a function unit pair having a call relationship. Wherein. The first function module and the second function module are matched, namely that the data which can be provided by the first function module is the same as the data which needs to be called by the second function module.
For example, a function module pair is composed of a first function module of the a function unit and a second function module of the D function unit, and if the first function module of the a function unit can provide the a data and the second function module of the D function unit needs to call the a data, the relationship identifying component 404 determines that the first function module of the a function unit and the second function module of the D function unit are matched. Correspondingly, the a functional unit and the D functional unit are a functional unit pair having a call relationship, and the a functional unit is called by the D functional unit, or the D functional unit calls the a functional unit.
In particular, upon identifying a matching pair of objective function modules from the established pair of function modules, relationship identification component 404 can be configured to:
acquiring a protocol definition of a first function module in a pair of function modules;
and judging whether the second function module in the function module pair has the code characteristics defined by the corresponding protocol, if so, judging that the function module pair is the target function module pair, and otherwise, judging that the function module pair is not the target function module pair.
It should be noted that the remote call of a remote call interface must conform to the protocol definition of the remote call interface, and the remote call interface can be correctly routed to the remote call interface, for example, a fixed URL is used for convention in the REST protocol, for example, in the protobuf protocol, a proto file is used for describing the protocol. Correspondingly, the code characteristics corresponding to the protocol definition of the called end must exist in the source code of the calling end of the remote call, so that the data which can be provided by the called end is ensured to be the same as the data which needs to be called by the calling end.
For example, a function module pair is composed of a first function module of the a function unit and a second function module of the D function unit, the relationship identification component 404 first analyzes the first function module of the a function unit to obtain the protocol definition of the first function module of the a function unit, then, the code analyzer is used for analyzing the code characteristics of the second function module of the D function unit, and whether the second function module of the D function unit has the code characteristics defined by the protocol of the first function module corresponding to the A function unit is judged, if yes, then the function module pair consisting of the first function module of the a function unit and the second function module of the D function unit is determined as the objective function module pair, and if not, it is determined that the pair of function blocks composed of the first function block of the a function unit and the second function block of the D function unit is not the pair of objective function blocks.
(5) A topology analysis component 405;
and the topology analysis component 405 is configured to generate a call topology corresponding to the target distributed system according to the determined functional unit pair.
In this embodiment of the present invention, after the relationship identification component 404 identifies all the functional unit pairs having a call relationship in the functional units of the target distributed system, the topology analysis component 405 further summarizes the call relationship of each functional unit pair according to the determined functional unit pair to generate a call topology of the functional units included in the target distributed system, where the call topology describes the call relationship between the functional units in the target distributed system.
For example, the target distributed system includes a functional unit a, a functional unit B, a functional unit C, and a functional unit D, and the generated call topology is as shown in fig. 2f, according to which the functional unit a and the functional unit B both call the functional unit C, and in addition, the functional unit B also calls the functional unit D.
Optionally, the topology analysis apparatus further includes a distributed system management module, after the topology analysis component 405 generates a call topology corresponding to the target distributed system according to the determined functional unit pair, configured to:
if receiving the service flow corresponding to the target distributed system, distributing the service flow according to the calling topology; alternatively, the first and second electrodes may be,
if the abnormal functional unit in the target distributed system is detected, generating an evaluation report according to the influence range of the abnormal functional unit in the calling topology evaluation; alternatively, the first and second electrodes may be,
if the changed functional unit in the target distributed system is detected, other functional units having a calling relation with the changed functional unit are identified according to the calling topology, and the other functional units are correspondingly changed.
It should be noted that, a distributed system deployed in a distributed manner generally provides services for a large number of clients at the same time, and if the service traffic from the clients cannot be effectively distributed, the distributed system may be crashed and cannot provide services continuously.
Therefore, in the embodiment of the present invention, when receiving the service traffic corresponding to the target distributed system, the distributed system management module may distribute the service traffic among the functional units of the target distributed system according to the call topology corresponding to the target distributed system, for example, load balancing of the job service traffic in the functional units of the target distributed system, so as to implement effective distribution of the service traffic, and enable the target distributed system to efficiently provide services to the user side.
It should be noted that, a distributed system deployed in a distributed manner generally includes a large number of functional units, and when an exception occurs in a functional unit, the functional unit will affect other functional units, and in order to be able to remove the exception well, it is necessary to quickly evaluate the scope of the exception.
Therefore, in the embodiment of the present invention, when detecting that an abnormality occurs in a functional unit, the distributed system management module may estimate the influence range of the target distributed system according to the corresponding call topology of the target distributed system, and generate a corresponding estimation report for a technician to accurately eliminate the abnormality.
It should be noted that, in order to better provide services to the user terminal, the functional units of the distributed system deployed in a distributed manner are usually iterated continuously, and when one functional unit is changed, if the functional units on the upstream and downstream sides (i.e., other functional units called by the changed functional unit and other functional units calling the changed functional unit) are not changed correspondingly, the distributed system cannot provide services to the user terminal normally.
Therefore, in the embodiment of the present invention, when detecting the changed functional unit in the target distributed system, the distributed system management module may identify, according to the call topology corresponding to the target distributed system, other functional units called by the changed functional unit and calling the changed functional unit, and then change the identified other functional units accordingly.
It should be noted that, in a specific implementation, each of the above components may be implemented as an independent entity, or may be optionally combined to be implemented as one or several entities, and the specific implementation of each of the above components may refer to the foregoing method embodiment, which is not described herein again.
As can be seen from the above, the request receiving component 401 of the topology analysis apparatus of the present embodiment can receive the analysis request, and determine the target distributed system that needs to perform the topology analysis according to the analysis request, the target distributed system comprises a plurality of functional units, and then the static analysis component 402 performs static analysis on the functional units comprised by the target distributed system to obtain a static analysis result, and the module identification component 403 identifies the function modules included in the function units according to the static analysis results corresponding to the function units, the relationship identification component 404 identifies the function unit pairs having call relationships according to the function modules included in the function units, and finally the topology analysis component 405 generates the call topology corresponding to the target distributed system according to the determined function unit pairs, thereby realizing efficient discovery of the call topology of the function units in the distributed system. And then, when the management requirement of the target distributed system exists, the management can be correspondingly carried out according to the generated calling topology.
Example four,
The embodiment of the invention also provides the electronic equipment which can be equipment such as a server or a terminal. As shown in fig. 5, a schematic structural diagram of an electronic device according to an embodiment of the present invention is shown, specifically:
the electronic device may include components such as a processor 501 of one or more processing cores, memory 502 of one or more computer-readable storage media, a power supply 503, and an input unit 504. Those of ordinary skill in the art will appreciate that the electronic device configuration shown in fig. 5 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 501 is a control center of the electronic device, connects various parts of the whole electronic device by using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 502 and calling data stored in the memory 502, thereby performing overall monitoring of the electronic device. Optionally, processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 501.
The memory 502 may be used to store software programs and modules, and the processor 501 executes various functional applications and data processing by operating the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.
The electronic device further comprises a power supply 503 for supplying power to each component, and preferably, the power supply 503 may be logically connected to the processor 501 through a power management system, so that functions of managing charging, discharging, power consumption, and the like are realized through the power management system. The power supply 503 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The electronic device may also include an input unit 504, where the input unit 504 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the electronic device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 501 in the electronic device loads the executable file corresponding to the process of one or more application programs into the memory 502 according to the following instructions, and the processor 501 runs the application program stored in the memory 502, so as to implement various functions as follows:
receiving an analysis request, and determining a target distributed system which needs topology analysis according to the received analysis request, wherein the target distributed system comprises a plurality of functional units; performing static analysis on functional units included in the target distributed system to obtain a static analysis result; identifying a function module included in the function unit according to a static analysis result corresponding to the function unit; identifying a functional unit pair with a calling relation according to a function module included in each functional unit; and generating a calling topology corresponding to the target distributed system according to the determined functional unit pair.
It should be noted that the electronic device provided in the embodiment of the present application and the topology analysis method in the foregoing embodiment belong to the same concept, and any method provided in the embodiment of the topology analysis method may be run on the electronic device, and a specific implementation process of the method is described in the foregoing embodiment of the method, and is not described herein again.
Example V,
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the present invention provides a storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the topology analysis methods provided by the embodiments of the present invention. For example, the instructions may perform the steps of:
receiving an analysis request, and determining a target distributed system which needs topology analysis according to the received analysis request, wherein the target distributed system comprises a plurality of functional units; performing static analysis on functional units included in the target distributed system to obtain a static analysis result; identifying a function module included in the function unit according to a static analysis result corresponding to the function unit; identifying a functional unit pair with a calling relation according to a function module included in each functional unit; and generating a calling topology corresponding to the target distributed system according to the determined functional unit pair.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the storage medium can execute the steps in any topology analysis method provided in the embodiment of the present invention, the beneficial effects that can be achieved by any topology analysis method provided in the embodiment of the present invention can be achieved, which are detailed in the foregoing embodiments and will not be described herein again.
The topology analysis method, the topology analysis device, and the storage medium provided by the embodiments of the present invention are described in detail above, and the principles and embodiments of the present invention are explained in this document by applying specific examples, and the description of the above embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A topology analysis method, comprising:
receiving an analysis request, and determining a target distributed system which needs topology analysis according to the analysis request, wherein the target distributed system comprises a plurality of functional units;
performing static analysis on the functional unit to obtain a static analysis result, wherein the static analysis result comprises a calling relationship among different function modules in the functional unit;
identifying a function module included in the function unit according to a static analysis result corresponding to the function unit;
identifying a functional unit pair with a call relation according to a function module included in each functional unit, wherein the functional unit pair with the call relation refers to that one functional unit in the functional unit pair remotely calls another functional unit or that one functional unit is remotely called by another functional unit;
and generating a calling topology corresponding to the target distributed system according to the determined functional unit pair, wherein the calling topology describes the calling relationship among the functional units in the target distributed system.
2. The topology analysis method according to claim 1, wherein the identifying a functional unit pair having a call relationship according to a function module included in each of the functional units includes:
identifying a first function module which realizes a remote call interface function in function modules included in each function unit, and identifying a second function module which realizes a remote call client function in the function modules included in each function unit;
combining the first function module and the second function module of different function identification units in pairs to establish a function module pair;
and identifying a target function module pair matched with the first function module and the second function module from the established function module pair, and taking two function units corresponding to the target function module pair as the function unit pair.
3. The topology analysis method of claim 2, wherein the identifying a matching pair of objective function modules from the established pair of function modules comprises:
acquiring a protocol definition of a first function module in the function module pair;
and judging whether the second function module in the function module pair has the code characteristics corresponding to the protocol definition, if so, judging that the function module pair is the target function module pair, otherwise, judging that the function module pair is not the target function module pair.
4. A topology analysis method according to any of claims 1-3, characterized in that performing a static analysis of said functional unit comprises:
and performing static analysis on the source code of the functional unit.
5. A topology analysis method according to any of claims 1-3, characterized in that performing a static analysis of said functional unit comprises:
and performing static analysis on the compiling process file of the functional unit.
6. The topology analysis method according to any one of claims 1 to 3, further comprising, after generating the call topology corresponding to the target distributed system according to the determined pair of functional units:
and if the service flow corresponding to the target distributed system is received, distributing the service flow according to the calling topology.
7. The topology analysis method according to any one of claims 1 to 3, further comprising, after generating the call topology corresponding to the target distributed system according to the determined pair of functional units:
and if the abnormal functional unit in the target distributed system is detected, evaluating the influence range of the abnormal functional unit according to the calling topology, and generating an evaluation report.
8. The topology analysis method according to any one of claims 1 to 3, further comprising, after generating the call topology corresponding to the target distributed system according to the determined pair of functional units:
if the changed functional unit in the target distributed system is detected, identifying other functional units having a calling relationship with the changed functional unit according to the calling topology, and correspondingly changing the other functional units.
9. A topology analysis apparatus, comprising:
the request receiving component is used for receiving an analysis request and determining a target distributed system which needs topology analysis according to the analysis request, and the target distributed system comprises a plurality of functional units;
the static analysis component is used for carrying out static analysis on the functional unit to obtain a static analysis result, and the static analysis result comprises a calling relationship among different function modules in the functional unit;
the module identification component is used for identifying the function module included in the functional unit according to the static analysis result corresponding to the functional unit;
the relationship identification component is used for identifying a functional unit pair with a call relationship according to a function module included in each functional unit, wherein the functional unit pair with the call relationship refers to that one functional unit in the functional unit pair remotely calls another functional unit or that one functional unit is remotely called by another functional unit;
and the topology analysis component is used for generating a calling topology corresponding to the target distributed system according to the determined functional unit pair, and the calling topology describes a calling relation among all functional units in the target distributed system.
10. A storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps of the topology analysis method according to any of claims 1 to 8.
CN201910423761.0A 2019-05-21 2019-05-21 Topology analysis method and device and storage medium Active CN110417574B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910423761.0A CN110417574B (en) 2019-05-21 2019-05-21 Topology analysis method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910423761.0A CN110417574B (en) 2019-05-21 2019-05-21 Topology analysis method and device and storage medium

Publications (2)

Publication Number Publication Date
CN110417574A CN110417574A (en) 2019-11-05
CN110417574B true CN110417574B (en) 2022-01-07

Family

ID=68357797

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910423761.0A Active CN110417574B (en) 2019-05-21 2019-05-21 Topology analysis method and device and storage medium

Country Status (1)

Country Link
CN (1) CN110417574B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117453280B (en) * 2023-09-12 2024-05-14 湖南长银五八消费金融股份有限公司 Code topology and service topology generation method, device, equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106657192A (en) * 2015-11-03 2017-05-10 阿里巴巴集团控股有限公司 Method used for presenting service calling information and equipment thereof
CN108322351A (en) * 2018-03-05 2018-07-24 北京奇艺世纪科技有限公司 Generate method and apparatus, fault determination method and the device of topological diagram
CN108763059A (en) * 2018-04-24 2018-11-06 阿里巴巴集团控股有限公司 A kind of method for detecting abnormality, device and equipment
CN108874470A (en) * 2017-05-11 2018-11-23 腾讯科技(深圳)有限公司 A kind of information processing method and server, computer storage medium
CN109189833A (en) * 2018-08-28 2019-01-11 中国银联股份有限公司 A kind of method for digging and device of knowledge base
CN109634580A (en) * 2018-10-31 2019-04-16 平安科技(深圳)有限公司 Monitoring method, device, terminal and computer readable storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000112759A (en) * 1998-09-30 2000-04-21 Hitachi Software Eng Co Ltd Static analyzing method and optimizing method of program in distributed object environment
US8516443B2 (en) * 2011-05-26 2013-08-20 Oracle International Corporation Context-sensitive analysis framework using value flows
KR102105690B1 (en) * 2016-04-27 2020-04-28 한국전자통신연구원 Network Computing Testbed System Based on Open Source Virtualized Cloud Environment
US10599551B2 (en) * 2016-08-12 2020-03-24 The University Of Chicago Automatically detecting distributed concurrency errors in cloud systems
CN109344612A (en) * 2018-09-25 2019-02-15 郑州昂视信息科技有限公司 The active defense method and system inversely attacked for program code static analysis

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106657192A (en) * 2015-11-03 2017-05-10 阿里巴巴集团控股有限公司 Method used for presenting service calling information and equipment thereof
CN108874470A (en) * 2017-05-11 2018-11-23 腾讯科技(深圳)有限公司 A kind of information processing method and server, computer storage medium
CN108322351A (en) * 2018-03-05 2018-07-24 北京奇艺世纪科技有限公司 Generate method and apparatus, fault determination method and the device of topological diagram
CN108763059A (en) * 2018-04-24 2018-11-06 阿里巴巴集团控股有限公司 A kind of method for detecting abnormality, device and equipment
CN109189833A (en) * 2018-08-28 2019-01-11 中国银联股份有限公司 A kind of method for digging and device of knowledge base
CN109634580A (en) * 2018-10-31 2019-04-16 平安科技(深圳)有限公司 Monitoring method, device, terminal and computer readable storage medium

Also Published As

Publication number Publication date
CN110417574A (en) 2019-11-05

Similar Documents

Publication Publication Date Title
CN107294808A (en) The methods, devices and systems of interface testing
CN108256118B (en) Data processing method, device, system, computing equipment and storage medium
KR20120120220A (en) Cloud computing monitoring and management system
CN110765024A (en) Simulation test method, simulation test device, electronic equipment and computer-readable storage medium
CN109618176B (en) Processing method, equipment and storage medium for live broadcast service
CN104156246B (en) The method and device of gray scale upgrading
US10084637B2 (en) Automatic task tracking
US9276819B2 (en) Network traffic monitoring
CN107203464B (en) Method and device for positioning service problem
CN113792341B (en) Automatic detection method, device, equipment and medium for privacy compliance of application program
CN111666217A (en) Method and apparatus for testing code
US9866466B2 (en) Simulating real user issues in support environments
CN112769943A (en) Service processing method and device
CN110417574B (en) Topology analysis method and device and storage medium
US11726893B2 (en) System for automatically evaluating a change in a large population of processing jobs
US10191844B2 (en) Automatic garbage collection thrashing monitoring
CN106992893A (en) The management method and device of router
CN114143000A (en) Secret trace query method and device based on careless transmission protocol and secret sharing
CN106484601B (en) User data analysis method and system for client
CN109274533B (en) Web service fault positioning device and method based on rule engine
CN109587349B (en) Multimedia agent line testing method and device, electronic equipment and storage medium
KR20170122874A (en) Apparatus for managing log of application based on data distribution service
CN115052041A (en) Channel identification distribution method, device, equipment and storage medium
CN115242422A (en) Data intercommunication processing method and device and information management system
CN113778780A (en) Application stability determination method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant