Calling relation generation method, computing device and computer storage medium
By mounting components in the kernel space of the first node in the distributed system, intercepting access requests and creating call relationships, the difficulty in generating call relationships caused by frequent code upgrades in distributed systems is solved, and the effect of generating call relationships without modifying the code is achieved.
Patent Information
- Application Number
- CN202311056828.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-21
- Publication Date
- 2025-02-28
AI Technical Summary
In distributed systems, due to frequent upgrades to source service code and programming language library, developers need to spend a lot of time inserting request link generation code into each new version of code so that nodes can generate call relationships.
By mounting the first component in the kernel space of the first node, access requests from the second node are intercepted, and calling relationships are created, storing the call relationship associated with the request identification, without modifying the programming language library or source service code.
It realizes that in the distributed system, the generation and storage of call relationships are generated and stored without changing the node's programming language library or source service code, thereby simplifying the development process and improving efficiency.
Smart Images

Figure CN119536960A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a call relationship generation method, a computing device, and a computer storage medium. Background Art
[0002] A distributed system is a system composed of multiple nodes that communicate and coordinate through a network to jointly complete some tasks or provide some services. In a distributed system, each node can run in parallel and cooperate with each other to achieve the goals of the system.
[0003] In a distributed system, the processing of an access task usually requires multiple nodes in the distributed system to call each other to complete. In this case, when a node in the distributed system encounters a performance bottleneck or fails, the nodes with which it has a call relationship may also fail or behave abnormally. Therefore, it is necessary to generate a request link for the task processing request. The request link can be used to represent the call relationship between nodes, so that when a node fails, the generated request link can be used to locate the fault.
[0004] In the related art, an invasive method is usually used to achieve the generation of request links. Specifically, developers insert the code generated by the request link into the programming language library or source service code of the node, so that the node has the ability to generate call relationships.
[0005] In the process of implementing the concept of the present invention, the inventors found that since the source service code and programming language library in the distributed system are upgraded very quickly, developers must spend a lot of time inserting code into each new version of the programming language library or source service code so that the nodes can also generate calling relationships between nodes in the new version of the programming language library or source service code. Summary of the invention
[0006] The embodiments of the present invention provide a method, an apparatus, a computing device and a computer storage medium for generating a call relationship.
[0007] In a first aspect, an embodiment of the present invention provides a method for generating a call relationship, which is applied to a first component, wherein the first component runs in a kernel space of a first node; the method comprises:
[0008] Detecting a first access request sent from a second node to a kernel space, wherein the first access request includes a request identifier;
[0009] Determining a third node to be called to process the first access request;
[0010] Creating a first calling relationship, where the first calling relationship is used to represent that the first node calls the third node;
[0011] The first calling relationship is associated with the request identifier and stored.
[0012] In a second aspect, an embodiment of the present invention provides a call relationship generation device, which is applied to a first component, wherein the first component runs in a kernel space of a first node; the call relationship generation device includes:
[0013] A detection module, configured to detect a first access request sent from a second node to a kernel space, wherein the first access request includes a request identifier;
[0014] A node determination module, used to determine a third node required to be called to process the first access request;
[0015] A calling relationship creation module, used to create a first calling relationship, wherein the first calling relationship is used to represent that the first node calls the third node;
[0016] A storage module is used to store the first calling relationship in association with the request identifier.
[0017] In a third aspect, an embodiment of the present invention provides a computing device, including a processing component and a storage component;
[0018] The storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the calling relationship generation method provided in the embodiment of the present invention.
[0019] In a fourth aspect, an embodiment of the present invention provides a computer storage medium storing a computer program, which, when executed by a computer, implements the call relationship generation method provided by an embodiment of the present invention.
[0020] The embodiment of the present invention provides a flow chart of a method for generating a call relationship, which can be applied to a first component, and the first component runs in the kernel space of a first node; the method for generating a call relationship includes: detecting a first access request sent from a second node to the kernel space, the first access request including a request identifier; determining a third node to be called to process the first access request; creating a first call relationship, the first call relationship is used to characterize the first node calling the third node; and storing the first call relationship in association with the request identifier. By adopting the above technical solution, the first component mounted in the kernel space of the first node can be used to intercept the access request of the second node to the first node, and the first component can be used to create and store the first call relationship, so that there is no need to change the programming language library or source service code of the first node.
[0021] These and other aspects of the present invention will become more apparent from the following description of the embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 A schematic diagram of transmitting a request identifier of an access request in the related art;
[0024] Figure 2 A flowchart of a method for generating a call relationship provided by an embodiment of the present invention is schematically shown;
[0025] Figure 3 A schematic diagram schematically shows a method for generating a call relationship provided by an embodiment of the present invention;
[0026] Figure 4 A schematic diagram schematically shows a method for generating a call relationship provided by another embodiment of the present invention;
[0027] Figure 5 A schematic diagram schematically shows a method for generating a call relationship provided by another embodiment of the present invention;
[0028] Figure 6 A schematic diagram schematically shows a request provided by an embodiment of the present invention;
[0029] Figure 7 A block diagram of a call relationship generating device provided by an embodiment of the present invention is schematically shown;
[0030] Figure 8 The block diagram of a computing device provided by an embodiment of the present invention is schematically shown. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0032] In some of the processes described in the specification and claims of the present invention and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 201, 202, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0033] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0034] With the continuous development of application development technology, distributed systems have emerged. A distributed system is a system composed of multiple nodes that communicate and coordinate through the network to jointly complete some tasks or provide some services. In a distributed system, each node can run in parallel and cooperate with each other to achieve the goals of the system. The distributed tracing system is an important part of the distributed system architecture. It can obtain the call relationship between services, locate errors, analyze the call link, and debug online problems.
[0035] In a distributed tracing system, a request identifier for the access request is set. Starting from the initiation of the access request, the request identifier is passed in the process of layer-by-layer dependency on nodes and tracking responses. The request identifier can mark the order in which the nodes call the access request and the nested relationship between nodes. Finally, the time consumed in collecting logs, printing error information, and obtaining responses is determined based on the request identifier. In this way, the access request can be traced based on the request identifier, and then the error can be quickly located, the call relationship can be obtained, and the call link can be analyzed.
[0036] See also Figure 1 , Figure 1 A schematic diagram of the transmission of a request identifier of an access request in the related art. Figure 1 The following shows the transmission process of request identifiers in the current related methods. Figure 1As shown, a device, such as a first node, can receive an access request and a request identifier trace-id from a second node. Furthermore, in the process of transmitting the trace-id, the first node will assemble the trace-id into a context object context, and use context to transparently transmit the trace-id in each sub-method of the first node. For example, Figure 1 In the function-a, function-b, function-a1, function-a2 and other sub-methods, ctx (i.e. context object context) is used to pass trace-id. When the sub-method function-a1 needs to call a third node, context can be used to pass trace-id to the third node.
[0037] In the related art, an invasive method is usually used to generate a request link. Specifically, the developer inserts the code generated by the request link into the programming language library or source service code of the first node, so that the first node has the transparent transmission capability of the request identifier shown above, and enables the first node to record the calling relationship of the first node to the third node.
[0038] In the process of implementing the concept of the present invention, the inventors found that since the source service code and programming language library in the distributed system are upgraded very quickly, developers must spend a lot of time inserting code into each new version of the programming language library or source service code so that the nodes can also generate calling relationships between nodes in the new version of the programming language library or source service code.
[0039] In order to solve the technical problems existing in the related art, an embodiment of the present invention provides a flowchart of a call relationship generation method, which can be applied to a first component, and the first component runs in the kernel space of a first node; the call relationship generation method includes: detecting a first access request sent from a second node to the kernel space, the first access request including a request identifier; determining a third node to be called to process the first access request; creating a first call relationship, the first call relationship is used to characterize the first node calling the third node; and the first call relationship is associated with the request identifier and stored. By adopting the above technical solution, the first component mounted in the kernel space of the first node can be used to intercept the access request of the second node to the first node, and the first component can be used to create and store the first call relationship, so that the generation of the call relationship can be realized without changing the programming language library or source service code of the first node.
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0041] Figure 2 A flowchart of a method for generating a call relationship provided by an embodiment of the present invention is schematically shown. The method for generating a call relationship can be applied to a first component, and the first component runs in the kernel space of a first node; Figure 2 As shown, the calling relationship generation method may specifically include the following steps:
[0042] 201, detecting a first access request sent from a second node to a kernel space, where the first access request includes a request identifier;
[0043] 202, determining a third node to be called for processing the first access request;
[0044] 203, creating a first calling relationship, where the first calling relationship is used to represent that the first node calls the third node;
[0045] 204. Store the first call relationship in association with the request identifier.
[0046] According to an embodiment of the present invention, a first node may receive an access request sent from another node, a client, or another server or other device. For example, a first node may receive a first access request from a second node. The first access request carries a request identifier of the access request, and after the first component detects the first access request sent by the second node, it may obtain the request identifier of the first access request. In an embodiment of the present invention, the request identifier of the first access request may be represented by a trace-id.
[0047] According to an embodiment of the present invention, the kernel space is the area where the kernel of the operating system of the first node runs, which has higher permissions and the ability to access system resources. In the kernel space, the operating system performs various core functions, such as managing processes, memory management, device drivers, file systems, and processing of access requests. The kernel space is usually protected and only allows operations with higher privilege levels to access, so as to ensure the stability and security of the system.
[0048] According to an embodiment of the present invention, the first access request is usually sent to the kernel space, and the network protocol stack in the kernel space performs corresponding processing on the first access request, such as data packet decapsulation, protocol parsing, routing selection, error detection and correction, etc. Then, according to the configuration and rules of the protocol stack, the processed data packet is passed to the application or the upper layer protocol.
[0049] According to an embodiment of the present invention, the network protocol stack generally implements various functions of network communication through a series of functions. For example, it may include a receiving function and a sending function, wherein the receiving function may be used to receive access requests from other nodes. Therefore, in one embodiment of the present invention, the first component may be mounted on the receiving function, thereby implementing the interception of the first access request by the first component.
[0050] According to an embodiment of the present invention, in an actual application scenario, for example, an access request needs to access resources on other nodes, or the access request requires other nodes to collaborate and process in parallel, the first node is required to call other nodes when processing the access request to implement the processing of the access request.
[0051] In one embodiment of the present invention, the first component can determine the third node required to process the first access request after detecting that the kernel space receives the first access request; in another embodiment of the present invention, the first access request sent by the second node to the first node may include identification information of the third node, so that the first component can determine the third node required to process the first access request based on the identification information of the third node.
[0052] According to an embodiment of the present invention, after the third node is determined, a first calling relationship may be created, and the first calling relationship may be used to represent that the first node calls the third node when processing the first access request.
[0053] Then, the first call relationship and the request identifier may be associated and stored. For example, the first call relationship may be represented as R1, and thus, the first call relationship and the request identifier may be stored as R1-trace-id; wherein, the first call relationship may be identified as P1—>P3, wherein P1 may represent the first node, and P3 may represent the third node.
[0054] According to an embodiment of the present invention, the first node further has a user space, and the second component runs in the user space.
[0055] According to an embodiment of the present invention, user space is an area allocated to applications running on an operating system. In user space, applications can perform various tasks, such as running a user interface, processing data, interacting with users, etc. Applications in user space cannot directly access kernel space or change the core functions of the operating system. Instead, they request services and resources from the operating system through system calls.
[0056] According to an embodiment of the present invention, the call relationship generation method further includes:
[0057] The first call relationship and the request identifier stored in association are sent to the second component so that the second component can export the first call relationship and the request identifier stored in association.
[0058] According to an embodiment of the present invention, after receiving the associated stored first call relationship and the request identifier, the second component may export the associated stored first call relationship and the request identifier to a database.
[0059] According to an embodiment of the present invention, after the associated stored first call relationship and request identifier are exported to a database, relevant personnel can directly read the associated stored first call relationship and request identifier from the database and visualize the complete request link using a user interface.
[0060] Figure 3 The following is a schematic diagram of a method for generating a calling relationship according to an embodiment of the present invention.
[0061] exist Figure 3 In the figure, 300 may represent a distributed system, which includes multiple nodes, wherein the first node may be represented as 301.
[0062] The first node 301 has a user space 3011 and a kernel space 3012, wherein a second component 3013 runs in the user space 3011, and a first component 3014 runs in the kernel space 3012, and the first component 3014 can be mounted on a network protocol stack 3016. A thread 3015 running in the user space 3011 can call the first component 3014 by way of a system call to trigger the first component 3014.
[0063] After the first component 3014 generates a call relationship, the first component 3014 can send an event to the second component 3013 to pass the generated call relationship and the request identifier to the second component 3013, and then the second component 3013 can store the call relationship and the request identifier in the database 302.
[0064] According to an embodiment of the present invention, the first component is generated by the following operations:
[0065] In the user space, using the second component to receive a first code input by a user;
[0066] Compiling the first code using a compiler to obtain a second code in a bytecode format;
[0067] The second code is sent to the kernel space, so that the kernel space runs the second code to generate the first component.
[0068] In one implementation of the present invention, the second component can be implemented as an extended Berkeley Packet Filter (eBPF). eBPF is a kernel technology that provides a programmable execution environment that allows users to write customized secure and efficient network and system analysis and various network function implementations.
[0069] In an embodiment of the present invention, a code snippet may be inserted into the kernel space through eBPF, and when the code snippet is executed in the kernel space, the generation of a call relationship may be realized.
[0070] The eBPF code runs in kernel space, and when the eBPF code is running, it is restricted by kernel space, which ensures the security of the eBPF code.
[0071] The eBPF code can be compiled into eBPF bytecode, and after verification and inspection by the kernel, an eBPF program, i.e., the first component, is generated. At the same time, the eBPF program executes quickly, which can ensure the speed of call relationship generation.
[0072] According to an embodiment of the present invention, eBPF provides a capability of dynamically loading and running custom code at runtime, thereby, by utilizing eBPF to insert custom code into the kernel space, a first component with a call relationship generation function is mounted in the kernel space, without modifying the programming language library or source service code of the first node.
[0073] According to an embodiment of the present invention, after creating the first call relationship, the call relationship generation method further includes:
[0074] Obtaining a second access request for a third node;
[0075] The associated stored request identifier and the first calling relationship are written into the second access request, and the second access request is sent to the third node.
[0076] According to an embodiment of the present invention, as described above, the network protocol stack may include a receiving function and a sending function, wherein the above-mentioned eBPF program, which may be recorded herein as a first eBPF program, is mounted on the receiving function to intercept a first access request from a second node. Furthermore, in an embodiment of the present invention, a second eBPF program may also be implemented, and the second eBPF program may be mounted on the sending function, thereby writing the request identifier and the first calling relationship into the second access request, and sending the second access request including the request identifier and the first calling relationship to the third node.
[0077] According to an embodiment of the present invention, storing the first call relationship in association with the request identifier includes:
[0078] Associating the first call relationship with the request identifier and storing it in the memory;
[0079] Writing the request identifier and the first call relationship into the second access request includes:
[0080] Reading the first call relationship and the request identifier stored in association from the memory;
[0081] The associated stored request identifier and the first calling relationship are written into the second access request.
[0082] According to an embodiment of the present invention, after the first access request is sent to the kernel space, the first node needs to first respond to and process the first access request. During the process of the first node processing the first access request, the first call relationship and the request identifier can be temporarily stored in the memory. When the first node completes processing the first access request and needs to call the third node, the first call relationship and the request identifier are read out from the memory and written into the second access request.
[0083] Figure 4 A schematic diagram schematically shows a method for generating a calling relationship provided by another embodiment of the present invention.
[0084] Under the synchronous thread model, after receiving the access request from the previous hop, the processing thread in the first node sends a request to the next hop. Since the receiver function and the sender function are completed by the same thread, the corresponding request context can be found through the same thread ID between the two requests, so that the causal relationship between the two requests can be easily maintained.
[0085] like Figure 4As shown, the first eBPF program can update the call relationship and request identifier to the memory, and use the thread ID as a key for retrieval. Then the second eBPF program can query the request context through the same thread ID, and inject the returned call relationship and request identifier into the request to be sent. In this way, the request context is transferred between the two requests.
[0086] Figure 5 A schematic diagram schematically shows a method for generating a calling relationship provided by another embodiment of the present invention.
[0087] like Figure 5 As shown, the access request can be generated by the user end and first sent to the second node. When the user end generates the access request, a request identifier corresponding to the access request can be generated.
[0088] The second node can record the calling relationship of the user terminal to the second node, and if the second node needs to call the first node when processing the access request, the request identifier can be written into the access request for the first node and the access request can be sent to the first node.
[0089] Correspondingly, the first node can also record the calling relationship of the second node to the first node, and when the first node processes the access request, if it needs to call the third node, the request identifier can be written into the access request for the third node, and the access request can be sent to the third node, thereby realizing the transparent transmission of the request identifier between the second node, the first node and the third node.
[0090] Based on calling the first node, the second node can also call the fourth node. Then, the second node can also record the calling relationship with the second node, write the request identifier into the access request for the fourth node, and send the access request to the fourth node.
[0091] After the first node, the second node, the third node and the fourth node have processed the access request, the call relationships recorded and generated by each node will be stored in association with the request identifier. In this way, when it is necessary to locate the exception, the call relationship associated with the request identifier can be searched based on the request identifier, and the specific node where the exception exists can be located using the call relationship.
[0092] According to an embodiment of the present invention, writing the request identifier and the first call relationship into the second access request may be specifically implemented as follows:
[0093] The request identifier and the first calling relationship are written into the message header of the second access request.
[0094] Figure 6 The following is a schematic diagram of a request provided by an embodiment of the present invention.
[0095] like Figure 6 As shown, a request may include a request line, a message header, and a request body.
[0096] In the embodiment of the present invention, in order for the receiving end of the request to still be able to read and process the modified request message, the request identifier and the first calling relationship are written into the HTTP protocol message header.
[0097] According to an embodiment of the present invention, the request identifier and the first call relationship may be written into the message header in the form of a key-value pair. Specifically, a custom key name may be set, and the request identifier and the first call relationship may be used as values.
[0098] According to an embodiment of the present invention, by writing the request identifier and the first call relationship into the message header of the second access request, the entire request link can be tracked and traced in subsequent requests. On the receiving node, that is, the third node, the fields in the message header can be parsed to obtain the request identifier and the first call relationship, and record, count or perform other operations as needed.
[0099] According to an embodiment of the present invention, by writing the request identifier and the first calling relationship into the message header of the second access request, transparent transmission of the request identifier in the first node, the second node and the third node is also achieved.
[0100] According to an embodiment of the present invention, the call relationship generation method further includes:
[0101] Recording a first timestamp corresponding to when the first access request is received;
[0102] Recording a second timestamp corresponding to when the second access request is sent to the third node;
[0103] The first timestamp and the second timestamp are associated with the first call relationship and stored.
[0104] According to an embodiment of the present invention, the call relationship generation method further includes:
[0105] generating a second calling relationship, where the second calling relationship is used to represent that the second node calls the first node;
[0106] In response to an exception check instruction for the first access request, searching for a first call relationship and a second call relationship corresponding to the request identifier;
[0107] Based on the timestamps corresponding to the first calling relationship and the second calling relationship, it is determined whether there is an abnormality between the first calling relationship and the second calling relationship.
[0108] According to an embodiment of the present invention, by recording the first timestamp and the second timestamp, the duration used by the first node to process the first access request can be determined, and by the duration, it can be determined whether the first node has a processing anomaly. Specifically, when anomaly location is required, by reading the first timestamp and the second timestamp, the time span between the first timestamp and the second timestamp can be determined, and then the expected duration of the first node in processing the first access request can be determined, and by comparing the relationship between the expected duration and the time span, it can be determined whether the first node has an anomaly.
[0109] Figure 7 A block diagram of a call relationship generation device provided by an embodiment of the present invention is schematically shown. The call relationship generation device 700 can be applied to a first component, and the first component runs in the kernel space of a first node. The call relationship generation device can specifically include:
[0110] A detection module 701 is used to detect a first access request sent from a second node to a kernel space, where the first access request includes a request identifier;
[0111] A node determination module 702, used to determine a third node to be called to process the first access request;
[0112] A call relationship creation module 703, used to create a first call relationship, where the first call relationship is used to represent that the first node calls the third node;
[0113] The storage module 704 is used to store the first calling relationship in association with the request identifier.
[0114] According to an embodiment of the present invention, a second component also runs in the user space of the first node.
[0115] According to an embodiment of the present invention, the storage module 704 includes:
[0116] The storage unit is used to send the first call relationship and the request identifier to the second component so that the second component stores the first call relationship and the request identifier in association.
[0117] According to an embodiment of the present invention, the call relationship generating device 700 further includes:
[0118] A first code receiving module, used for receiving a first code input by a user by using a second component in a user space;
[0119] A compiling module, used for compiling the first code using a compiler to obtain a second code in a bytecode format;
[0120] The first code sending module is used to send the second code to the kernel space so that the kernel space runs the second code to generate the first component.
[0121] According to an embodiment of the present invention, the call relationship generating device 700 further includes:
[0122] A second request generating module, used to generate a second access request for a third node;
[0123] The information sending module is used to write the request identifier and the first calling relationship into the second access request and send it to the third node.
[0124] According to an embodiment of the present invention, the call relationship generating device 700 further includes:
[0125] A storage module, used for storing the first call relationship and the request identifier in a memory;
[0126] According to an embodiment of the present invention, the information sending module includes:
[0127] A reading unit, used for reading the first call relationship and the request identifier from the memory;
[0128] The writing unit is used to write the request identifier and the first calling relationship into the second access request.
[0129] According to an embodiment of the present invention, the call relationship generating device 700 further includes:
[0130] A first timestamp recording module, used to record a first timestamp corresponding to when a first access request is received;
[0131] A second timestamp recording module, used to record a second timestamp corresponding to when the second access request is sent to the third node;
[0132] The timestamp storage module is used to store the first timestamp and the second timestamp in association with the first calling relationship.
[0133] According to an embodiment of the present invention, the first access request further includes a second calling relationship, and the second calling relationship is used to represent that the second node calls the first node.
[0134] According to an embodiment of the present invention, the call relationship generating device 700 further includes:
[0135] An instruction receiving module, used for receiving an abnormality checking instruction;
[0136] A call relationship search module, used to search for a first call relationship and a second call relationship corresponding to the request identifier in response to an exception check instruction;
[0137] The abnormality locating module is used to determine whether there is an abnormality between the first calling relationship and the second calling relationship based on the timestamps corresponding to the first calling relationship and the second calling relationship.
[0138] According to an embodiment of the present invention, the writing unit includes:
[0139] The writing subunit is used to write the request identifier and the first calling relationship into the message header of the second access request.
[0140] Figure 7 The calling relationship generating device can execute Figure 2 The implementation principle and technical effect of the call relationship generation method described in the illustrated embodiment will not be described in detail. The specific manner in which each module and unit performs operations in the call relationship generation device in the above embodiment has been described in detail in the embodiment of the method, and will not be described in detail here.
[0141] In a possible design, the call relationship generating device provided in the embodiment of the present invention can be implemented as a computing device, such as Figure 8 As shown, the computing device may include a storage component 801 and a processing component 802;
[0142] The storage component 801 stores one or more computer instructions, wherein the one or more computer instructions are called and executed by the processing component 802 to implement the calling relationship generation method provided in the embodiment of the present invention.
[0143] Of course, the computing device may also include other components, such as input / output interfaces, communication components, etc. The input / output interface provides an interface between the processing component and the peripheral interface module, which may be an output device, an input device, etc. The communication component is configured to facilitate wired or wireless communication between the computing device and other devices.
[0144] Among them, the computing device can be a physical device or an elastic computing host provided by a cloud computing platform, etc. In this case, the computing device can refer to a cloud server, and the above-mentioned processing components, storage components, etc. can be basic server resources rented or purchased from the cloud computing platform.
[0145] When the computing device is a physical device, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device.
[0146] The embodiment of the present invention further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a computer, the method for generating a call relationship provided by the embodiment of the present invention can be implemented.
[0147] The embodiment of the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a computer, the calling relationship generating method provided by the embodiment of the present invention can be implemented.
[0148] The processing components in the above corresponding embodiments may include one or more processors to execute computer instructions to complete all or part of the steps in the above method. Of course, the processing components may also be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.
[0149] The storage component is configured to store various types of data to support operations in the device. The storage component can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0150] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0151] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0152] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0153] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating a call relationship, characterized in that: Applied to a first component, the first component runs in the kernel space of a first node; the method comprises: Detecting a first access request sent from a second node to the kernel space, wherein the first access request includes a request identifier; Determining a third node to be called to process the first access request; Creating a first calling relationship, where the first calling relationship is used to represent that the first node calls the third node; The first calling relationship is associated with the request identifier and stored.
2. The method according to claim 1, characterized in that: The first node also has a user space, and the user space runs a second component; the method further includes: The first call relationship and the request identifier stored in association are sent to the second component so that the second component can export the first call relationship and the request identifier stored in association.
3. The method according to claim 2, characterized in that The first component is generated by the following operations: In the user space, receiving a first code input by a user by using the second component; Compiling the first code using a compiler to obtain a second code in a bytecode format; The second code is sent to the kernel space, so that the kernel space runs the second code and generates the first component.
4. The method according to claim 1, characterized in that After the first call relationship is created, the method further includes: Obtaining a second access request to the third node; The associated stored request identifier and the first calling relationship are written into a message header of the second access request, and the second access request is sent to the third node.
5. The method according to claim 4, characterized in that The storing the first calling relationship in association with the request identifier comprises: Associating the first call relationship with the request identifier and storing it in a memory; Writing the request identifier and the first call relationship into the second access request includes: Reading the first call relationship and the request identifier stored in association from the memory; The associated stored request identifier and the first calling relationship are written into the second access request.
6. The method according to claim 4, characterized in that The method further comprises: Recording a first timestamp corresponding to when the first access request is received; Recording a second timestamp corresponding to when the second access request is sent to the third node; The first timestamp and the second timestamp are associated with the first calling relationship and stored.
7. The method according to claim 1, characterized in that The method further comprises: generating a second calling relationship, wherein the second calling relationship is used to represent that the second node calls the first node; In response to an exception check instruction for the first access request, searching for the first call relationship and the second call relationship corresponding to the request identifier; Based on the timestamps corresponding to the first calling relationship and the second calling relationship, it is determined whether there is an abnormality between the first calling relationship and the second calling relationship.
8. The method according to claim 1, characterized in that: The method further comprises: The first component is mounted to a receiving function in the kernel space, so as to use the receiving function to detect a first access request sent from a second node to the kernel space.
9. A computing device, characterized in that including a processing component and a storage component; The storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the call relationship generation method as described in any one of claims 1 to 8.
10. A computer storage medium, characterized in that: A computer program is stored, and when the computer program is executed, the calling relationship generation method according to any one of claims 1 to 8 is implemented.