A link tracking method and system for microservices

By dynamically adjusting the sampling strategy of the link tracking service, and using monitoring statistics to generate and issue policy configurations, the problem of cumbersome sampling rate configuration in the microservice architecture is solved, efficient sampling strategy maintenance is achieved, and the cost of manual intervention is reduced.

CN115883343BActive Publication Date: 2024-10-22CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211563312.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-07
Publication Date
2024-10-22
Estimated Expiration
2042-12-07

AI Technical Summary

Technical Problem

In a microservice architecture, the sampling rate of the link tracking service requires manual configuration, which results in high maintenance costs and inconvenience. Especially when there are a large number of microservices and a large number of requests, it is difficult to effectively maintain the sampling strategy.

Method used

By obtaining the monitoring statistics of the link tracking service, the sampling strategy is dynamically adjusted, the policy configuration information is generated and sent to the sampling end, and the sampling strategy of the link tracking service is automatically updated.

Benefits of technology

It reduces the cost of manual configuration, improves the sampling strategy maintenance efficiency of the link tracking service in high concurrency environments, and reduces computing and storage costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115883343B_ABST
    Figure CN115883343B_ABST
Patent Text Reader

Abstract

The present application provides a link tracking method and system for a microservice, which generates corresponding policy configuration information by analyzing and judging the monitoring statistical data in the link tracking service, and sends the policy information configuration to the sampling end, which reloads the configuration, thereby dynamically adjusting the sampling strategy of link tracking. The present application uses monitoring statistical data to generate a sampling strategy according to the method, and uses the policy sending capability provided by the link tracking service to dynamically adjust the sampling strategy of link tracking and reduce the cost of manual configuration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical fields of microservices, cloud computing and link tracking, and in particular to a link tracking method and system for microservices. Background Art

[0002] In a microservice architecture, requests flow between services, and the call chain is complicated. Once a problem or exception occurs, it is difficult to track and locate. In order to quickly find which link has a problem and solve similar problems, link tracking is usually used to track and locate service problems. For example: Jaeger, Zipkin, OpenTracing, SkyWalking, etc. Through the link tracking service, you can query the call relationship between requests and services, and query the time spent on each link, thereby helping to locate faults and analyze performance of complex microservice architecture systems.

[0003] However, when there are many microservices and a large number of requests, if the call chain information of all requests is sampled, the computing cost and storage cost are very high. The link tracking service reduces the amount of sampled call chain information data by providing a way to control the sampling rate and rate limit. However, this control method requires manual configuration of each interface. For example, if interface A uses adoption rate control, what is the configured adoption rate? Interface B uses rate limit, what is the speed limit per second? Newly added interfaces need to be configured, etc. Such configuration is not only time-consuming, but also very inconvenient to maintain. Summary of the invention

[0004] In order to solve the problem that the sampling rate of link tracking services needs to be manually configured and the rate control strategy is difficult to maintain, this application proposes a link tracking method and system for microservices, which generates corresponding policy configuration information by analyzing and judging the monitoring statistics in the link tracking service, and sends the policy information configuration to the sampling end, which reloads the configuration, thereby realizing dynamic adjustment of the link tracking sampling strategy. The technical solutions adopted by this application are as follows:

[0005] A link tracing method for a microservice, the method comprising:

[0006] Step 1: The link tracking system periodically obtains monitoring statistics through the link tracking service query interface according to the preset adjustment strategy frequency;

[0007] Step 2: Obtain the actual sampling rate of the interface and the space occupancy rate of the storage module through the monitoring statistical data, update the actual sampling rate of the interface according to the number of business requests of the interface, and update the expected sampling number of the interface according to the space occupancy rate of the storage module.

[0008] Furthermore, before step 1, the initialization parameter configuration of the model is also included, including:

[0009] Adjust the strategy frequency t, with the unit of time;

[0010] The default sampling rate d of the newly added interface, with the initial default value of 100%;

[0011] The actual sampling rate P of the interface d , with the unit of percentage;

[0012] The minimum sampling rate d min , with the initial default value of 10%;

[0013] The actual sampling count P of the interface c , with the unit of times;

