Method, device, electronic equipment and storage medium for high timeliness message processing

By using a message processing model based on hash partitioning and business priority queues, the problems of performance degradation and resource waste in traditional message processing are solved, achieving efficient and reliable message sending and querying.

CN120104672BActive Publication Date: 2025-12-05SICHUAN RURAL COMMERCIAL UNITED BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510311546.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-12-05
Estimated Expiration
2045-03-17

AI Technical Summary

Technical Problem

Traditional message processing models suffer from significant performance degradation in message loading, sending, and querying after the accumulation of database data, resulting in wasted system resources, delayed message reception, data cleanup anomalies, and severe lock contention issues.

Method used

The data table is partitioned using hash partitioning, a business priority queue is set up, and message processing logic is optimized through round-robin and partition jump algorithms to ensure even message distribution and efficient querying.

Benefits of technology

It improves the efficiency and reliability of message processing, reduces data backlog, reduces lock contention and cleans up anomalies, and improves system resource utilization and message sending speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120104672B_ABST
    Figure CN120104672B_ABST
Patent Text Reader

Abstract

The application relates to a high timeliness message processing method, device, electronic equipment and storage medium. The high timeliness message processing method comprises the following steps: data table setting, performing hash partitioning on a sending data table according to a unique primary key id, and uniformly distributing all message data into multiple hash partitioning databases; setting a priority order in a default state, designing a priority configuration mode; sending logic setting, setting a partitioning-based jump rule, repeatedly loading a to-be-sent short message from a first partition according to a message query rule in the partition in a polling mode; setting a message query and loading rule in the partition, setting a priority queue, and defining a maximum query quantity; setting a single query threshold, setting a maximum query quantity of each query, and then performing a query according to whether it is a first priority. According to the high timeliness message processing method, business priority and hash partitioning are combined, the query performance can be obviously improved, and message accumulation can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computers, and more specifically, to a method, apparatus, electronic device, and storage medium for high-time-efficiency message processing. Background Technology

[0002] Balancing different business needs with improving processing efficiency has always been a technical challenge in message sending and processing. In traditional message processing models, such as SMS sending scenarios, the performance of message loading and sending significantly decreases as the amount of data in the database accumulates, especially in distributed databases.

[0003] Most existing message processing models are based on traditional B+ tree-structured non-distributed databases, which offer a relatively balanced performance between query and insertion. Traditional message processing methods employ a global loop to scan the table. To improve loading performance, a list is typically partitioned based on the sending status, allowing messages in different sending statuses to be retrieved from specific partitions to accelerate query performance. However, the failure to consider database performance led to the following problems in the distributed database: 1. Waste of system resources: Slow message querying and loading message content into the sending queue resulted in a significant portion of the sending queue being idle, failing to make good use of system resources; 2. Message reception delay: Due to slow message loading, a large number of messages accumulated in the database, causing customers to wait a long time to receive messages, especially in the case of SMS verification codes, which seriously affected business processing; 3. Data cleanup anomalies: To ensure message sending performance, messages in the table are generally cleaned up globally according to certain rules every day. Under the original mechanism, the efficiency of daily batch deletion in the distributed database is low, resulting in a large accumulation of messages to be cleaned, which cannot be deleted quickly, leading to long transactions, accompanied by timeouts and deadlocks, thus affecting query performance; 4. Lock contention: To avoid duplicate message loading, traditional message sending designs use row locks (such as the skip locked statement in Oracle) to prevent multi-threaded queries from obtaining duplicate data. In the traditional global scanning method, when the number of query service threads is large or the number of messages queried at one time is large, lock contention will increase significantly, thereby reducing query performance.

[0004] Therefore, there is an urgent need to develop a highly timely message processing solution that can significantly improve query performance while avoiding the problem of large backlogs caused by uneven distribution of messages of different priorities in partitions. Summary of the Invention

[0005] The technical problem this invention aims to solve is that in traditional message processing models, the performance of loading, sending, and querying messages significantly decreases as the amount of data in the database accumulates.

