A message queue monitoring method and device, a storage medium and a computer device

By retrieving and calculating consumption and production data within a preset time period from the message queue, dividing the time period into sub-time periods, calculating the delay time, and issuing early warnings, the problems of unintuitive delay information and low early warning accuracy are solved, thus achieving accurate delay monitoring and early warning.

CN116302801BActive Publication Date: 2026-03-20PING AN PAY ELECTRONIC PAYMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-16
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

In existing technologies, message queue latency is not easily identifiable, latency warnings are inaccurate, and latency time cannot be accurately measured.

Method used

By acquiring queue monitoring data of the target message queue within a preset time period, dividing the time period into sub-time periods, calculating the average consumption rate and message latency, calculating the latency time using the consumption rate and latency at the target time point, and issuing an alert when the latency time exceeds the threshold.

Benefits of technology

It provides an intuitive display of message delay time, improves the accuracy of delay warnings, reduces manpower costs, and enables timely assessment of business impact.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302801B_ABST
    Figure CN116302801B_ABST
Patent Text Reader

Abstract

The application provides a message queue monitoring method and device, a storage medium and a computer device, which comprises the following steps: obtaining queue monitoring data of a target message queue in a preset time period; dividing the preset time period into at least one sub time period according to preset time points; calculating the average consumption speed of each sub time period and the message delay quantity of each preset time point by using the message consumption quantity and the message production quantity corresponding to each preset time point; calculating the target consumption speed of a target time point by using the average consumption speed of each sub time period; calculating the message delay time corresponding to the target time point by using the message delay quantity of the target time point and the target consumption speed; and performing delay early warning on the target message queue when the message delay time exceeds a preset time threshold. The application realizes intuitive display of the message delay time, enables a business party to monitor and early warn the message queue in a timely manner according to the delay time, and greatly improves the accuracy of monitoring and early warning.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computer data processing, and in particular to a message queue monitoring method and device, a storage medium and a computer device. BACKGROUND

[0002] In real-time data processing, a message queue is usually used as a data storage scheme. Kafka is a common message queue and is widely used due to its real-time performance, high performance and stability. As the amount of real-time data increases, the number of message queues also increases, and how to monitor the link of message production and consumption is a great challenge. When using Kafka, the business most concerned is the delay. The industry now monitors the delay indicators in units of message quantity, and compares the latest produced message position of the queue with the current consumed message position to monitor and alarm. However, measuring the delay in units of message quantity is not intuitive, and the business side would like to know how much the delay time is. Secondly, the prior art generally uses the delay quantity as the basis when configuring the early warning, and since the consumption speed of each message queue is different, only manual estimation by the business side can be relied on, which is easy to cause low-efficiency early warning with low estimation accuracy. SUMMARY

[0003] In view of the above problems, the present application provides a message queue monitoring method and device, a storage medium and a computer device to solve the problems of the prior art that the delay of the message queue is not intuitive and the delay early warning accuracy is low.

[0004] To achieve the above-mentioned purpose, according to the first aspect of the present application, a message queue monitoring method is provided, comprising:

[0005] Obtaining queue monitoring data of a target message queue in a preset time period; wherein the queue monitoring data comprises message consumption quantity and message production quantity corresponding to each preset time point in the preset time period;

[0006] Dividing the preset time period into at least one sub-time period according to the preset time points, and calculating the average consumption speed of each sub-time period and the message delay quantity of each preset time point by using the message consumption quantity and the message production quantity corresponding to each preset time point;

[0007] Calculating the target consumption speed of a target time point by using the average consumption speed of each sub-time period; wherein the target time point is one of the preset time points;

[0008] Calculating the message delay time corresponding to the target time point by using the message delay quantity and the target consumption speed of the target time point;

[0009] When the message delay time at the target time point exceeds the preset time threshold, a delay warning is given for the target message queue.

[0010] Optionally, the average consumption speed of each of the sub time periods and the message delay quantity of each of the preset time points are calculated by using the message consumption quantity and the message production quantity corresponding to each of the preset time points, including:

[0011] The average consumption speed of each of the sub time periods is calculated by using the first consumption quantity corresponding to the previous preset time point and the second consumption quantity corresponding to the subsequent preset time point corresponding to each of the sub time periods; and

[0012] The message delay quantity corresponding to each of the preset time points is calculated by using the message consumption quantity and the message production quantity corresponding to each of the preset time points; and the message delay quantity is calculated by using the following formula:

[0013] x 延迟 = x 生产 - x 消费 ;

[0014] wherein, x 延迟 is the message delay quantity corresponding to the preset time point; x 生产 is the message production quantity corresponding to the preset time point; and x 消费 is the message consumption quantity corresponding to the preset time point.

[0015] Optionally, the average consumption speed of each of the sub time periods is calculated by using the first consumption quantity corresponding to the previous preset time point and the second consumption quantity corresponding to the subsequent preset time point corresponding to each of the sub time periods, including:

[0016] The average consumption speed is calculated by using the following formula:

[0017]

[0018] wherein, is the average consumption speed of the sub time period; t 前 is the previous preset time point corresponding to the sub time period; t 后 is the subsequent preset time point corresponding to the sub time period; x1 is the first consumption quantity corresponding to the previous preset time point; and x2 is the second consumption quantity corresponding to the subsequent preset time point.

[0019] Optionally, the target consumption speed of the target time point is calculated by using the average consumption speed of each of the sub time periods, including:

[0020] The time difference value weight of the target time point with respect to other preset time points in the preset time period is calculated;

[0021] The target consumption speed of the target time point is calculated according to the time difference weight of each preset time point and the average consumption speed of each sub time period after the other preset time points.

[0022] Optionally, the time difference weight of the target time point for the other preset time points in the preset time period comprises:

[0023] The time difference weight is calculated by the following formula:

[0024]

[0025] Wherein, w is the time difference weight of the target time point for the other preset time points; t 目标 is the target time point; t 其他 is the other preset time point in the sub time period;

[0026] Optionally, the target consumption speed of the target time point is calculated according to the time difference weight of each preset time point and the average consumption speed of each sub time period after the other preset time points.

[0027] The target consumption speed is calculated by the following formula:

[0028]

[0029] Wherein, v is the target consumption speed of the target time point, and n is the number of the other preset time points except the target time point in the preset time period; are the average consumption speeds of the sub time periods after each other preset time point; w1···w n are the time difference weights of the target time point for each other preset time point.

[0030] Optionally, the message delay time corresponding to the target time point is calculated by using the message delay number and the target consumption speed of the target time point.

[0031] The message delay time is calculated by the following formula:

[0032]

[0033] Wherein, t 延迟 is the message delay time corresponding to the target time point; x is the message delay number corresponding to the target time point; and v is the target consumption speed of the target time point.

[0034] According to the second aspect of the present application, a message queue monitoring device is provided, comprising:

[0035] The monitoring data acquisition module is configured to acquire queue monitoring data of the target message queue within a preset time period, wherein the queue monitoring data comprises message consumption quantity and message production quantity corresponding to each preset time point within the preset time period;

[0036] The first data calculation module is configured to divide the preset time period into at least one sub time period according to the preset time points, and calculate average consumption speed of each sub time period and message delay quantity of each preset time point by using the message consumption quantity and the message production quantity corresponding to each preset time point.

[0037] The second data calculation module is configured to calculate target consumption speed of a target time point by using the average consumption speed of each sub time period, wherein the target time point is one of the preset time points.

[0038] The third data calculation module is configured to calculate message delay time corresponding to the target time point by using the message delay quantity and the target consumption speed of the target time point.

[0039] The message delay warning module is configured to perform delay warning for the target message queue when the message delay time of the target time point exceeds a preset time threshold.

[0040] According to the third aspect of the present application, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the steps of the message queue monitoring method according to any one of the first aspect of the present application.

[0041] According to the fourth aspect of the present application, a computer device is provided, which comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the message queue monitoring method according to any one of the first aspect of the present application when executing the computer program.

[0042] The message queue monitoring method and device, storage medium and computer device provided by the application obtain queue monitoring data of a target message queue in a preset time period, the queue monitoring data includes message consumption quantity and message production quantity corresponding to each preset time point in the preset time period, the preset time period is divided into at least one sub time period according to the preset time point, the average consumption speed of each sub time period and the message delay quantity of each preset time point are calculated by using the message consumption quantity and the message production quantity corresponding to each preset time point, the target consumption speed of the target time point is calculated by using the average consumption speed of each sub time period, the message delay time corresponding to the target time point is calculated by using the message delay quantity and the target consumption speed of the target time point, and a delay warning is given for the target message queue when the message delay time of the target time point exceeds a preset time threshold. The application realizes intuitive display of message delay time, enables business parties to evaluate business impact in a timely manner, can monitor and warn the message queue based on the delay time, reduces labor cost, and greatly improves the accuracy of monitoring and warning.

