API Interface Performance Research and Judgment Method, System and Medium Based on Link Tracing
By intelligently analyzing and judging the static data of the interface in the distributed system and forming a comprehensive score, the problem of low accuracy of interface risk monitoring in the existing technology is solved, and reasonable recommendations and system optimization of the interface are achieved.
Patent Information
- Application Number
- CN202210152251.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-18
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2042-02-18
AI Technical Summary
The existing methods of using link tracking for distributed system performance monitoring and analysis have low accuracy in monitoring and analysis of whether the interface has some risks, and cannot reasonably recommend it. Only the called interface is monitored, and the unused interface is not monitored.
Through intelligent analysis and judgment of interface static data and link tracking dynamic data, a comprehensive score containing interface performance characteristics and behavior characteristics is formed, and this score is focused on recommendations. The specific steps include: each agent accesses distributed services without code and obtains full static data; implements link tracking and calculates average performance indicators; uses an interface behavior feature model to calculate interface behavior feature data; combines static data, performance indexes and behavior feature data for comprehensive analysis and judgment, and focuses on scoring.
It improves the accuracy of monitoring and analysis of interface risks, can reasonably recommend interfaces that need to be paid attention to, identify useless interfaces, and helps to realize system reconstruction and optimization.
Smart Images

Figure CN114528196B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of distributed Web API interface application performance, and particularly to a method, system and medium for judging the performance of API interfaces based on link tracing. Background Art
[0002] In computer programming, an application programming interface (API) is a software interface that allows other computer programs to access specific functions or data. A Web API is an API that can be accessed using the HTTP protocol, and Web APIs can be built using different technologies (such as Java,.NET, Golang, etc.). In a software system with a B / S architecture, almost all system capabilities are provided in the form of Web APIs. Therefore, the performance, stability and availability of the system largely depend on the performance of Web APIs. As Figure 1 shown.
[0003] In a distributed system, an external request often requires multiple internal modules, multiple middleware, and multiple machines to call each other to complete. Currently, link tracing technology is mainly used for monitoring the performance of Web API interfaces in a distributed system.
[0004] Link tracing mainly restores a complete request into a call chain and centrally displays the call conditions of Web API interfaces of each distributed service. For example, the time consumption, latency, request status, etc. of each interface. There are generally two technical solutions for using link tracing to monitor distributed system interfaces: aggregation by request dimension and aggregation by interface dimension.
[0005] 1. Aggregation by request dimension means aggregating the interfaces called during a request process into a link according to the trace ID and the order of calls, and displaying the performance indicators of each interface in the link, such as time consumption, latency, and response time. Zipkin, Jaeger, etc. adopt such solutions;
[0006] 2. Aggregation by interface dimension means statistically aggregating the performance indicators of each request of a single interface to calculate the average performance indicators of a single interface, such as average time consumption, average latency, and error rate. Tencent Cloud APM, etc. adopt such solutions.
[0007] As can be seen from the above, the technical solutions for using link tracing to monitor the performance of a distributed system generally include aggregation by request dimension and aggregation by interface dimension. However, these two solutions have their limitations.
[0008] The existing solution one is to aggregate by request dimension. Although the complete path of each request is displayed through the link, the collected performance metrics only represent the result of one request. Judging whether there are performance problems with the interface based on the result of one request is too simple and crude, and it is easy to produce misjudgments.
[0009] The existing solution two is to aggregate by interface dimension. This method statistically analyzes the results of multiple requests for a single interface, but there are still two problems: First, simply statistically aggregating the performance metrics does not summarize the behavioral characteristics of the interface and cannot identify abnormal behaviors. For example, if the access traffic of an interface suddenly increases, there may be a DOS attack behavior; Second, all data comes from link tracing, and only the requested interfaces will be recorded, ignoring the unrequested interfaces.
[0010] Therefore, the existing methods for distributed system performance monitoring and research and judgment using link tracing have problems such as low accuracy in monitoring and researching and judging whether there are some risks for interfaces and inability to make reasonable recommendations. Summary of the Invention
[0011] The technical problem to be solved by the present invention is that the existing methods for distributed system performance monitoring and research and judgment using link tracing have problems such as low accuracy in monitoring and researching and judging whether there are some risks for interfaces and inability to make reasonable recommendations. The purpose of the present invention is to provide an API interface performance research and judgment method, system and medium based on link tracing. The present invention takes the interface as the dimension, and through the intelligent research and judgment of the interface static data and link tracing dynamic data, forms a comprehensive score including the interface performance characteristics and behavioral characteristics, and makes key attention recommendations based on this score.
[0012] The present invention is realized through the following technical solutions:
[0013] In the first aspect, the present invention provides an API interface performance research and judgment method based on link tracing, and the method includes:
[0014] Each proxy accesses the corresponding distributed service without code intrusion, actively scans all Web API interfaces in the distributed service when the distributed service is started, obtains the full amount of static data S of the Web API interface and reports it to the center;
[0015] When an HTTP request arrives, link tracing is implemented through each proxy to obtain the link tracing data D of each said HTTP request reported by the proxy to the center at regular intervals; adopting an aggregation method with the interface as the dimension, calculating the average performance index Y of each Web API interface;
[0016] The center calculates the interface behavior characteristic data W according to the link tracing data D by using the interface behavior characteristic model;
[0017] The center uses a comprehensive judgment model to conduct a comprehensive evaluation based on the full - volume static data S, the average performance index Y, and the interface behavior characteristic data W, and performs timely response processing on the Web API interfaces corresponding to the scores of key concerns.
[0018] The working principle is as follows: In the existing methods for monitoring and judging the performance of distributed systems using link tracing, there are problems such as low accuracy in monitoring and judging whether there are some risks in the interfaces and inability to make reasonable recommendations; moreover, the existing methods only monitor the called interfaces, and the unused interfaces are not monitored. The present invention designs a method for judging the performance of API interfaces based on link tracing. Compared with the existing solution one, the present invention comprehensively judges the link tracing sampling data generated by multiple requests in terms of interfaces, and the obtained performance indicators are more accurate. Compared with the existing solution two, although both aggregate performance indicators in terms of interfaces, the present invention does not simply count the performance indicators of interfaces, but combines the performance indicators of interfaces with the behavior characteristics of interfaces to intelligently recommend the interfaces that need to be focused on. The more link tracing data there is, the more reliable the algorithm model is, and the higher the recommendation accuracy. At the same time, by actively scanning to obtain the full - volume interface data, the monitoring scope is wider, useless interfaces can be identified, which is more conducive to realizing the reconstruction and optimization of the system.
[0019] The present invention does not achieve the performance monitoring of Web API interfaces through simple statistical aggregation, but through learning the behavior characteristics of interfaces, combines performance indicators to intelligently recommend the interfaces that need to be focused on for reasonable recommendation; it does not obtain the behavior characteristics of Web API interfaces only through link tracing data, but combines the full - volume interface data obtained by scanning for comprehensive judgment, and the accuracy is high.
[0020] Furthermore, the full - volume static data S includes the interface path, the calling method of the interface, the calling protocol of the interface, and the parameter type of the interface.
[0021] Furthermore, when an HTTP request arrives, link tracing is implemented through each proxy to obtain the link tracing data D of each HTTP request reported by the proxy to the center at regular intervals; an aggregation method in terms of interfaces is adopted to calculate the average performance index Y of each Web API interface. Specifically, it includes:
[0022] When an HTTP request arrives, the HTTP request passes through the proxy, and it is judged whether the HTTP request contains a tracing ID: when the proxy identifies that the HTTP request does not contain a tracing ID, a tracing ID is added to the HPPT request; when communication occurs between distributed services, the proxy is responsible for intercepting the outgoing requests and adding the tracing ID in the context to the outgoing requests to realize the correlation of different requests on the same link;
[0023] The agent periodically reports the link tracing data D of each HTTP request to the center;
[0024] The center receives the link tracing data D sent by the agent periodically, and statistically analyzes the link tracing data D generated by n requests within the time range T n and statistically aggregates the link tracing data D generated by n requests within the time range T n by interface dimension, and the average performance index Y of each Web API interface can be obtained.
[0025] Furthermore, the link tracing data D includes the interface path, the call time of the interface, the response time of the interface, the response status code, the error message, and the call parameters.
[0026] Furthermore, the average performance index Y includes the interface path, the interface error rate, the number of requests with error messages among n requests, the average response time, and the average call delay;
[0027] The calculation expression of the interface error rate is: er = e n / n, where er is the interface error rate, and e n is the number of requests with error messages among n requests, and n is the number of requests;
[0028] The calculation expression of the average response time is: at = ∑t2 / n, where t2 is the response time of the interface, and n is the number of requests;
[0029] The calculation expression of the average call delay is: al = ∑(t2 - t1) / n, where t2 is the response time of the interface, t1 is the call time of the interface, and n is the number of requests.
[0030] Furthermore, the interface behavior characteristic data W includes the call frequency, the number of requests hitting the interface path p among n requests, the call time, the performance change trend, and the call parameters;
[0031] The calculation expression of the interface behavior characteristic model is:
[0032] cr = p n / T,
[0033] y1 = (Y - Y1) / Y
[0034] where cr is the call frequency, that is, the number of calls per second; p n is the number of requests hitting the interface path p among n requests; T is the time range of a single batch statistic (unit: second), y1 is the performance change trend, Y1 is the average performance index in the previous time range T, and Y is the average performance index.
[0035] Further, the center comprehensively evaluates according to the full - volume static data S, the average performance index Y, and the interface behavior characteristic data W by using a comprehensive research and judgment model, and performs timely response processing on the Web API interfaces corresponding to the key - concern scores; specifically including:
[0036] The center performs a left - outer join operation on the full - volume static data S, the average performance index Y, and the interface behavior characteristic data W to obtain an interface characteristic relationship A within the T - time range; the interface characteristic relationship A = ((S left - outer join Y) left - outer join W);
[0037] Within v T - time ranges, the center statistically obtains a set C of the interface characteristic relationship A, the set C = {A1, A2, A3,.., Av}; a certain tuple o in the interface characteristic relationship A is separately formed into a data set C’, the data set C’ = {o1, o2, o3,.., ov};
[0038] Select a part of the subsets in the data set C’ as the validation set, and the remaining part as the training set; use a machine - learning algorithm to fit the training set to obtain a prediction function f(o) for o; select the training model with the smallest mean - square error of f for the validation set as the comprehensive research and judgment model; according to the comprehensive research and judgment model, obtain the key - concern score score, where score=(f(o)-o) / o.
[0039] In the second aspect, the present invention further provides an API interface performance research and judgment system based on link tracing. This system supports the API interface performance research and judgment method based on link tracing. This system includes:
[0040] A static data acquisition unit, which is used for each proxy to access the corresponding distributed service without code intrusion, actively scan all Web API interfaces in the distributed service when the distributed service starts, obtain the full - volume static data S of the Web API interfaces, and report it to the center;
[0041] An average performance index calculation unit, which is used for when an HTTP request arrives, implement link tracing through each proxy to obtain the link tracing data D of each HTTP request reported to the center by the proxy at regular intervals; calculate the average performance index Y of each Web API interface by using an interface - dimension aggregation method;
[0042] An interface behavior characteristic calculation unit, which is used for the center to calculate the interface behavior characteristic data W according to the link tracing data D by using an interface behavior characteristic model;
[0043] The comprehensive judgment unit is used for the center to comprehensively judge according to the full static data S, the average performance index Y and the interface behavior characteristic data W by using a comprehensive judgment model, and perform timely response processing on the Web API interfaces corresponding to the scores of key concerns.
[0044] Further, the execution process of the comprehensive judgment unit is as follows:
[0045] The center performs a left outer join operation on the full static data S, the average performance index Y and the interface behavior characteristic data W to obtain the interface characteristic relationship A within the T time range; the interface characteristic relationship A = ((S left outer join Y) left outer join W);
[0046] Within v T time ranges, the center statistically obtains the set C of the interface characteristic relationship A, the set C = {A1, A2, A3,.., Av}; a certain tuple o in the interface characteristic relationship A is separately formed into a data set C’, the data set C’ = {o1, o2, o3,..ov};
[0047] Select a part of the subsets in the data set C’ as the validation set, and the remaining part as the training set; use a machine learning algorithm to fit the training set to obtain a prediction function f(o) for o; select the training model with the smallest mean square error of f for the validation set as the comprehensive judgment model; according to the comprehensive judgment model, obtain the key concern score score, where score = (f(o) - o) / o.
[0048] In a third aspect, the present invention further provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the API interface performance judgment method based on link tracing.
[0049] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0050] 1. The present invention does not achieve performance monitoring of Web API interfaces through simple statistical aggregation, but through learning the interface behavior characteristics, intelligently recommends the interfaces that need to be key concerned in combination with performance indicators, and makes reasonable recommendations; it does not obtain the behavior characteristics of Web API interfaces only through link tracing data, but combines the full interface data obtained by scanning for comprehensive judgment, and the accuracy is high.
[0051] 2. The present invention combines interface behavior characteristics and performance indicators to intelligently recommend the interfaces that need to be key concerned, which helps to better locate the performance bottleneck of the distributed system and better discover abnormal access behaviors. The more link tracing data there is, the more reliable the algorithm model is, and the higher the recommendation accuracy.
[0052] 3. The present invention can identify malicious attack behaviors, such as DOS attacks, SQL injections, XSS attacks, brute force cracking, etc.
[0053] 4. The present invention obtains the full amount of interface data through active scanning, with a wider monitoring range, which is more conducive to realizing the reconstruction and optimization of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The drawings described herein are used to provide a further understanding of the embodiments of the present invention, form a part of this application, and do not limit the embodiments of the present invention. In the drawings:
[0055] Figure 1 It is a schematic diagram of the Web API interface of the distributed system.
[0056] Figure 2 It is a flowchart of the API interface performance research and judgment method based on link tracing of the present invention.
[0057] Figure 3 It is a detailed flowchart of the API interface performance research and judgment method based on link tracing of the present invention.
[0058] Figure 4 It is a schematic diagram of the present invention for comprehensively researching and judging by combining performance indicators and interface behavior characteristics to recommend key concerns.
[0059] Figure 5 It is a schematic diagram of the structure of the API interface performance research and judgment system based on link tracing of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0060] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below in combination with the embodiments and the drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and do not limit the present invention.
[0061] Embodiment 1
[0062] Taking the interface as the dimension, the present invention forms a comprehensive score including interface performance characteristics and behavior characteristics through intelligent research and judgment on interface static data and link tracing dynamic data, and recommends key concerns based on this score. The research and judgment flowchart block diagram of the present invention is as Figure 3 shown. Compared with the prior art, it adds active scanning from each proxy to the corresponding distributed service, and comprehensively researches and judges the central comprehensive performance indicators and interface behavior characteristics.
[0063] As Figure 2 shown, the API interface performance research and judgment method based on link tracing of the present invention includes:
[0064] Each agent accesses the corresponding distributed service without code intrusion. When the distributed service starts, it actively scans all Web API interfaces in the distributed service, obtains the full set of static data S of the Web API interfaces, and reports it to the center;
[0065] When an HTTP request arrives, link tracing is implemented through each agent to obtain the link tracing data D of each HTTP request reported by the agent to the center at regular intervals; an interface-based aggregation method is used to calculate the average performance metric Y of each Web API interface;
[0066] The center calculates the interface behavior feature data W using the interface behavior feature model based on the link tracing data D;
[0067] The center performs a comprehensive evaluation using the comprehensive judgment model based on the full set of static data S, the average performance metric Y, and the interface behavior feature data W, and performs timely response processing on the Web API interfaces corresponding to the key concern scores.
[0068] The specific implementation is as follows:
[0069] Step 1, each agent accesses the corresponding distributed service without code intrusion. When the distributed service starts, it actively scans all Web API interfaces in the distributed service, obtains the full set of static data S of the Web API interfaces, and reports it to the center; among them, the full set of static data S includes the interface path, the call method of the interface, the call protocol of the interface, and the parameter type of the interface.
[0070] The full set of static data S = {p, m, proto, param}, where p is the interface path, m is the call method of the interface, proto is the call protocol of the interface, and param is the parameter type of the interface.
[0071] Step 2, when an HTTP request arrives, link tracing is implemented through each agent to obtain the link tracing data D of each HTTP request reported by the agent to the center at regular intervals; an interface-based aggregation method is used to calculate the average performance metric Y of each Web API interface; Step 2 specifically includes:
[0072] When an HTTP request arrives, the HTTP request passes through the agent, and it is judged whether the HTTP request contains a tracing ID: when the agent identifies that the HTTP request does not contain a tracing ID, a tracing ID is added to the HPPT request; when communication occurs between distributed services, the agent is responsible for intercepting the outgoing request and adding the tracing ID in the context to the outgoing request so that different requests on the same link can be associated with each other;
[0073] The agent regularly reports the link tracing data D of each HTTP request to the center; where the link tracing data D includes the interface path, the call time of the interface, the response time of the interface, the response status code, the error information, and the call parameters. The link tracing data D = {p, t1, t2, c, e, x}, where p is the interface path, t1 is the call time of the interface, t2 is the response time of the interface, c is the response status code, e is the error information, and x is the call parameter.
[0074] The center receives the link tracing data D regularly sent by the agent, and statistically analyzes the link tracing data D generated by n requests within the T time range. n and statistically analyzes the link tracing data D generated by n requests within the T time range. n Statistically aggregate by interface dimension, and the average performance metric Y of each Web API interface can be obtained. Where the average performance metric Y includes the interface path, the interface error rate, the number of requests with error information in n requests, the average response time, and the average call latency; the average performance metric Y = {p, er, at, al}, where p is the interface path, er is the interface error rate, e n is the number of requests with error information in n requests, at is the average response time, and al is the average call latency.
[0075] The calculation expression of the interface error rate is: er = e n / n, where er is the interface error rate, e n is the number of requests with error information in n requests, and n is the number of requests;
[0076] The calculation expression of the average response time is: at = ∑t2 / n, where t2 is the response time of the interface, and n is the number of requests;
[0077] The calculation expression of the average call latency is: al = ∑(t2 - t1) / n, where t2 is the response time of the interface, t1 is the call time of the interface, and n is the number of requests.
[0078] Step 3, the center calculates the interface behavior feature data W using the interface behavior feature model based on the link tracing data D; the interface behavior feature data W includes the call frequency, the number of requests hitting the interface path p in n requests, the call time, the performance change trend, and the call parameters;
[0079] The interface behavior feature W = {p, cr, t1, y1, x}, where p is the interface path, cr is the call frequency, p n is the number of requests hitting the interface path p in n requests, t1 is the call time, y1 is the performance change trend, and x is the call parameter.
[0080] The calculation expression of the interface behavior feature model is as follows:
[0081] cr = p n / T,
[0082] y1 = (Y - Y1) / Y
[0083] where cr is the call frequency, i.e., the number of calls per second; p n is the number of requests that hit the interface path p in n requests; T is the time range (in seconds) for a single batch statistics, y1 is the performance change trend, Y1 is the average performance index in the previous T time range, and Y is the average performance index.
[0084] Step 4: The center performs a comprehensive judgment using the comprehensive judgment model based on the full - volume static data S, the average performance index Y, and the interface behavior feature data W, and performs timely response processing on the Web API interfaces corresponding to the key - attention scores. Step 4 specifically includes:
[0085] The center performs a left - outer join operation on the full - volume static data S, the average performance index Y, and the interface behavior feature data W to obtain the interface feature relationship A within the T time range; the interface feature relationship A = ((S left - outer join Y) left - outer join W); the display effect in a two - dimensional table is as follows:
[0086] p m proto param t1 t2 c e x er at al cr y1 / registry GET http id .. .. .. .. .. .. .. .. .. .. / user POST https .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. / login DELETE http .. .. .. .. .. .. .. .. .. .. ..
[0087] Within v T time ranges, the center statistically obtains the set C of the interface feature relationship A, the set C = {A1, A2, A3,.., Av}; a certain tuple o in the interface feature relationship A is separately formed into a data set C’, the data set C’ = {o1, o2, o3,.., ov};
[0088] Select a part of the subsets in the data set C’ as the validation set, and the remaining part as the training set; use a machine - learning algorithm to fit the training set to obtain a prediction function f(o) for o; select the training model with the smallest mean - square error of f for the validation set as the comprehensive judgment model; according to the comprehensive judgment model, obtain the key - attention score score, where score = (f(o)-o) / o.
[0089] After long - term and persistent machine learning and algorithm model optimization, this behavior feature will gradually stabilize, and abnormal behaviors of the interface can be accurately identified, such as a large number of calls occurring at unconventional time points, sudden performance degradation, etc.
[0090] Such as Figure 4As shown, after the implementation of the above steps 1 to 4, the key focus score of 98 is obtained as the recommended key focus. After analysis: 1. The average response time of the security posture interface reaches 1 minute, the average error rate reaches 90%, and the average call delay reaches 13s, with extremely poor interface performance; 2. The security posture interface has a large number of high-frequency calls in the recent 24 hours, and the call time is mainly concentrated at 2 am, and the performance trend has decreased by 90% compared with the same period yesterday, and the behavior characteristics are abnormal; 3. After intelligent judgment, the performance indicators of this interface have suddenly dropped, and at the same time, the behavior characteristics are significantly abnormal, with higher risks compared with other interfaces. Finally, a key focus score of 98 is obtained, indicating that this interface needs to be responded to and processed in a timely manner.
[0091] The working principle is as follows: In the existing method for monitoring and judging the performance of a distributed system using link tracing, there are problems such as low accuracy in monitoring and judging whether there are some risks in the interface and inability to make reasonable recommendations; and the existing method only monitors the called interfaces, and the unused interfaces are not monitored. The present invention designs a method for judging the performance of API interfaces based on link tracing. Compared with the existing solution 1, the present invention comprehensively judges the link tracing sampling data generated by multiple requests in terms of the interface, and the obtained performance indicators are more accurate. Compared with the existing solution 2, although both aggregate performance indicators in terms of the interface, the present invention does not simply statistically calculate the performance indicators of the interface, but combines the performance indicators of the interface with the behavior characteristics of the interface to intelligently recommend the interfaces that need to be focused on. The more link tracing data there is, the more reliable the algorithm model is, and the higher the recommendation accuracy. At the same time, by actively scanning to obtain the full amount of interface data, the monitoring range is wider, useless interfaces can be identified, which is more conducive to realizing the reconstruction and optimization of the system.
[0092] The present invention does not achieve the performance monitoring of Web API interfaces through simple statistical aggregation, but intelligently recommends the interfaces that need to be focused on through learning the behavior characteristics of the interfaces and combining performance indicators for reasonable recommendation; it does not obtain the behavior characteristics of Web API interfaces only through link tracing data, but combines the full amount of interface data obtained by scanning for comprehensive judgment, and the accuracy is high.
[0093] Embodiment 2
[0094] As Figure 5 shown, the difference between this embodiment and Embodiment 1 is that this embodiment provides a system for judging the performance of API interfaces based on link tracing. This system supports the method for judging the performance of API interfaces based on link tracing described in Embodiment 1. This system includes:
[0095] A static data acquisition unit, which is used for each agent to access the corresponding distributed service without code intrusion, actively scan all Web API interfaces in the distributed service when the distributed service is started, obtain the full volume of static data S of the Web API interfaces, and report it to the center;
[0096] An average performance index calculation unit, which is used to implement link tracing through each agent when an HTTP request arrives, obtain the link tracing data D of each time of the HTTP request reported by the agent to the center at regular intervals; calculate the average performance index Y of each Web API interface by adopting an interface-based dimension aggregation method;
[0097] An interface behavior feature calculation unit, which is used for the center to calculate the interface behavior feature data W by adopting an interface behavior feature model according to the link tracing data D;
[0098] A comprehensive research and judgment unit, which is used for the center to conduct a comprehensive evaluation by adopting a comprehensive research and judgment model according to the full volume of static data S, the average performance index Y, and the interface behavior feature data W, and perform timely response processing on the Web API interfaces corresponding to the key concern scores.
[0099] Specifically, the execution process of the comprehensive research and judgment unit is as follows:
[0100] The center performs a left outer join operation on the full volume of static data S, the average performance index Y, and the interface behavior feature data W to obtain an interface feature relationship A within the T time range; the interface feature relationship A = ((S left outer join Y) left outer join W);
[0101] Within v T time ranges, the center statistically obtains a set C of the interface feature relationship A, the set C = {A1, A2, A3,.., Av}; a certain tuple o in the interface feature relationship A is separately formed into a data set C’, the data set C’ = {o1, o2, o3,..ov};
[0102] Select a part of the subsets in the data set C’ as the validation set, and the remaining part as the training set; adopt a machine learning algorithm to fit the training set to obtain a prediction function f(o) for o; select the training model with the smallest mean square error of f for the validation set as the comprehensive research and judgment model; according to the comprehensive research and judgment model, obtain the key concern score score, where score = (f(o) - o) / o.
[0103] The execution processes of other units can be carried out according to the flow steps of the API interface performance research and judgment method based on link tracing described in Embodiment 1, and will not be elaborated one by one in this embodiment.
[0104] The system of the present invention combines interface behavior characteristics and performance indicators, and intelligently recommends the interfaces that need to be focused on, which helps to better locate the performance bottleneck of the distributed system and better discover abnormal access behaviors. The more link tracing data there is, the more reliable the algorithm model is, and the higher the recommendation accuracy is. The present invention can identify malicious attack behaviors, such as DOS attacks, SQL injections, XSS attacks, brute force cracking, etc. The present invention obtains the full amount of interface data through active scanning, with a wider monitoring range, which is more conducive to the reconstruction and optimization of the system.
[0105] Meanwhile, the present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method for judging the performance of the API interface based on link tracing.
[0106] 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-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0107] 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 the 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 realizing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0108] 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 realizes the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0109] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable apparatus to generate a computer-implemented process, thereby providing instructions for implementing the steps specified in one process or a plurality of processes and / or blocks Figure 1 in one block or a plurality of blocks Figure 1 for the functions specified in one block or a plurality of blocks.
[0110] The specific embodiments described above have further elaborated on the objectives, technical solutions, and beneficial effects of the present invention. It should be understood that the above description is only for the specific embodiments of the present invention and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for judging the performance of API interfaces based on link tracing, characterized in that, The method includes: Each agent accesses the corresponding distributed service without code intrusion, actively scans all Web API interfaces in the distributed service when the distributed service starts, obtains the full set of static data of the Web API interfaces, and reports it to the center; Obtain the HTTP requests of the external service, implement link tracing through each agent, and obtain the link tracing data of each of the HTTP requests reported by the agent to the center at regular intervals; adopt an aggregation method with the interface as the dimension to calculate the average performance index of each Web API interface; The center calculates the interface behavior characteristic data by using the interface behavior characteristic model according to the link tracing data; The center obtains the key attention score by using the comprehensive research and judgment model according to the full set of static data, average performance index and interface behavior characteristic data, recommends the key attention Web API interfaces according to the key attention score, and performs timely response processing; The center obtains the key attention score by using the comprehensive research and judgment model according to the full set of static data, average performance index and interface behavior characteristic data, recommends the key attention Web API interfaces according to the key attention score, and performs timely response processing, specifically including: The center performs a left outer join operation on the full set of static data, average performance index and interface behavior characteristic data to obtain the interface characteristic relationship A within the T time range; the interface characteristic relationship A = ((S left outer join Y) left outer join W), where S is the full set of static data, Y is the average performance index, and W is the interface behavior characteristic data; Within v T time ranges, the center statistically obtains the set C of the interface characteristic relationship A, and the set C = {A1, A2, A3,.., Av}; a certain tuple o in the interface characteristic relationship A is separately formed into a data set C', and the data set C' = {o1, o2, o3,..ov}; Select a part of the subsets in the data set C' as the validation set, and the remaining part as the training set; use a machine learning algorithm to fit the training set to obtain the prediction function f(o) for o; select the training model with the smallest mean square error of the prediction function f(o) for the validation set as the comprehensive research and judgment model; according to the comprehensive research and judgment model, obtain the key attention score score, where score = (f(o) - o) / o.
2. The method for judging the performance of an API interface based on link tracing according to claim 1, wherein The full set of static data includes the interface path, the calling method of the interface, the calling protocol of the interface, and the parameter type of the interface.
3. The method for judging the performance of an API interface based on link tracing according to claim 1, wherein Obtain the HTTP requests of the external service, implement link tracing through each agent, and obtain the link tracing data of each of the HTTP requests reported by the agent to the center at regular intervals; Adopt an aggregation method with the interface as the dimension to calculate the average performance index of each Web API interface, specifically including: When an HTTP request arrives, the HTTP request goes through a proxy to determine whether the HTTP request contains a trace ID: when the proxy identifies that the HTTP request does not contain a trace ID, a trace ID is added to the HPPT request; when communication occurs between distributed services, the proxy is responsible for intercepting outgoing requests and adding the trace ID in the context to the outgoing requests to correlate different requests on the same link; The proxy periodically reports the link trace data D of each HTTP request to the center; The central receiving agent periodically sends the link trace data D, and counts the link trace data D generated by n requests within the time range T. n And the link trace data D generated by n requests within the time range T n is statistically aggregated by interface dimension, and the average performance metric Y of each Web API interface can be obtained.
4. The method for judging the performance of an API interface based on link tracing according to claim 3, wherein The link trace data D includes the interface path, the call time of the interface, the response time of the interface, the response status code, the error message, and the call parameters.
5. The method for judging the performance of an API interface based on link tracing according to claim 3, wherein The average performance metric Y includes the interface path, the interface error rate, the number of requests with error messages in n requests, the average response time, and the average call latency; The calculation expression for the interface error rate is: er = e n / n, where er is the interface error rate, and e n is the number of requests with error information in n requests, and n is the number of requests; The calculation expression for the average response time is: at = ∑t2 / n, where t2 is the response time of the interface and n is the number of requests; The calculation expression for the average call latency is: al = ∑(t2 - t1) / n, where t2 is the response time of the interface, t1 is the call time of the interface, and n is the number of requests.
6. The method for judging the performance of an API interface based on link tracing according to claim 1, wherein The interface behavior characteristic data includes the call frequency, the number of requests hitting the interface path p in n requests, the call time, the performance change trend, and the call parameters; The calculation expression for the interface behavior characteristic model is: cr = p n / T, y1 = (Y - Y1) / Y Among them, cr is the call frequency, p n is the number of requests that hit the interface path p in n requests, T is the time range for a single batch of statistics, y1 is the performance change trend, Y1 is the average performance index in the previous time range of T, and Y is the average performance index.
7. A performance judgment system for API interfaces based on link tracing, characterized in that This system supports the API interface performance research and judgment method based on link tracing as described in any one of claims 1 to 6. This system includes: A static data acquisition unit, which is used for each proxy to access the corresponding distributed service without code intrusion, actively scan all Web API interfaces in the distributed service when the distributed service starts, obtain the full amount of static data of the Web API interfaces, and report it to the center; An average performance metric calculation unit, which is used to obtain the HTTP requests of external services, implement link tracing through each proxy, and obtain the link trace data of each HTTP request reported by the proxy to the center periodically; calculate the average performance metric of each Web API interface by using the interface - dimension aggregation method; An interface behavior characteristic calculation unit, which is used for the center to calculate the interface behavior characteristic data according to the link trace data by using the interface behavior characteristic model; A comprehensive research and judgment unit, which is used for the center to obtain the key - attention score according to the full amount of static data, the average performance metric, and the interface behavior characteristic data by using the comprehensive research and judgment model, recommend the key - attention Web API interfaces according to the key - attention score, and perform timely response processing; The execution process of the comprehensive research and judgment unit is: The center performs a left outer join operation on the full amount of static data, the average performance metric, and the interface behavior characteristic data to obtain the interface characteristic relationship A within the T - time range; the interface characteristic relationship A = ((S left outer join Y) left outer join W), where S is the full amount of static data, Y is the average performance metric, and W is the interface behavior characteristic data; Within the v T time ranges, the center statistically obtains the set C of the interface feature relationships A, and the set C = {A1, A2, A3,.., Av}; a certain tuple o in the interface feature relationship A is separately formed into a data set C', and the data set C' = {o1, o2, o3,.., ov}; Select a part of the subsets in the data set C' as the validation set, and the remaining part as the training set; use a machine learning algorithm to fit the training set to obtain a prediction function f(o) for o; select the training model with the smallest mean square error of the prediction function f(o) for the validation set as the comprehensive judgment model; according to the comprehensive judgment model, obtain the key attention score score, where score = (f(o) - o) / o.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the API interface performance judgment method based on link tracing according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for controlling sampling rate of distributed link tracking system
CN112860507A
Link data tracking method and device, equipment and storage medium
CN113254341A