[0006] To solve the above-mentioned technical problems, according to one aspect of the present invention, a method for high-timeliness message processing is provided, comprising the steps of: data table setting, canceling the traditional list partitioning method, performing hash partitioning on the sending data table according to the unique primary key id, dividing it into multiple hash partitions, and all message data being evenly distributed and inserted into multiple hash partition databases after being entered into the database; business priority queue setting, setting the priority order in the default state, which is designed according to the priority order from the first to the last position of the queue array by default, or flexibly adopting methods such as adjusting the queue size or the number of messages in the queue to change the order; designing the priority configuration method, which reads the configuration according to environment variables in the default state, and if a message queue is set, it reads the configuration in the message queue first; sending logic setting, including the steps of: setting the basic jump rules of the partition, repeatedly loading the short messages to be sent from the first partition according to the message query rules in the partition in a polling manner until the last partition is traversed; when the query of the last partition is completed, the query starts again from the first partition; setting the basic rules for message query and loading in the partition, within the current partition During a query, query rules and a priority queue are set, defining the maximum number of queries. Following a basic order from highest to lowest priority, each query loads a maximum number of messages of a certain priority into the message sending queue. If the query result is less than the maximum number of messages, the query continues for the next priority message in the current partition until all messages of the lowest priority in the current partition have been queried, then proceeding to the next partition. If the query result reaches the maximum number of messages, the process jumps to the next partition. A single query threshold and partition jump rules are set. In the current partition, each query retrieves the maximum number of messages. If, after three consecutive queries, the number of messages of a certain priority is the maximum number, it indicates that the message volume for that priority is large in the current partition. The process then determines whether that priority is the first priority and proceeds as follows: If it is the first priority, continue querying and loading messages of that priority in the current partition until a query reaches the maximum number of messages, then query the next priority message in the current partition; if it is not the first priority, jump directly to the next partition and start querying again from the highest priority, and so on.

[0007] According to an embodiment of the present invention, in the data table settings, the hash partition can be divided into 32 hash partitions.

[0008] According to an embodiment of the present invention, the sending logic settings may further include the step of: setting a handling method for blocking situations in the sending queue, wherein when there are many messages to be sent in the sending queue, the system pauses for one second and then jumps to the next partition while processing the messages to be sent in the order of high priority to low priority according to the above rules.

[0009] According to an embodiment of the present invention, the maximum number of queries can be defined as 100 in the sending logic settings.

[0010] According to a second aspect of the present invention, an apparatus for high-timeliness message processing is provided, comprising: a data table setting module, used to perform hash partitioning on the sending data table according to a unique primary key id, dividing it into multiple hash partitions, and all message data is evenly distributed and inserted into multiple hash partition databases after being entered into the database; a business priority queue setting module, used to set the priority order in the default state, which is designed according to the priority order from the first position to the last position of the queue array by default, or flexibly adopts methods including adjusting the queue size or the number of messages in the queue to change the order; designing the priority configuration method, which reads the configuration according to environment variables in the default state, and if a message queue is set, it reads the configuration in the message queue first; a sending logic setting module, used to set the sending logic, and perform the following operations: setting the basic jump rules of the partition, repeatedly loading the short messages to be sent from the first partition according to the message query rules in the partition in a polling manner until the last partition is traversed; when the query of the last partition is completed, the query starts again from the first partition; setting the basic rules for message query and loading in the partition, setting the basic rules for querying and loading messages in the current partition. Set query rules and priority queues, define the maximum number of queries, and load a maximum number of messages of a certain priority into the message sending queue each time, following the basic order from highest to lowest priority. If the query result is less than the maximum number of messages, query the next priority message in the current partition, and so on, until the lowest priority message in the current partition is queried, then proceed to the next partition. If the query result is the maximum number of messages, then jump to the next partition. Set a single query threshold and partition jump rules. In the current partition, query the maximum number of messages each time. If the number of messages of a certain priority is the maximum number of messages in three consecutive queries, it indicates that the message volume of that priority is large in the current partition. Then determine whether that priority is the first priority, and then proceed according to the following: First priority, continue querying and loading messages of that priority in the current partition until the number of messages is less than the maximum number of messages, then query the next priority message in the current partition; If not the first priority, jump directly to the next partition and start querying from the highest priority again, and so on.