[0043] The above description is only a summary of the technical scheme of the application, in order to more clearly understand the technical means of the application, the application can be implemented according to the content of the specification, and in order to make the above and other purposes, characteristics and advantages of the application more obvious and easy to understand, the following specific embodiments of the application are described.

[0044] The above and other objects, advantages and features of the application will become more apparent from the following detailed description of the application when read in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS

[0045] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of the preferred embodiments and are not intended to limit the scope of the application. Moreover, the same reference numerals are used throughout the drawings to designate similar or equivalent parts. In the drawings:

[0046] Figure 1 A flowchart of a message queue monitoring method provided by an embodiment of the application is shown;

[0047] Figure 2 A structural diagram of a message queue monitoring device provided by an embodiment of the application is shown;

[0048] Figure 3 An entity structure diagram of a computer device provided by an embodiment of the application is shown. DETAILED DESCRIPTION

[0049] Exemplary embodiments of the present disclosure will be described in greater detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.

[0050] It should be noted that, in this document, relational terms such as first and second, and the like, are used solely to distinguish one entity or action from another entity or action, without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises... a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the listed element.

[0051] The embodiments of the present application provide a message queue monitoring method, as shown in the figure, the method can at least include the following steps S101-S105: Figure 1

[0052] Step S101, obtaining the queue monitoring data of the target message queue in a preset time period.

[0053] The queue monitoring data includes the message consumption quantity and the message production quantity corresponding to each preset time point in the preset time period. Generally, the delay warning is real-time monitoring of the delay of the message queue, therefore, the embodiments of the present application can obtain the preset time period before the current time point of the target message queue in real time. It should be noted that the length of the preset time period can be set according to the actual situation, which can be 60s, 3min, 5min, etc., and the present application does not limit this.

[0054] ​For the further understanding of the present application, the preset time period is taken as 60s, the message delay of a message queue at 8:01:00 of a day is monitored in real time, and the queue monitoring data of the message queue from 8:00:00 to 8:01:00 of the day is obtained, wherein the queue monitoring data comprises the message consumption quantity and the message production quantity corresponding to the preset time points within 8:00:00-8:01:00. Therefore, a plurality of preset time points within 8:00:00-8:01:00 can be obtained, for example, 8:00:00, 8:00:15, 8:00:30, 8:00:45 and 8:01:00 can be taken as the preset time points, and the queue monitoring data of the five preset time points is obtained. The following table is taken as an example, and the queue monitoring data obtained for the message queue can be as follows:

[0055]

[0056]

[0057] It should be noted that the selection rule of the preset time points can be set according to the actual situation, and preferably, the preset time points with equal time intervals can be selected. The message consumption quantity and the message production quantity can be calculated according to the message consumption position and the message production position corresponding to each preset time point, that is, if the message production position of the message queue is monitored at 8:00:00 and is the 150th position, 150 is taken as the message production quantity of 8:00:00; if the message consumption position of the message queue is monitored at 8:00:00 and is the 100th position, 100 is taken as the message consumption quantity of 8:00:00.

[0058] In step S102, the preset time period is divided into at least one sub-time period according to the preset time points, and the average consumption speed of each sub-time period and the message delay quantity of each preset time point are calculated by using the message consumption quantity and the message production quantity corresponding to each preset time point.

[0059] Firstly, the preset time period is divided into a plurality of sub-time periods according to the determined preset time points. For example, the preset time points are 8:00:00, 8:00:15, 8:00:30, 8:00:45 and 8:01:00, and four sub-time periods of 8:00:00-8:00:15, 8:00:15-8:00:30, 8:00:30-8:00:45 and 8:00:45-8:01:00 can be obtained.

[0060] Further, the message delay quantity corresponding to each preset time point can be calculated by using the message consumption quantity and the message production quantity corresponding to each preset time point.

[0061] The message delay quantity is the quantity of message data that has been produced but not consumed by the message queue at the preset time point. The message delay quantity can be calculated by using the following formula:

[0062] x 延迟 =x 生产 -x 消费 ;

