Message scheduling method and device of message queue, terminal equipment and storage medium

By calculating the number of incoming items that can be processed by the message queue and scheduling messages in the risk control decision-making system, the problem of imbalance in the number of incoming items for post-loan risk control and pre-loan risk control is solved, server utilization is improved, and hardware resource costs are reduced. The goal of cost reduction and efficiency improvement was achieved.

CN118708378APending Publication Date: 2024-09-27晋商消费金融股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410766874.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-14
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

The current risk control decision-making system has an imbalance in the number of inputs in the time dimension between post-loan risk control and pre-loan risk control, resulting in high hardware resource costs and low utilization. It is necessary to reduce hardware resource costs and improve server utilization.

Method used

By obtaining the number of messages to be processed, the maximum processing quantity threshold and the predicted number of incoming messages of the message queue, calculate the number of incoming messages that can be processed, and schedule the backlog of messages to another message queue for processing, so that consumer threads of different messages are distributed to each on the server to improve the utilization of each server.

Benefits of technology

The number of servers was reduced, the goal of cost reduction and efficiency improvement was achieved, and the overall efficiency of the risk control decision-making system was improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118708378A
    Figure CN118708378A
Patent Text Reader

Abstract

The invention discloses a message scheduling method and device for message queues, terminal equipment and a storage medium, and the method comprises the steps: obtaining a first total number of first message queues, a maximum processing number threshold value of the first message queues, and a predicted input number of the first message queues, and calculating the processable input number of the first message queues in a next time period; and scheduling a second message in a second message queue to the first message queue according to the processable incoming number, so that a consumer thread of the first message queue processes the first message and the second message in the first message queue. Therefore, aiming at the imbalance of the number of messages in the time dimension of post-loan risk control and pre-loan risk control, the messages in the message queue which may generate backlog are scheduled to another message queue to be processed, so that consumer threads of different messages are distributed to each server to improve the utilization rate of each server, and the user experience is improved. Therefore, the number of servers can be reduced, and the purposes of reducing cost and increasing efficiency are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a message scheduling method, device, terminal equipment and storage medium for a message queue. Background Art

[0002] There are two important links in the personal loan business of financial institutions, namely post-loan risk control and pre-loan risk control. They control and manage loan risks at different stages. Pre-loan risk control mainly refers to the comprehensive investigation and understanding of individuals who want to borrow through various channels before the loan is issued, so as to achieve risk control before the individual loan. Post-loan risk control mainly refers to the tracking and analysis of the customer's post-loan consumption behavior after the loan is issued, monitoring the flow of funds, debt balance, etc., so as to implement risk control activities.

[0003] Most financial institutions will use risk control decision systems to conduct post-loan risk control and pre-loan risk control. However, post-loan risk control and pre-loan risk control have different characteristics and requirements in the processing process. The risk control decision system needs to process post-loan risk control of loan customers in batches, such as risk control decisions such as increasing or reducing the loan limit. Post-loan risk control has the characteristics of phased, large data volume, high concurrency, and low timeliness. It is necessary to process the customer's pre-loan risk control in real time, such as risk control decisions such as credit granting and requesting payment. Pre-loan risk control has the characteristics of real-time, unpredictable quantity, and high timeliness. The current risk control decision system meets the requirements of pre-loan risk control and post-loan risk control by executing different message queues on different servers.

[0004] Therefore, the current risk control decision system requires dedicated post-loan and pre-loan servers to perform post-loan risk control and pre-loan risk control respectively. The cost of hardware resources is high. In addition, since post-loan risk control is not a business scenario that is available all the time, it is often available at the beginning or end of the month, resulting in the disadvantage of low utilization of post-loan servers. Therefore, how to reduce the cost of hardware resources and improve the utilization of risk control decision system servers has become an urgent problem to be solved. Summary of the invention

[0005] The embodiments of the present invention provide a message scheduling method, apparatus, terminal device and storage medium for a message queue. According to the imbalance in the number of applications between post-loan risk control and pre-loan risk control in the time dimension, messages in a message queue that may generate backlogs are scheduled to another message queue for processing, thereby distributing consumer threads of different messages to various servers to improve the utilization rate of each server, thereby reducing the number of servers and achieving the goal of reducing costs and increasing efficiency.