[0014] The minimum interface sampling count C per second min , with the unit of times;

[0015] The expected sampling count C, with the unit of times;

[0016] The acceptable offset value Offset, with the initial default value of 5%;

[0017] The expected growth rate S of the space occupancy rate, with the unit of MB / s.

[0018] Furthermore, in step 2, update the actual sampling rate of the interface according to the number of business requests of the interface, including: if the interface is a newly added interface, update the actual sampling rate to the default sampling rate d, return to step 1, and wait for the next cycle.

[0019] Furthermore, in step 2, update the actual sampling rate of the interface according to the number of business requests of the interface, including: if the interface is not a newly added interface, perform sampling rate judgment. If the actual sampling rate P d < d min , then update the actual sampling rate to d min , return to step 1, and wait for the next cycle; if the actual sampling rate P d ≥ d min , then perform sampling count judgment. If the actual sampling count P c < C min , then set the actual sampling count P c to 1, perform all collections, return to step 1, and wait for the next cycle; if the actual sampling count P c ≥ C min , then compare the actual sampling count with the expected range. If P c > C(1 + Offset), then decrease the actual sampling rate P d , return to step 1, and wait for the next cycle; if P c < C(1 - Offset), then increase the actual sampling rate P d, return to step 1 and wait for the next cycle; if C(1-Offset)≤P c ≤C(1+Offset), then maintain the actual sampling rate P d No change, return to step 1, and wait for the next cycle.

[0020] Further, in step 2, the actual sampling number of the interface is updated according to the space occupancy rate of the storage module, including: obtaining the storage module space occupancy En1 of the link tracking system by monitoring statistical data, comparing the storage module space occupancy En1 with the storage module space occupancy En2 in the previous cycle, and calculating the growth rate E of the storage module space occupancy rate p =(En2-En1) / t, and the calculated growth rate E p Compared with the expected growth rate S of the space occupancy rate preset in the initialization parameter configuration, if E p >S, then reduce the expected number of samples C, return to step 1, and wait for the next cycle.

[0021] A microservice link tracking system, the system comprising a sampling strategy updating unit and a link tracking service unit;

[0022] A sampling strategy updating unit, used to generate a corresponding sampling strategy according to monitoring statistical data, dynamically adjust the sampling strategy, and provide it to the link tracking service unit in a manner supported by the link tracking service;

[0023] The link tracking service unit is used to monitor changes in the sampling strategy in the configuration file, obtain the adjusted sampling strategy, and update it to the server.

[0024] Furthermore, the sampling strategy update unit obtains the actual sampling rate of the interface and the space occupancy rate of the storage module through the monitoring statistical data, updates the actual sampling rate of the interface according to the number of business requests of the interface, and updates the expected sampling number of the interface according to the space occupancy rate of the storage module.

[0025] Further, the actual sampling rate of the interface is updated according to the number of service requests of the interface, including: if the interface is a newly added interface, the actual sampling rate is updated to the default sampling rate d, returning to step 1, and waiting for the next cycle.

[0026] Further, the actual sampling rate of the interface is updated according to the number of service requests of the interface, including: if the interface is not a newly added interface, the sampling rate is judged, and if the actual sampling rate P d <d min , then the actual sampling rate is updated to d min , return to step 1 and wait for the next cycle; if the actual sampling rate P d ≥d min, sampling number judgment is performed. If the actual sampling number P c <C min , then the actual sampling number P c is set to 1, all data is collected, step 1 is returned, and the next cycle is waited for; if the actual sampling number P c ≥C min , then the actual sampling number is compared with the expected range. If P c >C(1 + Offset), then the actual sampling rate P d is decreased, step 1 is returned, and the next cycle is waited for; if P c <C(1 - Offset), then the actual sampling rate P d is increased, step 1 is returned, and the next cycle is waited for; if C(1 - Offset) ≤ P c ≤C(1 + Offset), then the actual sampling rate P d remains unchanged, step 1 is returned, and the next cycle is waited for.

