Interface monitoring method, device, apparatus and storage medium
By automatically selecting an appropriate monitoring algorithm based on the total number of interface requests, the problem of inappropriate selection of interface monitoring algorithms in existing technologies is solved, improving the accuracy of monitoring results and optimizing resource utilization.
Patent Information
- Application Number
- CN202111620394.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2041-12-27
AI Technical Summary
The existing technology lacks a unified algorithm for monitoring the average time of interface, making it difficult for users to choose a suitable algorithm, resulting in inaccurate monitoring results and wasted computing resources and memory.
By obtaining the total number of requests received by the interface per unit time, an appropriate time consumption monitoring algorithm is automatically selected based on the comparison result with a preset threshold. This includes a first monitoring algorithm and a second monitoring algorithm, which are applicable to cases with a large number of requests and a small number of requests, respectively. The maximum average time consumption and the percentage of request time consumption are calculated to match the percentile value.
It automatically selects the appropriate time-consuming monitoring algorithm, which improves the accuracy of monitoring results, avoids resource waste and inconsistent results caused by manual selection, and balances the relationship between monitoring results, computing resources and memory.
Smart Images

Figure CN114398227B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of monitoring methods, and particularly relates to a monitoring method and device for an interface, an apparatus, and a storage medium. BACKGROUND
[0002] With the rapid development of technology, computer technology has been rapidly popularized and widely applied, and has become an indispensable tool in people's work and life. Many businesses can be completed through computers.
[0003] In order to maintain the normal operation of computer business, it is usually necessary to monitor the interface of the computer, and specifically, the average time consumption of the interface can be monitored, such as monitoring the P99 time consumption of the interface, so as to facilitate troubleshooting or performance improvement.
[0004] However, there are many monitoring algorithms for the average time consumption of the interface in the prior art, and they are all developed for specific businesses, are targeted, and are suitable for different scenarios. Before monitoring the interface, the user needs to manually select the monitoring algorithm to be used. If the user is not familiar with each monitoring algorithm, it is easy to select an inappropriate monitoring algorithm to monitor a certain business of the interface, and the final monitoring result is also inaccurate. If the user selects multiple monitoring algorithms to monitor a certain business of the interface in order to accurately monitor, multiple different results will be obtained, and the user cannot determine whether there is an accurate monitoring result among them, and which monitoring result is more accurate, which has a negative effect on the goal of troubleshooting or performance improvement. SUMMARY
[0005] The present disclosure provides a monitoring method, device, apparatus and storage medium for an interface, to automatically select a suitable monitoring algorithm and improve the accuracy of the monitoring result.
[0006] The technical solutions of the present disclosure are as follows:
[0007] According to a first aspect of the embodiments of the present disclosure, a monitoring method for an interface is provided, comprising: obtaining a total number of requests received by the interface within a unit time; comparing the total number of requests received by the interface within the unit time with a preset threshold to obtain a corresponding comparison result; and selecting a corresponding time consumption monitoring algorithm according to the comparison result to monitor the request time consumption of the interface.
[0008] Optionally, the step of selecting a corresponding time-consuming monitoring algorithm according to the comparison result to monitor the request time consumption of the interface comprises: if the total number of request times in a unit time is greater than or equal to a preset threshold, selecting a first monitoring algorithm to monitor the request time consumption of the interface, the first monitoring algorithm comprising grouping the request time consumption in the to-be-calculated batch and calculating the average of the maximum time consumption value in each group; if the total number of request times in a unit time is less than the preset threshold, selecting a second monitoring algorithm to monitor the request time consumption of the interface, the second monitoring algorithm comprising calculating the percentage of each request time consumption in the to-be-calculated batch, and matching the percentage of each request time consumption with a preset quantile value, wherein the time consumption with the same time length in the to-be-calculated batch is defined as one kind of time consumption.
[0009] Optionally, the step of selecting the first monitoring algorithm to monitor the request time consumption of the interface comprises: obtaining a target statistical quantity of each group of time consumption, the target statistical quantity being greater than or equal to a minimum statistical quantity corresponding to the first monitoring index; grouping the request time consumption in the to-be-calculated batch according to the target statistical quantity of each group of time consumption; determining the maximum time consumption value in each group of time consumption, and accumulating the maximum time consumption value in each group of time consumption; and taking the ratio of the accumulated accumulated time consumption to the total number of groups as the time consumption value of the to-be-calculated batch.
[0010] Optionally, before the step of selecting a corresponding time-consuming monitoring algorithm according to the comparison result to monitor the request time consumption of the interface, the monitoring method further comprises: obtaining a first monitoring instruction, the first monitoring instruction comprising a first monitoring index; and the step of taking the ratio of the accumulated accumulated time consumption to the total number of groups as the time consumption value of the to-be-calculated batch comprises: taking the time consumption value of the to-be-calculated batch as the monitoring result corresponding to the first monitoring index.
[0011] Optionally, the minimum statistical quantity corresponding to the first monitoring index is obtained by the following steps: obtaining a relationship between the expectation and the quantile value corresponding to the exponential distribution delay; and calculating the minimum statistical quantity of the maximum time consumption value according to the preset quantile value and the relationship.
[0012] Optionally, the step of selecting the second monitoring algorithm to monitor the request time consumption of the interface comprises: counting the number of requests of each request time consumption in the batch to be calculated; calculating the difference between the total number of requests in the batch to be calculated and the current cumulative number of requests, and calculating the percentage of the difference in the total number of requests, and recording the percentage as a first set; the current cumulative number of requests is the cumulative number of requests corresponding to the number of requests of each request time consumption; selecting the maximum percentage from the first set as the current percentage, and comparing it with the preset plurality of quantile values from large to small in order until the current percentage is greater than the first quantile value; placing the current percentage into the container corresponding to the second quantile value, wherein the second quantile value is greater than the first quantile value, and deleting the current percentage from the first set, and recording the remaining percentages as a second set; selecting the maximum percentage from the second set as the current percentage, and comparing it with the quantile values arranged from large to small starting from the first quantile value in order until the current percentage is greater than the third quantile value, and deleting the current percentage from the second set, and recording the remaining percentages as a third set; and so on until the percentages are placed in the containers corresponding to each quantile value.
[0013] Optionally, before the step of selecting the corresponding monitoring algorithm to monitor the request time consumption of the interface according to the comparison result, the monitoring method further comprises: obtaining a second monitoring instruction, the second monitoring instruction comprising a second monitoring index; and the step of selecting the second monitoring algorithm to monitor the interface further comprises: taking the percentages in the container of the second monitoring index corresponding quantile value as the monitoring result of the interface.
[0014] Optionally, the preset threshold is 100.
[0015] According to a second aspect of the embodiments of the present disclosure, a monitoring device for an interface is provided, comprising a first obtaining unit configured to obtain the total number of requests received by the interface within a unit time; a judging unit configured to compare the total number of requests received by the interface within the unit time with a preset threshold to obtain a corresponding comparison result; and a monitoring unit configured to select a corresponding time consumption monitoring algorithm to monitor the request time consumption of the interface according to the comparison result.
[0016] Optionally, the monitoring unit is specifically configured to: if the total number of requests within the unit time is greater than or equal to the preset threshold, select a first monitoring algorithm to monitor the request time consumption of the interface; and if the total number of requests within the unit time is less than the preset threshold, select a second monitoring algorithm to monitor the request time consumption of the interface.
[0017] Optionally, the monitoring unit is further configured to: obtain a target statistical quantity of each group of time consumption, the target statistical quantity being greater than or equal to the minimum statistical quantity corresponding to the first monitoring index; group the request time consumptions in the to-be-calculated batch according to the target statistical quantity of each group of time consumption; determine a maximum time consumption value in each group of time consumption, and accumulate the maximum time consumption values in each group of time consumption; and take a ratio of the accumulated time consumption to the total number of groups as the time consumption value of the to-be-calculated batch.
[0018] Optionally, the monitoring device further comprises: a second obtaining unit configured to obtain a first monitoring instruction, the first monitoring instruction comprising the first monitoring index; and the monitoring unit is further configured to: take the time consumption value of the to-be-calculated batch as the monitoring result corresponding to the first monitoring index.
[0019] Optionally, the monitoring device further comprises: a third obtaining unit configured to obtain a relationship between an expected value and a quantile value corresponding to the exponential distribution delay; and a calculating unit configured to perform calculation according to the preset quantile value and the relationship to obtain the minimum statistical quantity of the maximum time consumption value.
[0020] Optionally, the monitoring unit is further configured to: count the number of requests of each request time consumption in the to-be-calculated batch, wherein the time consumption with the same time length in the to-be-calculated batch is defined as one type of time consumption; calculate a difference between a total number of requests and a current cumulative number of requests in the to-be-calculated batch, and calculate a percentage of the difference in the total number of requests, and record the percentage as a first set; the current cumulative number of requests is a cumulative number of requests corresponding to the number of requests of each request time consumption; select a maximum percentage from the first set as a current percentage, and compare the current percentage with the quantile values in descending order, until the current percentage is greater than a first quantile value; put the current percentage into a container corresponding to a second quantile value, wherein the second quantile value is greater than the first quantile value, and delete the current percentage from the first set, and record the remaining percentages as a second set; select a maximum percentage from the second set as a current percentage, and compare the current percentage with the quantile values arranged in descending order from the first quantile value, until the current percentage is greater than a third quantile value, and delete the current percentage from the second set, and record the remaining percentages as a third set; and in this way, until the percentages are put into the containers corresponding to each quantile value.
[0021] Optionally, the monitoring device further comprises: a second obtaining unit configured to obtain a second monitoring target instruction, the second monitoring target instruction comprising a second monitoring index; and the monitoring unit is further configured to: take the percentages in the container corresponding to the quantile value of the second monitoring index as the monitoring result of the interface.
[0022] Optionally, the preset threshold is 100.
[0023] According to a third aspect of the embodiments of the present disclosure, an interface monitoring device is provided, comprising a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the interface monitoring method of any of the optional implementation manners of the first aspect.
[0024] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, and the computer-readable storage medium stores instructions, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the interface monitoring method of any of the optional implementation manners of the first aspect.
[0025] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided, and the computer program product comprises computer instructions, when the computer instructions are executed on an electronic device, the electronic device executes the interface monitoring method of any of the optional implementation manners of the first aspect.
[0026] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure.
[0027] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects:
[0028] Based on any of the above aspects, in the present disclosure, the total number of request times received by the interface in a unit time is first acquired; then according to the size relationship between the total number of request times received by the interface in a unit time and a preset threshold, a corresponding time-consuming monitoring algorithm is selected to monitor the request time consumption of the interface. In this way, the present disclosure takes the total number of request times received by the interface in a unit time as the trigger condition of each time-consuming monitoring algorithm, when the number of requests received by the interface in a unit time meets a certain time-consuming monitoring algorithm, the time-consuming monitoring algorithm is automatically selected, so as to realize automatic selection of the appropriate time-consuming monitoring algorithm to monitor the request time consumption of the interface, avoid the disturbance caused by manual selection, and the disturbance caused by the inconsistent results caused by manual selection of multiple time-consuming monitoring algorithms, which is helpful to help users to eliminate obstacles or improve performance; at the same time, the present disclosure can ensure the accuracy of the time-consuming monitoring result to a certain extent by automatically selecting the appropriate time-consuming monitoring algorithm, avoid the waste of computing resources and memory caused by using inappropriate time-consuming monitoring algorithm, so as to balance the relationship among the monitoring result, the computing resources and the memory.
[0029] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0030] The accompanying drawings, which are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure and, without in any way limiting the present disclosure, do not constitute an improper limitation of the present disclosure.
[0031] Figure 1 A monitoring system schematic diagram provided by the embodiments of the present disclosure;
[0032] Figure 2 A flowchart of a monitoring method of an interface according to the embodiments of the present disclosure;
[0033] Figure 3 A flowchart of a monitoring method of an interface according to the embodiments of the present disclosure;
[0034] Figure 4 A flowchart of a monitoring method of an interface according to the embodiments of the present disclosure;
[0035] Figure 5 A flowchart of a monitoring method of an interface according to the embodiments of the present disclosure;
[0036] Figure 6 A structural block diagram of a monitoring device of an interface according to the embodiments of the present disclosure;
[0037] Figure 7 A structural block diagram of a monitoring device of an interface according to the embodiments of the present disclosure. DETAILED DESCRIPTION
[0038] In order to make the ordinary person in the art better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below in conjunction with the drawings.
[0039] It should be noted that the terms "first", "second", and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0040] It should also be understood that the term "comprising" indicates the presence of described features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, and / or components.
[0041] As described in the background technology, since different methods are used for different business scenarios in the existing technology, users who are not familiar with the business scenarios may have questions: Why do different time consumption monitoring algorithms have different monitoring results for the same monitoring indicator? For example, different methods have different monitoring results for p99 time consumption. When users have these questions, they often get bogged down in the inconsistency of the data, which is not conducive to the use of time consumption monitoring algorithms and has the opposite effect on the goal of monitoring to shorten the user's troubleshooting time.
[0042] Based on this, this disclosure provides an interface monitoring method. First, the total number of requests received by the interface per unit time is obtained. Then, based on the relationship between the total number of requests received per unit time and a preset threshold, a corresponding time-consuming monitoring algorithm is selected to monitor the request time of the interface. In this way, by using the total number of requests received by the interface per unit time as the trigger condition for each time-consuming monitoring algorithm, this disclosure automatically selects the appropriate time-consuming monitoring algorithm when the number of requests received by the interface within a unit time matches a certain time-consuming monitoring algorithm. This achieves automatic selection of a suitable time-consuming monitoring algorithm to monitor the request time of the interface, avoiding the inconvenience caused by manual selection by the user, and the inconsistency caused by manually selecting multiple time-consuming monitoring algorithms. This helps users troubleshoot obstacles or improve performance. At the same time, by automatically selecting a suitable time-consuming monitoring algorithm, this disclosure can, to a certain extent, ensure the accuracy of the time-consuming monitoring results, avoiding the waste of computing resources and memory caused by using inappropriate time-consuming monitoring algorithms, thereby balancing the relationship between monitoring results, computing resources, and memory.
[0043] The monitoring method for the interface provided in this disclosure is illustrated below with reference to the accompanying drawings:
[0044] Figure 1 This is a schematic diagram of a monitoring system provided in an embodiment of the present disclosure, such as... Figure 1 As shown, the monitoring system may include: a requesting device 1100 and an electronic device 1200. The electronic device 1200 can establish a connection with the requesting device 1100 through a wired network or a wireless network.
[0045] In this disclosure, the requesting device 1100 can be a personal device. A user can send a corresponding request to the electronic device 1200 through the requesting device 1100. In some embodiments, the requesting device 1100 can also be an input device connected to the electronic device 1200. An exemplary requesting device 1100 can be one or more of a keyboard, touchpad, touchscreen, remote control, voice interaction, or handwriting device, similar to the relationship between a computer host and an I / O input device. This disclosure does not limit the scope of the requesting device.
[0046] In the present disclosure, the electronic device 1200 can be a server or a terminal, and the present disclosure does not limit the same.
[0047] In some embodiments, when the electronic device 1200 is a server, the server can be a single server, or can also be a server cluster composed of multiple servers. In some embodiments, the server cluster can also be a distributed cluster. The present disclosure does not limit the specific implementation of the server.
[0048] In some embodiments, when the electronic device 1200 is a terminal, the terminal can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, and a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) \ virtual reality (VR) device, and the like, which can install and use a content community application (such as Kuaishou). The present disclosure does not specially limit the specific form of the terminal. It can interact with the user through one or more ways such as a keyboard, a touchpad, a touch screen, a remote controller, voice interaction, or a handwriting device.
[0049] The data processing method provided by the embodiments of the present disclosure will be described in detail below in combination with the monitoring system shown in the foregoing Figure 1
[0050] The interface monitoring method provided by the embodiments of the present disclosure can be applied to the electronic device in the application scenario shown in the foregoing Figure 1
[0051] Figure 2 is a flowchart of an interface monitoring method according to an exemplary embodiment. As shown in Figure 2 The interface monitoring method is used in an electronic device, and includes the following steps:
[0052] In step S100, the total number of requests received by the interface in a unit time is obtained.
[0053] The present disclosure is applied to various electronic devices such as tablet computers, computers, and televisions, and can be used to monitor the state of various data interfaces in the electronic device. Specifically, the state of the interface is monitored by monitoring the time consumption of the requests received by the interface.
[0054] The unit time can be 1 second, 10 seconds, or 1 minute, which can be set as needed.
[0055] Optionally, the request can be a query request or a calling request, and can also be a request for adding data. Meanwhile, the request can be sent by a receiving terminal, a receiving server, or other electronic devices, and can also be triggered in response to a user's request operation, that is, the time consumption monitoring of the interface can be the request time consumption of the interface of the electronic device itself, or the request time consumption of the interface of other devices monitored by the electronic device, which is not limited in the present disclosure.
[0056] For example, the electronic device can respond to the query service of an external device, in which case the electronic device receives a service query request sent by the external device, the electronic device queries corresponding data at a corresponding position in response to the query request, and feeds back to the external device. The electronic device counts the number of query requests in a period of time, and then calculates the total number of received requests per unit time.
[0057] In step S200, the total number of received requests per unit time is compared with a preset threshold to obtain a corresponding comparison result.
[0058] The preset threshold is a value of the number of requests stored in advance in the electronic device, and can be one or multiple. The preset threshold is used to distinguish the triggering conditions of different time consumption monitoring algorithms.
[0059] Specifically, after obtaining the total number of received requests per unit time of the interface, the electronic device compares the total number of received requests per unit time with the preset threshold, determines the size relationship between the total number of received requests per unit time and the preset threshold as the comparison result, and as an example, the preset threshold can be one, in which case the comparison result includes that the total number of received requests per unit time is greater than or equal to the preset threshold, and the total number of received requests per unit time is less than the preset threshold. The preset threshold can be set according to actual conditions, and as an example, the preset threshold is set to 100 in the present disclosure. As another embodiment, the preset threshold can also be multiple, such as multiple preset thresholds A > B > C, A, B, and C are all greater than 0, in which case the comparison result includes that the total number of received requests per unit time can be between A and B, between B and C, greater than or equal to A, or less than C.
[0060] In step S300, a corresponding monitoring algorithm is selected according to the comparison result to monitor the interface.
[0061] The present disclosure can pre-set different monitoring algorithms (i.e., the above-mentioned time consumption monitoring algorithms, which can be referred to as monitoring algorithms for short), each of which corresponds to a comparison result. After the electronic device obtains the comparison result, a suitable monitoring algorithm can be selected according to the comparison result to monitor the interface.
[0062] Specifically, as an embodiment, in combination with Figure 2 , referring to Figure 3 , when the preset threshold is one, the step S300 of selecting a corresponding monitoring algorithm to monitor the interface according to the comparison result includes:
[0063] The step S310, if the total number of requests received in a unit of time is greater than or equal to the preset threshold, the first monitoring algorithm is selected to monitor the request time consumption of the interface, and the first monitoring algorithm includes grouping the request time consumption in the to-be-calculated batch and calculating the mean value of the maximum time consumption value in each group.
[0064] The step S320, if the total number of requests received in a unit of time is less than the preset threshold, the second monitoring algorithm is selected to monitor the request time consumption of the interface, and the second monitoring algorithm includes calculating the percentage of each request time consumption in the to-be-calculated batch, and matching the percentage of each request time consumption with a preset quantile value, wherein the request time consumption with the same time length in the to-be-calculated batch is defined as one request time consumption.
[0065] Specifically, when the preset threshold is one, two monitoring algorithms are pre-set, which are the first monitoring algorithm and the second monitoring algorithm. When the total number of requests received in a unit of time is greater than or equal to the preset threshold, the pre-set first monitoring algorithm is selected to monitor the interface. When the total number of requests received in a unit of time is less than the preset threshold, the pre-set second monitoring algorithm is selected to monitor the interface, wherein the first monitoring algorithm is mainly applicable to the case / business scenario with a large number of requests, and the second monitoring algorithm is mainly applicable to the case / business scenario with a small number of requests.
[0066] As another embodiment, when the preset threshold is multiple, for example, the multiple preset thresholds are A>B>C>0. If the total number of requests received in a unit of time is greater than or equal to A, the pre-set third monitoring algorithm can be selected. If the total number of requests received in a unit of time is greater than or equal to B and less than A, the pre-set fourth monitoring algorithm can be selected. If the total number of requests received in a unit of time is greater than or equal to C and less than B, the pre-set fifth monitoring algorithm can be selected. If the total number of requests received in a unit of time is less than C, the pre-set sixth monitoring algorithm can be selected. According to the above description, those skilled in the art can know that the preset threshold can be set according to the actual situation, and the appropriate monitoring algorithm is selected according to the size of the data amount.
[0067] The technical solution provided by the above embodiments brings at least the following beneficial effects: First, the total number of requests received by the interface per unit time is obtained. Then, based on the relationship between the total number of requests received by the interface per unit time and a preset threshold, a corresponding time-consuming monitoring algorithm is selected to monitor the request time of the interface. In this way, by using the total number of requests received by the interface per unit time as the trigger condition for each time-consuming monitoring algorithm, when the number of requests received by the interface per unit time meets the requirements of a certain time-consuming monitoring algorithm, the algorithm is automatically selected. This achieves automatic selection and switching of appropriate time-consuming monitoring algorithms to monitor the request time of the interface, avoiding the inconvenience caused by manual selection by users, and the inconsistency caused by manually selecting multiple time-consuming monitoring algorithms. This helps users to eliminate obstacles or improve performance. Furthermore, the total number of requests per unit time varies for different business scenarios. This disclosure can automatically select and switch appropriate time-consuming monitoring algorithms to monitor the request time of the interface based on the total number of requests per unit time, that is, it can automatically select and switch appropriate time-consuming monitoring algorithms to monitor the request time of the interface for different business scenarios. Meanwhile, this disclosure can ensure the accuracy of time consumption monitoring results to a certain extent by automatically selecting and switching appropriate time consumption monitoring algorithms, and avoid the waste of computing resources and memory caused by using inappropriate time consumption monitoring algorithms, thereby balancing the relationship between monitoring results, computing resources and memory.
[0068] In one embodiment, combined with Figure 3 ,like Figure 4 As shown, when the total number of requests per unit time is greater than or equal to a preset threshold, the steps for selecting the first monitoring algorithm to monitor the request time of the interface include:
[0069] Step S311: Obtain the target statistic for each group of time consumption. The target statistic is greater than or equal to the minimum statistic corresponding to the first monitoring indicator.
[0070] The target statistic for each time elapsed can be input by the user or automatically obtained by the electronic device. The condition for the target statistic for each time elapsed is that the target statistic for each time elapsed is greater than or equal to the minimum statistic corresponding to the first monitoring indicator. The minimum statistic corresponding to the first monitoring indicator is obtained through the following steps:
[0071] Obtain the relationship between the expected value and the quantile value corresponding to the exponential distribution delay.
[0072] The minimum statistical measure of the maximum time consumption is obtained by calculating based on the preset quantile value and relational formula.
[0073] Specifically, when dealing with large amounts of data, the probability of the request's latency value is typically distributed exponentially. Therefore, the probability density function and cumulative distribution function of the exponential distribution are as follows:
[0074] P(x) = l, e -λx , x > 0;
[0075] Wherein P(x) represents the function density function of exponential distribution, F(x) represents the cumulative distribution function, and x is the time consumption value.
[0076] Assuming that the maximum value of n time consumption values is used as an estimate, the cumulative distribution function of x can be obtained:
[0077] F X (x) = P(X < x)
[0078] = P(Max(X1, X2, …, X n ) < x)
[0079] = P(X1 < x), P(X2 < x) … P(X n < x)
[0080] = (F(x)) n
[0081] = (1 - e -λx ) n
[0082] The expectation E(X) of X can be calculated from the cumulative distribution function of X:
[0083]
[0084] E(X) is an estimated value, and our purpose is to monitor the state of the interface to obtain the corresponding quantile value, denoted as p. Then, the following can be obtained:
[0085]
[0086] E(X) = F -1 (p), that is n can be solved, and n represents the minimum statistic corresponding to the first monitoring index (i.e., the quantile value). For example, when p = 99%, n = 57. That is, when monitoring p99, the minimum statistic of each group is 57, and therefore the target statistic of each group of time consumption is at least 57.
[0087] The technical scheme provided by the above embodiment at least brings the following beneficial effects: a specific implementation manner for calculating the minimum statistic is given, which can make the calculated minimum statistic more accurate.
[0088] As an embodiment, the first monitoring target can also be specified by the user, such as specifying p99, or p99.5, etc. of the monitoring interface, at this time, before the step of selecting the corresponding time-consuming monitoring algorithm according to the comparison result to monitor the request time of the interface, the monitoring method further comprises:
[0089] Obtaining a first monitoring instruction, the first monitoring instruction comprising a first monitoring index.
[0090] Specifically, before the monitoring starts, the user can trigger the monitoring instruction of the interface through the input device, and the monitoring instruction at least comprises the first monitoring target index, which is p99, or p99.5, etc. As another embodiment, the first monitoring index can also be a fixed monitoring index, which is not triggered by the user, and the first monitoring index is obtained before the monitoring algorithm is selected.
[0091] Step S312, grouping the request time in the batch to be calculated according to the target statistical quantity of each group of time consumption.
[0092] Specifically, after obtaining the target statistical quantity of each group of time consumption, the request time in the batch to be calculated is grouped according to the target statistical quantity of each group of time consumption, that is, each group of time consumption has a target statistical quantity of data, for example, when monitoring p99, assuming that the target statistical quantity of each group of time consumption is 60, after grouping, each group of time consumption has 60 data, and in other embodiments, when monitoring p99, the target statistical quantity of each group of time consumption can be set to other values, as long as it is greater than or equal to 57.
[0093] Step S313, determining the maximum time value in each group of time consumption, and accumulating the maximum time value in each group of time consumption.
[0094] Specifically, after grouping, the maximum time consumption is selected from each group of time consumption, and the selected time value is accumulated.
[0095] Step S314, taking the ratio of the accumulated accumulated time to the total number of groups as the time value of the batch to be calculated.
[0096] Specifically, the ratio of the total accumulated time value to the total number of groups is taken as the time value of the batch to be calculated, that is, the maximum time value is selected from each group of time consumption, and then averaged. The time value of the batch to be calculated is taken as the monitoring result corresponding to the first monitoring index.
[0097] As described above, this time-consuming monitoring algorithm requires multiple sets of data, and each set of data must be greater than or equal to the minimum value corresponding to the monitoring metric. If the number of requests in the batch to be calculated is relatively small, it will not conform to the normal statistical law, and the result will inevitably have a large deviation. If the time-consuming monitoring algorithm is selected manually regardless of the number of requests per unit time, then when the number of requests is small, not only will a relatively accurate answer not be obtained, but computing resources will also be wasted.
[0098] The technical solution provided by the above embodiments brings at least the following beneficial effects: As can be seen from steps S311 to S314, the first monitoring algorithm is simple to calculate and has a relatively low space complexity requirement. Since the grouping process requires that each group of data be no less than the minimum number corresponding to the monitoring indicator according to the different monitoring indicators, the application of this method requires a large amount of data to be calculated, and the more batches of data to be calculated, the more accurate the monitoring results.
[0099] In another embodiment, combined Figure 3 ,like Figure 5 As shown, when the total number of requests received per unit time is less than a preset threshold, the steps for selecting the second monitoring algorithm to monitor the request time of the interface include:
[0100] Step S321: Count the number of requests for each type of request in the batch to be calculated.
[0101] Step S322: Calculate the difference between the total number of requests in the batch to be calculated and the current cumulative number of requests, and calculate the percentage of the difference to the total number of requests. Record this percentage as the first set. The current cumulative number of requests is the cumulative number of requests corresponding to the time consumed by each type of request.
[0102] Step S323: Select the largest percentage from the first set as the current percentage, and compare it with multiple preset quantile values in descending order until the current percentage is greater than the first quantile value.
[0103] Step S324: Place the current percentage into the container corresponding to the second quantile value, where the second quantile value is greater than the first quantile value, and delete the current percentage from the first set, and record the remaining percentage as the second set.
[0104] Step S325: Select the largest percentage from the second set as the current percentage, and compare it sequentially with the quantiles arranged from largest to smallest starting from the first quantile value until the current percentage is greater than the third quantile value. Then delete the current percentage from the second set and record the remaining percentage as the third set.
[0105] Step S326, and so on, until the percentage is placed in the container corresponding to each quantile value.
[0106] Specifically, as an embodiment, the embodiment first classifies the same time consumption in the request to be calculated into a category (the same time consumption), and counts the number of each time consumption, i.e., counts the number of requests of each time consumption. For example, the number of times of time consumption (the unit of time consumption can be unified as millisecond ms) of a certain business is 1, 1, 2, 6, 20, and 2 times respectively, and the total number of requests is 32 times. The total number of requests is arranged in descending order according to the time consumption, and then the percentage of each time consumption is calculated. The percentage of each time consumption is calculated by the following method: the difference between the total number of times and the current cumulative request number corresponding to each time consumption is divided by the total number of requests to obtain the percentage of each time consumption. For example, the percentage of time consumption of 600 is (32-1) / 32=96.875%, wherein the current cumulative request number corresponding to 600 is 1. The percentage of time consumption of 500 is (32-2) / 32=93.75%, wherein the current cumulative request number corresponding to 500 is 2. The percentage of time consumption of 400 is (32-4) / 32=87.5%, wherein the current cumulative request number corresponding to 400 is 4. The percentage of time consumption of 300 is (32-10) / 32=68.75%, wherein the current cumulative request number corresponding to 300 is 10. The percentage of time consumption of 200 is (32-30) / 32=6.25%, wherein the current cumulative request number corresponding to 200 is 20 (for convenience of description, the percentage of % is omitted). The percentage of time consumption of 100 is (32-32) / 32=0, wherein the current cumulative request number corresponding to 100 is 32. For example, the quantile values are 99.99, 99.5, 99, 95, and 50 respectively. The quantile values can be set according to actual conditions. After calculating the percentage of each time consumption, the percentage of each time consumption is matched with each quantile value. The specific matching process includes: the percentages can be sorted from large to small to form a first set, the largest percentage in the first set is taken as the current percentage, and the current percentage is compared with each quantile value from large to small, until the current percentage is greater than a certain quantile value, and the quantile value is recorded as the first quantile value.For example, the first round of the process includes: first taking out 96.875%, and comparing 96.875 with 99.99, 99.5, 99, 95, 50 in turn, because 96.875 is greater than 95, the first comparison ends at the quantile value of 95, and 95 is recorded as the first quantile value, at this time 96.875 matches the three quantile values of 99.99, 99.5, and 99, and 96.875 is put into the containers of the three quantile values of 99.99, 99.5, and 99. The set after removing 96.875 is recorded as the second set, and the maximum percentage in the second set is selected again, and then compared with the remaining quantile values from the first quantile value to the smallest. For example, the second round of the process includes: the maximum percentage in the second set is 93.75, and 93.75 is compared with 95 and 50, because 93.75 is greater than 50, the second comparison ends at the quantile value of 50, and 50 is recorded as the second quantile value, and 93.75 matches 95. The second set of 96.875 taken out is recorded as the third set, and the maximum percentage in the third set is selected to continue to compare with the remaining quantile values in turn, and the process is repeated in turn until the percentage is used up or the quantile value is used up. For example, according to the above description, the final result is as follows:
[0107] Quantile values 99.99 99.5 99 95 50 Percentile values 96.875 96.875 96.875 93.75 6.25
[0108] The above process can also be understood as: each time a maximum percentage is extracted from the set of percentages as the current percentage, and then the current percentage is compared with the quantile values in turn from the start position to the smallest. The start position is the quantile value less than the current percentage in each comparison result, and the start position of the first time is the maximum quantile value. The process ends when all percentages in the set are used up or each quantile value is matched by a percentage. If there is only one data in the batch to be calculated, the time-consuming value of the request can be directly compared with the preset multiple quantile values.
[0109] As another embodiment, to achieve the same result as the above process, the following method can also be used: each time the maximum percentage is extracted from the first set as the current percentage, and put into the container corresponding to the quantile value greater than the current percentage. The container that has already put in the percentage no longer puts in the percentage, so there is only one percentage in the container where the data is put in.
[0110] Alternatively, the second monitoring indicator can be directly one of the quantile values, such as 99.99 in the quantile value each time. As another embodiment, the second monitoring indicator can also be triggered by the user, and at this time, before the step of selecting the corresponding monitoring algorithm to monitor the interface according to the comparison result, the monitoring method further includes:
[0111] The second monitoring target instruction includes a second monitoring index.
[0112] Specifically, before the monitoring starts, the user can trigger the monitoring instruction of the interface through the input device, and the monitoring instruction includes at least the second monitoring index, such as p99 or p995. As another embodiment, the second monitoring index can also be a fixed monitoring index, which is not triggered by the user, and the second monitoring index is obtained before the monitoring algorithm is selected. The first monitoring index and the second monitoring index can be the same or different.
[0113] The step of selecting the second monitoring algorithm to monitor the interface further includes:
[0114] The percentage of the container corresponding to the quantile value of the second monitoring index is taken as the monitoring result of the interface.
[0115] Specifically, after the second monitoring index is obtained, the corresponding quantile value or the percentage corresponding to the quantile value is queried according to the second monitoring index, and is taken as the monitoring result. For example, the monitoring result obtained by monitoring p99 is 96.875.
[0116] According to the above description, the time-consuming monitoring algorithm is mainly suitable for the case where the number of requests is small. In the monitoring algorithm, the number of each time-consuming needs to be counted, and sorting needs to be performed, the space complexity of the algorithm is high, and the required computing resources and memory are also large, so it is suitable for the business situation with small data volume. If the time-consuming monitoring algorithm is selected regardless of the number of requests per unit time, when the number of requests is large, more resources and memory are consumed.
[0117] The technical scheme provided by the above embodiment at least brings the following beneficial effects: in the embodiment, as can be known from steps S321 to S326, the second monitoring algorithm has no requirement for the amount of data to be calculated in batches, and the less the data volume is, the more accurate the result is. When the data to be calculated in batches is larger, the data needs to be sorted and calculated, and more computer resources and memory are required.
[0118] It can be understood that, in actual implementation, the electronic device of the embodiments of the present disclosure can contain one or more hardware structures and / or software modules for implementing the foregoing corresponding data processing method, and these execution hardware structures and / or software modules can constitute an electronic device. Those skilled in the art should easily realize that, in combination with the algorithm steps of the examples described in the embodiments disclosed herein, the present disclosure can be realized in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present disclosure.
[0119] Based on such understanding, the embodiments of the present disclosure also correspondingly provide an interface monitoring device applied to an electronic device, Figure 6 The structure schematic diagram of the interface monitoring device provided by the embodiments of the present disclosure is shown. As Figure 6 shown, the interface processing device can include a first acquisition unit 10, a judgment unit 20, and a monitoring unit 30
[0120] The first acquisition unit 10 is configured to acquire the total number of requests received by the interface within a unit time. The example first acquisition unit 10 can be as shown in step S100 of Figure 2 .
[0121] The judgment unit 20 is configured to compare the total number of requests received within a unit time with a preset threshold to obtain a corresponding comparison result. The example judgment unit 20 can be as shown in step S200 of Figure 2 .
[0122] The monitoring unit 30 is configured to select a corresponding time-consuming monitoring algorithm to monitor the request time consumption of the interface according to the comparison result. The example monitoring unit 30 can be as shown in step S300 of Figure 2 .
[0123] Optionally, the monitoring unit 30 is specifically configured to:
[0124] If the total number of requests received within a unit time is greater than or equal to the preset threshold, a first monitoring algorithm is selected to monitor the request time consumption of the interface, and the first monitoring algorithm includes grouping the request time consumption in a to-be-calculated batch and calculating the mean value of the maximum time consumption value in each group.
[0125] If the total number of request times in a unit of time is less than a preset threshold, a second monitoring algorithm is selected to monitor the request time consumption of the interface, the second monitoring algorithm comprising calculating the percentage of each request time consumption in the to-be-calculated batch, and matching the percentage of each request time consumption with a preset quantile value, wherein the time consumption with the same time length in the to-be-calculated batch is defined as one type of time consumption.
[0126] Optionally, the monitoring unit 30 is further configured to:
[0127] Obtain a target statistical quantity of each group of time consumption, the target statistical quantity being greater than or equal to the minimum statistical quantity corresponding to the first monitoring indicator.
[0128] Group the request time consumption in the to-be-calculated batch according to the target statistical quantity of each group of time consumption.
[0129] Determine the time consumption of the maximum time value in each group of time consumption, and accumulate the time consumption of the maximum time value in each group of time consumption. Take the ratio of the accumulated time consumption to the total number of groups as the time consumption value of the to-be-calculated batch.
[0130] Optionally, the monitoring device further comprises:
[0131] A second obtaining unit (not shown in the figure) is configured to obtain a first monitoring instruction, the first monitoring instruction comprising a first monitoring indicator.
[0132] The monitoring unit 30 is further configured to take the time consumption value of the to-be-calculated batch as the monitoring result corresponding to the first monitoring indicator.
[0133] Optionally, the monitoring device further comprises:
[0134] A third obtaining unit (not shown in the figure) is configured to obtain a relationship between the expectation and the quantile value corresponding to the exponential distribution delay.
[0135] A calculating unit (not shown in the figure) is configured to calculate according to the preset quantile value and the relationship to obtain the minimum statistical quantity of the maximum time value.
[0136] Optionally, the monitoring unit 30 is further configured to:
[0137] Count the number of requests of each request time consumption in the to-be-calculated batch.
[0138] Calculate the difference between the total number of requests and the current cumulative number of requests in the to-be-calculated batch, and calculate the percentage of the difference in the total number of requests, and take the percentage as a first set. The current cumulative number of requests is the cumulative number of requests corresponding to the number of requests of each request time consumption.
[0139] Select the maximum percentage from the first set as the current percentage, and compare it with the preset multiple quantile values from large to small in order until the current percentage is greater than the first quantile value.
[0140] Put the current percentage into the container corresponding to the second quantile value, which is greater than the first quantile value, and delete the current percentage from the first set, and record the remaining percentages as the second set.
[0141] Select the maximum percentage from the second set as the current percentage, and sequentially compare it with the quantile values arranged from large to small starting from the first quantile value, until the current percentage is greater than the third quantile value, and delete the current percentage from the second set, and record the remaining percentages as the third set.
[0142] In this way, the percentages are put into the containers corresponding to each quantile value.
[0143] Optionally, the monitoring device further comprises:
[0144] A second acquisition unit (not shown in the figure) is configured to acquire a second monitoring instruction, and the second monitoring instruction comprises a second monitoring index.
[0145] The monitoring unit 30 is further configured to take the percentages in the container corresponding to the quantile value of the second monitoring index as the monitoring result of the interface.
[0146] Optionally, the preset threshold is 100.
[0147] As described above, the embodiments of the present disclosure can divide the functional modules of the electronic device according to the method examples described above. The integrated modules described above can be implemented in the form of hardware or in the form of software functional modules. In addition, it should be noted that the division of modules in the embodiments of the present disclosure is illustrative, and is only a logical functional division. In actual implementation, another division manner can be used. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module.
[0148] As for the data processing apparatus in the above embodiments, the specific manner in which each module performs operations and the beneficial effects thereof have been described in detail in the foregoing method embodiments, and will not be described here.
[0149] The embodiments of the present disclosure also provide a monitoring device of an interface, which can be a user terminal such as a mobile phone or a computer. Figure 7 A structural schematic diagram of the monitoring device of the interface provided by the embodiments of the present disclosure is shown. The monitoring device of the interface can include at least one processor 61, a communication bus 62, a memory 63, and at least one communication interface 64.
[0150] The processor 61 can be a central processing unit (CPU), a micro-processing unit, an ASIC, or one or more integrated circuits for controlling the execution of programs of the present disclosure.
[0151] The communication bus 62 can include a path that carries information between the aforementioned components.
[0152] The communication interface 64, using any transceiver-like device, can be used to communicate with other devices or computer networks, such as servers, Ethernet, radio access networks (RANs), wireless local area networks (WLANs), etc.
[0153] The memory 63 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, a magnetic disk storage or other magnetic storage devices, or any other medium capable of storing instructions or data that can be accessed by a computer, but not limited to. The memory can exist independently, connected to the processing unit through a bus. The memory can also be integrated with the processing unit.
[0154] The memory 63 is configured to store application program codes for implementing the present disclosure, and the processor 61 is configured to control the execution of the application program codes. The processor 61 is configured to execute the application program codes stored in the memory 63, thereby realizing the functions in the method of the present disclosure.
[0155] In a specific implementation, as an example, the processor 61 can include one or more CPUs, such as CPU0 and CPU1 in Figure 7 .
[0156] In a specific implementation, as an example, the interface monitoring device can include multiple processors, such as Figure 7The processors 61 and 65 in the terminal and the server can be single-CPU processors or multi-CPU processors. The processor herein can refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0157] In a specific implementation, as an embodiment, the monitoring device of the interface can further include an input device 66 and an output device 67. The input device 66 and the output device 67 are in communication and can accept user input in various ways. For example, the input device 66 can be a mouse, a keyboard, a touch screen device, a sensor device, or the like. The output device 67 is in communication with the processor 61 and can display information in various ways. For example, the output device 61 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, or the like.
[0158] Those skilled in the art can understand that the structure shown in the terminal does not constitute a limitation on the terminal, and can include more or fewer components than shown, or combine certain components, or use different component arrangements. Figure 7
[0159] The present disclosure also provides a computer readable storage medium including instructions, the instructions stored on the computer readable storage medium, when executed by a processor of a computer device, enable the computer to perform the monitoring method of the interface provided by the above-mentioned embodiments. For example, the computer readable storage medium can be a memory 63 including instructions, the above-mentioned instructions executable by the processor 61 of the terminal to complete the above-mentioned method. For another example, the computer readable storage medium can be a memory 72 including instructions, the above-mentioned instructions executable by the processor 71 of the server to complete the above-mentioned method. Optionally, the computer readable storage medium can be a non-transitory computer readable storage medium, for example, the non-transitory computer readable storage medium can be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, or the like.
[0160] The present disclosure also provides a computer program product including computer instructions, when the computer instructions run on an electronic device, enable the electronic device to perform the monitoring method of the interface shown in any of the above-mentioned embodiments. Figures 2-5 The monitoring method of the interface shown in any of the above-mentioned embodiments.
[0161] Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the features disclosed herein. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
[0162] It should be understood that the present disclosure is not limited to the precise structures as herein described and illustrated in the drawings, and that various modifications and changes can be made without departing from its scope. The scope of the present disclosure is limited only by the claims that follow.
Claims
1. A method of monitoring an interface, characterized by, The method comprises: acquiring the total number of requests received by the interface per unit time; if the total number of requests per unit time is greater than or equal to a preset threshold, selecting a first monitoring algorithm to monitor the request time consumption of the interface, the first monitoring algorithm comprising grouping the request time consumption in a to-be-calculated batch and calculating the average of the maximum time consumption value in each group; if the total number of requests per unit time is less than the preset threshold, selecting a second monitoring algorithm to monitor the request time consumption of the interface, the second monitoring algorithm comprising calculating the percentage of each request time consumption in the to-be-calculated batch and matching the percentage of each request time consumption with a preset quantile value, wherein the request time consumption with the same time length in the to-be-calculated batch is defined as one type of request time consumption.
2. The monitoring method according to claim 1, characterized in that, The step of selecting the first monitoring algorithm to monitor the request time consumption of the interface comprises: acquiring a target statistical quantity of each group of time consumption, the target statistical quantity being greater than or equal to a minimum statistical quantity corresponding to a first monitoring index; grouping the request time consumption in the to-be-calculated batch according to the target statistical quantity of each group of time consumption; determining the maximum time consumption value in each group of time consumption and accumulating the maximum time consumption value in each group of time consumption; taking the ratio of the accumulated accumulated time consumption to the total number of groups as the time consumption value of the to-be-calculated batch.
3. The monitoring method according to claim 2, characterized in that, The monitoring method further comprises: acquiring a first monitoring instruction, the first monitoring instruction comprising a first monitoring index; The step of taking the ratio of the accumulated accumulated time consumption to the total number of groups as the time consumption value of the to-be-calculated batch comprises: taking the time consumption value of the to-be-calculated batch as the monitoring result corresponding to the first monitoring index.
4. The monitoring method of claim 2, wherein, The minimum statistical quantity corresponding to the first monitoring index is obtained by the following steps: acquiring a relationship between the expectation and the quantile value corresponding to the exponential distribution delay; calculating the relationship according to the preset quantile value and the relationship to obtain the minimum statistical quantity of the maximum time consumption value.
5. The monitoring method of claim 1, wherein, The step of selecting the second monitoring algorithm to monitor the request time consumption of the interface comprises: counting the number of requests of each request time consumption in the to-be-calculated batch; calculating the difference between the total number of requests in the to-be-calculated batch and the current cumulative number of requests, and calculating the percentage of the difference in the total number of requests, denoted as a first set; the current cumulative number of requests is the cumulative number of requests corresponding to the number of requests of each request time consumption; selecting the maximum percentage from the first set as the current percentage, and comparing it with the preset multiple quantile values from large to small in order until the current percentage is greater than the first quantile value; putting the current percentage into the container corresponding to the second quantile value, wherein the second quantile value is greater than the first quantile value, and deleting the current percentage from the first set, and recording the remaining percentages as a second set; selecting the maximum percentage from the second set as the current percentage, and comparing it with the quantile values arranged from large to small starting from the first quantile value in order until the current percentage is greater than the third quantile value, and deleting the current percentage from the second set, and recording the remaining percentages as a third set; and so on, until the percentages are put into the containers corresponding to each quantile value.
6. The monitoring method according to claim 5, characterized in that, The monitoring method further comprises: obtain a second monitoring instruction, the second monitoring instruction comprising a second monitoring index; the step of selecting the second monitoring algorithm to monitor the request time consumption of the interface further comprises: taking the percentage in the container of the corresponding quantile value of the second monitoring index as the monitoring result of the interface.
7. The monitoring method according to any one of claims 1 to 5, characterized in that, The preset threshold value is 100.
8. A monitoring device for an interface, characterized in that comprising: a first obtaining unit, configured to obtain a total number of requests received by the interface within a unit time; a monitoring unit, configured to: if the total number of requests within the unit time is greater than or equal to a preset threshold value, select a first monitoring algorithm to monitor the request time consumption of the interface, the first monitoring algorithm comprising grouping the request time consumption in a to-be-calculated batch and calculating the average of the maximum time consumption value in each group; if the total number of requests within the unit time is less than the preset threshold value, select a second monitoring algorithm to monitor the request time consumption of the interface, the second monitoring algorithm comprising calculating the percentage of each request time consumption in the to-be-calculated batch, and matching the percentage of each request time consumption with a preset quantile value, wherein the time consumption with the same time length in the to-be-calculated batch is defined as one type of time consumption.
9. The monitoring device of claim 8, wherein, The monitoring unit is further specifically configured to: obtain a target statistical quantity of each group of time consumption, the target statistical quantity being greater than or equal to a minimum statistical quantity corresponding to the first monitoring index; group the request time consumption in the to-be-calculated batch according to the target statistical quantity of each group of time consumption; determine the maximum time consumption value in each group of time consumption, and accumulate the maximum time consumption value in each group of time consumption; take the ratio of the accumulated time consumption to the total number of groups as the time consumption value of the to-be-calculated batch.
10. The monitoring device of claim 9, wherein, The monitoring device further comprises: a second obtaining unit, configured to obtain a first monitoring instruction, the first monitoring instruction comprising a first monitoring index; The monitoring unit is further specifically configured to take the time consumption value of the to-be-calculated batch as the monitoring result corresponding to the first monitoring index.
11. The monitoring device of claim 9, wherein, The monitoring device further comprises: a third obtaining unit, configured to obtain a relationship between the expectation and the quantile value corresponding to the exponential distribution delay; a calculation unit, configured to calculate the minimum statistical quantity of the maximum time consumption value according to the preset quantile value and the relationship.
12. The monitoring device of claim 8, wherein, The monitoring unit is further specifically configured to: statistically obtain the number of requests of each type of request time consumption in the to-be-calculated batch; calculate the difference between the total number of requests in the to-be-calculated batch and the current cumulative number of requests, and calculate the percentage of the difference in the total number of requests, taking the percentage as a first set; the current cumulative number of requests is the cumulative number of requests corresponding to the number of requests of each type of request time consumption; select the maximum percentage from the first set as the current percentage, and compare it with a plurality of preset quantile values from large to small in order until the current percentage is greater than a first quantile value; put the current percentage into a container corresponding to a second quantile value, wherein the second quantile value is greater than the first quantile value, and delete the current percentage from the first set, and take the remaining percentages as a second set; Select the maximum percentage from the second set as the current percentage, and sequentially compare it with the quantile values arranged from large to small from the first quantile value, until the current percentage is greater than the third quantile value, delete the current percentage from the second set, and record the remaining percentages as the third set; By analogy, until the percentage in the container corresponding to each quantile value is put in.
13. The monitoring device of claim 12, wherein, The monitoring device further comprises: A second acquisition unit is configured to acquire a second monitoring target instruction, wherein the second monitoring target instruction comprises a second monitoring index; The monitoring unit is further configured to take the percentage in the container corresponding to the quantile value of the second monitoring index as the monitoring result of the interface.
14. The monitoring device according to any one of claims 8 to 13, characterized in that, The preset threshold is 100.
15. An interface monitoring device, characterized by Comprise: A processor; A memory for storing the processor-executable instructions; The processor is configured to execute the instructions to implement the interface monitoring method of any one of claims 1-7.
16. A computer-readable storage medium having stored thereon instructions, the instructions comprising, When the instructions in the computer readable storage medium are executed by the processor of the electronic device, the electronic device can execute the interface monitoring method of any one of claims 1-7.
17. A computer program product comprising instructions, characterized in that, The instructions are executed by the processor to implement the interface monitoring method of any one of claims 1-7.
Citation Information
Patent Citations
Online interface monitoring method and device and computer readable storage medium
CN110278124A