[0063] wherein x 延迟 is the message delay quantity corresponding to the preset time point; x 生产 is the message production quantity corresponding to the preset time point; and x 消费 is the message consumption quantity corresponding to the preset time point.

[0064] The following table is an example. The message delay quantity corresponding to each preset time point is calculated as follows:

[0065]

[0066]

[0067] Further, the average consumption speed of each sub time period can be calculated by using the first consumption quantity corresponding to the preceding preset time point and the second consumption quantity corresponding to the subsequent preset time point of each sub time period.

[0068] The average consumption speed refers to the average speed of consuming message data by the message queue within a time period. For a sub time period, the preceding preset time point is the initial time point of the sub time period, and the subsequent preset time point is the terminal time point of the sub time period. For example, the preceding preset time point of the sub time period 8:00:00-8:00:15 is 8:00:00, and the subsequent preset time point is 8:00:15. The first consumption quantity or the second consumption quantity is the message consumption quantity corresponding to the preset time point.

[0069] Specifically, the average consumption speed can be calculated by using the following formula:

[0070]

[0071] wherein is the average consumption speed of the sub time period; t 前 is the preceding preset time point corresponding to the sub time period; t 后 is the subsequent preset time point corresponding to the sub time period; x1 is the first consumption quantity corresponding to the preceding preset time point; and x2 is the second consumption quantity corresponding to the subsequent preset time point.

[0072] It can be understood that x2-x1 is the message consumption quantity of the message queue within the sub time period, and t 后 -t 前The message consumption duration of the consumption queue in the sub-time period is calculated. The following table is taken as an example, and the average consumption speed of each sub-time period is calculated as follows:

[0073] Sub-time period Message consumption quantity Message consumption duration (s) Average consumption speed (pieces / s) 8:00:00-8:00:15 120-100 15 (120-100) / 15 8:00:15-8:00:30 130-120 15 (130-120) / 15 8:00:30-8:00:45 150-130 15 (150-130) / 15 8:00:45-8:01:00 170-150 15 (170-150) / 15

[0074] In step S103, the target consumption speed of the target time point is calculated by using the average consumption speed of each sub-time period.

[0075] The target time point is one of the preset time points. In the embodiment of the application, the delay of the message queue at 8:01:00 is monitored in real time, and the message delay time at 8:01:00 is obtained. First, the instantaneous consumption speed at 8:01:00 is calculated, and therefore, 8:01:00 is selected as the target time point. It can be understood that the preset time period is generally a time period before the current time point of the target message queue, and therefore, the end time point of the preset time period, i.e., the current time point for real-time monitoring, can be taken as the target time point.

[0076] Specifically, the target consumption speed of the target time point is calculated by using the average consumption speed of each sub-time period, and the time difference weight of the target time point for other preset time points needs to be calculated first.

[0077] From the above table, it can be seen that the consumption speed of the message queue changes every moment, because the performance of the data processing system often fluctuates. In order to eliminate the fluctuation, the weight based on the time difference is used to approximately estimate the target consumption speed. The time difference weight can be calculated by using the following formula:

[0078]

[0079] In the formula, w is the time difference weight of the target time point for other preset time points; t 目标 is the target time point; t 其他 is the other preset time point in the sub-time period.

[0080] In the embodiment of the application, 8:01:00 is taken as the target time point, and the other preset time points include 8:00:00, 8:00:15, 8:00:30, and 8:00:45, t 目标 -t 其他 is the time difference of the target time point for other preset time points. The following table is taken as an example, and the time difference weight of the target time point for other preset time points is calculated as follows:

[0081] Other preset time points Time difference value Time difference value weight 8:00:00 8:01:00-8:00:00 e -(8:01:00-8:00:00) ]]> 8:00:15 8:01:00-8:00:15 e -(8:01:00-8:00:15) ]]> 8:00:30 8:01:00-8:00:30 e -(8:01:00-8:00:30) ]]> 8:00:45 8:01:00-8:00:45 e -(8:01:00-8:00:45) ]]>

[0082] Further, the target consumption speed of the target time point is calculated according to the time difference weight corresponding to each preset time point and the average consumption speed corresponding to each sub time period after each other preset time point.

[0083] To realize the approximate calculation of the target consumption speed of the target time point, the average consumption speed of each sub time period after each other preset time point is taken as the consumption speed of the other preset time point. Specifically, the target consumption speed can be calculated by using the following formula:

[0084]

[0085] wherein v is the target consumption speed of the target time point, n is the number of other preset time points except the target time point in the preset time period; are the average consumption speeds corresponding to each sub time period after each other preset time point; w1···wnare the time difference weights of the target time point with respect to each other preset time point. n are the time difference weights of the target time point with respect to each other preset time point.

[0086] Taking the above table as an example, the target consumption speed of the target time is calculated as:

[0087]

[0088] wherein the parameters required by the formula are shown in the following table:

[0089]

[0090] Step S104, the message delay time corresponding to the target time point is calculated by using the message delay number of the target time point and the target consumption speed.

[0091] It can be understood that after obtaining the target consumption speed corresponding to the target time point, the message delay number can be converted into real-time message delay time according to the message delay number of the target time point. Specifically, the message delay time can be calculated by using the following formula:

[0092]

[0093] wherein t 延迟 is the message delay time corresponding to the target time point; x is the message delay number corresponding to the target time point; v is the target consumption speed of the target time point.

[0094] Step S105, when the message delay time of the target time point exceeds the preset time threshold, a delay warning is performed on the target message queue.

[0095] The message delay quantity is converted into a message delay time by using the above formula, which more intuitively shows the delay of the message queue, and further, the message delay time can be used as a basis for early warning to monitor and early warn the delay of the message queue in real time. Specifically, when the message delay time at the target time point exceeds the preset time threshold, delay early warning can be performed on the target message queue.

[0096] In order to facilitate business personnel to know the message delay of the target message queue in time, in the embodiment of the application, delay early warning can be performed on the target message queue when the message delay time exceeds the preset time threshold. The specific delay early warning manner can be pre-set according to requirements, and the embodiment of the application does not limit this. Moreover, in order to accurately prompt the target message queue that currently has message delay, the business related personnel can be prompted to check and correct.

[0097] The message queue monitoring method provided by the embodiment of the application comprises the following steps: obtaining queue monitoring data of a target message queue in a preset time period, the queue monitoring data comprising message consumption quantity and message production quantity corresponding to each preset time point in the preset time period; dividing the preset time period into at least one sub time period according to the preset time point; calculating average consumption speed of each sub time period and message delay quantity of each preset time point by using the message consumption quantity and the message production quantity corresponding to each preset time point; calculating target consumption speed of a target time point by using the average consumption speed of each sub time period; calculating message delay time corresponding to the target time point by using the message delay quantity of the target time point and the target consumption speed; and performing delay early warning on the target message queue when the message delay time exceeds a preset time threshold. The embodiment of the application realizes intuitive display of the message delay time, enables the business party to timely evaluate the business impact, and can also monitor and early warn the message queue based on the delay time, thereby reducing the labor cost and greatly improving the accuracy of monitoring and early warning.

[0098] Further, as a specific implementation of Figure 1 , the embodiment of the application provides a message queue monitoring device, as shown in Figure 2 , which can comprise a monitoring data acquisition module 210, a first data calculation module 220, a second data calculation module 230, a third data calculation module 240, and a message delay early warning module 250.

[0099] The monitoring data acquisition module 210 can be used to acquire queue monitoring data of a target message queue in a preset time period; the queue monitoring data comprises message consumption quantity and message production quantity corresponding to each preset time point in the preset time period.

[0100] The first data calculation module 220 can be configured to divide a preset time period into at least one sub time period according to preset time points, and calculate the average consumption speed of each sub time period and the message delay quantity of each preset time point by using the message consumption quantity and the message production quantity corresponding to each preset time point.

[0101] The second data calculation module 230 can be configured to calculate the target consumption speed of a target time point by using the average consumption speed of each sub time period; the target time point is one of the preset time points.

[0102] The third data calculation module 240 can be configured to calculate the message delay time corresponding to the target time point by using the message delay quantity of the target time point and the target consumption speed.

[0103] The message delay warning module 250 can be configured to perform delay warning on the target message queue when the message delay time of the target time point exceeds a preset time threshold.

[0104] Optionally, the first data calculation module 220 can be further configured to calculate the average consumption speed of each sub time period by using the first consumption quantity corresponding to the previous preset time point and the second consumption quantity corresponding to the subsequent preset time point corresponding to each sub time period; and,

