Link tracking method and device, storage medium and program product

By setting up a link tracking module in the kernel state of a distributed application system, monitoring and reporting link information, the protocol adaptation complexity and intrusion risks of link tracking in the prior art are solved, and the integrity of full-link tracking and unaware link tracking are achieved.

CN120371559APending Publication Date: 2025-07-25HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410095146.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-23
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

Existing link tracking schemes require carrying tracking marks in requests, resulting in complex adaptation with communication protocols, increasing transmission overhead, risk of intrusion and inability to fully track.

Method used

The link tracking module is set up in the server kernel state of the distributed application system, and the link information between the application is monitored through the mount point, and the information is reported to the link accounting center to realize full link tracking.

Benefits of technology

There is no need to add trace marks to the request, avoiding the risk of communication protocol adaptation and intrusion, providing complete link tracking information, and supporting applications in any programming language and network framework.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371559A_ABST
    Figure CN120371559A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a link tracking method and device, a storage medium and a program product. In the scheme, the link tracking module is arranged in the kernel mode of the server, mounting points are arranged in a network subsystem and a process management system of the link tracking module in the kernel mode, and link tracking is carried out inside the application and between the applications when the request enters the application in cooperation with a link bookkeeping center outside the server. The distributed application system is not intervened in the whole link tracking process; the link tracking information obtained through tracking is complete, the situation that the request enters the application can be tracked, the process / thread switching process in the application can be tracked, and the process communication process between different applications can be tracked. According to the technical scheme, additional communication protocol adaptation does not need to be carried out on the request, the request does not need to be modified, and the intrusion risk cannot be brought to the distributed application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of microservice technologies, and in particular, to a link tracing method, device, storage medium, and program product. Background Art

[0002] In the current microservice architecture, link tracing ability is an essential basic ability. Link tracing can restore the call chain between applications for developers of distributed applications, help developers quickly analyze performance bottlenecks under the distributed application architecture, conduct problem diagnosis, and improve the development and diagnosis efficiency in the microservice era.

[0003] The existing link tracing solution is to carry a tracing tag in the request, and use additional enhanced technologies to sequentially copy the tracing tag to subsequent requests during the subsequent application flow. Requests carrying the same tracing tag are considered to be on the same link to achieve link tracing.

[0004] However, the current solution has certain limitations: (1) Carrying a tracing tag in the request needs to be adapted to the communication protocol adopted by the application; (2) Carrying a tracing tag in the request may bring an intrusion risk to the application; (3) For applications that do not support adding a tracing tag, full-link tracing cannot be achieved. Summary of the Invention

[0005] Multiple aspects of this application provide a link tracing method, device, storage medium, and program product to achieve full-link tracing without modifying the request and without intrusion into the application.

[0006] An embodiment of the present application provides a link tracing method, which is applied to a link tracing device on any server in a distributed application system. The link tracing device includes a first link tracing module in the kernel mode, and the first link tracing module sets mounting points at least in the network subsystem and the process management system in the kernel mode. The method includes: when a first mounting point for monitoring whether a first request is received in the network subsystem is triggered, obtaining information of a first application responsible for processing the first request on the server as entry link information and reporting it to a link accounting center, so that the link accounting center adds the entry link information to target link tracing information corresponding to the first request; when a second mounting point for monitoring process / thread switching within an application in the process management system is triggered, obtaining in-application link information of the first request within the first application and reporting it to the link accounting center, so that the link accounting center adds the in-application link information to the target link tracing information; when a third mounting point for monitoring inter-application process communication in the network subsystem is triggered, obtaining inter-application link information of the first request between the first application and a second application and reporting it to the link accounting center, so that the link accounting center adds the inter-application link information to the target link tracing information.

[0007] An embodiment of the present application further provides a link tracing device, which is deployed on any server in a distributed application system. The device includes: a first link tracing module in the kernel mode, and the first link tracing module sets mounting points at least in the network subsystem and the process management system in the kernel mode. Among them, the first link tracing module is used for: when a first mounting point for monitoring whether a first request is received in the network subsystem is triggered, obtaining information of a first application responsible for processing the first request on the server as entry link information and reporting it to a link accounting center, so that the link accounting center adds the entry link information to target link tracing information corresponding to the first request; when a second mounting point for monitoring process / thread switching within an application in the process management system is triggered, obtaining in-application link information of the first request within the first application and reporting it to the link accounting center, so that the link accounting center adds the in-application link information to the target link tracing information; when a third mounting point for monitoring inter-application process communication in the network subsystem is triggered, obtaining inter-application link information of the first request between the first application and a second application and reporting it to the link accounting center, so that the link accounting center adds the inter-application link information to the target link tracing information.

[0008] An embodiment of the present application further provides an electronic device, including: a memory and a processor; the memory is used to store one or more computer instructions; the processor is used to execute the one or more computer instructions to: execute the steps in the link tracing method provided by the embodiment of the present application.

[0009] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the link tracing method provided by the embodiment of the present application.

[0010] An embodiment of the present application further provides a computer program product, including a computer program / instructions, which, when executed by a processor, enables the processor to implement the link tracing method provided by the present application.

[0011] In this embodiment, a link tracing module is set in the kernel state of the server in a distributed application system. By setting mount points for the link tracing module in the network subsystem and process management system in the kernel state, and cooperating with a link accounting center outside the server to trace the link when a request enters the application, inside the application, and between applications, the distributed application system will not be intervened during the entire process of link tracing; moreover, the obtained link tracing information is relatively complete, and it can not only trace the situation when a request enters the application, but also trace the process / thread switching process inside the application, as well as the process communication process between different applications. In the process of link tracing of the technical solution of the present application, there is no need to add a tracing mark to the request. Therefore, there is no need to perform additional communication protocol adaptation on the request, nor to modify the request, nor will it bring an intrusion risk to the distributed application. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:

[0013] Figure 1 It is a schematic diagram of ThreadLocal in multi-threaded operations provided by an exemplary embodiment of the present application;

[0014] Figure 2 It is a schematic flowchart of link tracing provided by an exemplary embodiment of the present application;

[0015] Figure 3 It is a schematic flowchart of the link tracing method provided by an exemplary embodiment of the present application;

[0016] Figure 4 It is a schematic structural diagram of request flow provided by an exemplary embodiment of the present application;

[0017] Figure 5 Schematic diagram of the first application and the second application provided by an exemplary embodiment of the present application on the same server;

[0018] Figure 6 Schematic diagram of the first application and the second application provided by an exemplary embodiment of the present application on different servers;

[0019] Figure 7 Schematic diagram of the request provided by an exemplary embodiment of the present application for flowing between different applications on the same server and between different servers;

[0020] Figure 8 Schematic diagram of the structure of the link tracing device containing the second link tracing module provided by an exemplary embodiment of the present application;

[0021] Figure 9 Schematic diagram of the link tracing method in an actual scenario provided by an exemplary embodiment of the present application;

[0022] Figure 10 Schematic diagram of the link tracing device provided by an exemplary embodiment of the present application;

[0023] Figure 11 Schematic diagram of the electronic device provided by an exemplary embodiment of the present application. Detailed implementation manners

[0024] To make the objectives, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be clearly and completely described below in conjunction with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0025] 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 for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse. In addition, various models (including but not limited to language models or large models) involved in the present application comply with relevant laws and standards.

[0026] A centralized application system refers to a system built on a single hardware node (such as a high-performance computer), which presents an overall function to users and has extremely high requirements for the computing, storage, and other capabilities of the system. However, with the rapid progress of hardware technology and the significant reduction in hardware costs, the software complexity has become increasingly high. The performance of a single system cannot meet complex data computing tasks, and the complexity of software logic has also led to a substantial increase in maintenance costs. In addition, the reliability of a single node is difficult to guarantee, and there will inevitably be occasional downtime and other issues, affecting the availability of the software. Against this background, a distributed application system emerged. A distributed application system is a network system built on software, consisting of multiple independent hardware nodes, such as multiple computers or multiple servers, etc. A distributed application system can perform a service-oriented split of the original system. For users, a complete interaction process is divided into multiple microservices in a distributed application system, and each microservice can exist on different hardware nodes.

[0027] In this way, a complex monolithic software system can be decomposed into smaller and more manageable parts, and a single application program can be divided into a group of small services that coordinate and cooperate with each other. However, the price of this flexibility is complexity. When a distributed application system receives a request, the request usually undergoes a relatively complex flow in the distributed application system. Therefore, existing technologies usually rely on full-link tracing technology (Tracing) to track the flow path and status of requests in a distributed application system, restore the call link between applications for developers of distributed applications, and thus help developers quickly analyze the performance bottlenecks under the distributed application architecture, conduct problem diagnosis, and improve the development and diagnosis efficiency in the microservices era.