[0006] An embodiment of the present invention provides a message scheduling method for a message queue, characterized by comprising:

[0007] Obtaining a first total number of first messages to be processed in a first message queue, a maximum processing quantity threshold of the first message queue, and a predicted number of first messages to be processed in the first message queue in a next time period;

[0008] Calculate the number of incoming messages that can be processed by the first message queue in the next time period according to the first total number, the maximum processing quantity threshold, and the predicted number of incoming messages;

[0009] The processable number of incoming messages is the number of second messages that the consumer thread of the first message queue can process in the next period of time;

[0010] According to the processable number of incoming messages, the second message in the second message queue is dispatched to the first message queue, so that the consumer thread of the first message queue processes the first message and the second message in the first message queue.

[0011] Further, obtaining the predicted number of incoming first messages of the first message queue in the next time period includes:

[0012] Obtaining a preset predicted incoming coefficient of the first message queue and a total number of historical first message consumptions;

[0013] The total number of historical first message consumptions is the number of first messages processed by the consumer thread in each historical period;

[0014] The predicted number of first messages to be consumed in the first message queue in the next time period is calculated based on the total number of first message consumptions in history and the predicted incoming coefficient.

[0015] Further, the calculating the predicted number of first messages to be consumed by the first message queue in the next period according to the total number of first message consumptions in history and the predicted incoming coefficient includes:

[0016] According to the total number of the historical first message consumptions, a median of the total number of the historical first message consumptions is generated;

[0017] According to the median and the predicted number of incoming items, the predicted number of incoming items is calculated by the following formula:

[0018] n pre =m median ×k;

[0019] Among them, n pre is the predicted number of incoming items, m median is the median, and k is the predicted advance coefficient.

[0020] Further, the calculating, according to the first total number, the maximum processing quantity threshold, and the predicted number of incoming items, the number of incoming items that can be processed by the first message queue in the next time period includes:

[0021] The number of incoming messages that can be processed by the first message queue in the next period is calculated according to the following formula:

[0022] x=y most -z1-n pre ;

[0023] Among them, x is the number of incoming items that can be processed, y most is the maximum processing quantity threshold, z1 is the first total number, n pre is the predicted number of incoming items.

[0024] Furthermore, after calculating the number of incoming messages that can be processed by the first message queue in the next time period, the method further includes:

[0025] Obtain a second total number of second messages to be processed in the second message queue;

[0026] When it is determined that the second total is equal to 0, the second message in the second message queue is not scheduled.

[0027] Further, scheduling the second message in the second message queue to the first message queue according to the processable number of incoming messages includes:

[0028] When it is determined that the second total number is not less than the processable number of incoming messages, dispatching a corresponding number of second messages in the second message queue to the first message queue according to the processable number of incoming messages;

[0029] When it is determined that the second total number is greater than 0 and the second total number is less than the processable number of incoming messages, all the to-be-processed second messages in the second message queue are scheduled to the first message queue.

[0030] Furthermore, the message scheduling method of a message queue described in the above embodiment further includes:

[0031] Obtain the target message currently being processed by the consumer thread of the first message queue;

[0032] When it is determined that the target message is the first message, the total number of first message consumptions in the current time period is increased by one.

[0033] Another embodiment of the present invention provides a message scheduling device for a message queue, including:

[0034] A data acquisition module, used to acquire a first total number of first messages to be processed in a first message queue, a maximum processing quantity threshold of the first message queue, and a predicted number of first messages to be processed in the first message queue in a next time period;

[0035] A data processing module, configured to calculate the number of incoming messages that can be processed by the first message queue in the next time period according to the first total number, the maximum processing quantity threshold, and the predicted number of incoming messages;

[0036] The processable number of incoming messages is the number of second messages that the first message queue can process in the next period of time;

[0037] The message scheduling module is used to schedule the second message in the second message queue to the first message queue according to the processable number of incoming messages, so that the consumer thread of the first message queue processes the first message and the second message in the first message queue.