[0011] According to an embodiment of the present invention, in the data table setting module, the hash partition can be divided into 32 hash partitions.

[0012] According to an embodiment of the present invention, the sending logic setting module may also perform the following operations: setting the sending queue blocking handling mode, when there are many messages to be sent in the sending queue, after a one-second pause, jump to the next partition and process the messages to be sent in the order of high priority to low priority according to the above rules.

[0013] According to an embodiment of the present invention, the maximum number of queries can be defined as 100 in the sending logic setting module.

[0014] According to a third aspect of the present invention, an electronic device is provided, comprising: a memory, a processor, and a time-sensitive message processing program stored in the memory and executable on the processor, wherein the time-sensitive message processing program, when executed by the processor, implements the steps of the above-described time-sensitive message processing method.

[0015] According to a fourth aspect of the present invention, a computer storage medium is provided, wherein a time-sensitive message processing program is stored on the computer storage medium, and when the time-sensitive message processing program is executed by a processor, it implements the steps of the above-described time-sensitive message processing method.

[0016] Compared with the prior art, the technical solution provided by the embodiments of the present invention can achieve at least the following beneficial effects:

[0017] The present invention proposes a message processing mode based on business priority and hash partitioning for high-timeliness message processing. By flexibly configuring business priorities, the specific needs of different businesses for message sending are met, improving the targeting and response speed of the business. At the same time, by using a hash partitioning database design and a specific partition jump algorithm, the data processing pressure is effectively distributed, greatly improving the performance of message processing and ensuring the efficiency and reliability of message processing.

[0018] The high-timeliness message processing method of the present invention can flexibly configure business priorities and effectively manage business priorities, so that urgent business messages can be delivered in a timely manner, bringing benefits to enterprises and users.

[0019] The timeliness message processing method of the present invention avoids the degradation of query performance caused by large accumulation of data and improves message push efficiency; it avoids the problem of long transaction time in cleaning up large amounts of data and avoids timeout and deadlock.

[0020] The method and apparatus for high-timeliness message processing of the present invention greatly improve the efficiency of querying and loading messages in message sending scenarios by using a message processing method that uses hash partitioning to jump to partitions according to business priority and certain rules, while solving abnormal situations such as data cleanup and reducing lock contention.

[0021] The method and apparatus for high-timeliness message processing of the present invention enhance flexibility in meeting the needs of complex business scenarios, and the flexible configuration of business priorities can satisfy various complex business scenarios. Compared with traditional sending modes, it is more flexible.

[0022] The method and apparatus for high-timeliness message processing of the present invention improve system resource utilization, solve the message receiving delay problem, improve SQL query performance, and thus improve the utilization of message sending channels and the overall efficiency of message sending.

[0023] The method and apparatus for high-timeliness message processing of the present invention solves the problem of data cleanup anomalies. By deleting within a partition, the amount of data is reduced, greatly improving deletion performance while avoiding anomalies such as timeouts and deadlocks caused by long transactions.

[0024] The method and apparatus for high-timeliness message processing of the present invention reduce lock contention. Under partitioned query mode, each partition is independent, which greatly reduces lock contention in multi-threaded and multi-replica scenarios and is more friendly to server expansion in high-concurrency scenarios. Attached Figure Description

[0025] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings of the embodiments will be briefly described below. Obviously, the drawings described below only relate to some embodiments of the present invention and are not intended to limit the present invention.

[0026] Figure 1 This is a schematic diagram illustrating partition navigation for high-timeliness message processing according to an embodiment of the present invention;

[0027] Figure 2 This is a flowchart illustrating the partitioning and redirection process for high-timeliness message processing according to an embodiment of the present invention;

[0028] Figures 3a-3d This is pseudocode illustrating a highly timely message processing method according to an embodiment of the present invention;

[0029] Figure 4a This is a diagram illustrating message loading speed in existing technologies;