[0028] The existing link tracing solution is to carry a tracing tag in the request and use additional enhanced technologies in the subsequent application flow to sequentially copy the tracing tag into the subsequent requests. Requests carrying the same tracing tag are considered to be on the same link to achieve link tracing. For example, taking the Hypertext Transfer Protocol (HTTP) as an example, a header field can be added to the HTTP request, and the tracing identifier (TraceId) is carried through this header field; when this request is in the subsequent application flow, when the application is implemented in the Java language, technologies such as javaagent (Java agent) can be used to sequentially copy the header field of the subsequent requests. Specifically, within the process, the TraceId field can be written into the thread local variable (ThreadLocal) of Java. Among them, the function of the java agent technology is a complete set of backdoors provided by the Java virtual machine. Through this set of backdoors, the virtual machine can be monitored and analyzed, and even the operation of the virtual machine can be intervened. Among them, ThreadLocal is provided by the Java Development Kit (JKD) and can provide thread local variables. If a ThreadLocal variable is created, each thread accessing this variable will have a copy of this variable. During actual multithreaded operations, the variable in its own local memory is operated on, thus avoiding thread safety issues, such as Figure 1 shown

[0029] The above solutions have certain limitations: (1) For different protocols such as the HTTP protocol and the Remote Procedure Call (RPC) protocol, the field positions and field names for adding TraceId to the request may be different. Therefore, carrying the tracing mark in the request requires additional adaptation to the communication protocol adopted by the application. (2) In some cases, when carrying the tracing mark in the request, the additional field names may conflict with the application fields, thus bringing an intrusion risk to the application. (3) Carrying the tracing mark in the request can increase the transmission overhead, for example, it will consume more transmission bandwidth and increase the transmission delay, etc. (4) In some scenarios, some applications do not allow adding additional fields to the request, so it is impossible to add the tracing mark to the request. For these applications that do not support adding the tracing mark, full-link tracing cannot be achieved. (5) If additional enhanced technologies need to be used to replicate the tracing mark during the flow of the application, additional adaptation of the application language and the application framework needs to be done in advance. For example, when developing a Java application, it may rely on network frameworks such as netty, webflux, or tomcat. Then, when adding the tracing mark to the request in the Java application, the Javaagent technology needs to be used to adapt to network frameworks such as netty, webflux, or tomcat. Another example is that when developing an application using the Go language (also known as Golang, a programming language), it may rely on network frameworks such as net or gin. Then, when adding the tracing mark to the request in the Go application, binary enhancement needs to be used to adapt to network frameworks such as net or gin.

[0030] In the embodiment of the present application, a link tracing device can be deployed on the server in the distributed application system. The device at least includes a first link tracing module deployed in the kernel state. By setting the mounting points of the link tracing module in the relevant systems in the kernel state, these mounting points can be used to monitor whether the server receives the first request, monitor the link information within the application and between different applications, so as to send the monitored information to the link accounting center for the link accounting center to process this information to obtain relatively complete link tracing information. Figure 2 An example of the above process is as Figure 2 shown. The dotted arrow is the link tracing path, and the solid arrow is the transmission path or flow path of the request. As shown in the figure, the first request can not only flow between different applications on the same server, but also flow within the same application on the same server, and can also flow between different applications on different servers. These flow processes can all be traced by the first link tracing module and the traced link information can be synchronized to the link accounting center.

[0031] Server 10 can use the first link tracing module therein to record the transfer process of the first request among different applications in Server 10. Server 20 can also use the first link tracing module therein to record the transfer process of the first request in Server 20. Based on this, the first tracing module can report the recorded information to the link accounting center for it to generate the target link tracing information corresponding to the first request according to this information. And in the above process, no intervention is made on the request, so that the full-link tracing is completed without intruding into the application.

[0032] In this way, on the one hand, the obtained link tracing information is relatively complete and can be used to describe the whole process of the request transfer in the distributed application system. It can not only trace the situation of the request entering the application, but also trace the process / thread switching process within the application, as well as the process communication process among different applications. On the other hand, in the above link tracing process, there is no need to add a tracing mark to the request. Therefore, there is no need to perform additional communication protocol adaptation on the request, nor will it bring an intrusion risk to the distributed application system; in addition, it will not increase the transmission overhead of the request, and there is no limitation on whether the application supports adding additional fields to the request, and it can perform full-link tracing on applications developed based on any programming language and any network framework.

[0033] The following will combine the accompanying drawings to detail the technical solutions provided by each embodiment of the present application.

[0034] Figure 3 is the system architecture diagram of the distributed application system 100 provided by the present application. As Figure 3 shown, the distributed application system 100 may include: multiple servers, which are network-connected to each other. Figure 3 Taking the distributed application system including two servers as an example, they are Server 10 and Server 20 respectively, Figure 3 The shown does not limit the number of servers. Among them, the server can be implemented as a general server, a cloud host, a virtual center in the cloud, an elastic computing instance in the cloud, etc., and this embodiment does not limit this.

[0035] As Figure 3 shown, the internal architecture of any server can be divided into: a hardware layer, a kernel layer, and an application layer from bottom to top. Among them, the hardware layer includes various hardware resources of the server, such as a processor, a memory (including a memory and a hard disk, etc.), a communication component, a display, a power supply component, an audio component, and various external devices, etc. In Figure 3Among them, some hardware resources are taken as examples for illustration. An operating system, that is, the kernel layer, runs on the hardware resources of the server. Above the operating system is the application layer. The application layer includes various application programs running on the server, such as various databases or data warehouses, streaming computing applications, log processing applications, distributed computing, various virtual machines or containers, etc. Relative to the application programs, the operating system is a set of interrelated system software programs that manage and control various operations of the physical machine, utilize and run hardware and software resources, and provide public services to organize user interactions. In the embodiments of the present application, the operating system serves as a bridge between the application programs and the hardware resources. The operating system includes drivers for various hardware resources to drive various hardware resources. Among them, the operating system of the server may include, but is not limited to: a network subsystem, a process management system, a file management system, a storage management system, etc. Among them, the network subsystem is one of the core parts of the operating system and is responsible for handling network-related tasks. The process management system is used to manage the processes of the application programs in the user state or the threads within the processes. The file management system provides interfaces for users or programmers to access, create, modify, delete, and share files, and is used to store, organize, and manage files and directories. The storage management system is used to manage memory resources and can be specifically used for operations such as allocating, protecting, and expanding the memory.

[0036] In the embodiments of the present application, the type of the operating system adopted by the server is not limited. Any operating system that allows new functional modules to be added to the operating system is applicable to the embodiments of the present application. For example, it may be, but is not limited to: Windows operating system, Linux operating system, Unix operating system, and Android operating system, etc. In this embodiment, a link tracing device is added to the server. The link tracing device at least includes a link tracing module added in the kernel layer. To facilitate distinction from other link tracing modules, the link tracing module in the kernel layer is called the first link tracing module. In the embodiments of the present application, the implementation manner of adding the link tracing module in the kernel layer is not limited. For example, some operating systems provide a code embedding mechanism for users. These mechanisms allow users to implant and run custom program codes in the kernel. Then, the first link tracing module can be embedded in the kernel layer based on these mechanisms.

[0037] Taking the Linux operating system as an example, it provides users with the extended Berkeley Packet Filter (eBPF) technology. It is based on the elastic byte program framework introduced in software-defined networks and is an important function of the Linux operating system. Based on this, an optional implementation method for adding a first link tracing module to the kernel layer of the server is as follows: The eBPF monitoring program is mounted on the kernel layer through the eBPF technology, and the eBPF monitoring program in the kernel layer can be implemented as the first link tracing module in the link tracing device. Specifically, the pre-written eBPF monitoring program can be compiled into eBPF bytecode by using a preset compiler, and the eBPF bytecode is loaded into the kernel layer to achieve the purpose of embedding the first link tracing module in the kernel layer. In this embodiment, the main function of the eBPF monitoring program implemented as the first link tracing module is to perform link tracing on the requests on its affiliated server.

[0038] In addition to adding the first link tracing module to the kernel layer, in order to achieve the purpose of the first link tracing module to perform link tracing on the requests on its affiliated server, corresponding mounting points are also set for the first link tracing module at certain function positions in the kernel layer. The mounting point is the position point that connects the existing functional modules or functions in the kernel layer with the first link tracing module. These mounting points are associated with specific events, and these specific events can be regarded as the trigger times of the first link tracing module. When the kernel code executes to the corresponding mounting point and a specific event occurs, the first link tracing module will be executed, and the first link tracing module will trace the request processing process at this mounting point. Specifically, certain functions in the network subsystem, process management system, and file management system in the kernel layer can be used as mounting points. By setting the mounting points, when the trigger event associated with the mounting point (function) occurs, the first link tracing module can be executed to monitor and collect information on the request processing process at the mounting point, and then the link tracing of the request can be completed based on the first link tracing module and the set mounting points.