[0038] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements a message scheduling method for a message queue as described in any one of the embodiments.

[0039] Another embodiment of the present invention provides a storage medium, characterized in that the storage medium includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute a message scheduling method for a message queue as described in any of the above embodiments.

[0040] The following beneficial effects are achieved by implementing the present invention:

[0041] The present invention discloses a message scheduling method, apparatus, terminal device and storage medium for a message queue, which calculates the number of incoming items that can be processed by the first message queue in the next time period by obtaining the first total number of the first message queue, the maximum processing number threshold of the first message queue, and the predicted number of incoming items of the first message queue, and schedules the second message in the second message queue to the first message queue according to the number of incoming items that can be processed, so that the consumer thread of the first message queue performs the consumption task and processes the first message and the second message in the first message queue. It can be understood that the present invention, in view of the imbalance in the number of incoming items between post-loan risk control and pre-loan risk control in the time dimension, schedules the messages in the message queue that may generate backlogs to another message queue for processing, and realizes that the consumer threads of different messages are distributed to each server to improve the utilization rate of each server, thereby reducing the number of servers and achieving the goal of reducing costs and increasing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 The present invention is a flowchart of a message scheduling method for a message queue provided by an embodiment of the present invention.

[0043] Figure 2 It is a structural diagram of a message scheduling device of a message queue provided by an embodiment of the present invention.

[0044] Figure 3 This is another flowchart of a message scheduling method for a message queue provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.

[0047] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.

[0048] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0049] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0050] In the description of the embodiments of the present application, the term "multiple" refers to more than two (including two). Similarly, "multiple groups" refers to more than two groups (including two groups), and "multiple pieces" refers to more than two pieces (including two pieces).

[0051] In the description of the embodiments of the present application, unless otherwise clearly specified and limited, technical terms such as "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal connection of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.

[0052] See also Figure 1 , is a flow chart of a message scheduling method of a message queue provided by an embodiment of the present invention, including:

[0053] S1, obtaining a first total number of first messages to be processed in a first message queue, a maximum processing quantity threshold of the first message queue, and a predicted number of first messages to be processed in the first message queue in the next time period;

[0054] In a preferred embodiment of the present invention, the first message queue is a pre-loan message queue, the first message is a pre-loan risk control message, and the first total is the number of pre-loan risk control information to be processed in the pre-loan message queue.

[0055] It should be noted that since a large number of post-loan risk control messages need to be processed at the beginning and end of the month, post-loan risk control is characterized by stages, large data volume, and high concurrency, which can easily cause backlogs in the post-loan message queue. Therefore, in this embodiment, the pre-loan message queue is used as the first message queue to help the post-loan message queue, which is prone to backlogs, process post-loan risk control messages.

[0056] It is understandable that if there is a sudden large number of pre-loan risk control messages, which causes a backlog in the pre-loan queue, the post-loan message queue can also be used as the first message queue to help the pre-loan risk control queue consume pre-loan risk control messages.

[0057] It should be further explained that before obtaining the first total number of first messages to be processed in the first message queue, the maximum processing number threshold of the first message queue, and the predicted number of first messages in the first message queue in the next time period, the server needs to be configured, that is, the number of threads for processing pre-loan risk control messages and the number of threads for processing post-loan risk control messages are configured, and the configured server is stress tested to obtain the maximum processing number threshold of the first message queue. It can be understood that when the number of incoming messages in the first message queue exceeds the maximum processing number threshold, the first message queue will generate a backlog.

[0058] In this embodiment, the server has 8 cores and 32G, and the number of threads configured to process pre-loan risk control messages is 6, and the number of threads configured to process post-loan risk control messages is 2.

[0059] Preferably, obtaining the predicted number of incoming first messages of the first message queue in the next time period includes:

[0060] S11, obtaining a preset predicted incoming coefficient of the first message queue and a total number of historical first message consumptions;

[0061] The total number of historical first message consumptions is the number of first messages processed by the consumer thread in each historical period;