[0030] Figure 4b This is a schematic diagram illustrating message loading speed under a partitioned design mode for high-timeliness message processing according to an embodiment of the present invention. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the described embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0032] Unless otherwise defined, the technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains. The terms “first,” “second,” and similar terms used in the specification and claims of this patent application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms “an” or “a” and similar terms do not indicate a limitation of quantity, but rather indicate the presence of at least one.

[0033] According to one or more embodiments of the present invention, a method for processing time-sensitive messages includes the following steps: data table setting, service priority queue setting, and sending logic setting.

[0034] In the data table settings, the traditional list partitioning method is canceled. The sending data table is partitioned by hash based on the unique primary key id, and divided into multiple hash partitions. All message data will be evenly distributed and inserted into multiple hash partition databases after being entered into the database.

[0035] The business priority queue settings allow you to define the default priority order, which is designed from the first to the last element of the queue array. Alternatively, you can flexibly adjust the queue size or the number of messages in the queue to change the order. The settings also allow you to design the priority configuration method. By default, the configuration is read according to environment variables. If a message queue is set, the configuration in the message queue will be read first.

[0036] Figure 1 This is a schematic diagram illustrating partition navigation for high-timeliness message processing according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating the partitioning and navigation process for high-time-efficiency message processing according to an embodiment of the present invention.

[0037] like Figure 1 and Figure 2 As shown, the sending logic settings include the following steps: setting the basic partition jump rules, setting the basic rules for message querying and loading within the partition, and setting the single query threshold and partition jump rules.

[0038] Set up basic partition jump rules, and repeatedly load the SMS messages to be sent from the first partition according to the message query rules in the partition in a polling manner until the last partition is traversed; when the query of the last partition is completed, the query starts again from the first partition.

[0039] Set the basic rules for message querying and loading within a partition. When querying within the current partition, set query rules and a priority queue, define the maximum number of queries, and load a maximum number of messages of a certain priority into the message sending queue each time, following the basic order from highest to lowest priority. If the query results are less than the maximum number of messages to be queried, then query the next priority message in the current partition, and so on, until the lowest priority message in the current partition has been queried, before moving to the next partition. If the query results are the maximum number of messages to be queried, then jump to the next partition.

[0040] Set a single query threshold and partition jump rules. In the current partition, the maximum number of queries is set for each query. If the number of messages to be sent for a certain priority is the maximum number of queries for three consecutive queries, it means that the message volume of that priority is large in the current partition. Then, determine whether that priority is the first priority and then execute according to the following conditions.

[0041] For the first priority, continue querying and loading messages of that priority in the current partition until the maximum number of messages to be queried is reached in a certain query, then query the next priority message in the current partition; for non-first priority messages, directly jump to the next partition and start querying again from the highest priority, and so on.

[0042] The present invention proposes a message processing mode based on business priority and hash partitioning for high-timeliness message processing. By flexibly configuring business priorities, the specific needs of different businesses for message sending are met, improving the targeting and response speed of the business. At the same time, by using a hash partitioning database design and a specific partition jump algorithm, the data processing pressure is effectively distributed, greatly improving the performance of message processing and ensuring the efficiency and reliability of message processing.

[0043] According to one or more embodiments of the present invention, in the data table setup, the hash partition is divided into 32 hash partitions.

[0044] The method and apparatus for high-timeliness message processing of the present invention greatly improve the efficiency of querying and loading messages in message sending scenarios by using a message processing method that uses hash partitioning to jump to partitions according to business priority and certain rules, while solving abnormal situations such as data cleanup and reducing lock contention.

[0045] According to one or more embodiments of the present invention, the sending logic settings further include the step of: setting a sending queue blocking handling method, wherein when there are many messages to be sent in the sending queue, the sending queue pauses for one second and then jumps to the next partition, while processing the messages to be sent in the order of high priority to low priority according to the above rules.

[0046] The timeliness message processing method of the present invention avoids the degradation of query performance caused by large accumulation of data and improves message push efficiency; it avoids the problem of long transaction time in cleaning up large amounts of data and avoids timeout and deadlock.