[0039] The following combines Figures 4 - 7 the system architecture shown to elaborate in detail on the link tracing process based on the link tracing device. In Figures 4 - 7 , taking the example that server 10 in the distributed application system receives the first request for illustration.

[0040] Multiple applications are deployed on each server in a distributed application system. These applications can provide services externally, and these applications can also call each other. Among them, the applications that can call each other can be located on the same server or on different servers, and there is no limitation on this. For the first request, it can come from outside server 10. For example, it can be a request sent by an application on other servers within the distributed application system, or a request sent by a user or client outside the distributed application system. Of course, the first request can also be an internal request initiated by an application on server 10 to request other applications. In Figure 4 the following, taking the first request coming from outside server 10 as an example for illustration.

[0041] A link tracing device is deployed on server 10. The link tracing device includes a first link tracing module added at the kernel layer. The first link tracing module can set a first mount point in the network subsystem for monitoring whether the first request is received. The first link tracing module can also set a second mount point in the process management system for monitoring process switching or thread switching within an application, and set a third mount point in the network subsystem for monitoring process communication between applications. The above uses "first", "second", and "third" to limit the mount points, which are only used to distinguish different mount points, and do not limit the order and mounting method of the mount points, etc.

[0042] When the first link tracing module is triggered at the first mount point, it can obtain the information of the first application on the server responsible for processing the first request as the entry link information. Among them, the first application refers to the application on the server responsible for processing the first request. For example, if the first request is a request regarding a navigation behavior, then the first application can be a navigation application responsible for processing this request. The information of the first application can be used to describe the application running information regarding the first request in the first application. Specifically, the information of the first application at least includes the identification information of the first application. Among them, the entry link information refers to the starting point information for full-link tracing of the first request on server 10. The entry link information can at least include the path information of the first request, such as including but not limited to: the identification of the server that issues the first request, the identification of the current server 10, and the identification information of the first application that receives the first request in the current server 10. Further optionally, in a multi-process and multi-thread system, it can also include the process ID of the process in the first application currently responsible for processing the first request and the thread ID of the thread in this process currently responsible for processing the first request. Further, the entry link information can also include: the status information of the first request, such as whether the first request is successfully received, whether it is stored in the receiving queue, and the entry link information can also include: the position of the first request in the receiving queue and whether the first request is scheduled, etc.

[0043] As Figure 4As shown in the figure, after obtaining the entry link information, the first link tracing module may report it to the link accounting center, so that the link accounting center can add the entry link information to the target link tracing information corresponding to the first request. Among them, one request corresponds to one link tracing information. In the embodiments of the present application, for the convenience of distinction, the link tracing information corresponding to the first request is referred to as the target link tracing information.

[0044] As Figure 4 shown in the figure, when the second mount point is triggered, the first link tracing module may obtain the in-application link information of the first request within the first application. Among them, the in-application link information is used to describe the process of application process / thread switching when the first request flows within the first application. The first link tracing module may report the in-application link information to the link accounting center, so that the link accounting center can add the in-application link information to the target link tracing information.

[0045] As Figure 4 shown in the figure, when the third mount point is triggered, the first link tracing module may obtain the inter-application link information of the first request between the first application and the second application and report it to the link accounting center. Among them, the second application refers to other applications in the distributed application system except the first application. The second application may be another application on the server where the first application is located, that is, the first application and the second application are located on the same server, as Figure 4 shown in the figure; or, the second application may also be another application located on other servers, that is, the first application and the second application are located on different servers, as Figure 6 shown in the figure. The inter-application link information is used to describe the process of application process / thread switching when the first request flows between different applications. The first link tracing module may report the inter-application link information to the link accounting center, so that the link accounting center can add the inter-application link information to the target link tracing information.

[0046] It should be noted here that the situation of process / thread switching when the first request flows within the application and the situation of the first request flowing between different applications do not necessarily occur. That is to say, the second mount point and the third mount point are not necessarily triggered, which specifically depends on the type and application scenario of the first request and the first application. Whether or not they will be triggered, the second mount point and the third mount point will exist, and only when triggered will the first link tracing module execute the corresponding monitoring tasks.

[0047] In Figures 4 - 7Among them, the dashed line with an arrow represents the link tracing path, and the solid line with an arrow represents the transfer path of the first request. It can be found that the two paths are independent of each other. That is to say, the link tracing process will not affect or interfere with the request transfer process. The first link tracing module performs link tracing on the request from the perspective of a bystander, and the request or application is unaware of the entire link tracing process. That is to say, in the embodiment of the present application, a link tracing module is set in the kernel state of the server. By setting mount points for the link tracing module in the network subsystem and process management system in the kernel state, and cooperating with the link accounting center outside the server to perform link tracing when the request enters the application, inside the application, and between applications, the distributed application system will not be intervened during the entire process of link tracing; moreover, the obtained link tracing information is relatively complete. It can not only trace the situation when the request enters the application, but also trace the process of process / thread switching within the application, as well as the process communication process between different applications. The technical solution of the present application does not require additional communication protocol adaptation for the request, nor does it require modification of the request, nor does it bring an intrusion risk to the distributed application.

[0048] In some alternative embodiments, as Figure 4 shown, the first mount point in the foregoing embodiment may be the first function for managing communication connections in the network subsystem. Among them, the first function can be used to monitor each port that has been enabled on the network subsystem, and when a first request is received on the target port, report the first request to the first application according to the destination address of the first request and the port number of the target port, so that the first thread in the first process in the first application processes the first request. Among them, the first process refers to the process in the first application that processes the first request, and the first thread refers to the thread in the first process that needs to process the first request.

[0049] That is to say, when the first request is received, the first function can be triggered and determine the destination address of the first request and the port number of the target port, and determine the first application that processes the first request according to the port number of the target port and the destination address of the first request. Among them, different ports correspond to different applications. When starting the application, the operating system can assign a unique port to the application and establish a mapping relationship between the port and the application. The first function can determine whether the server 10 is the receiving end of the first request according to the destination address of the first request. When it is determined that the server 10 is the receiving end of the first request, further determine the application that processes the first request, that is, the first application, according to the port number of the target port where the first request is received. After that, the first request can be reported to the first application, and the first application will allocate a process (that is, the first process) to process the first request. Further, in a multi-thread scenario, the first process will also allocate a thread (that is, the first thread) to process the first request.

[0050] Optionally, in the case where the operating system adopts a socket communication mechanism, the communication connection can be a socket connection, and the first function can be a function for managing Transmission Control Protocol (TCP) connection information, such as the sk_msg function. Among them, a socket buffer can be provided under the socket communication mechanism. A socket can be understood as a file descriptor, and a file descriptor can point to both ends (i.e., two socket buffers). Both of the two socket buffers can be read and written, so as to implement a two-way full-duplex communication mode. The connection method between the two socket buffers is the socket connection. The communication principle of the socket can be understood as follows: one end writes data into the sending buffer through the file descriptor, and the other end can receive data from the receiving buffer. Of course, it can also be that one end reads data and the other end writes data, which will not be elaborated here. Among them, the sk_msg function can obtain each data packet sent by the socket and determine the destination address of the first request according to the fields of msg in the function (such as IP address, port, etc.). The sk_msg function can also record the identifier of the request and record the process information and thread information for processing the request when the first application processes the request.

[0051] Correspondingly, when the first link tracing module obtains the information of the first application on the server responsible for processing the first request as the entry link information, it can obtain the identifier information of the first request, the process ID of the first process, and the thread ID of the first thread from the first function. The identifier information of the first request includes, but is not limited to, at least one of the following: source address, destination address, request sequence number, etc., and will vary specifically due to different communication protocols.

[0052] After that, the first link tracing module can report the identifier of the server 10, the process ID of the first process, and the thread ID of the first thread as the entry link information to the link accounting center according to the identifier information of the first request. Specifically, this step can be implemented based on the following method:

[0053] The first link tracing module can report the identifier information of the first request to the link accounting center to request to obtain the target tracing identifier corresponding to the target link to which the first request belongs. At this time, two situations may occur. The first situation is that the tracing identifier of the target link to which the first request belongs already exists in the link accounting center, denoted as the target tracing identifier, and the first link tracing module can receive the target tracing identifier returned by the link accounting center; the second situation is that the first request is a request that appears for the first time, and the tracing identifier of the target link to which the first request belongs does not exist in the link accounting center. Therefore, the first link tracing module cannot receive the target tracing identifier returned by the link accounting center.