[0027] Furthermore, the actual sampling number of the interface is updated according to the space occupancy rate of the storage module, including: by monitoring statistical data, the space occupancy En1 of the storage module of the link tracing system is obtained, the space occupancy rate En1 of the storage module is compared with the space occupancy En2 of the storage module in the previous cycle, and the growth rate E p =(En2 - En1) / t of the space occupancy rate of the storage module is calculated, and the calculated growth rate E p is compared with the expected growth rate S of the space occupancy rate preset in the initialization parameter configuration. If E p >S, then the expected sampling number C is decreased, step 1 is returned, and the next cycle is waited for.

[0028] Through the embodiments of the present application, the following technical effects can be obtained:

[0029] (1) In the case of a large number of microservices and a large number of requests, the problems that a large amount of manual configuration of the sampling rate is required for the link tracing service and the sampling strategy is difficult to maintain are solved;

[0030] (2) By using monitoring statistical data, a sampling strategy is generated according to the method, and the strategy distribution ability provided by the link tracing service is utilized to dynamically adjust the sampling strategy of the link tracing, reducing the cost of manual configuration. Description of the Drawings

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0032] Figure 1 is a flowchart of a link tracking method;

[0033] Figure 2 A flow chart of adjusting the number of interface samples according to the space occupied by the storage module;

[0034] Figure 3 This is a schematic diagram of the reporting and policy delivery process. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0036] The flowchart of the link tracking method of this application is as follows Figure 1 As shown, the method uses the link tracking service query interface to cyclically obtain monitoring statistics for a period of time, analyze the data, and generate corresponding policy configuration information based on the model, thereby dynamically adjusting the sampling strategy of link tracking. The method includes the following steps:

[0037] Step 1: The link tracking system periodically obtains monitoring statistics data through the link tracking service query interface according to the preset adjustment strategy frequency t;

[0038] Before step 1, the initialization parameters of the model are configured, including:

[0039] Adjust the strategy frequency t, in time;

[0040] Added the default sampling rate d of the new interface, the initial default value is 100%;

[0041] The actual sampling rate P of the interface d , the unit is percentage;

[0042] Minimum sampling rate d min , the initial default value is 10%;

[0043] The actual sampling number P of the interfacec , in times;

[0044] The minimum number of interface samples per second C min , in times;

[0045] The expected number of samples C, in times;

[0046] The acceptable offset value Offset, with an initial default value of 5%;

[0047] The expected growth rate S of the space occupancy rate, in MB / s.

[0048] Step 2: Obtain the actual sampling rate of the interface and the space occupancy rate of the storage module from the monitored statistical data, update the actual sampling rate of the interface according to the number of service requests of the interface, and update the expected sampling number of the interface according to the space occupancy rate of the storage module.

[0049] Figure 1 It is a flow schematic diagram of the link tracing method. In step 2, updating the actual sampling rate of the interface according to the number of service requests of the interface includes:

[0050] If the interface is a newly added interface, update the actual sampling rate to the default sampling rate d, return to step 1, and wait for the next cycle;

[0051] If the interface is not a newly added interface, perform sampling rate judgment. If the actual sampling rate P d <d min , then update the actual sampling rate to d min , return to step 1, and wait for the next cycle; if the actual sampling rate P d ≥d min , then perform sampling number judgment. If the actual sampling number P c <C min , then set the actual sampling number P c to 1, perform full collection, return to step 1, and wait for the next cycle; if the actual sampling number P c ≥C min , then compare the actual sampling number with the expected range. If P c >C(1 + Offset), then decrease the actual sampling rate P d , return to step 1, and wait for the next cycle; if P c <C(1 - Offset), then increase the actual sampling rate P d , return to step 1, and wait for the next cycle; if C(1 - Offset) ≤ P c ≤C(1 + Offset), then keep the actual sampling rate P d unchanged, return to step 1, and wait for the next cycle.

[0052] Figure 2 The flowchart of adjusting the interface sampling number according to the space occupation rate of the storage module is shown in step 2. The actual sampling number of the interface is updated according to the space occupation rate of the storage module, including:

[0053] By monitoring statistical data, the storage module space occupancy rate En1 of the link tracking system is obtained, and the storage module space occupancy rate En1 is compared with the storage module space occupancy rate En2 in the previous cycle, and the growth rate E of the storage module space occupancy rate is calculated. p =(En2-En1) / t, and the calculated growth rate E p Compared with the expected growth rate S of the space occupancy rate preset in the initialization parameter configuration, if E p >S, then reduce the expected number of samples C, return to step 1, and wait for the next cycle.

[0054] Link tracking system, the system includes a sampling strategy update unit, a link tracking service unit

[0055] A sampling strategy updating unit, used to generate a corresponding sampling strategy according to monitoring statistical data, dynamically adjust the sampling strategy, and provide it to the link tracking service unit in a manner supported by the link tracking service;

[0056] The link tracking service unit is used to monitor changes in the sampling strategy in the configuration file, obtain the adjusted sampling strategy, and update it to the server.

[0057] The link tracking service supports configuration file updates or http services.

[0058] Figure 3 This is a schematic diagram of the reporting and policy delivery process. Figure 3 In jaeger-collect, jaeger-collect adjusts the sampling strategy by monitoring the changes in the policy file. The server then sends the strategy to each collection end. After receiving the new strategy, the collection end will reload it, thereby dynamically adjusting the sampling strategy of link tracking.

[0059] Reporting process: In the link tracking service system that uses Jaeger as a microservice, ElasticSearch is used as the backend storage, and the jaeger-agent sampling strategy is configured to be remote, which is the configuration delivery mode. The Jaeger service and ElasticSearch service can expose the metric interface to Prometheus.

[0060] The sampling strategy system for link tracking is dynamically adjusted. In each cycle, Prometheus is queried to obtain monitoring statistics for a period of time. The monitoring statistics include the number of requests in the microservice, such as obtaining user information, and obtaining the space occupied by the storage module.

[0061] By monitoring statistical data, a sampling strategy is generated using the method of this application. The sampling strategy is written to the configuration file of jaeger-collect. Jaeger-collect monitors the changes of the sampling strategy in the configuration file, and reloads it when a change is detected, and keeps it unchanged if there is no change.

[0062] Sampling strategy delivery process: jaeger-collect will deliver the new sampling strategy to jaeger-agent, thereby realizing dynamic adjustment of the sampling strategy for link tracking.

[0063] In summary, the method of the present application obtains the microservice request link data and the monitoring data stored in the back-end, and generates a sampling strategy according to the method of the present application. The system of the present application realizes dynamic strategy generation and dynamic adjustment of the sampling strategy of the sampling end by utilizing the policy distribution mechanism of the link tracking service. In view of the large number of microservices and the large number of requests, the problem that the link tracking service requires a large amount of manual configuration of the sampling rate and the sampling strategy is difficult to maintain is solved. By utilizing monitoring statistical data, a sampling strategy is generated according to the method, and the policy distribution capability provided by the link tracking service is utilized, so as to realize dynamic adjustment of the link tracking sampling strategy and reduce the cost of manual configuration.

[0064] Although the specific implementation methods of the present application are described above, those skilled in the art should understand that these are only examples, and the protection scope of the present application is defined by the appended claims. Those skilled in the art may make various changes or modifications to these implementation methods without departing from the principles and essence of the present application, but these changes and modifications all fall within the protection scope of the present application.

Claims