[0047] According to one or more embodiments of the present invention, the maximum number of queries is defined as 100 in the sending logic settings.

[0048] The method and apparatus for high-timeliness message processing of the present invention improve system resource utilization, solve the message receiving delay problem, improve SQL query performance, and thus improve the utilization of message sending channels and the overall efficiency of message sending.

[0049] According to a second aspect of the present invention, an apparatus for high-time-efficiency message processing is provided, comprising: a data table setting module, a service priority queue setting module, and a sending logic setting module.

[0050] The data table settings module is used to perform hash partitioning on the sending data table according to the unique primary key id, dividing it into multiple hash partitions. After all message data is entered into the database, it will be evenly distributed and inserted into multiple hash partition databases.

[0051] The business priority queue setting module is used to set the priority order in the default state. By default, it is designed according to the priority order from the first to the last item in the queue array. Alternatively, it can flexibly adopt the method of adjusting the queue size or the number of messages in the queue to change the order. The priority configuration method is designed. In the default state, the configuration is read according to the environment variable. If a message queue is set, the configuration in the message queue will be read first.

[0052] The sending logic settings module is used to set the sending logic and perform the following operations: setting basic partition jump rules, setting basic rules for message querying and loading within a partition, and setting single query thresholds and partition jump rules.

[0053] Set up basic partition jump rules, and repeatedly load the SMS messages to be sent from the first partition according to the message query rules in the partition in a polling manner until the last partition is traversed; when the query of the last partition is completed, the query starts again from the first partition.

[0054] Set the basic rules for message querying and loading within a partition. When querying within the current partition, set query rules and a priority queue, define the maximum number of queries, and load a maximum number of messages of a certain priority into the message sending queue each time, following the basic order from highest to lowest priority. If the query results are less than the maximum number of messages to be queried, then query the next priority message in the current partition, and so on, until the lowest priority message in the current partition has been queried, before moving to the next partition. If the query results are the maximum number of messages to be queried, then jump to the next partition.

[0055] Set a single query threshold and partition jump rules. In the current partition, query the maximum number of messages to be sent in each query. If the number of messages to be sent for a certain priority is the maximum number of messages to be sent in three consecutive queries, it means that the message volume of that priority is large in the current partition. Then, determine whether that priority is the first priority, and then proceed as follows: If it is the first priority, continue to query and load the messages to be sent for that priority in the current partition until the number of messages to be sent in a query is less than the maximum number of messages to be sent. Then query the messages of the next priority in the current partition. If it is not the first priority, jump directly to the next partition and start querying again from the highest priority, and so on.

[0056] The method and apparatus for high-timeliness message processing of the present invention reduce lock contention. Under partitioned query mode, each partition is independent, which greatly reduces lock contention in multi-threaded and multi-replica scenarios and is more friendly to server expansion in high-concurrency scenarios.

[0057] According to one or more embodiments of the present invention, in the data table setting module, the hash partition is divided into 32 hash partitions.

[0058] According to one or more embodiments of the present invention, the sending logic setting module further performs the following operations: setting the handling method for sending queue blocking. When there are many messages to be sent in the sending queue, after a one-second pause, it jumps to the next partition and processes the messages to be sent in order from high priority to low priority according to the above rules.

[0059] The method and apparatus for high-timeliness message processing of the present invention solves the problem of data cleanup anomalies. By deleting within a partition, the amount of data is reduced, greatly improving deletion performance while avoiding anomalies such as timeouts and deadlocks caused by long transactions.

[0060] According to one or more embodiments of the present invention, the maximum number of queries is defined as 100 in the sending logic setting module.

[0061] The method and apparatus for high-timeliness message processing of the present invention enhance flexibility in meeting the needs of complex business scenarios, and the flexible configuration of business priorities can satisfy various complex business scenarios. Compared with traditional sending modes, it is more flexible.

[0062] Figures 3a-3d This is pseudocode illustrating a high-timeliness message processing method according to an embodiment of the present invention, to express the idea and logical structure of the high-timeliness message processing method according to the embodiment of the present invention.