[0054] In the first case, the first link tracing module may report the target tracing identifier, the identifier of the server, the process ID of the first process, and the thread ID of the first thread to the link accounting center, so that the link accounting center can add the identifier of the server, the process ID of the first process, and the thread ID of the first thread to the target link tracing information according to the target tracing identifier. Among them, the link accounting center may determine the target link corresponding to the first request according to the target tracing identifier, and add the identifier of the server, the process ID of the first process, and the thread ID of the first thread to the target link tracing information corresponding to the target link.

[0055] In the second case, the first link tracing module may create or allocate a target tracing identifier for the target link to which the first request belongs. After that, the first link tracing module may report the target tracing identifier, the identifier of server 10, the process ID of the first process, and the thread ID of the first thread to the link accounting center. The link accounting center may generate target link tracing information corresponding to the target tracing identifier according to the reported information, and add the identifier of server 10, the process ID of the first process, and the thread ID of the first thread to the target link tracing information.

[0056] Optionally, when the link accounting center adds the identifier of server 10, the process ID of the first process, and the thread ID of the first thread to the target link tracing information, it may first form a triple with the identifier of the server, the process ID of the first process, and the thread ID of the first thread, and then add the triple to the target link tracing information of the target link.

[0057] In this way, the first link tracing module can relatively accurately determine the entry link information and report it to the link accounting center. The link accounting center can cooperate with the first link tracing module to add the entry link information to the target link tracing information corresponding to the first request, so as to obtain relatively accurate and complete link tracing information.

[0058] In some alternative embodiments, such as Figure 4 shown, the second mount point may be a second function in the process management system for managing process creation information. Among them, the second function may be used to respond to a sub-process creation request of the first process in the first application, create a second process as the sub-process, and switch the thread processing the first request from the first thread in the first process to the second thread in the second process.

[0059] The first process here and the first process mentioned above are the same process, that is, the process currently processing the first request. The second process is the sub-process of the first process, and the first process is the parent process of the second process. The relationship between this sub-process and the parent process can be understood as: the sub-process can be created by the parent process, inherits most of the attributes of the parent process, and is used to help the parent process execute tasks.

[0060] Optionally, when the operating system adopts the socket communication mechanism, the communication connection can be a socket connection, and the second function can be a function for creating a process, such as the alloc_pid (allocate_process_identifier) function. The alloc_pid function can be used to: allocate a corresponding pid (process identifier) for the child process to be created to complete the creation of the child process, thereby obtaining the process creation information of the application. Among them, the alloc_pid function can create a child process in the fork mode or the spawn mode. The fork mode means splitting the second process from the first process in the way of "copying the current state of the parent process and the memory of the parent process", and the second process can inherit most of the attributes of the second process; the spawn mode means creating a child process by running a series of spawn functions, which is a way of creating a child process from scratch. The alloc_pid function can record the process identifier of the first process, the thread identifier of the first thread, the process identifier of the second process, and the thread identifier of the second thread during the creation of the child process.

[0061] Correspondingly, when the first link tracing module obtains the in-application link information of the first request in the first application and reports it to the link accounting center, it can be implemented based on the following method:

[0062] The first link tracing module can obtain the process identifier of the first process, the thread identifier of the first thread, the process identifier of the second process, and the thread identifier of the second thread from the second function. Then, the first link tracing module can report the identifier of server 10, the process identifier of the first process, the thread identifier of the first thread, the process identifier of the second process, and the thread identifier of the second thread as the in-application link information to the link accounting center.

[0063] The link accounting center can add the identifier of server 10, the process identifier of the second process, and the thread identifier of the second thread to the target link tracing information according to the identifier of server 10, the process identifier of the first process, and the thread identifier of the first thread. Specifically, the link accounting center can match the identifier of server 10, the process identifier of the first process, and the thread identifier of the first thread as a triple in the target link tracing information, that is, determine whether the target link tracing information contains the identifier of server 10, the process identifier of the first process, and the thread identifier of the first thread. If it contains, it is a match; if it does not contain, it is a mismatch. When the link accounting center matches the identifier of server 10, the process identifier of the first process, and the thread identifier of the first thread in the target link tracing information, it can add the identifier of server 10, the process identifier of the second process, and the thread identifier of the second thread to the target link tracing information.

[0064] In this way, the first link tracking module can more accurately determine the in-application link information of the first request within the first application and report it to the link accounting center. The link accounting center can collaborate with the first link tracking module to add the in-application link information to the target link tracking information to obtain more accurate and complete link tracking information.

[0065] In some optional embodiments, the third mount point may be a third function in the network subsystem for managing inter-process communication, and the third function may be used to: respond to an inter-process call request initiated by a third thread in a third process in the first application to the second application due to processing a first request, and establish an inter-process communication connection between the third thread in the third process in the first application and the fourth thread in the fourth process in the second application.

[0066] The third process refers to the process in which the first application is currently located, which may be the first process mentioned above or the second process mentioned above, which may be determined by whether a process switch occurs in the previous step. For example, if no process switch occurs in the previous step, the third process may be the first process; if a process switch occurs in the previous step, the third process may be the second process. The third thread is a thread in the third process used to process the first request or perform operations related to the first request.

[0067] The addition of "first" and "second" before the application is only used to distinguish the two applications, and does not limit the type, location, order, etc. of the applications. The second application can be located on the current server where the first application is located, or on other servers, which is not limited in this embodiment.

[0068] Among them, the fourth process refers to the process on the second application that establishes an inter-process communication connection with the first application, and the fourth thread refers to the thread in the fourth process that is responsible for processing the first request or performing operations related to the first request. This thread needs to establish an inter-process communication connection with the third thread to facilitate the flow of the first request between applications.

[0069] That is, when the third thread in the third process of the first application processes the first request, it may need to use other processes on other applications to process the first request or need other processes on other applications to provide corresponding services for processing the first request. In this case, the third thread may initiate an inter-process call request to the second application due to processing the first request to request to call the relevant process / thread on the second application to process the first request or provide corresponding services. The third function may respond to the inter-process call request and establish an inter-process communication connection between the third thread in the third process of the first application and the fourth thread in the fourth process of the second application. After the inter-process communication connection is established, the corresponding inter-process call can be made between the first application and the second application.

[0070] Accordingly, when the first link tracing module obtains the inter-application link information between the first application and the second application for the first request and reports it to the link accounting center, it can obtain the associated information of the inter-process communication connection from the third function. The associated information is used to describe the communication association relationship established between the first application and the second application, and at least includes the process ID of the third process and the thread ID of the third thread, and may also include other information. The other information includes, but is not limited to, at least one of the following: the process ID of the fourth process, the thread ID of the fourth thread, and the identification information of the request sent to the second application.

[0071] After that, the first link tracing module can report the identification of server 10 and the associated information as the inter-application link information to the link accounting center. The link accounting center can add the other information in the associated information to the target link tracing information according to the identification of server 10, the process ID of the third process, and the thread ID of the third thread. Specifically, the link accounting center can match the identification of server 10, the process ID of the third process, and the thread ID of the third thread as a triple in the target link tracing information, that is, determine whether the target link tracing information contains the identification of server 10, the process ID of the third process, and the thread ID of the third thread. If it contains, it is a match; if it does not contain, it is a mismatch. When the link accounting center matches the identification of server 10, the process ID of the third process, and the thread ID of the third thread in the target link tracing information, it can add the other information in the associated information except the identification of server 10, the process ID of the third process, and the thread ID of the third thread to the target link tracing information.

[0072] It should be noted that the types of inter-process call requests are different when the second application is on different servers. For example, when the second application is on the current server where the first application is located, the inter-process call request is a local inter-process call request; when the second application is on other servers, the first application needs to establish an inter-process communication connection with the second application across servers, that is, the inter-process call request is a remote inter-process call request. In addition, the associated information of the inter-process communication connection obtained from the third function is different when the server where the second application is located and the type of the inter-process call request are different.

[0073] Based on this, the following will combine Figure 5 and Figure 6 to illustrate the above two cases of "the second application is on the current server 10 where the first application is located" and "the second application is on other servers 20". Figure 6 The server 20 is simplified, and the architecture of the server 20 is not limited. The architecture of the server 20 can be the same as or similar to the architecture of the server 10, and this embodiment does not make any restrictions.

[0074] Case 1, asFigure 5 As shown, when the second application is on the current server where the first application is located, that is, the first application and the second application are on the same server, the first link tracing module may also have a fourth mount point set in the file system. Here, the file system is a system in a computer for naming files and logically storing and retrieving the placed files. The file system can provide local shared files to support different application threads to read and write in the local shared files. That is to say, data between different applications can be exchanged in kernel mode with the help of the file system. In addition, the file system can also provide the name of the local shared file and the file offset written by the thread in the local shared file, where the file offset is used to describe the position when the thread reads or writes in the local shared file.