[0105] The message delay quantity corresponding to each preset time point is calculated by using the message consumption quantity and the message production quantity corresponding to each preset time point; and the message delay quantity is calculated by using the following formula:

[0106] x 延迟 =x 生产 -x 消费 ;

[0107] Wherein, x 延迟 is the message delay quantity corresponding to the preset time point; x 生产 is the message production quantity corresponding to the preset time point; and x 消费 is the message consumption quantity corresponding to the preset time point.

[0108] Optionally, the first data calculation module 220 can be further configured to calculate the average consumption speed by using the following formula:

[0109]

[0110] Wherein, is the average consumption speed of the sub time period; t 前 is the previous preset time point corresponding to the sub time period; t 后 is the subsequent preset time point corresponding to the sub time period; x1 is the first consumption quantity corresponding to the previous preset time point; and x2 is the second consumption quantity corresponding to the subsequent preset time point.

[0111] Optionally, the second data calculation module 230 can also be used to calculate the weight of the time difference between the target time point and other preset time points in the preset time period;

[0112] The target consumption rate at the target time point is calculated based on the weight of the time difference corresponding to each preset time point and the average consumption rate corresponding to the sub-time periods after each other preset time point.

[0113] Optionally, the second data calculation module 230 can also be used to calculate the time difference weight using the following formula:

[0114]

[0115] Where w is the weight of the time difference between the target time point and other preset time points; t 目标 The target time point; t 其他 Other preset time points within the sub-time period;

[0116] Optionally, the second data calculation module 230 can also be used to calculate the target consumption rate using the following formula:

[0117]

[0118] Where v is the target consumption rate at the target time point, and n is the number of other preset time points outside the target time point within the preset time period; These represent the average consumption rate for each sub-time period following each other preset time point; w1···w n These are the time difference weights of the target time point relative to each of the other preset time points.

[0119] Optionally, the third data calculation module 240 can also be used to calculate the message delay time using the following formula:

[0120]

[0121] Among them, t 延迟 is the message delay time corresponding to the target time point; x is the number of messages delayed at the target time point; v is the target consumption rate at the target time point.

[0122] It should be noted that other corresponding descriptions of the functional modules involved in the message queue monitoring device provided in this embodiment of the invention can be found in [reference needed]. Figure 1 The corresponding description of the method shown will not be repeated here.

[0123] Based on the above, Figure 1According to the method, the embodiment of the present application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps of the message queue monitoring method in any of the above embodiments.

[0124] According to the method and the device as described above, Figure 1 According to the method and the device as described above, Figure 2 According to the method and the device as described above, Figure 3 According to the method and the device as described above,

[0125] Those skilled in the art can clearly understand the specific working process of the system, the device, the module and the unit described above, and can refer to the corresponding process in the foregoing method embodiments. For the sake of brevity, no further description is given here.

[0126] In addition, each functional unit in each embodiment of the present application can be physically independent, or two or more functional units can be integrated together, or all functional units can be integrated in one processing unit. The integrated functional units can be realized in the form of hardware, software or firmware.

[0127] Those skilled in the art can understand that the integrated functional units, if realized in the form of software and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application can be essentially realized in the form of a software product, and the computer software product is stored in a storage medium, which includes a plurality of instructions to make a computing device (such as a personal computer, a server or a network device) execute all or part of the steps of the method described in the embodiments of the present application when the instructions are run. The foregoing storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk and various program code storage media.

[0128] Alternatively, all or part of the steps of the foregoing method embodiments can be accomplished by program instruction related hardware (such as a computing device of a personal computer, a server, or a network device, etc.), which can be stored in a computer readable storage medium, and when the program instruction is executed by a processor of the computing device, the computing device executes all or part of the steps of the method according to the embodiments of the present application.

[0129] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand: within the spirit and principles of the present application, the technical solutions recorded in the foregoing embodiments can still be modified, or part or all of the technical features can be replaced by equivalents; and these modifications or replacements do not make the corresponding technical solutions deviate from the protection scope of the present application.

Claims