[0063] Figure 4a This is a diagram illustrating message loading speed in existing technologies; Figure 4b This is a schematic diagram illustrating message loading speed under a partitioned design mode for high-timeliness message processing according to an embodiment of the present invention.

[0064] like Figure 4a and 4b As shown, a performance analysis is performed during use:

[0065] By observing actual performance and the partition jump process in the production environment, under single-point execution (single server) conditions, the time to scan a partition is about 50-100 milliseconds, and the total time to scan all partitions once is 0.5 to 1.5 seconds.

[0066] Based on calculations and actual operation results, there is no situation where data cannot be processed in a timely manner due to the large number of partitions.

[0067] Performance comparison: Two modes were compared using 10 million data points, and the loading status was as follows. Figure 4a and 4b As shown.

[0068] Results from both models show that the new message processing model significantly improves message sending efficiency, reducing the average sending time from 80 milliseconds to approximately 5 milliseconds. In a real-world production environment, the improvement in the reception rate of important business messages such as verification codes in the SMS system is particularly noticeable; even during peak business hours, customers can quickly receive important notifications.

[0069] The high-timeliness message processing method of the present invention can flexibly configure business priorities and effectively manage business priorities, so that urgent business messages can be delivered in a timely manner, bringing benefits to enterprises and users.

[0070] According to another aspect of the present invention, an apparatus for high-timeliness message processing is provided, comprising: a memory, a processor, and a high-timeliness message processing program stored in the memory and executable on the processor, wherein the high-timeliness message processing program, when executed by the processor, implements the steps of the high-timeliness message processing method described above.

[0071] The present invention also provides a computer storage medium.

[0072] A time-sensitive message processing program is stored on the computer storage medium. When the time-sensitive message processing program is executed by the processor, it implements the steps of the time-sensitive message processing method described above.

[0073] The method implemented when the high-timeliness message processing program running on the processor is executed can be referred to in various embodiments of the high-timeliness message processing method of the present invention, and will not be repeated here.

[0074] The present invention also provides a computer program product.

[0075] The computer program product of the present invention includes a time-sensitive message processing program, which, when executed by a processor, implements the steps of the time-sensitive message processing method described above.

[0076] The method implemented when the high-timeliness message processing program running on the processor is executed can be referred to in various embodiments of the high-timeliness message processing method of the present invention, and will not be repeated here.

[0077] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0078] The above description is merely an exemplary embodiment of the present invention and is not intended to limit the scope of protection of the present invention, which is determined by the appended claims.

Claims

1. A method for high timeliness message processing, comprising the following steps: data table setting, canceling the list partition mode in the traditional mode, and performing hash partition on the sending data table according to a unique primary key id to divide the sending data table into a plurality of hash partitions, and all the message database data are evenly and evenly inserted into the plurality of hash partition databases; service priority queue setting, setting the priority order in the default state, and the priority order is designed from the first position to the last position of the queue array, or the order is flexibly adjusted by adjusting the queue size or the number of messages in the queue; the priority configuration mode is designed, and the configuration is read in the default state according to the environment variable, and if the message queue is set, the configuration in the message queue is read first; sending logic setting, comprising the following steps: setting the partition-based jump rule, repeatedly loading the to-be-sent short message from the first partition according to the message query rule in the partition in a polling manner until the last partition is traversed; and starting to query from the first partition again after the query in the last partition is completed; setting the basic rule for message query and loading in the partition, setting the query rule and the priority queue when querying in the current partition, defining the maximum query number, and loading the to-be-sent message of a certain priority into the message sending queue according to the basic order rule from the highest priority to the lowest priority each time, and the maximum query number; if the query result is less than the maximum query number, the to-be-sent message of the next priority in the current partition is queried until the to-be-sent message of the lowest priority in the current partition is queried, and the next partition is entered; if the query result is equal to the maximum query number, the next partition is jumped to; setting the single query threshold and the partition jump rule, in the current partition, the maximum query number is queried each time, if the number of to-be-sent messages of a certain priority is equal to the maximum query number for three consecutive times, it is judged whether the priority is the first priority, and the following cases are executed: first priority, continue to query and load the to-be-sent message of the priority in the current partition until the number of to-be-sent messages of the priority is less than the maximum query number, and then query the to-be-sent message of the next priority in the current partition; non-first priority, directly jump to the next partition, and start to query from the highest priority, and the same is true.