[0075] Based on this, the third function can be specifically used to: when the inter-process call request is a local inter-process call request, write the data of the third thread into the local shared file for the fourth thread to read the data from the local shared file. During this read and write process, the read and write operations in the local shared file can trigger the fourth mount point.

[0076] Correspondingly, when the first link tracing module obtains the association information of the inter-process communication connection from the third function, it can be achieved in the following way:

[0077] When the fourth mount point is triggered by a write operation, the first link tracing module can obtain the process ID of the third process, the thread ID of the third thread, the name of the local shared file, and the first file offset written by the third thread in the local shared file from the third function. When the fourth mount point is triggered by a read operation, the first link tracing module can obtain the process ID of the fourth process, the thread ID of the fourth thread, the name of the local shared file, and the second file offset read by the fourth thread from the local shared file from the third function.

[0078] Based on the above steps, the first link tracing module can use the process ID of the third process, the thread ID of the third thread, the process ID of the fourth process, and the thread ID of the fourth thread as associated information according to the name of the local shared file, the first file offset, and the second file offset. Specifically, if the name of the local shared file is the same and the first file offset and the second file offset are the same, it can be shown that the local shared file for the third thread to write data and the local shared file for the fourth thread to read data are the same file, and the position where the third thread writes in the local shared file and the position where the fourth thread reads from the local shared file are the same, without position offset. In this case, the first link tracing module can use the process ID of the third process, the thread ID of the third thread, the process ID of the fourth process, and the thread ID of the fourth thread as associated information. If the name of the local shared file is different, the local shared file for the third thread to write data and the local shared file for the fourth thread to read data can be unified to ensure that the shared file written by the third thread and read by the fourth thread is the same file.

[0079] If the first file offset and the second file offset are not the same, it can be shown that the position where the third thread writes in the local shared file and the position where the fourth thread reads from the local shared file are different, with a position offset. In this case, the first link tracing module can align the position where the third thread writes in the local shared file and the position where the fourth thread reads from the local shared file. After alignment, the process ID of the third process, the thread ID of the third thread, the process ID of the fourth process, and the thread ID of the fourth thread can be used as the above-mentioned associated information.

[0080] Case 2: As Figure 6 shown, when the second application is on other servers, that is, the first application and the second application are on different servers, the third function can be specifically used for: when the inter-process call request is a remote inter-process call request, generating a second request according to the inter-process call request and sending the second request to the second application. The second request can be understood as a remote request that can be transmitted between different servers. The third function can generate different types of requests according to different request protocols. Different requests have different request headers. For example, if the request protocol is HTTP, an HTTP request can be generated according to this protocol; if the request protocol is TCP, a TCP request can be generated according to this protocol; if the request protocol is the File Transfer Protocol (FTP), an FTP request can be generated according to this protocol. When the third function generates the second request, it can determine the identification information of the second request. The identification information of the second request includes, but is not limited to, at least one of the following: source address, destination address, and request sequence number.

[0081] Accordingly, when the first link tracing module obtains the association information of the inter-process communication connection from the third function, it specifically is used for: obtaining the process ID of the third process, the thread ID of the third thread, and the identification information of the second request from the third function as the association information.

[0082] In this way, the first link tracing module can more accurately determine the inter-application link information between the first application and the second application and report it to the link accounting center. The inter-application link information is more comprehensive, and it can be not only the link information between different server applications but also the link information between cross-server applications. The link accounting center can cooperate with the first link tracing module to add the intra-application link information to the target link tracing information to obtain more accurate and complete link tracing information.

[0083] In addition to the cases where the first application and the second application in the foregoing embodiments are located on the same server and the cases where the first application and the second application are located on different servers, there may also be the following situation: The first request first passes through two applications on the same server and then goes to the third application on another server. This situation can be regarded as a combination of the first two situations, as Figure 7 shown. Figure 7 The tracing process between different applications on the same server can be referred to the embodiment shown in Figure 5 shown, Figure 7 The tracing process between different applications across servers can be referred to the embodiment shown in Figure 6 shown, which will not be elaborated here.

[0084] In some alternative embodiments, as Figure 8 shown, the link tracing device may further include: a second link tracing module located in the user space. Different from the first link tracing module in the kernel space, the first link tracing module is used to perform link tracing on the flow of the first request in the kernel space, while the second link tracing module is used to perform link tracing on the flow of the first request in the user space.

[0085] The user space may further include: a request processing system and a coroutine management system. Among them, a coroutine is different from a process and a thread. It is a feature provided by the programming language (the switching method and process between coroutines can be determined by the programmer). It is a user-space operation and can also be understood as different functions in a thread, and these functions can be switched quickly with each other.

[0086] Among them, the request processing system includes a standard library for processing protocol requests, which is used to process the requests received in the user space. Optionally, if the programming language is the Go language, this standard library can be the net / http library.

[0087] The coroutine management system includes a coroutine creation function and a coroutine switching function, which are used to create, transform, and monitor the status of user-mode coroutines. The second link tracing module can set a fifth mount point in the request processing system in user mode for processing the first request; and set a sixth mount point in the coroutine management system in user mode for monitoring coroutine switching within the application. Optionally, the second link tracing module can mount the fifth mount point and the sixth mount point to user mode through uprobe (short for uprobes), where uprobe is a performance tool in the Linux kernel used to track function calls or instruction executions in an application for performance analysis and debugging.

[0088] Based on this, when the fifth mount point is triggered, the second link tracing module can obtain the ID of the first coroutine responsible for processing the first request in the first application and report the ID of the first coroutine to the link accounting center for the link accounting center to write the ID of the first coroutine into the target link tracing information.

[0089] When the sixth mount point is triggered, the second link tracing module can obtain the coroutine switching information of the first request within the first application and report it to the link accounting center for the link accounting center to write the coroutine switching information into the target link tracing information.

[0090] In this way, the second link tracing module in user mode can perform link tracing on user-mode coroutines, thereby collaborating with the link accounting center to write the relevant information of the coroutines into the target link tracing information to obtain more complete link tracing information.

[0091] Optionally, the link accounting center can include a centralized link accounting center and a local link accounting center. Among them, the centralized link accounting center can be understood as the link accounting center in the cloud; the local link accounting center refers to the accounting center located on each server locally. Among them, the local link accounting center can be used to store various link information reported by the second link tracing module. The centralized link accounting center can be used to store various link information reported by the first link tracing module. That is to say, the link information obtained by path tracing of user mode can be stored in the local link accounting center, and the link information obtained by path tracing of kernel mode can be stored in the centralized link accounting center. Optionally, when the storage capacity of the local link accounting center reaches a preset threshold, the local link accounting center can upload the stored link information of user mode to the centralized link accounting center to relieve the storage pressure of the local link accounting center.

[0092] The following will take Figure 9 as an example. Taking the first request as an HTTP request, the link tracing method of this application will be further described in combination with the actual application scenario. In Figure 9Among them, taking an application implemented based on the Go language as an example, the application implemented based on the Go language supports the concept of coroutines, and the coroutine switching is completed in the user space. Based on this, Figure 9 the shown link tracing device not only includes a first link tracing module in the kernel space, but also includes a second link tracing module in the user space. In Figure 9 it, taking the first link tracing module as a kernel-space eBPF module and the second link tracing module as a user-space eBPF module as an example for illustration.

[0093] See Figure 9 ① in it. When receiving an HTTP request, the kernel-space eBPF module can read the Tcp (Transmission Control Protocol) link number, Seq number (i.e., sequence number), source IP address sIp, destination IP address dIp (i.e., the IP address of the current server), and the identifier of the current application (i.e., AppId) of the HTTP request as the identification information of the HTTP request.

[0094] See Figure 9 ② in it. The kernel-space eBPF module can query the TraceId (link identifier) corresponding to the HTTP request from the centralized link accounting center. The kernel-space eBPF module generates a data structure of the link, that is, <AppId, sIp, dIp, TcpId, Seq>-TraceId.

[0095] See Figure 9 ③ in it. The kernel-space eBPF module will provide the TraceId corresponding to the HTTP request to the user-space eBPF module.

[0096] See Figure 9 ④ in it. When any one of the multiple coroutines in the user space (such as the i coroutine) starts to process the HTTP request, the user-space eBPF module can record the ID of the current coroutine (abbreviated as GoId). Assume that the GoId of the i coroutine is i, and generate the following data structure, which is recorded in the local link accounting center:

[0097] {

[0098] ParentGoId:

[0099] GoId: i

[0100] TraceId: xxx

[0101] SpanId: xxx

[0102] }

[0103] See Figure 9In ⑤, when a coroutine switch occurs, assuming that another coroutine (for example, coroutine j) among the multiple coroutines in user state continues to process the first request, the user state ebpf module can continue to record the GoId of the current coroutine j and generate the following data structure, where coroutine i is the parent coroutine of coroutine j, which is reflected in the following data structure and recorded in the local link accounting center:

[0104] {

[0105] ParentGoId:i

[0106] GoId: j

[0107] TraceId: xxx

[0108] SpanId: xxx

[0109] }

[0110] See also Figure 9 ⑥, when another coroutine (such as k coroutine) in the user-state multiple coroutines initiates an HTTP remote call to an application in another server, k coroutine can generate a new HTTP request, and the user-state ebpf module records the TCP link number, Seq number, source IP address sIp (i.e., the IP address of the current server), destination IP address dIp, and target application AppId of the new HTTP request as the identification information of the new HTTP request. That is, it is similar to the following data structure<AppId,sIp,dIp,TcpId,Seq> -TraceId, and write the data structure to the centralized link accounting center through the kernel-mode ebpf module, so that the link tracking device on the server where the target application is located can continue to track the new HTTP request. The new HTTP request belongs to the same link as the previous HTTP request and corresponds to the same TraceId.

[0111] The SpanId in the above data structure represents the span identifier in the link tracing process, TraceId represents the entire link view of the HTTP request in the distributed application system, and SpanId represents the view of the HTTP request within different applications in the entire link. Optionally, SpanId can be passed downstream together with TraceId.

[0112] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 31 to 33 can be device A; for another example, the execution subject of steps 31 and 32 can be device A, and the execution subject of step 33 can be device B; and so on.

[0113] In addition, in some of the processes described in the above embodiments and the accompanying drawings, a plurality of operations appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order in which they appear herein or may be executed in parallel. The serial numbers of the operations, such as 31, 32, etc., are only used to distinguish each different operation, 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 such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., do not represent a sequence, and do not limit that "first" and "second" are of different types.

[0114] Figure 11 FIG. 4 is a schematic structural diagram of a link tracing device provided in another exemplary embodiment of the present application. The link tracing device is deployed on any server in the distributed application system. The device includes: a first link tracing module 1001 in the kernel state, and the first link tracing module sets mount points at least in the network subsystem and the process management system in the kernel state.

[0115] Wherein, the first link tracing module 1001 is configured to: when a first mount point for monitoring whether a first request is received in the network subsystem is triggered, obtain information of a first application on the server responsible for processing the first request as entry link information and report it to the link accounting center, so that the link accounting center adds the entry link information to the target link tracing information corresponding to the first request; when a second mount point for monitoring process / thread switching within an application in the process management system is triggered, obtain in-application link information of the first request within the first application and report it to the link accounting center, so that the link accounting center adds the in-application link information to the target link tracing information; when a third mount point for monitoring inter-application process communication in the network subsystem is triggered, obtain inter-application link information of the first request between the first application and a second application and report it to the link accounting center, so that the link accounting center adds the inter-application link information to the target link tracing information.

[0116] Further optionally, the first mounting point is the first function in the network subsystem for managing communication connections. The first function is used to monitor each port that has been enabled on the network subsystem, and when a first request is received on a target port, report the first request to a first application according to the destination address of the first request and the port number of the target port, so that a first thread in a first process in the first application processes the first request. Correspondingly, when the first link tracing module 1001 obtains information of the first application responsible for processing the first request on the server as the entry link information, it specifically is used for: obtaining the identification information of the first request, the process ID of the first process, and the thread ID of the first thread from the first function; and reporting the identification of the server, the process ID of the first process, and the thread ID of the first thread as the entry link information to the link accounting center according to the identification information of the first request.

[0117] Further optionally, when the first link tracing module 1001 reports the identification of the server, the process ID of the first process, and the thread ID of the first thread as the entry link information to the link accounting center according to the identification information of the first request, it specifically is used for: reporting the identification information of the first request to the link accounting center to request to obtain a target tracing identifier corresponding to the target link to which the first request belongs; if receiving the target tracing identifier returned by the link accounting center, reporting the target tracing identifier, the identification of the server, the process ID of the first process, and the thread ID of the first thread to the link accounting center, so that the link accounting center adds the identification of the server, the process ID of the first process, and the thread ID of the first thread to the target link tracing information according to the target tracing identifier.

[0118] Further optionally, the first link tracing module 1001 is further used for: if not receiving the target tracing identifier returned by the link accounting center, allocating a target tracing identifier for the first request; and reporting the target tracing identifier, the identification of the server, the process ID of the first process, and the thread ID of the first thread to the link accounting center, so that the link accounting center generates target link tracing information corresponding to the target tracing identifier and adds the identification of the server, the process ID of the first process, and the thread ID of the first thread to the target link tracing information.

[0119] Further optionally, the second mounting point is a second function in the process management system for managing process creation information. The second function is used to respond to a child process creation request of a first process in the first application, create a second process as the child process, and switch the thread processing the first request from the first thread in the first process to the second thread in the second process. Correspondingly, when the first link tracing module 1001 obtains the in-application link information of the first request within the first application and reports it to the link accounting center, it specifically is used for: obtaining the process ID of the first process, the thread ID of the first thread, the process ID of the second process, and the thread ID of the second thread from the second function; reporting the identifier of the server, the process ID of the first process, the thread ID of the first thread, the process ID of the second process, and the thread ID of the second thread as the in-application link information to the link accounting center, so that the link accounting center can add the identifier of the server, the process ID of the second process, and the thread ID of the second thread to the target link tracing information according to the identifier of the server, the process ID of the first process, and the thread ID of the first thread.

[0120] Further optionally, the third mounting point is a third function in the network subsystem for managing inter-process communication. The third function is used to respond to an inter-process call request initiated by a third thread in a third process in the first application to the second application due to processing the first request, and establish an inter-process communication connection between the third thread in the third process in the first application and the fourth thread in the fourth process in the second application. Correspondingly, when the first link tracing module 1001 obtains the inter-application link information of the first request between the first application and the second application and reports it to the link accounting center, it specifically is used for: obtaining the association information of the inter-process communication connection from the third function, where the association information at least includes the process ID of the third process and the thread ID of the third thread; reporting the identifier of the server and the association information as the inter-application link information to the link accounting center, so that the link accounting center can add other information in the association information to the target link tracing information according to the identifier of the server, the process ID of the third process, and the thread ID of the third thread.

[0121] Further optionally, the first link tracing module further has a fourth mount point set in the file management system; the third function is specifically configured to: when the inter-process call request is a local inter-process call request, write the data of the third thread into a local shared file for the fourth thread to read the data from the local shared file, and the read and write operations in the local shared file trigger the fourth mount point; correspondingly, when the first link tracing module 1001 obtains the association information of the inter-process communication connection from the third function, it is specifically configured to: when the fourth mount point is triggered by a write operation, obtain the process ID of the third process, the thread ID of the third thread, the name of the local shared file, and the first file offset written by the third thread in the local shared file from the third function; and when the fourth mount point is triggered by a read operation, obtain the process ID of the fourth process, the thread ID of the fourth thread, the name of the local shared file, and the second file offset read by the fourth thread from the local shared file from the third function; and use the process ID of the third process, the thread ID of the third thread, the process ID of the fourth process, and the thread ID of the fourth thread as the association information according to the name of the local shared file, the first file offset, and the second file offset.

[0122] Further optionally, the third function is specifically configured to: when the inter-process call request is a remote inter-process call request, generate a second request according to the inter-process call request and send the second request to the second application; correspondingly, when the first link tracing module 1001 obtains the association information of the inter-process communication connection from the third function, it is specifically configured to: obtain the process ID of the third process, the thread ID of the third thread, and the identification information of the second request from the third function as the association information.

[0123] Further optionally, the link tracing device further includes: a second link tracing module 1002 located in the user state, and the second link tracing module 1002 has mount points set in the request processing system and the coroutine management system in the user state; the second link tracing module 1002 is further configured to: when the fifth mount point for processing the first request in the request processing system is triggered, obtain the ID of the first coroutine responsible for processing the first request in the first application and report the ID of the first coroutine to the link accounting center for the link accounting center to write the ID of the first coroutine into the target link tracing information; when the sixth mount point for monitoring the coroutine switch within the application in the coroutine management system is triggered, obtain the coroutine switch information of the first request within the first application and report it to the link accounting center for the link accounting center to write the coroutine switch information into the target link tracing information.

[0124] Further optionally, the link accounting center includes a centralized link accounting center and a local link accounting center; wherein, the local link accounting center is used to store various link information reported by the second link tracing module; the centralized link accounting center is used to store various link information reported by the first link tracing module.

[0125] The internal functions and structures of a link tracing device are described above. As Figure 11 shown, in practice, this link tracing device can be implemented as an electronic device, including: a memory 1101 and a processor 1102. It should be noted that the electronic device can be any server in a distributed application system. The electronic device may include a first link tracing module in the kernel state, and the first link tracing module sets mount points at least in the network subsystem and the process management system in the kernel state.