1. A message queue monitoring method, characterized in that, include: Obtain queue monitoring data of the target message queue within a preset time period; wherein, the queue monitoring data includes the number of messages consumed and the number of messages produced at each preset time point within the preset time period; The preset time period is divided into at least one sub-time period based on the preset time point, and the average consumption rate and message delay of each sub-time period are calculated using the message consumption and message production quantities corresponding to each preset time point. The target consumption rate at the target time point is calculated using the average consumption rate of each of the sub-time periods; wherein, the target time point is one of the preset time points; Calculate the message delay time corresponding to the target time point using the message delay quantity and the target consumption speed at the target time point; When the message delay time at the target time point exceeds a preset time threshold, a delay warning is issued for the target message queue. The calculation of the target consumption rate at the target time point using the average consumption rate of each of the sub-time periods includes: Calculate the time difference weight of the target time point relative to other preset time points within the preset time period; The target consumption rate at the target time point is calculated based on the time difference weights corresponding to each preset time point and the average consumption rate corresponding to the sub-time periods after each of the other preset time points. The calculation of the time difference weight of the target time point relative to other preset time points in the preset time period includes: The time difference weight is calculated using the following formula: ; in, Weighting of the time difference between the target time point and other preset time points; For the target time point; Other preset time points within the sub-time period.

2. The method according to claim 1, characterized in that, The step of calculating the average consumption rate and message latency for each of the preset time periods using the message consumption and message production quantities corresponding to each preset time point includes: The average consumption rate for each sub-time period is calculated using the first consumption quantity at the preceding preset time point and the second consumption quantity at the following preset time point; and, The message delay quantity corresponding to each preset time point is calculated using the message consumption and message production quantities at each preset time point; specifically, the message delay quantity is calculated using the following formula: ; in, The number of message delays corresponding to a preset time point; The number of messages produced at a preset time point; This represents the number of messages consumed at a preset time point.

3. The method according to claim 2, characterized in that, The step of calculating the average consumption rate for each of the sub-time periods using the first consumption quantity corresponding to the previous preset time point and the second consumption quantity corresponding to the subsequent preset time point includes: The average consumption rate is calculated using the following formula: ; in, This represents the average consumption rate over the sub-time period. This refers to the preset time point corresponding to the sub-time period; This refers to the preset time point corresponding to the sub-time period; This represents the first consumption quantity corresponding to the previously preset time point; This is the second consumption quantity corresponding to the preset time point.

4. The method according to claim 1, characterized in that, The step of calculating the target consumption rate at the target time point based on the time difference weights corresponding to each of the preset time points and the average consumption rate corresponding to the sub-time periods after each of the other preset time points includes: The target consumption rate is calculated using the following formula: ; in, The target consumption rate at the target time point. This represents the number of other preset time points outside the target time point within the preset time period. These represent the average consumption rate for each sub-time period following each other preset time point; These are the time difference weights of the target time point relative to each of the other preset time points.

5. The method according to claim 1, characterized in that, The step of calculating the message delay time corresponding to the target time point using the message delay quantity and target consumption speed at the target time point includes: The message delay time is calculated using the following formula: ; in, The message delay time corresponding to the target time point; The number of message delays corresponding to the target time point; The target consumption rate at the target time point.

6. A message queue monitoring device, characterized in that, include: The monitoring data acquisition module is used to acquire queue monitoring data of the target message queue within a preset time period; wherein, the queue monitoring data includes the number of messages consumed and the number of messages produced at each preset time point within the preset time period; The first data calculation module is used to divide the preset time period into at least one sub-time period according to the preset time point, and calculate the average consumption rate and message delay of each sub-time period using the message consumption and message production quantities corresponding to each preset time point; The second data calculation module is used to calculate the target consumption rate at the target time point using the average consumption rate of each of the sub-time periods; wherein the target time point is one of the preset time points; The third data calculation module is used to calculate the message delay time corresponding to the target time point using the message delay quantity and the target consumption speed at the target time point; The message delay warning module is used to issue a delay warning for the target message queue when the message delay time at the target time point exceeds a preset time threshold. The second data calculation module is specifically used to calculate the time difference weight of the target time point relative to other preset time points in the preset time period; and to calculate the target consumption rate of the target time point based on the time difference weight corresponding to each preset time point and the average consumption rate corresponding to the sub-time periods after each other preset time point. The second data calculation module specifically calculates the time difference weight using the following formula: ; in, Weighting of the time difference between the target time point and other preset time points; For the target time point; Other preset time points within the sub-time period.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the message queue monitoring method according to any one of claims 1 to 5.

8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the message queue monitoring method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Message queue monitoring method and device, electronic device and readable storage medium

    CN110187980A

  • Cross-service consumption method and storage medium

    CN111045837A