[0062] S12: Calculate the predicted number of first messages to be consumed in the first message queue in the next time period based on the total number of first message consumptions in history and the predicted incoming coefficient.

[0063] Preferably, the calculating the predicted number of first messages to be consumed by the first message queue in the next period according to the total number of first message consumptions in history and the predicted incoming coefficient includes:

[0064] S121. Generate a median of a number of total number of historical first message consumptions according to a number of total number of historical first message consumptions;

[0065] S122. Calculate the predicted number of incoming applications according to the median and the predicted incoming application coefficient using the following formula:

[0066] n pre =m median ×k;

[0067] Among them, n pre is the predicted number of incoming items, m median is the median, and k is the predicted advance coefficient.

[0068] In a preferred embodiment of the present invention, the preset prediction input coefficient is 1, a time period is set to one minute, and the total number of historical first message consumptions is the number of first messages processed by the consumer thread every minute in the last six hours.

[0069] S2, calculating the number of incoming messages that can be processed by the first message queue in the next time period according to the first total number, the maximum processing quantity threshold, and the predicted number of incoming messages;

[0070] The processable number of incoming messages is the number of second messages that the consumer thread of the first message queue can process in the next period of time;

[0071] Preferably, the calculating the number of incoming messages that can be processed by the first message queue in the next time period according to the first total number, the maximum processing quantity threshold, and the predicted number of incoming messages includes:

[0072] S21. Calculate the number of incoming messages that can be processed by the first message queue in the next period according to the following formula:

[0073] x=y most -z1-n pre ;

[0074] Among them, x is the number of incoming items that can be processed, y most is the maximum processing quantity threshold, z1 is the first total number, n pre is the predicted number of incoming items.

[0075] In a preferred embodiment of the present invention, the processable number of incoming messages is the number of second messages that the consumer thread of the pre-loan message queue can process within the next minute.

[0076] It is understandable that the number of processable incoming cases is affected by the maximum processing number threshold, the first total number, and the predicted number of incoming cases, and the maximum processing number threshold and the first total number exist objectively. Therefore, the number of processable incoming cases can be controlled by adjusting the predicted number of incoming cases. In this embodiment, when it is predicted that there will be a large increase in the number of pre-loan risk control messages at the next moment, the predicted number of incoming cases at the next moment can be increased by increasing the predicted incoming case coefficient, and the number of processable incoming cases can be reduced, so as to achieve the purpose of reserving sufficient capacity in the pre-loan message queue for the pre-loan risk control messages that will be added in the future, which can effectively avoid the backlog of pre-loan risk control messages, resulting in the inability to meet the timeliness of pre-loan risk control message processing.

[0077] Preferably, after calculating the number of incoming messages that can be processed by the first message queue in the next time period, the method further includes:

[0078] S22, obtaining a second total number of second messages to be processed in the second message queue;

[0079] S23: When it is determined that the second total is equal to 0, the second message in the second message queue is not scheduled.

[0080] Preferably, after calculating the number of incoming messages that can be processed by the first message queue in the next time period, the method further includes:

[0081] S24, obtaining a second total number of second messages to be processed in the second message queue;

[0082] S25. When it is determined that the second total is equal to 0, the second message in the second message queue is not scheduled.

[0083] S3. According to the processable number of incoming messages, dispatch the second message in the second message queue to the first message queue, so that the consumer thread of the first message queue processes the first message and the second message in the first message queue.

[0084] Preferably, scheduling the second message in the second message queue to the first message queue according to the processable number of incoming messages includes:

[0085] S31, when it is determined that the second total number is not less than the processable number of incoming messages, dispatching a corresponding number of second messages in the second message queue to the first message queue according to the processable number of incoming messages;

[0086] S32: When it is determined that the second total number is greater than 0 and the second total number is less than the processable number of incoming messages, dispatch all the to-be-processed second messages in the second message queue to the first message queue.

[0087] In a preferred embodiment of the present invention, the second message queue is a post-loan message queue, the second message is a post-loan risk control message, and the second total is the post-loan risk control information to be processed in the post-loan message queue.