2. The method for high timeliness message handling according to claim 1, wherein, In the data table setting, the hash partition is divided into 32 hash partitions.

3. The method for high timeliness message handling according to claim 1, wherein, In the sending logic setting, the following steps are further included: setting the sending queue blocking condition processing mode, when the to-be-sent message content in the sending queue is large, skipping to the next partition after resting for one second, and processing the to-be-sent message according to the above rule from the high priority to the low priority.

4. The method for high timeliness message handling according to claim 1, wherein, In the sending logic setting, the maximum query number is defined as 100.

5. An apparatus for high timeliness message processing, comprising: a data table setting module, configured to perform hash partition on a sending data table according to a unique primary key id to divide the sending data table into a plurality of hash partitions, and all the message database data are evenly and evenly inserted into the plurality of hash partition databases; The service priority queue setting module is used for setting the priority order in the default state, and the priority order is designed from the first position to the last position of the queue array, or the order is flexibly adjusted by adjusting the queue size or the number of messages in the queue; the priority configuration mode is designed, and the configuration is read according to the environment variable in the default state, and if the message queue is set, the configuration in the message queue is read first; The sending logic setting module is used for setting the sending logic, and the following operations are performed: The partition-based jump rule is set, and the first partition is repeatedly loaded with the to-be-sent short message according to the message query rule in the partition in a polling manner until the last partition is traversed; when the query of the last partition is completed, the query is restarted from the first partition; The basic rule of message query and loading in the partition is set, the query rule and the priority queue are set when the query is performed in the current partition, the maximum query number is defined, and the to-be-sent message of a priority is loaded into the message sending queue according to the basic order rule from the highest priority to the lowest priority each time, and the maximum query number is loaded each time; If the query result is less than the maximum query number, the to-be-sent message of the next priority in the current partition is queried until the to-be-sent message of the lowest priority in the current partition is queried, and the next partition is entered; if the query result is equal to the maximum query number, the next partition is jumped to; The single-query threshold and the partition jump rule are set, in the current partition, the maximum query number is queried each time, if the number of the to-be-sent message of a priority is equal to the maximum query number for three times in succession, it is judged whether the priority is the first priority, and the following situations are executed: The first priority, the to-be-sent message of the priority in the current partition is continuously queried and loaded until the number of the to-be-sent message is less than the maximum query number in a query, and the to-be-sent message of the next priority in the current partition is queried; The non-first priority, the next partition is directly jumped to, and the to-be-sent message is processed according to the above rule from the highest priority to the lowest priority.

6. The apparatus for high timeliness message processing of claim 5, wherein, In the data table setting module, the hash partition is divided into 32 hash partitions.

7. The apparatus for high time-critical message processing of claim 5, wherein, In the sending logic setting module, the following operations are further performed: When the number of to-be-sent messages in the sending queue is large, the next partition is jumped to after a one-second rest, and the to-be-sent message is processed according to the order from the high priority to the low priority.

8. The apparatus for high timeliness message processing of claim 5, wherein, In the sending logic setting module, the maximum query number is defined as 100.

9. An electronic device comprising: The memory, the processor, and the high-time-efficiency message processing program stored on the memory and capable of running on the processor, when the high-time-efficiency message processing program is executed by the processor, the steps of the high-time-efficiency message processing method in any one of claims 1 to 4 are implemented.

10. A computer storage medium, wherein, The computer storage medium stores the high-time-efficiency message processing program, and when the high-time-efficiency message processing program is executed by the processor, the steps of the high-time-efficiency message processing method in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Chat message processing method and device, computer equipment and storage medium

    CN115633187A

  • Data hierarchical storage and query processing method and device, equipment and medium

    CN119415568A