[0126] The memory 1101 is used to store computer programs and can be configured to store various other data to support operations on the computing platform. Examples of these data include instructions for any application program or method for operating on the computing platform, contact data, phone book data, messages, pictures, videos, etc.

[0127] The memory 1101 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.

[0128] The processor 1102 is coupled to the memory 1101 and is used to execute the computer program in the memory 1101 for: when the first mount point for monitoring whether a first request is received in the network subsystem is triggered, obtaining information of a first application responsible for processing the first request on the server as entry link information and reporting it to the link accounting center, so that the link accounting center adds the entry link information to the target link tracing information corresponding to the first request; when the second mount point for monitoring application-internal process / thread switching in the process management system is triggered, obtaining application-internal link information of the first request within the first application and reporting it to the link accounting center, so that the link accounting center adds the application-internal link information to the target link tracing information; when the third mount point for monitoring inter-application process communication in the network subsystem is triggered, obtaining inter-application link information of the first request between the first application and the second application and reporting it to the link accounting center, so that the link accounting center adds the inter-application link information to the target link tracing information.

[0129] Further optionally, the first mounting point is the first function in the network subsystem for managing communication connections. The first function is used to monitor each port enabled on the network subsystem, and when a first request is received on a target port, report the first request to a first application according to the destination address of the first request and the port number of the target port, so that a first thread in a first process in the first application processes the first request. Correspondingly, when the processor 1102 obtains information of the first application responsible for processing the first request on the server as the entry link information, it specifically is used for: obtaining the identification information of the first request, the process number of the first process, and the thread number of the first thread from the first function; and reporting the identification of the server, the process number of the first process, and the thread number of the first thread to the link accounting center as the entry link information according to the identification information of the first request.

[0130] Further optionally, when the processor 1102 reports the identification of the server, the process number of the first process, and the thread number of the first thread to the link accounting center as the entry link information according to the identification information of the first request, it specifically is used for: reporting the identification information of the first request to the link accounting center to request to obtain a target tracking identifier corresponding to the target link to which the first request belongs; if receiving the target tracking identifier returned by the link accounting center, reporting the target tracking identifier, the identification of the server, the process number of the first process, and the thread number of the first thread to the link accounting center, so that the link accounting center adds the identification of the server, the process number of the first process, and the thread number of the first thread to the target link tracking information according to the target tracking identifier.

[0131] Further optionally, the processor 1102 is further used for: if not receiving the target tracking identifier returned by the link accounting center, allocating a target tracking identifier for the first request; and reporting the target tracking identifier, the identification of the server, the process number of the first process, and the thread number of the first thread to the link accounting center, so that the link accounting center generates target link tracking information corresponding to the target tracking identifier and adds the identification of the server, the process number of the first process, and the thread number of the first thread to the target link tracking information.

[0132] Further optionally, the second mounting point is a second function in the process management system for managing process creation information. The second function is used to respond to a child process creation request of a first process in the first application, create a second process as the child process, and switch the thread processing the first request from the first thread in the first process to the second thread in the second process. Correspondingly, when the processor 1102 obtains the in-application link information of the first request within the first application and reports it to the link accounting center, it specifically is used for: obtaining the process ID of the first process, the thread ID of the first thread, the process ID of the second process, and the thread ID of the second thread from the second function; reporting the identifier of the server, the process ID of the first process, the thread ID of the first thread, the process ID of the second process, and the thread ID of the second thread as the in-application link information to the link accounting center, so that the link accounting center can add the identifier of the server, the process ID of the second process, and the thread ID of the second thread to the target link tracking information according to the identifier of the server, the process ID of the first process, and the thread ID of the first thread.

[0133] Further optionally, the third mounting point is a third function in the network subsystem for managing inter-process communication. The third function is used to respond to an inter-process call request initiated by a third thread in a third process in the first application to the second application due to processing the first request, and establish an inter-process communication connection between the third thread in the third process in the first application and the fourth thread in the fourth process in the second application. Correspondingly, when the processor 1102 obtains the inter-application link information of the first request between the first application and the second application and reports it to the link accounting center, it specifically is used for: obtaining the association information of the inter-process communication connection from the third function, where the association information at least includes the process ID of the third process and the thread ID of the third thread; reporting the identifier of the server and the association information as the inter-application link information to the link accounting center, so that the link accounting center can add other information in the association information to the target link tracking information according to the identifier of the server, the process ID of the third process, and the thread ID of the third thread.

[0134] Further optionally, the first link tracing module further has a fourth mount point set in the file management system; the third function is specifically configured to: when the inter-process call request is a local inter-process call request, write the data of the third thread into a local shared file for the fourth thread to read the data from the local shared file, and the read and write operations in the local shared file trigger the fourth mount point; correspondingly, when the processor 1102 obtains the association information of the inter-process communication connection from the third function, it is specifically configured to: when the fourth mount point is triggered by a write operation, obtain the process ID of the third process, the thread ID of the third thread, the name of the local shared file, and the first file offset written by the third thread in the local shared file from the third function; and when the fourth mount point is triggered by a read operation, obtain the process ID of the fourth process, the thread ID of the fourth thread, the name of the local shared file, and the second file offset read by the fourth thread from the local shared file from the third function; and use the process ID of the third process, the thread ID of the third thread, the process ID of the fourth process, and the thread ID of the fourth thread as the association information according to the name of the local shared file, the first file offset, and the second file offset.

[0135] Further optionally, the third function is specifically configured to: when the inter-process call request is a remote inter-process call request, generate a second request according to the inter-process call request and send the second request to the second application; correspondingly, when the processor 1102 obtains the association information of the inter-process communication connection from the third function, it is specifically configured to: obtain the process ID of the third process, the thread ID of the third thread, and the identification information of the second request from the third function as the association information.

[0136] Further optionally, the electronic device further includes: a second link tracing module located in the user mode, where the second link tracing module has mount points set in the request processing system and the coroutine management system in the user mode; the processor 1102 is further configured to: when a fifth mount point for processing a first request in the request processing system is triggered, obtain the ID of the first coroutine responsible for processing the first request in the first application and report the ID of the first coroutine to the link accounting center for the link accounting center to write the ID of the first coroutine into the target link tracing information; and when a sixth mount point for monitoring coroutine switching within an application in the coroutine management system is triggered, obtain the coroutine switching information of the first request within the first application and report it to the link accounting center for the link accounting center to write the coroutine switching information into the target link tracing information.

[0137] Further optionally, the link accounting center includes a centralized link accounting center and a local link accounting center; wherein, the local link accounting center is used to store various link information reported by the second link tracing module; the centralized link accounting center is used to store various link information reported by the first link tracing module.

[0138] Further, as Figure 11 shown, the electronic device further includes: communication component 1103, power supply component 1104, and other components. Figure 11 Only some components are schematically shown in Figure 11 the figure, and it does not mean that the electronic device only includes

[0139] Among them, the communication component 1103 is configured to facilitate communication between the device where the communication component is located and other devices in a wired or wireless manner. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, or 5G, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can be implemented based on near field communication (NFC) technology, radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0140] Among them, the power supply component 1104 provides power for various components of the device where the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device where the power supply component is located.

[0141] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed, it can implement each step executable by the electronic device in the above method embodiment.

[0142] Correspondingly, an embodiment of the present application further provides a computer program product, including a computer program / instructions, and when the computer program / instructions are executed by a processor, each step executable by the electronic device is executed.

[0143] In this embodiment, a link tracing module is set in the kernel state of the server. By setting mount points for the link tracing module in the network subsystem and process management system in the kernel state, and cooperating with the link accounting center outside the server to trace the links when a request enters an application, within the application, and between applications, the distributed application system will not be intervened during the entire process of link tracing. Moreover, the obtained link tracing information is relatively complete. It can not only trace the situation of a request entering an application, but also trace the process / thread switching process within the application and the process communication process between different applications. The technical solution of this application does not require additional communication protocol adaptation for requests, nor does it require modification of requests, and it will not bring intrusion risks to distributed applications.

[0144] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, compact disc read-only memory (CD-ROM), optical memory, etc.) containing computer-usable program code.

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

[0146] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0147] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 steps of the functions specified in one block or multiple blocks.

[0148] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), an input / output interface, a network interface, and a memory.