1. A link tracking method for microservices, characterized in that: The method includes: Step 1: The link tracking system periodically obtains monitoring statistics through the link tracking service query interface according to the preset adjustment strategy frequency; Step 2: obtaining the actual sampling rate of the interface and the space occupancy rate of the storage module through the monitoring statistical data, updating the actual sampling rate of the interface according to the number of service requests of the interface, and updating the expected sampling number of the interface according to the space occupancy rate of the storage module; In step 2, the actual sampling rate of the interface is updated according to the number of service requests of the interface, including: if the interface is a newly added interface, the actual sampling rate is updated to the default sampling rate d, returning to step 1, and waiting for the next cycle; In step 2, update the actual sampling rate of the interface according to the number of business requests of the interface, including: if the interface is not a newly added interface, perform sampling rate judgment. If the actual sampling rate P d <d min , update the actual sampling rate to d min , return to step 1, and wait for the next cycle; if the actual sampling rate P d ≥d min , perform sampling number judgment. If the actual sampling number P c <C min , set the actual sampling number P c to 1, perform full collection, return to step 1, and wait for the next cycle; if the actual sampling number P c ≥C min , compare the actual sampling number with the expected range. If P c >C(1 + Offset), decrease the actual sampling rate P d , return to step 1, and wait for the next cycle; if P c <C(1 - Offset), increase the actual sampling rate P d , return to step 1, and wait for the next cycle; if C(1 - Offset) ≤ P c ≤C(1 + Offset), keep the actual sampling rate P d unchanged, return to step 1, and wait for the next cycle; In step 2, the actual sampling number of the interface is updated according to the space occupancy rate of the storage module, including: obtaining the storage module space occupancy En1 of the link tracking system through monitoring statistical data, comparing the storage module space occupancy En1 with the storage module space occupancy En2 in the previous cycle, and calculating the growth rate E of the storage module space occupancy rate p =(En2-En1) / t, and the calculated growth rate E p Compared with the expected growth rate S of the space occupancy rate preset in the initialization parameter configuration, if E p >S, then reduce the expected number of samples C, return to step 1, and wait for the next cycle.

2. The method according to claim 1, characterized in that Before step 1, the initialization parameters of the model are configured, including: Adjust the strategy frequency t, in time; Added the default sampling rate d of the new interface, the initial default value is 100%; The actual sampling rate P of the interface d , the unit is percentage; Minimum sampling rate d min , the initial default value is 10%; The actual sampling number P of the interface c , the unit is times; Minimum number of interface samples per second C min , the unit is times; Expected number of samples C, in times; The acceptable offset value Offset, the initial default value is 5%; Expected growth rate S of space occupancy, in MB / s.

3. A microservice link tracking system, characterized in that: The system includes a sampling strategy updating unit and a link tracking service unit; A sampling strategy updating unit, used to generate a corresponding sampling strategy according to monitoring statistical data, dynamically adjust the sampling strategy, and provide it to the link tracking service unit in a manner supported by the link tracking service; The link tracking service unit is used to monitor the changes of the sampling strategy in the configuration file, obtain the adjusted sampling strategy, and update it to the server; Updating the actual sampling rate of the interface according to the number of service requests of the interface, including: if the interface is a newly added interface, updating the actual sampling rate to the default sampling rate d, returning to step 1, and waiting for the next cycle; Update the actual sampling rate of an interface according to the number of business requests of the interface, including: if the interface is not a newly added interface, perform sampling rate judgment. If the actual sampling rate P d <d min , update the actual sampling rate to d min , return to step 1, and wait for the next cycle; if the actual sampling rate P d ≥d min , perform sampling number judgment. If the actual sampling number P c <C min , set the actual sampling number P c to 1, perform full collection, return to step 1, and wait for the next cycle; if the actual sampling number P c ≥C min , compare the actual sampling number with the expected range. If P c >C(1 + Offset), decrease the actual sampling rate P d , return to step 1, and wait for the next cycle; if P c <C(1 - Offset), increase the actual sampling rate P d , return to step 1, and wait for the next cycle; if C(1 - Offset) ≤ P c ≤C(1 + Offset), keep the actual sampling rate P d unchanged, return to step 1, and wait for the next cycle; The actual sampling number of the interface is updated according to the space occupancy rate of the storage module, including: obtaining the storage module space occupancy En1 of the link tracking system through monitoring statistical data, comparing the storage module space occupancy En1 with the storage module space occupancy En2 in the previous cycle, and calculating the growth rate E of the storage module space occupancy rate p =(En2-En1) / t, and the calculated growth rate E p Compared with the expected growth rate S of the space occupancy rate preset in the initialization parameter configuration, if E p >S, then reduce the expected number of samples C, return to step 1, and wait for the next cycle.

4. The system according to claim 3, characterized in that The sampling strategy updating unit obtains the actual sampling rate of the interface and the space occupancy rate of the storage module through the monitoring statistical data, updates the actual sampling rate of the interface according to the number of business requests of the interface, and updates the expected sampling number of the interface according to the space occupancy rate of the storage module.