Service link tracing method, device, storage medium and program product
Patent Information
- Application Number
- CN202211136211.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-19
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2042-09-19
AI Technical Summary
[0005]本申请提供一种服务链路追踪方法、设备、存储介质及程序产品,用以解决现有技术无法简便、高效地实现服务器的链路追踪的问题
[0019]本申请提供的服务链路追踪方法、设备、存储介质及程序产品,首先根据在服务调用时获取的各个目标应用调用各个目标服务器的目标IP地址,通过映射关系,获取相应的目标服务器标识;然后针对各个所述目标应用,通过存储系统Redis,将各个所述目标服务器标识存储到位图bitmap数据结构中,生成目标bitmap;根据目标bitmap中的比特索引以及所述比特索引对应的存储值,确定服务链路,用以支持定位服务链路中的各个服务器。因此,通过获取服务调用的服务器的IP地址对应的服务器标识,然后基于Redis,建立服务器标识与bitmap数据结构的关系,即可实现服务器的链路追踪,无需关注服务间的调用关系,实现上简单可行,高效易用。
Smart Images

Figure CN115543668B_ABST
Abstract
Description
Technical Field
[0001] This application relates to technologies in the field of financial technology or other related fields, and in particular to a service link tracing method, device, storage medium and program product. Background Technology
[0002] With the rapid development of internet services, software architecture has evolved from monolithic services to distributed services, becoming exceptionally complex. To handle high-concurrency requests from massive numbers of users, the deployment of system applications must be distributed. A high-concurrency system with massive users often involves hundreds or even thousands of servers, and also involves service calls between multiple applications, thus constituting a complex distributed service system.
[0003] However, based on the aforementioned distributed service system, if a service request is abnormal, it is impossible to quickly locate which specific server is handling the error. Checking each server individually using logs is extremely inefficient. To address this inefficiency, existing distributed tracing systems are typically used for troubleshooting.
[0004] However, existing distributed tracing systems are either open-source or closed-source, with numerous limitations. Some require tracing the service paths (i.e., the path a request takes through all services, requiring a clear understanding of each request's specific service path and the inter-service call relationships) and labeling (i.e., spans, which identify the parent-child relationship when a service in the tracing calls two other services; parent nodes at the same level have the same parentId, while child nodes have different spanIds, with ascending spanIds indicating the order of service calls). With hundreds, thousands, or even tens of thousands of services, the workload for tracing and configuring these systems is enormous. Furthermore, existing distributed tracing systems are quite complex and large, with high complexity in deployment and usage. Therefore, current technologies cannot easily and efficiently implement server-side distributed tracing. Summary of the Invention
[0005] This application provides a service link tracing method, device, storage medium, and program product to solve the problem that existing technologies cannot easily and efficiently implement server link tracing.
[0006] On the one hand, this application provides a service link tracing method, including:
[0007] Based on the target IP addresses of each target application calling each target server obtained during service invocation, the corresponding target server identifier is obtained through the mapping relationship;
[0008] For each of the target applications, the target server identifiers are stored in a bitmap data structure using the Redis storage system to generate a target bitmap;
[0009] Based on the bit index in the target bitmap and the storage value corresponding to the bit index, the service link is determined to support the location of each server in the service link.
[0010] On the other hand, this application provides a service link tracing device, including:
[0011] The acquisition module is used to obtain the corresponding target server identifier based on the target IP address of each target application calling each target server obtained during service invocation and through the mapping relationship.
[0012] The storage module is used to store the identifiers of each target server in a bitmap data structure through the storage system Redis for each target application, thereby generating a target bitmap.
[0013] The link determination module is used to determine the service link based on the bit index in the target bitmap and the storage value corresponding to the bit index, so as to support the location of each server in the service link.
[0014] In another aspect, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0015] The memory stores computer-executed instructions;
[0016] The processor executes computer execution instructions stored in the memory to implement the method as described in any one of the aspects.
[0017] In another aspect, this application provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, are used to implement the method as described in any one aspect.
[0018] On the other hand, a computer program product includes a computer program that, when executed by a processor, implements the method as described in any one of the aspects.
[0019] The service link tracing method, device, storage medium, and program product provided in this application first obtains the target IP addresses of each target server called by each target application during service invocation, and then obtains the corresponding target server identifiers through mapping relationships. Next, for each target application, the target server identifiers are stored in a bitmap data structure using the Redis storage system to generate a target bitmap. Based on the bit indexes in the target bitmaps and the corresponding stored values, the service link is determined to support the location of each server in the service link. Therefore, by obtaining the server identifiers corresponding to the IP addresses of the servers calling the service, and then establishing the relationship between the server identifiers and the bitmap data structure based on Redis, server link tracing can be achieved without needing to concern itself with the call relationships between services. This approach is simple, feasible, efficient, and easy to use. Attached Figure Description
[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0021] Figure 1 A schematic diagram illustrating a scenario for the service link tracing method provided in this application embodiment;
[0022] Figure 2 A flowchart illustrating the service link tracing method provided in this application embodiment;
[0023] Figure 3 This is a schematic diagram of the bitmap data structure provided in the embodiments of this application;
[0024] Figure 4 A schematic diagram illustrating a service link tracing method provided in another embodiment of this application;
[0025] Figure 5 This is a schematic diagram of a bitmap data structure provided in another embodiment of this application;
[0026] Figure 6 A schematic diagram illustrating the server mapping configuration provided in an embodiment of this application;
[0027] Figure 7 A schematic diagram illustrating a service link tracing method provided in another embodiment of this application;
[0028] Figure 8 This is a schematic diagram of the structure of the service link tracing device provided in the embodiments of this application;
[0029] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0030] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0031] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0032] First, let me explain the terms used in this application:
[0033] Link tracing: Reconstructing the call chain of a service call. In this application, link tracing mainly refers to reconstructing the server chain, that is, identifying which servers a service call specifically passed through.
[0034] Parity flag: The server involved in the application is identified by mapping the server's IP address. Each server is mapped to two flags: an odd-numbered bit to identify the requesting server and an even-numbered bit to identify the returning server.
[0035] To address the problem that existing technologies cannot easily and efficiently implement server link tracing, the technical concept of this application is to leverage the high performance of Redis and the high space utilization of bitmaps. Based on Redis, the relationship between server identifiers and bitmap data structures is established, thereby enabling server link tracing without needing to concern oneself with the call relationships between services. This approach is simple and easy to implement, lightweight and convenient to deploy, and highly efficient in operation.
[0036] It should be noted that the service tracing method, device, storage medium, and program products provided in this application can be used in the fields of big data, cloud computing, and information security, as well as in the financial field or any other field. The application fields of the service tracing method, device, storage medium, and program products provided in this application are not limited. The following uses a single service request (or service call) as an example to illustrate the service tracing method.
[0037] In practical applications, see Figure 1 As shown, Figure 1This is a schematic diagram illustrating a service tracing method provided in an embodiment of this application. The execution entity of this service tracing method can be a service tracing device (or a service tracing system), which can be deployed in an electronic device. Based on a distributed service system, each application involves multiple servers; for example, application 1 corresponds to server group 1, application 2 corresponds to server group 2, ..., application n corresponds to server group n, etc.
[0038] A single service request may involve service calls between multiple applications. For example, once a service call is initiated, it can be determined which applications are involved and which servers within each application are involved. During the service call, the service tracing device can obtain the IP address of the calling server. Through server mapping, the server identifier can be obtained through the IP address. Then, through Redis operations, the server identifier is stored in a bitmap data structure to generate a target bitmap. Based on the bit index in the target bitmap and the corresponding stored value, the service link is determined, and each server in the service link is located accordingly, thus determining which servers processed the current service call.
[0039] The data transmission method provided in this application is intended to solve the above-mentioned technical problems of the prior art.
[0040] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0041] Figure 2 This is a flowchart illustrating the service link tracing method provided in an embodiment of this application. The method may include:
[0042] S201. Based on the target IP addresses of each target server obtained during service invocation, the corresponding target server identifier is obtained through the mapping relationship.
[0043] In this embodiment, the executing entity can be a service tracing device, which can be deployed in an electronic device, such as a terminal device or a server, without specific limitations. Taking a terminal device as an example, the terminal device can be a computer used to perform tracing processing on service requests or calls, thereby determining the path of a request through all servers. If a request is abnormal, it can quickly locate which specific server is causing the abnormality.
[0044] In one possible design, the service tracing method may also include:
[0045] Based on the service request, determine the target server and corresponding target IP address of each target application invoked by the service.
[0046] Specifically, based on a distributed service system, when a service call is initiated, i.e. when a service request occurs, the application involved (here referring to the target application) and the server called between the applications (here referring to the target server) can be determined according to the service. Based on the IP address of the server called by each application involved, the server identifier of the called server (here referring to the target server identifier) can be obtained through the established server mapping relationship.
[0047] S202. For each of the target applications, the target server identifiers are stored in a bitmap data structure using the Redis storage system to generate a target bitmap.
[0048] In this embodiment, Redis, as a distributed cache, boasts extremely high performance. Typically, Redis read speeds are around 110,000 times per second, and write speeds are around 80,000 times per second. Leveraging Redis's support for bitmap data types, target server identifiers corresponding to the various target servers called by different target applications can be stored in a bitmap data structure through Redis operations, thus generating the target bitmap.
[0049] The basic principle of a bitmap is to use a single bit to represent the value corresponding to a given element, while the key is that element. See also Figure 3 As shown, Figure 3 This is a schematic diagram of the bitmap data structure provided in an embodiment of this application. The length of the bitmap is n, where 0, 1, 2, ..., n are used to represent the bit (i.e., bit) index of the bitmap data structure, i.e., the key of the bitmap, which can be used as a server identifier; the value stored in each bit (e.g., 0 or 1) is used as the value of the bitmap.
[0050] In computers, one byte is 8 bits. If a bitmap is used for data storage, one byte can store 8 data items. For example, one integer data type occupies 4 bytes, or 32 bits. To store 100 million data items, ordinary storage would require 381.5MB, while bitmap storage would only require 11.9MB. Therefore, using bitmaps to store the request chain of massive users has a significant space advantage, saving a lot of storage space, and eliminating the need for the middleware required by traditional distributed tracing systems.
[0051] For example, see Figure 4 As shown, Figure 4 This is a schematic diagram illustrating a service tracing method provided in another embodiment of this application. When invoking a service, the unique identifier of the service can be used as the Redis KEY (i.e., identifier), and the bitmap data structure can be used as the Redis VALUE (i.e., value) for data storage.
[0052] S203. Determine the service link based on the bit index in the target bitmap and the storage value corresponding to the bit index, so as to support the location of each server in the service link.
[0053] In this embodiment, in the bitmap data structure, each bit stores only 0 and 1 values, which can be used to identify whether each bit has a value. See [link to documentation]. Figure 5 As shown, Figure 5 This is a schematic diagram of a bitmap data structure provided in another embodiment of this application. The values at positions 1, 2, 4, and n in the bitmap are 1, indicating that the bitmap stores data for elements 1, 2, 4, and n.
[0054] Specifically, the server identifier is determined using the parity identification method based on the bit index, and the value corresponding to that server identifier is determined based on the stored value corresponding to the bit index. For example, Figure 5 The value of 1 at position 1 indicates that the corresponding server identifier stores the value 1.
[0055] The service link tracing method provided in this embodiment first obtains the target server identifiers by mapping the target IP addresses of each target application calling each target server obtained during service invocation. Then, for each target application, the target server identifiers are stored in a bitmap data structure using the Redis storage system to generate a target bitmap. Based on the bit index in the target bitmap and the corresponding stored value, the service link is determined to support the location of each server in the service link. Therefore, by obtaining the server identifiers corresponding to the IP addresses of the servers calling the service, and then establishing the relationship between the server identifiers and the bitmap data structure based on Redis, server link tracing can be achieved without needing to concern itself with the call relationships between services. This method is simple, feasible, efficient, and easy to use.
[0056] In one possible design, the service link tracing method can also be implemented through the following steps:
[0057] For each application, each server is identified based on the IP address of the server corresponding to the application, thereby obtaining the mapping relationship between the IP address of each server and the corresponding server identifier.
[0058] The server identifier includes an even-numbered identifier and an odd-numbered identifier; the even-numbered and odd-numbered bits of a server identifier are two adjacent identifier bits; the even-numbered identifier is used to indicate the location of the service request, and the odd-numbered identifier is used to indicate the location of the service return; or, the odd-numbered identifier is used to indicate the location of the service request, and the even-numbered identifier is used to indicate the location of the service return.
[0059] In this embodiment, by grouping and mapping servers and using parity flags, bidirectional storage for requests and responses can be achieved. Specifically, all servers in each application are grouped together, such as... Figure 1 Application 1 corresponds to server group 1, application 2 corresponds to server group 2, ..., application n corresponds to server group n. Then, an identifier mapping is performed for each server group, that is, each server in each server group is identified, and a mapping relationship is established between the identifier and the server's IP address. Each server identifier corresponds to two identifier bits, namely an even-numbered bit and an odd-numbered bit. Therefore, each server identifier includes an even-numbered identifier and an odd-numbered identifier. The even-numbered identifier is used to indicate either the location of the service request or the location of the service return, and correspondingly, the odd-numbered identifier is used to indicate either the location of the service return or the location of the service request.
[0060] In one possible design, the step of storing the identifiers of each target server in a bitmap data structure using the Redis storage system to generate the target bitmap for each target application can be achieved through the following steps:
[0061] Step a1: Use the unique service identifier corresponding to the service as the identifier stored in Redis;
[0062] Step a2: Retrieve the value stored in Redis based on the identifier stored in Redis;
[0063] Step a3: Using the values stored in Redis, store the identifiers of each target server in each target application into the bitmap data structure to generate a target bitmap corresponding to the unique identifier of the service.
[0064] In this context, each bit index in the target bitmap corresponds one-to-one with the identifier bit of each target server, and the identifier bit includes even bits and odd bits; the even bits and odd bits of a server identifier are two adjacent identifier bits.
[0065] In this embodiment, by using Redis operations to store the server identifier in a bitmap data structure, a server link trace (i.e., service link trace) for a service call can be obtained. Each service request can generate a bitmap data structure (here referring to the target bitmap) using the service's unique identifier, and the index of the data structure contains the identifier bits of all related application servers.
[0066] In one possible design, the step of storing the identifiers of each target server in each target application into the bitmap data structure using the values stored in Redis, and generating a target bitmap corresponding to the unique identifier of the service, can be achieved through the following steps:
[0067] Step a31: Group the indices in the bitmap data structure according to each target application; wherein each index group corresponds to all servers of a target application;
[0068] Step a32: For each index group, based on the value stored in Redis and the identifiers of each target server in the corresponding target application, store the data of each bit in the index group in the bitmap data structure to generate a target bitmap corresponding to the unique identifier of the service.
[0069] In this embodiment, the bitmap index can be divided into different groups according to the server grouping, and each group corresponds to all servers of the relevant application. Specifically, a successful service call in the bitmap storage will always have one pair of adjacent bits with a value of 1 in each group.
[0070] Specifically, there's no need to concern yourself with the service call hierarchy; you only need to group and identify the servers for each application using their IP addresses. For example, see... Figure 6 As shown, Figure 6 This is a schematic diagram of the server mapping configuration provided in an embodiment of this application. An application has n servers (e.g., server 0, server 1, server 2, ..., server n). Each server is assigned a mapping identifier. Each server has two identifiers: an even-numbered identifier and an odd-numbered identifier. The even-numbered identifier indicates the location of the service request, and the odd-numbered identifier indicates the location of the service return. Figure 5As shown, all servers for each application are mapped as described above, and the server identifiers are incremented sequentially. For example, if the odd-numbered identifier of the last server in an application is 2n+1, then the even-numbered identifier of the first server in the next application will be 2n+2, and so on. For instance, server 0 is mapped to an even-numbered identifier of 0 and an odd-numbered identifier of 1, server 2 is mapped to an even-numbered identifier of 2 and an odd-numbered identifier of 3, server 2 is mapped to an even-numbered identifier of 4 and an odd-numbered identifier of 5, ..., and server n is mapped to an even-numbered identifier of 2n and an odd-numbered identifier of 2n+1.
[0071] In one possible design, determining the service link based on the bit index in the target bitmap and the corresponding stored value, in order to locate each server in the service link, can be achieved through the following steps:
[0072] Step b1: Determine the corresponding target server identifier based on the bit index in the target bitmap;
[0073] Step b2: Determine the service path corresponding to the service based on the target server identifier and the storage value corresponding to the bit index.
[0074] The stored value corresponding to the index is used to indicate whether to request or return the corresponding target server.
[0075] In this embodiment, combined with Figure 7 As shown, Figure 7 This is a schematic diagram illustrating a service link tracing method provided in another embodiment of this application. First, all servers for each application are grouped. There's no need to concern ourselves with the service call hierarchy; we only need to identify the servers for each application using their IP addresses. When a service call is initiated, the applications involved in the service and the servers involved in the inter-application calls can be determined. During the service call, the program of the service link tracing device can obtain the IP address of the calling server. Through server mapping, the server identifier can be obtained through the IP address. By using Redis operations to store the server identifier in a bitmap data structure, the server link tracing for a service call can be obtained. That is, it reveals which servers the service has traversed.
[0076] In one possible design, this service tracing method can also be implemented through the following steps:
[0077] Step c1: If the service request is abnormal, determine the server identifier that has the processing error based on the server identifier in the service link and the corresponding stored value.
[0078] Step c2: Based on the server identifier with the failure problem, obtain the IP address of the server to be tracked corresponding to the server identifier with the processing abnormality through the mapping relationship;
[0079] Step c3: Locate the corresponding server based on the IP address of the server to be tracked.
[0080] In this embodiment, if a service request is abnormal, it is also possible to trace which servers caused the service request abnormality. Specifically, by reading the index and its corresponding stored value in the bitmap data structure of the service chain, and combining the correspondence between the index and server identifiers (even-bit identifiers and odd-bit identifiers), the identifier of the server that caused the abnormality can be found, and the server corresponding to the server that caused the abnormality is selected as the server to be traced. Then, through the mapping relationship between the server identifier and the server's IP address, the IP address of the server to be traced is obtained, realizing rapid tracing of service abnormalities. The tracing operation steps are convenient, thus enabling the abnormal problem to be handled as quickly as possible.
[0081] In one possible design, determining the server identifier with a failure problem based on the server identifier and its corresponding stored value in the service link can be achieved through the following steps:
[0082] Step c11: For each server identifier in the service link, determine whether the even-numbered and odd-numbered bits of the server identifier are different values;
[0083] Step c12: If the values are different, then the server identifier is determined to be a server identifier with a failure problem.
[0084] In this embodiment, a successful service call in the bitmap storage must have one pair of adjacent odd and even bits with a value of 1 in each group. Therefore, if there are two servers in one or more groups whose even and even bits have different values (for example, in one group, the even bits are 1 and the odd bits are 0), it means that the service was requested by server 0 of the application in that group, but did not receive a response from server 0, resulting in a service exception. Therefore, server 0 can be used as a server to be traced. By finding its corresponding IP address, server 0 can be located, and the problems encountered during the call can be investigated to quickly resolve the service exception.
[0085] Therefore, this application introduces the bitmap data structure into the field of distributed tracing. By grouping and mapping servers and combining it with parity flags, it can satisfy bidirectional storage of requests and responses, thereby determining the path of servers traversed during service calls. This application does not rely on any other middleware or components designed into traditional distributed tracing systems; it simply leverages the high performance of Redis and the high space utilization of bitmaps, making it simple and easy to implement, lightweight and convenient to deploy, and highly efficient in operation, thus achieving convenient and rapid server location.
[0086] To implement the image processing method described above, this embodiment provides a service link tracing device, see [link to documentation]. Figure 8 , Figure 8 This is a schematic diagram of the structure of a service link tracing device provided in an embodiment of this application; the service link tracing device includes: an acquisition module 801, a storage module 802, and a link determination module 803.
[0087] The acquisition module 801 is used to obtain the corresponding target server identifier based on the target IP address of each target application calling each target server obtained during service invocation and through the mapping relationship.
[0088] Storage module 802 is used to store the identifiers of each target server in a bitmap data structure through the storage system Redis for each target application, and generate a target bitmap.
[0089] The link determination module 803 is used to determine the service link based on the bit index in the target bitmap and the storage value corresponding to the bit index, so as to support the location of each server in the service link.
[0090] In this embodiment, the acquisition module 801, storage module 802, and link determination module 803 are used to obtain the corresponding target server identifiers based on the target IP addresses of each target application calling each target server obtained during service invocation, through a mapping relationship. Then, for each target application, the target server identifiers are stored in a bitmap data structure using the Redis storage system to generate a target bitmap. Based on the bit index in the target bitmap and the storage value corresponding to the bit index, the service link is determined to support the location of each server in the service link. Therefore, by obtaining the server identifier corresponding to the IP address of the server calling the service, and then establishing the relationship between the server identifier and the bitmap data structure based on Redis, server link tracing can be achieved without needing to concern itself with the call relationship between services. This is simple, feasible, efficient, and easy to use.
[0091] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.
[0092] In one possible design, the service link tracing device further includes: a mapping module; the mapping module is used for:
[0093] For each application, each server is identified based on the IP address of the server corresponding to the application, thereby obtaining the mapping relationship between the IP address of each server and the corresponding server identifier.
[0094] The server identifier includes an even-numbered identifier and an odd-numbered identifier; the even-numbered and odd-numbered bits of a server identifier are two adjacent identifier bits; the even-numbered identifier is used to indicate the location of the service request, and the odd-numbered identifier is used to indicate the location of the service return; or, the odd-numbered identifier is used to indicate the location of the service request, and the even-numbered identifier is used to indicate the location of the service return.
[0095] In one possible design, the storage module is specifically used for:
[0096] Use the unique identifier of the service corresponding to the service as the identifier stored in Redis;
[0097] Retrieve the value stored in Redis based on the identifier stored in Redis;
[0098] Using the values stored in Redis, the identifiers of each target server in each target application are stored in the bitmap data structure to generate a target bitmap corresponding to the unique identifier of the service;
[0099] In this context, each bit index in the target bitmap corresponds one-to-one with the identifier bit of each target server, and the identifier bit includes both even-numbered bits and odd-numbered bits.
[0100] In one possible design, the storage module is specifically used for:
[0101] The indices in the bitmap data structure are grouped according to each target application; wherein each index group corresponds to all servers of a target application;
[0102] For each index group, based on the value stored in Redis and the identifiers of each target server in the corresponding target application, each bit in the index group of the bitmap data structure is stored to generate a target bitmap corresponding to the unique identifier of the service.
[0103] In one possible design, the stored value corresponding to the index is used to indicate whether a request is made to or a response is returned to the corresponding target server; the service link determination module is specifically used for:
[0104] Determine the corresponding target server identifier based on the bit index in the target bitmap;
[0105] The service path corresponding to the service is determined based on the target server identifier and the storage value corresponding to the bit index.
[0106] In one possible design, the service link tracing device further includes: an anomaly location module; the anomaly location module is used for:
[0107] When a request to the service is abnormal, the server identifier that is experiencing a processing error is determined based on the server identifier in the service chain and the corresponding stored value.
[0108] Based on the server identifier with the failure problem, the IP address of the server to be tracked corresponding to the server identifier with the processing error is obtained through the mapping relationship;
[0109] Locate the corresponding server based on the IP address of the server to be tracked.
[0110] In one possible design, the anomaly localization module is specifically used for:
[0111] For each server identifier in the service link, determine whether the even-numbered and odd-numbered bits of the server identifier are different values;
[0112] If the values are different, then the server identifier is determined to be a server identifier with a failure problem.
[0113] In one possible design, the service link tracing device further includes: a determination module; the determination module is configured to:
[0114] Based on the service request, determine the target server and corresponding target IP address of each target application invoked by the service.
[0115] To implement the methods of the above embodiments, this embodiment provides an electronic device. Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 9 As shown, the electronic device 90 of this embodiment includes: a processor 901 and a memory 902 communicatively connected to the processor; wherein, the memory 902 is used to store computer execution instructions; the processor 901 is used to execute the computer execution instructions stored in the memory to implement the various steps performed in the above embodiment. For details, please refer to the relevant descriptions in the foregoing method embodiments.
[0116] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described above.
[0117] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method described above.
[0118] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms. Additionally, the functional modules in the various embodiments of this application may be integrated into one processing unit, or each module may exist physically separately, or two or more modules may be integrated into one unit. The above-mentioned modular units can be implemented in hardware or in the form of hardware plus software functional units.
[0119] The integrated modules implemented as software functional modules described above can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application. It should be understood that the processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0120] The memory may include high-speed RAM, and may also include non-volatile memory (NVM), such as at least one disk drive, and may also be a USB flash drive, external hard drive, read-only memory, disk, or optical disc. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses in the accompanying drawings are not limited to a single bus or a single type of bus. The aforementioned storage medium 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 storage, flash memory, disk, or optical disc. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.
[0121] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.
[0122] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0123] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0124] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A service link tracing method, characterized in that, The method includes: Based on the target IP addresses of each target application calling each target server obtained during service invocation, the corresponding target server identifiers are obtained through mapping relationships. Specifically, for each application, each server is identified based on the IP addresses of the servers corresponding to the application, resulting in a mapping relationship between the IP addresses of each server and the corresponding server identifiers. The server identifier includes an even-numbered identifier and an odd-numbered identifier; the even-numbered and odd-numbered bits of a server identifier are two adjacent identifier bits. The even-numbered identifier is used to indicate the location of the service request, and the odd-numbered identifier is used to indicate the location of the service return; or, the odd-numbered identifier is used to indicate the location of the service request, and the even-numbered identifier is used to indicate the location of the service return. For each target application, the indexes in the bitmap data structure are grouped according to the storage system Redis; each index group corresponds to all servers of a target application; for each index group, the data is stored in the index group according to the target server identifiers in the corresponding target application, based on the values stored in Redis, to generate the target bitmap. Based on the bit index in the target bitmap and the storage value corresponding to the bit index, the service link is determined to support the location of each server in the service link.
2. The method according to claim 1, characterized in that, The step of storing data in the index group of the bitmap data structure based on the values stored in Redis and the corresponding target server identifiers in the target application to generate the target bitmap includes: Use the unique identifier of the service corresponding to the service as the identifier stored in Redis; Retrieve the value stored in Redis based on the identifier stored in Redis; Using the values stored in Redis, and based on the target server identifiers of the respective target applications, each bit in the index group of the bitmap data structure is stored to generate a target bitmap corresponding to the unique identifier of the service. In this context, each bit index in the target bitmap corresponds one-to-one with the identifier bit of each target server, and the identifier bit includes both even-numbered bits and odd-numbered bits.
3. The method according to claim 2, characterized in that, The stored value corresponding to the index is used to indicate whether a request or return to the corresponding target server is made; the step of determining the service link based on the bit index in the target bitmap and the stored value corresponding to the bit index, in order to locate each server in the service link, includes: Determine the corresponding target server identifier based on the bit index in the target bitmap; The service path corresponding to the service is determined based on the target server identifier and the storage value corresponding to the bit index.
4. The method according to claim 3, characterized in that, The method further includes: If the service request is abnormal, the server identifier with the failure problem is determined based on the server identifier in the service link and the corresponding stored value; Based on the server identifier with the failure problem, the IP address of the server to be tracked corresponding to the server identifier with the failure problem is obtained through the mapping relationship; Locate the corresponding server based on the IP address of the server to be tracked.
5. The method according to claim 4, characterized in that, The step of determining the server identifier with a failure problem based on the server identifier in the service link and the corresponding stored value includes: For each server identifier in the service link, determine whether the even-numbered and odd-numbered bits of the server identifier are different values; If the values are different, the server identifier is determined to be a server identifier with a failure problem.
6. The method according to claim 1 or 2, characterized in that, The method further includes: Based on the service request, determine the target server and corresponding target IP address of each target application invoked by the service.
7. A service link tracing device, characterized in that, include: The acquisition module is used to obtain the corresponding target server identifier based on the target IP addresses of each target application calling each target server obtained during service invocation, through a mapping relationship. Specifically, for each application, each server is identified based on the IP addresses of the servers corresponding to that application, resulting in a mapping relationship between the IP addresses of each server and the corresponding server identifier. The server identifier includes an even-numbered identifier and an odd-numbered identifier; the even-numbered and odd-numbered bits of a server identifier are adjacent identifier bits. The even-numbered identifier indicates the location of the service request, and the odd-numbered identifier indicates the location of the service return; or, the odd-numbered identifier indicates the location of the service request, and the even-numbered identifier indicates the location of the service return. The storage module is used to group the indexes in the bitmap data structure according to each target application using the Redis storage system; wherein each index group corresponds to all servers of a target application; for each index group, the module stores each bit in the index group in the bitmap data structure according to the value stored in Redis and the identifier of each target server in the corresponding target application, thereby generating a target bitmap; The link determination module is used to determine the service link based on the bit index in the target bitmap and the storage value corresponding to the bit index, so as to support the location of each server in the service link.
8. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1-6.
Citation Information
Patent Citations
Virtualized service monitoring method and device
CN107306196A
Shortest path query method and system based on approximation algorithm
CN112380460A