[0149] The memory may include non-permanent memory in the computer-readable medium, in the form of random access memory (Random Access Memory, RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.

[0150] The computer-readable medium includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of the computer's storage medium include, but are not limited to, phase-change random access memory (Phase-change Random Access Memory, PRAM), static random access memory (SRAM), dynamic random access memory (Dynamic Random Access Memory, DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory, or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (Digital Video Disc, DVD), or other optical storage, magnetic cassette tapes, magnetic disk storage, or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. As defined herein, the computer-readable medium does not include transitory computer-readable media, such as modulated data signals and carrier waves.

[0151] It should also be noted that the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, commodity or device comprising a series of elements not only includes those elements but also other elements not expressly listed, or elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising the element.

[0152] The above are only embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. A link tracing method, characterized in that, A link tracing device applied to any server in a distributed application system. The link tracing device includes a first link tracing module in the kernel mode, and the first link tracing module sets mounting points at least in the network subsystem and the process management system in the kernel mode. The method includes: When a first mounting point for monitoring whether a first request is received in the network subsystem is triggered, obtain information of a first application responsible for processing the first request on the server as entry link information and report it to a link accounting center, so that the link accounting center adds the entry link information to target link tracing information corresponding to the first request; When a second mounting point for monitoring process / thread switching within an application in the process management system is triggered, obtain in-application link information of the first request within the first application and report it to the link accounting center, so that the link accounting center adds the in-application link information to the target link tracing information; When a third mounting point for monitoring inter-application process communication in the network subsystem is triggered, obtain inter-application link information of the first request between the first application and a second application and report it to the link accounting center, so that the link accounting center adds the inter-application link information to the target link tracing information.

2. The method according to claim 1, wherein The first mounting point is a first function for managing communication connections in the network subsystem. The first function is used to monitor each port that has been opened on the network subsystem, and when a first request is received on a target port, report the first request to a first application according to the destination address of the first request and the port number of the target port, so that a first thread in a first process in the first application processes the first request; Correspondingly, obtaining information of a first application responsible for processing the first request on the server as entry link information includes: obtaining identification information of the first request, the process ID of the first process, and the thread ID of the first thread from the first function; According to the identification information of the first request, report the identification of the server, the process ID of the first process, and the thread ID of the first thread to the link accounting center as entry link information.

3. The method according to claim 2, wherein Reporting the identification of the server, the process ID of the first process, and the thread ID of the first thread to the link accounting center as entry link information according to the identification information of the first request includes: Report the identification information of the first request to the link accounting center to request to obtain a target tracing identifier corresponding to a target link to which the first request belongs; If the target tracing identifier returned by the link accounting center is received, report the target tracing identifier, the identification of the server, the process ID of the first process, and the thread ID of the first thread to the link accounting center, so that the link accounting center adds the identification of the server, the process ID of the first process, and the thread ID of the first thread to the target link tracing information according to the target tracing identifier.

4. The method according to claim 3, wherein It further includes: If the target tracking identifier returned by the link accounting center is not received, allocate a target tracking identifier for the first request; Report the target tracking identifier, the identifier of the server, the process ID of the first process, and the thread ID of the first thread to the link accounting center, so that the link accounting center can generate target link tracking information corresponding to the target tracking identifier and add the identifier of the server, the process ID of the first process, and the thread ID of the first thread to the target link tracking information.

5. The method according to claim 1, characterized in that, The second mount point is the second function in the process management system for managing process creation information. The second function is used to respond to the sub-process creation request of the first process in the first application, create a second process as the sub-process, and switch the thread processing the first request from the first thread in the first process to the second thread in the second process; Accordingly, obtaining the in-application link information of the first request within the first application and reporting it to the link accounting center includes: Obtain the process ID of the first process, the thread ID of the first thread, the process ID of the second process, and the thread ID of the second thread from the second function; Report the identifier of the server, the process ID of the first process, the thread ID of the first thread, the process ID of the second process, and the thread ID of the second thread as the in-application link information to the link accounting center, so that the link accounting center can add the identifier of the server, the process ID of the second process, and the thread ID of the second thread to the target link tracking information according to the identifier of the server, the process ID of the first process, and the thread ID of the first thread.

6. The method according to claim 1, wherein The third mount point is the third function in the network subsystem for managing inter-process communication. The third function is used to respond to the inter-process call request initiated by the third thread in the third process of the first application to the second application due to processing the first request, and establish an inter-process communication connection between the third thread in the third process of the first application and the fourth thread in the fourth process of the second application; Accordingly, obtaining the inter-application link information of the first request between the first application and the second application and reporting it to the link accounting center includes: obtaining the association information of the inter-process communication connection from the third function, and the association information at least includes the process ID of the third process and the thread ID of the third thread; Report the identifier of the server and the association information as the inter-application link information to the link accounting center, so that the link accounting center can add other information in the association information to the target link tracking information according to the identifier of the server, the process ID of the third process, and the thread ID of the third thread.

7. The method according to claim 6, characterized in that The first link tracing module also has a fourth mount point set in the file system; specifically, the third function is used to: when the inter-process call request is a local inter-process call request, write the data of the third thread into a local shared file for the fourth thread to read the data from the local shared file, and the read and write operations in the local shared file trigger the fourth mount point; Accordingly, obtaining the association information of the inter-process communication connection from the third function includes: When the fourth mount point is triggered by a write operation, obtaining the process ID of the third process, the thread ID of the third thread, the name of the local shared file, and the first file offset written by the third thread in the local shared file from the third function; And When the fourth mount point is triggered by a read operation, obtaining the process ID of the fourth process, the thread ID of the fourth thread, the name of the local shared file, and the second file offset read by the fourth thread from the local shared file from the third function; Based on the name of the local shared file, the first file offset, and the second file offset, taking the process ID of the third process, the thread ID of the third thread, the process ID of the fourth process, and the thread ID of the fourth thread as the association information.

8. The method according to claim 6, wherein Specifically, the third function is used to: when the inter-process call request is a remote inter-process call request, generate a second request according to the inter-process call request and send the second request to the second application; Accordingly, obtaining the association information of the inter-process communication connection from the third function includes: obtaining the process ID of the third process, the thread ID of the third thread, and the identification information of the second request from the third function as the association information.

9. The method according to any one of claims 1 to 8, characterized in that, The link tracing device further includes: a second link tracing module in the user state, where the second link tracing module has mount points set in the request processing system and the coroutine management system in the user state; the method further includes: When the fifth mount point for processing the first request in the request processing system is triggered, obtaining the ID of the first coroutine responsible for processing the first request in the first application and reporting the ID of the first coroutine to the link accounting center for the link accounting center to write the ID of the first coroutine into the target link tracing information; When the sixth mount point for monitoring the coroutine switch within the application in the coroutine management system is triggered, obtaining the coroutine switch information of the first request within the first application and reporting it to the link accounting center for the link accounting center to write the coroutine switch information into the target link tracing information.

10. The method according to claim 9, wherein The link accounting center includes a centralized link accounting center and a local link accounting center; wherein, the local link accounting center is used to store various link information reported by the second link tracing module; the centralized link accounting center is used to store various link information reported by the first link tracing module.

11. A link tracing device, characterized in that, The link tracing device is deployed on any server in the distributed application system. The device includes: a first link tracing module in the kernel state, and the first link tracing module sets mount points at least in the network subsystem and the process management system in the kernel state; Wherein, the first link tracing module is used for: when a first mount point for monitoring whether a first request is received in the network subsystem is triggered, obtaining information of a first application responsible for processing the first request on the server as entry link information and reporting it to the link accounting center, so that the link accounting center adds the entry link information to the target link tracing information corresponding to the first request; When a second mount point for monitoring process / thread switching within an application in the process management system is triggered, obtaining in-application link information of the first request within the first application and reporting it to the link accounting center, so that the link accounting center adds the in-application link information to the target link tracing information; When a third mount point for monitoring inter-application process communication in the network subsystem is triggered, obtaining inter-application link information of the first request between the first application and a second application and reporting it to the link accounting center, so that the link accounting center adds the inter-application link information to the target link tracing information.

12. The device according to claim 11, wherein, It further includes: A second link tracing module in the user state, and the second link tracing module sets mount points in the request processing system and the coroutine management system in the user state; The second link tracing module is used for: When a fifth mount point for processing a first request in the request processing system is triggered, obtaining the ID of a first coroutine responsible for processing the first request in the first application, and reporting the ID of the first coroutine to the link accounting center, so that the link accounting center writes the ID of the first coroutine into the target link tracing information; When a sixth mount point for monitoring coroutine switching within an application in the coroutine management system is triggered, obtaining coroutine switching information of the first request within the first application and reporting it to the link accounting center, so that the link accounting center writes the coroutine switching information into the target link tracing information.

13. An electronic device, characterized in that, It includes: A memory and a processor; the memory is used to store one or more computer instructions; the processor is used to execute the one or more computer instructions to: execute the steps in the method according to any one of claims 1-10.

14. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it causes the processor to be able to implement the steps in the method according to any one of claims 1-10.

15. A computer program product, characterized in that, It includes a computer program / instructions, and when the computer program / instructions are executed by the processor, it executes the method according to any one of claims 1-10.