[0088] It is understandable that before scheduling post-loan risk control messages, it is necessary to determine whether there are any post-loan risk control messages to be processed in the post-loan message queue. If not, there is no need to schedule the post-loan risk control messages; if so, then based on the second total and the number of processable incoming items, determine how many post-loan risk control messages need to be scheduled to the pre-loan risk control message queue for processing.

[0089] Specifically, when the second total number is not less than the number of processable incoming items, the corresponding number of second messages in the second message queue are scheduled to the first message queue according to the number of processable incoming items; when it is determined that the second total number is greater than 0 and less than the number of processable incoming items, all second messages in the second message queue are scheduled to the first message queue.

[0090] Preferably, the message scheduling method of a message queue described in the above embodiment further includes:

[0091] S4. Obtain the target message currently processed by the consumer thread of the first message queue;

[0092] S5. When it is determined that the target message is the first message, the total number of first message consumptions in the current time period is increased by one.

[0093] In a preferred embodiment of the present invention, by determining whether the target message currently being processed by the consumer thread of the first message queue is the first message, the total number of first message consumptions in the current time period is counted, so that the predicted number of incoming messages in the next time period can be calculated based on the total number of first message consumptions in the current time period.

[0094] This embodiment provides a message scheduling method for a message queue, which calculates the number of incoming items that can be processed by the first message queue in the next time period by obtaining the first total number of the first message queue, the maximum processing number threshold of the first message queue, and the predicted number of incoming items of the first message queue, and schedules the second message in the second message queue to the first message queue according to the number of incoming items that can be processed, so that the consumer thread of the first message queue processes the first message and the second message in the first message queue. Therefore, the present invention targets the imbalance in the number of incoming items between post-loan risk control and pre-loan risk control in the time dimension, schedules the messages in the message queue that may generate backlogs to another message queue for processing, and distributes the consumer threads of different messages to each server to improve the utilization rate of each server, thereby reducing the number of servers and achieving the goal of reducing costs and increasing efficiency.

[0095] See also Figure 2 , is a schematic diagram of the structure of a message scheduling device of a message queue provided by an embodiment of the present invention, including:

[0096] A data acquisition module, used to acquire a first total number of first messages to be processed in a first message queue, a maximum processing quantity threshold of the first message queue, and a predicted number of first messages to be processed in the first message queue in a next time period;

[0097] A data processing module, configured to calculate the number of incoming messages that can be processed by the first message queue in the next time period according to the first total number, the maximum processing quantity threshold, and the predicted number of incoming messages;

[0098] The processable number of incoming messages is the number of second messages that the first message queue can process in the next period of time;

[0099] The message scheduling module is used to schedule the second message in the second message queue to the first message queue according to the processable number of incoming messages, so that the consumer thread of the first message queue processes the first message and the second message in the first message queue.

[0100] This embodiment provides a message scheduling device for a message queue, which calculates the number of incoming items that can be processed by the first message queue in the next time period by obtaining the first total number of the first message queue, the maximum processing number threshold of the first message queue, and the predicted number of incoming items of the first message queue, and schedules the second message in the second message queue to the first message queue according to the number of incoming items that can be processed, so that the consumer thread of the first message queue processes the first message and the second message in the first message queue. Therefore, in view of the imbalance in the number of incoming items between post-loan risk control and pre-loan risk control in the time dimension, the present invention schedules the messages in the message queue that may generate backlogs to another message queue for processing, and realizes that the consumer threads of different messages are distributed to each server to improve the utilization rate of each server, thereby reducing the number of servers and achieving the goal of reducing costs and increasing efficiency.

[0101] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.

[0102] Those skilled in the art can clearly understand that for the sake of convenience and brevity, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0103] Another preferred embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements a message scheduling method for a message queue as described in any one of the above embodiments.

[0104] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.

[0105] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.

[0106] The memory can be used to store the computer program, and the processor realizes various functions of the terminal device by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0107] Another preferred embodiment of the present invention provides a storage medium, the storage medium is a computer-readable storage medium, the computer program is stored in the computer-readable storage medium, and the computer program, when executed by the processor, can implement the steps of the above-mentioned various method embodiments. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.

[0108] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A message scheduling method for a message queue, characterized in that: include: Obtaining a first total number of first messages to be processed in a first message queue, a maximum processing quantity threshold of the first message queue, and a predicted number of first messages to be processed in the first message queue in a next time period; Calculate the number of incoming messages that can be processed by the first message queue in the next time period according to the first total number, the maximum processing quantity threshold, and the predicted number of incoming messages; The processable number of incoming messages is the number of second messages that the consumer thread of the first message queue can process in the next period of time; According to the processable number of incoming messages, the second message in the second message queue is dispatched to the first message queue, so that the consumer thread of the first message queue processes the first message and the second message in the first message queue.

2. A message scheduling method for a message queue as claimed in claim 1, characterized in that: Obtaining the predicted number of incoming first messages of the first message queue in the next time period includes: Obtaining a preset predicted incoming coefficient of the first message queue and a total number of historical first message consumptions; The total number of historical first message consumptions is the number of first messages processed by the consumer thread in each historical period; The predicted number of first messages to be consumed in the first message queue in the next time period is calculated based on the total number of first message consumptions in history and the predicted incoming coefficient.

3. A message scheduling method for a message queue as claimed in claim 2, characterized in that: The calculating, based on the total number of the historical first message consumptions and the predicted incoming item coefficient, the predicted incoming item number of the first message in the first message queue in the next time period includes: Generate a median of a number of total number of historical first message consumptions according to the total number of historical first message consumptions; According to the median and the predicted number of incoming items, the predicted number of incoming items is calculated by the following formula: n pre =m median ×k; Among them, n pre is the predicted number of incoming items, m median is the median, and k is the predicted advance coefficient.

4. A message scheduling method for a message queue as claimed in claim 1, characterized in that: The calculating, according to the first total number, the maximum processing quantity threshold, and the predicted number of incoming messages, the number of incoming messages that can be processed by the first message queue in the next time period includes: The number of incoming messages that can be processed by the first message queue in the next period is calculated according to the following formula: x=y most -z1-n pre ; Among them, x is the number of incoming items that can be processed, y most is the maximum processing quantity threshold, z1 is the first total number, n pre is the predicted number of incoming items.

5. A message scheduling method for a message queue as claimed in claim 1, characterized in that: After calculating the number of incoming messages that can be processed by the first message queue in the next time period, the method further includes: Obtain a second total number of second messages to be processed in the second message queue; When it is determined that the second total is equal to 0, the second message in the second message queue is not scheduled.

6. A message scheduling method for a message queue as claimed in claim 5, characterized in that: The step of dispatching the second message in the second message queue to the first message queue according to the processable number of incoming messages includes: When it is determined that the second total number is not less than the processable number of incoming messages, dispatching a corresponding number of second messages in the second message queue to the first message queue according to the processable number of incoming messages; When it is determined that the second total number is greater than 0 and the second total number is less than the processable number of incoming messages, all the to-be-processed second messages in the second message queue are scheduled to the first message queue.

7. A message scheduling method for a message queue as claimed in claim 2, characterized in that: Also includes: Obtain the target message currently being processed by the consumer thread of the first message queue; When it is determined that the target message is the first message, the total number of first message consumptions in the current time period is increased by one.

8. A message scheduling device for a message queue, characterized in that: include: A data acquisition module, used to acquire a first total number of first messages to be processed in a first message queue, a maximum processing quantity threshold of the first message queue, and a predicted number of first messages to be processed in the first message queue in a next time period; A data processing module, configured to calculate the number of incoming messages that can be processed by the first message queue in the next time period according to the first total number, the maximum processing quantity threshold, and the predicted number of incoming messages; The processable number of incoming messages is the number of second messages that the first message queue can process in the next period of time; The message scheduling module is used to schedule the second message in the second message queue to the first message queue according to the processable number of incoming messages, so that the consumer thread of the first message queue processes the first message and the second message in the first message queue.

9. A terminal device, characterized in that: It comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements a message scheduling method for a message queue as described in any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute a message scheduling method for a message queue as described in any one of claims 1 to 7.