Message processing method and device

By dynamically adjusting the target duration and capacity of the target queue in the message processing system, ensuring resource balance between each queue, solving the problem of packets with low priority being ignored, and improving the packet forwarding efficiency and real-time performance of system response.

CN119697128APending Publication Date: 2025-03-25LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411932477.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the process of forwarding packets in the prior art, when the forwarding amount of high priority packets is large, messages with lower priority will be ignored, resulting in reduced packet forwarding efficiency of the system, thereby reducing the real-time nature of system response.

Method used

By determining the target duration of the target queue and forwarding the packets to be sent in the target queue according to the duration, forwarding the packets to be sent in the target queue when the target duration is exhausted, and dynamically adjusting the target duration according to the proportion of the message processing volume and the total amount to ensure the fairness and efficiency of each queue.

Benefits of technology

It realizes balanced resource allocation among multiple queues, ensures fairness in forwarding of high-priority and low-priority packets, improves packet forwarding efficiency, and improves the real-time system response.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697128A_ABST
    Figure CN119697128A_ABST
Patent Text Reader

Abstract

The invention provides a message processing method and device, and the method comprises the steps: determining a target duration corresponding to a target queue; forwarding the to-be-sent message in the target queue according to the target duration; and under the condition that the target duration is used up, forwarding the to-be-sent message of the next queue.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, and in particular to a message processing method and device. Background Art

[0002] Data communication between different data processing systems or between different units in a system is usually carried out through message forwarding. The message forwarding efficiency is directly related to the real-time response capability of the system. For example, in an autonomous driving system, real-time data communication is required between sensors, control systems, and actuators. Data communication is usually carried out through message forwarding. Messages carry information about vehicle perception, decision-making, and execution. The message forwarding efficiency is directly related to the real-time response capability and driving safety of the autonomous driving system. Summary of the invention

[0003] In view of this, the present disclosure provides a message processing method and device.

[0004] One aspect of the present disclosure provides a message processing method, including: determining a target duration corresponding to a target queue, the target queue being one of a plurality of queues, and the plurality of queues being used to store and forward messages; forwarding messages to be sent in the target queue according to the target duration; and forwarding messages to be sent in a next queue when the target duration has expired, the next queue being one of the plurality of queues.

[0005] According to an embodiment of the present disclosure, the method further includes: when the amount of messages to be sent corresponding to the target queue is greater than the target capacity, increasing the target duration by a first value.

[0006] According to an embodiment of the present disclosure, the method also includes: determining a first value based on the ratio of the message processing volume of the target queue and the total message processing volume of multiple queues, the message processing volume of the target queue includes the forwarded message volume and the to-be-sent message volume corresponding to the target queue, and the total message processing volume of multiple queues includes the forwarded message volume and the to-be-sent message volume corresponding to the multiple queues.

[0007] According to an embodiment of the present disclosure, when the amount of messages to be sent corresponding to the target queue is greater than the target capacity, the target duration is increased by a first value, including: in response to the completion of forwarding of a message to be sent in the target queue, obtaining the message processing volume of the target queue, the message processing volume of the target queue including the amount of forwarded messages and the amount of messages to be sent corresponding to the target queue; when it is determined that the message processing volume of the target queue has increased and the amount of messages to be sent corresponding to the target queue is greater than the target capacity, the target duration is increased by the first value.

[0008] According to an embodiment of the present disclosure, a target duration corresponding to a target queue is determined, including: determining the target duration according to a ratio of a message processing volume of the target queue and a total message processing volume of multiple queues, the message processing volume of the target queue includes a forwarded message volume and a to-be-sent message volume corresponding to the target queue, and the total message processing volume of multiple queues includes a forwarded message volume and a to-be-sent message volume corresponding to the multiple queues.

[0009] According to an embodiment of the present disclosure, the ratio of the target duration to the polling periods of the multiple queues corresponds to the ratio of the message processing volume of the target queue to the total message processing volume of the multiple queues.

[0010] According to an embodiment of the present disclosure, the priority of the message to be sent in the target queue is higher than the priority of the message to be sent in the next queue.

[0011] According to an embodiment of the present disclosure, each of the multiple queues corresponds to a specific priority interval, and the method also includes: receiving a target message to be sent; determining a target priority corresponding to the target message to be sent; and storing the target message to be forwarded in the target queue when the target priority corresponds to the priority interval of the target queue.

[0012] According to an embodiment of the present disclosure, the method further includes: adjusting the capacity of the target queue based on the amount of messages to be sent corresponding to the target queue.

[0013] Another aspect of the present disclosure also provides a message processing device, which includes: a determination unit, used to determine a target duration corresponding to a target queue, the target queue is one of multiple queues, and the multiple queues are used to store and forward messages; a forwarding unit, used to forward the to-be-sent messages in the target queue according to the target duration, and when the target duration has expired, forward the to-be-sent messages in the next queue, which is one of the multiple queues.

[0014] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0016] Figure 1 A schematic diagram of an application scenario of a message processing method, apparatus, device, medium, and program product according to an embodiment of the present disclosure is shown;

[0017] Figure 2 A flowchart of a message processing method according to an embodiment of the present disclosure is schematically shown;

[0018] Figure 3 A schematic diagram schematically shows the correspondence between a target queue and a target duration of a message processing method according to an embodiment of the present disclosure;

[0019] Figure 4 A schematic diagram of a message processing process of a message processing method according to an embodiment of the present disclosure is schematically shown;

[0020] Figure 5 A flowchart of a message processing method according to an embodiment of the present disclosure is schematically shown;

[0021] Figure 6 A schematic diagram of a process of adjusting the target queue capacity of a message processing method according to an embodiment of the present disclosure is schematically shown.

[0022] Figure 7 A structural block diagram of a message processing device according to an embodiment of the present disclosure is schematically shown; and

[0023] Figure 8 A block diagram of an electronic device suitable for implementing a message processing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0024] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered as merely exemplary. Therefore, it should be appreciated by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Likewise, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0025] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision, disclosure and application of the data involved (including but not limited to user personal information) comply with the provisions of relevant laws and regulations, take necessary confidentiality measures, and do not violate public order and good morals.

[0026] Data communication between different systems or between different units within a system is carried out through message forwarding. The efficiency of message forwarding is directly related to the real-time response capability of the system. For example, in an autonomous driving system, the data generated by components such as sensors, controllers, and actuators needs to be processed to generate valid messages, which need to be sent to other system components for processing. Since the autonomous driving system needs to respond quickly to environmental changes, the message sending needs to meet real-time requirements to ensure that the system can respond in a timely manner.

[0027] In the related art, the forwarding of messages is carried out according to the priority of the messages. When the system receives a message, it will assign a priority to the message according to the urgency and importance of the message data. The message is forwarded according to the priority of the message to ensure that key data is processed first to ensure the stability and security of the system. For example, the control instruction queue stores messages containing urgent instructions and messages containing non-urgent instructions. Urgent instructions need to be processed first. According to the priority, the urgent instructions are forwarded first, and then the non-urgent instructions are forwarded.

[0028] However, when forwarding messages in order of their priority, when the forwarding volume of high-priority messages is large, the communication system concentrates resources on forwarding high-priority messages, causing lower-priority messages to be ignored. Lower-priority messages cannot be processed for a long time, that is, lower-priority messages are in a starvation state, resulting in a decrease in the system's message forwarding efficiency, and further reducing the real-time response of the system.

[0029] Figure 1 An application scenario diagram of a message processing method according to an embodiment of the present disclosure is schematically shown.

[0030] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0031] The user may use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication systems and client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0032] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0033] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.

[0034] It should be noted that the message processing method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the message processing device provided in the embodiment of the present disclosure can generally be set in the server 105. The message processing method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the message processing device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.

[0035] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0036] The following will be based on Figure 1 The scene described by Figure 2~Figure 6 A message processing method of a disclosed embodiment is described in detail.

[0037] Figure 2 The flowchart of a message processing method according to an embodiment of the present disclosure is schematically shown. Figure 2 As shown, a message processing method according to an embodiment of the present disclosure includes steps S201 to S203.

[0038] Step S201: Determine the target duration corresponding to the target queue.

[0039] The target queue is any one of the multiple queues. The messages to be sent are stored in multiple queues, and each queue can carry messages of different types or priorities, such as sensor data queues, control instruction queues, diagnostic information queues, etc. Each of the multiple queues can be polled in a certain polling cycle in a preset order, and the messages to be sent in each queue can be forwarded. The target duration is the message forwarding duration corresponding to the target queue. The target duration corresponding to the target queue is determined so that the system performs a forwarding operation on the messages to be sent in the target queue within the target duration.

[0040] For example, see Figure 3 . Figure 3 FIG. 1 is a schematic diagram of the correspondence between the target queue and the target duration of a message processing method according to an embodiment of the present disclosure. Figure 3 As shown, there are N queues in the system for storing and forwarding messages. The corresponding target duration is determined for each of the N queues. The target duration corresponding to queue 1 is duration 1, the target duration corresponding to queue 2 is duration 2, and the target duration corresponding to each queue is duration N. Furthermore, the time period or time slot corresponding to each queue can be determined according to the target duration corresponding to each queue. For example, the starting forwarding time corresponding to queue 1 is t 0, According to duration 1, we can determine that the time for queue 1 to terminate forwarding is t1. Similarly, the time period for queue 2 is from t2 to t3... and queue N is at time point t 2n-2 At time t 2n-1 Each queue performs forwarding operations on the messages to be sent in the queue within the time period corresponding to it.

[0041] The target duration can be determined based on key factors such as system performance requirements, the priority of the messages in the target queue, and the capacity of the target queue. For example, if the messages in queue 1 are logs that need to be processed urgently, and the messages in queue 2 are logs that are not processed urgently, then the priority of the messages in queue 1 is greater than the priority of the messages in queue 2. In this case, the target duration of queue 1 can be set to be greater than the target duration of queue 2.

[0042] Step S202: forwarding the to-be-sent messages in the target queue according to the target duration.

[0043] Within the target duration, the messages to be sent in the target queue are removed from the target queue and forwarded through the communication link. For example, in an autonomous driving system, the message contains the vehicle's status information, control instructions, sensor data, etc., and these messages are stored in the corresponding queue. The message is taken out of the queue and sent to the target receiver, such as an electronic control unit or other vehicle system, through the vehicle network. Optionally, within the target duration, the messages to be sent in the target queue are forwarded in sequence according to the priority order or reception order of the messages to be sent.

[0044] Step S203: when the target duration has expired, forward the messages to be sent in the next queue.

[0045] When the target duration has expired, the next queue is selected from the multiple queues in a preset order, and the messages to be sent in the next queue are forwarded. The target duration has expired, which means that the message forwarding duration of the target queue has expired. If the messages to be sent in the target queue have not been fully forwarded when the target duration has expired, the forwarding operation of the messages to be sent in the target queue is suspended, and the messages to be sent in the next queue are forwarded. Optionally, the system can use a timer or clock interrupt method to monitor whether the target duration of the target queue has expired.

[0046] like Figure 3 As shown, the system polls queue 1, queue 2, ... queue N in sequence. Starting from t0, the messages to be sent in queue 1 are forwarded first according to duration 1. When the system detects that the end forwarding time t1 of queue 1 has arrived, it means that duration 1 has expired. At this time, regardless of whether the messages to be sent in queue 1 have been forwarded, the forwarding operation of the messages to be sent in queue 1 is suspended, and the messages to be sent in queue 2 are forwarded according to duration 2 in the polling order. Among them, after suspending the message forwarding operation of queue 1, the system can detect whether the start forwarding time t0 of queue 2 has arrived. If it reaches t0, the messages to be sent in queue 2 will start to be forwarded, and so on.

[0047] According to the method provided by the embodiment of the present disclosure, the target duration corresponding to the target queue is determined, and the to-be-sent messages in the target queue are forwarded according to the target duration, so that the message forwarding operation of the target queue can be limited to the target duration. When the target duration has been exhausted, the to-be-sent messages of the next queue are forwarded, so that the system can take into account the message forwarding of each queue in multiple queues, and avoid the problem that when the amount of to-be-sent messages in a certain queue is large, the system concentrates resources on forwarding the messages of the queue and ignores other queues, balances the resource allocation between multiple queues, and ensures the forwarding fairness of high-priority messages and low-priority messages, thereby improving the message forwarding efficiency and the real-time response of the system.

[0048] based on Figure 2 According to a message processing method of an embodiment of the present disclosure, in some embodiments, determining the target duration corresponding to the target queue may include: determining the target duration based on the ratio of the message processing volume of the target queue and the total message processing volume of multiple queues.

[0049] Among them, the message processing volume of the target queue includes the forwarded message volume and the to-be-sent message volume corresponding to the target queue. The forwarded message volume corresponding to the target queue is the number of all messages that have been removed from the target queue and sent to the communication link. The to-be-sent message volume corresponding to the target queue includes the number of to-be-sent messages that have been stored in the target queue, and the number of to-be-sent messages that the system has received and needs to be stored in the target queue but has not yet been stored in the target queue. The message processing volume of the target queue is used to characterize the workload of the target queue.

[0050] The total amount of message processing of multiple queues includes the amount of forwarded messages and the amount of messages to be sent corresponding to the multiple queues. The amount of forwarded messages and the amount of messages to be sent corresponding to the multiple queues are the sum of the amount of forwarded messages corresponding to each queue in the multiple queues and the amount of messages to be sent corresponding to each queue. The total amount of message processing of multiple queues is used to characterize the overall workload of the system.

[0051] For example, there are three queues Q1, Q2, and Q3 in the system for storing and forwarding messages. The message processing capacity of Q1 is 100, of which 30 messages have been forwarded and 70 messages are to be sent. The message processing capacity of Q2 is 50, of which 20 messages have been forwarded and 30 messages are to be sent. The message processing capacity of Q3 is 50, of which 10 messages have been forwarded and 40 messages are to be sent. The total message processing capacity of the three queues is 200. The polling period of the three queues is 200ms. The proportion of Q1's message processing volume to the total message processing volume of the three queues is 50%, the proportion of Q2's message processing volume is 25%, and the proportion of Q3's message processing volume is 25%. Then, the target duration of Q1 can be determined as 50% of 200ms, that is, 100ms. Similarly, the target duration of Q2 can be determined as 50ms, and the target duration of Q3 can be determined as 50ms.

[0052] The target duration is determined based on the ratio of the target queue's message processing volume to the total message processing volume of multiple queues. Each queue completes message forwarding within its corresponding target duration, so that the system can take into account message forwarding of multiple queues within a limited polling cycle, ensuring fairness among the queues. This strategy enables the system resources to be reasonably allocated, thereby improving the overall message forwarding efficiency of the system.

[0053] Based on the above embodiment, the ratio of the target duration to the polling periods of the multiple queues may correspond to the ratio of the message processing volume of the target queue to the total message processing volume of the multiple queues.

[0054] For example, the ratio of the message processing volume of the target queue to the total message processing volume of the multiple queues can be calculated first, and the calculated ratio can be used as the ratio of the target duration to the polling period of the multiple queues. The corresponding relationship between the ratio of the target duration to the polling period of the multiple queues and the ratio of the message processing volume of the target queue to the total message processing volume of the multiple queues can also be preset, and according to the ratio of the message processing volume of the target queue to the total message processing volume of the multiple queues, the ratio of the target duration to the polling period of the multiple queues can be found in the corresponding relationship.

[0055] based on Figure 2 According to a message processing method according to an embodiment of the present disclosure, in some embodiments, the polling order of multiple queues can be determined according to the priority of the messages stored in each queue. Among them, the priority of the message to be sent in the target queue is higher than the priority of the message to be sent in the next queue.

[0056] Figure 4 The following is a schematic diagram of a message processing process of a message processing method according to an embodiment of the present disclosure. Figure 4 As shown in the figure, the circles in the figure represent multiple messages received by the system. The priorities of the messages are divided into a, b, and c. Among them, a>b>c. The messages are stored in the corresponding queue according to the priority of the received messages. Figure 4 As shown in the figure, the message with priority a is stored in queue A as the message to be sent by queue A. The message with priority b is stored in queue B as the message to be sent by queue B. The message with priority c is stored in queue C as the message to be sent by queue C. The target duration corresponding to queue A is duration 1, the target duration corresponding to queue B is duration 2, and the target duration corresponding to queue C is duration 3. According to the priority of the message, it can be determined that the priority of queue A is greater than the priority of queue B, and the priority of queue B is greater than the priority of queue C. The system polls queue A, queue B, and queue C in order of priority. If the duration 1 corresponding to queue A is exhausted, the message to be sent in queue B is forwarded. If the duration 2 corresponding to queue B is exhausted, the message to be sent in queue C is forwarded. In this way, the messages in queue A, queue B, and queue C can all be processed, avoiding the situation where the system only focuses on forwarding messages in queue A and ignores the message forwarding in queues B and C because of the large amount of messages in queue A.

[0057] like Figure 4 As shown in the figure, when the duration 3 corresponding to queue C has been exhausted, if the polling cycles of the three queues have not ended, the remaining messages to be sent in queue A can continue to be forwarded in order of priority. At this time, the target duration corresponding to queue A can be re-determined to be duration 4, the target duration corresponding to queue B to be duration 5, the target duration corresponding to queue C to be duration 6, and so on.

[0058] The polling order of multiple queues is determined according to the priority of the messages stored in each queue, so that the system can take into account the message forwarding of multiple queues and ensure that high-priority messages can be processed first.

[0059] Based on the above embodiment, a priority interval can be set for each queue in multiple queues, and the target message to be sent received by the system can be stored in the corresponding queue according to the priority of the target message to be sent, which specifically includes the following steps: receiving the target message to be sent; determining the target priority corresponding to the target message to be sent; and when the target priority corresponds to the priority interval of the target queue, storing the target message to be forwarded in the target queue.

[0060] For example, queue 1 can store messages with priorities a to b, and queue 2 can store messages with priorities c to d. The mapping relationship between message priorities and queue priority intervals can be pre-stored in the configuration table. According to the target priority corresponding to the target message to be sent, the priority interval corresponding to the target priority is searched in the configuration table. The target message to be sent is stored in the target queue corresponding to the found priority interval.

[0061] A priority interval is set for each of the multiple queues. When the target priority corresponds to the priority interval of the target queue, the target message to be forwarded is stored in the target queue, so that the queue corresponding to each priority interval can store messages of multiple priorities, reducing the number of queues, saving the system's storage space, reducing the switching frequency between queues, and improving the message forwarding efficiency.

[0062] During data communication, the system will receive new messages in real time and store them in the corresponding queue. The number of messages to be sent in the queue may increase dramatically within a certain period of time. For example, in an autonomous driving system, different operating environments and vehicle states can cause significant changes in the number of messages. At this time, the target duration corresponding to the queue cannot meet the message forwarding requirements, and only a small number of messages can be forwarded within the target duration corresponding to the queue. The large number of unprocessed messages remaining in the queue need to wait until the subsequent queue is polled before they can be forwarded one after another, resulting in a large delay in message forwarding.

[0063] To this end, in some embodiments, a message processing method may further include: when the amount of messages to be sent corresponding to the target queue is greater than the target capacity, increasing the target duration by a first value.

[0064] Among them, the amount of messages to be sent corresponding to the target queue includes two parts: one part is the number of messages to be sent that have been stored in the target queue, and the other part is the number of messages to be sent that have been received by the system and need to be stored in the target queue but have not yet been stored in the target queue. The target capacity is the upper limit of the number of messages that the target queue can accommodate. The target capacity can be set based on various factors such as system performance indicators and network bandwidth, and can also be dynamically adjusted according to the amount of messages to be sent corresponding to the target queue. The first value is the increase in the target duration.

[0065] When the amount of messages to be sent corresponding to the target queue is greater than the target capacity, a possible implementation method of increasing the target duration by a first value is: the system can continuously and regularly detect the amount of messages to be sent corresponding to the target queue. When the detected amount of messages to be sent of the target queue exceeds the target capacity, the time adjustment mechanism is triggered. According to the preset rules or algorithms, the duration to be increased, that is, the first value, is calculated. The first value is added to the original target duration to obtain the increased target duration. The system can determine the first value according to the degree to which the amount of messages to be sent corresponding to the target queue exceeds the target capacity. For example, when it exceeds the target capacity by 10%, the target duration is increased by 20ms, and when it exceeds 20%, it is increased by 40ms.

[0066] When the amount of messages to be sent corresponding to the target queue exceeds the target capacity, the target duration corresponding to the target queue is increased, which can increase the amount of messages forwarded by the target queue within the target duration. By increasing the target duration, the system can reduce the message backlog and message forwarding delay when the number of messages in the target queue increases sharply, thereby improving message forwarding efficiency.

[0067] Based on the above embodiment, the first value may be determined according to a ratio of a packet processing volume of the target queue to a total packet processing volume of the multiple queues.

[0068] Among them, the message processing volume of the target queue includes the forwarded message volume and the to-be-sent message volume corresponding to the target queue. The forwarded message volume corresponding to the target queue is the number of all messages that have been removed from the target queue and sent out. The to-be-sent message volume corresponding to the target queue includes the number of to-be-sent messages that have been stored in the target queue, and the number of to-be-sent messages that the system has received and needs to be stored in the target queue but has not yet been stored in the target queue. The message processing volume of the target queue is used to characterize the workload of the target queue. The total message processing volume of multiple queues is the sum of the forwarded message volume corresponding to each queue in the multiple queues and the to-be-sent message volume corresponding to each queue. The total message processing volume of multiple queues is used to characterize the overall workload of the system.

[0069] A possible implementation method for determining the first value based on the ratio of the message processing volume of the target queue to the total message processing volume of multiple queues is: the ratio can be used as the ratio of the target duration of the target queue to the polling period of all queues to further determine the increment of the target duration.

[0070] For example, there are three queues Q1, Q2, and Q3 in the system. The message processing volume of Q1 is 100, of which 30 messages have been forwarded and 70 messages are to be sent. The message processing volume of Q2 is 50, of which 20 messages have been forwarded and 30 messages are to be sent. The message processing volume of Q3 is 50, of which 10 messages have been forwarded and 40 messages are to be sent. The total message processing volume of the three queues is 200. The polling cycle of the three queues is 200ms. If Q1 is used as the target queue, the target capacity of Q1 is 50, and the original target duration of Q1 is 50ms. At this time, the number of messages to be sent of Q1 exceeds 50, then the ratio of the message processing volume of Q1 to the total message processing volume of the three queues is 50%, and the target duration corresponding to Q1 needs to be adjusted to 50% of 200ms, that is, 100ms, then the first value is 50ms.

[0071] When the target duration is increased, the ratio of the target queue's message processing volume to the total message processing volume of multiple queues is calculated to measure the importance of the target queue's workload to the system's overall workload. Based on this ratio, the increase in the target duration is calculated to prevent the target duration from being too large, which causes the system to concentrate resources on message forwarding in the target queue, and ensure that messages in each queue except the target queue can be forwarded.

[0072] After the target duration is increased by the first value, the increased target duration can be compared with the limit duration of the target queue. If the increased target duration is greater than or equal to the limit duration of the target queue, the limit duration of the target queue is used as the target duration of the target queue. In this way, the target duration will not be increased indefinitely, so that the system takes into account the message forwarding of each queue in multiple queues.

[0073] After the target duration is increased by the first value, the polling periods of the multiple queues may also be increased by the first value accordingly. If the increased polling period is greater than or equal to the upper limit of the polling period, the upper limit of the polling period is used as the polling period of the multiple queues. In this way, the polling period will not increase indefinitely, so that the multiple queues can be switched quickly, thereby improving the message forwarding efficiency of the system.

[0074] During the increased target duration, the messages to be sent in the target queue are forwarded in a certain order. If no new messages are added to the target queue during the forwarding process, the message processing volume of the target queue has not increased. In this case, as the forwarding operation of each message is completed, the amount of messages to be sent in the target queue is constantly decreasing. However, at this time, there may still be a situation where the amount of messages to be sent corresponding to the target queue exceeds the target capacity. When the system detects that the amount of messages to be sent corresponding to the target queue exceeds the target capacity, it will increase the target duration again, resulting in a repeated increase in the target duration. This will cause the target duration to be too large, which will cause the target duration of other queues in multiple queues to be too short, so that the messages to be sent in other queues cannot be processed in time.

[0075] To this end, in some embodiments, when the amount of messages to be sent corresponding to the target queue is greater than the target capacity, increasing the target duration by a first value includes: in response to the completion of forwarding of a message to be sent in the target queue, obtaining the message processing volume of the target queue; when it is determined that the message processing volume of the target queue has increased and the amount of messages to be sent corresponding to the target queue is greater than the target capacity, increasing the target duration by the first value.

[0076] Within the target duration, each message to be sent in the target queue is forwarded in sequence. When the system detects that a message to be sent in the target queue has been forwarded, the message processing volume of the target queue is obtained.

[0077] When the receiving speed of the messages corresponding to the target queue is greater than the message forwarding speed of the target queue, the message processing volume of the target queue will increase.

[0078] For example, the number of forwarded messages corresponding to target queue A is 10, and the number of messages to be sent is 5, namely a1, a2, a3, a4, and a5. The target capacity of target queue A is 2. There are 2 messages a1 and a2 to be sent stored in target queue A. The remaining 3 messages a3, a4, and a5 to be sent corresponding to target queue A have not yet been stored in target queue A. The target duration corresponding to target queue A is T1.

[0079] After a1 is forwarded, a3 can be stored in the target queue A. At this time, there are two messages a2 and a3 to be sent in the target queue A. The number of messages to be sent corresponding to the target queue A is 4, namely a2, a3, a4, and a5. At this time, although the number of messages to be sent corresponding to the target queue A is greater than the capacity of the target queue, the message processing capacity of the target queue A is still 15.

[0080] After a2 is forwarded, a4 can be stored in the target queue A. There are two messages a3 and a4 to be sent in the target queue A. If the system receives a message a6 that needs to be stored in the target queue A, the number of messages to be sent in the target queue A is 4, namely a3, a4, a5, and a6. The message processing capacity of the target queue A becomes 16. At this time, the number of messages to be sent corresponding to the target queue A is greater than the capacity of the target queue, and the message processing capacity of the target queue A increases by 1 compared to the message processing capacity after a1 is forwarded.

[0081] Figure 5 The flowchart of a message processing method according to an embodiment of the present disclosure is schematically shown. Figure 5 According to an embodiment of the present disclosure, a message processing method includes steps S501 to S508:

[0082] Step S501: Determine whether there is a message to be sent in the target queue. If yes, execute S502 to S503, otherwise execute S507;

[0083] Step S502: forwarding the to-be-sent messages in the target queue in sequence according to the target duration;

[0084] Step S503: After each forwarding is completed, determine whether the target duration has expired. If the target duration has expired, execute S507; if the target duration has not expired, execute S504;

[0085] Step S504: Determine whether the amount of messages to be sent corresponding to the target queue is greater than the target capacity. If yes, execute S505, otherwise execute S501;

[0086] Step S505: Determine whether the packet processing volume of the target queue is increased compared to the packet processing volume after the previous forwarding is completed. If yes, execute S506, otherwise execute S501;

[0087] Step S506: increase the target duration by a first value and execute S501;

[0088] Step S507: Determine whether the polling cycle has ended. If the polling cycle has ended, the entire process ends. If the polling cycle has not ended, execute S508;

[0089] Step S508: Take the next queue as the target queue and execute S501.

[0090] Each to-be-sent message in the target queue is forwarded in turn, and after a to-be-sent message in the target queue is forwarded, the message processing volume of the target queue is obtained. When the message processing volume of the target queue increases and the to-be-sent message volume corresponding to the target queue is greater than the target capacity, the target duration is increased by a first value, and the target duration can be increased when the message processing volume increases, avoiding the situation where the target duration is repeatedly increased for the same message processing volume, avoiding the target duration being too large, so that the to-be-sent messages of other queues can be forwarded within a limited polling cycle.

[0091] On the basis of the above embodiment, the capacity of the target queue may be adjusted based on the amount of messages to be sent corresponding to the target queue.

[0092] Among them, the capacity of the target queue represents the number of to-be-sent messages that the target queue can currently accommodate. The capacity of the target queue is less than or equal to the target capacity of the target queue. In some possible embodiments, an upper limit and a lower limit of the occupancy rate of the target queue can be set. The occupancy rate of the target queue is the ratio of the amount of to-be-sent messages corresponding to the target queue to the current capacity of the target queue. If the occupancy rate of the target queue exceeds the upper limit of the occupancy rate, the capacity of the target queue is expanded. If the occupancy rate of the target queue is less than the lower limit of the occupancy rate, the capacity of the target queue is reduced. A circular queue can be used to automatically adjust the capacity of the target queue.

[0093] Figure 6 The following is a schematic diagram showing a process of adjusting the target queue capacity according to a message processing method according to an embodiment of the present disclosure. Figure 6 As shown in the figure, queue A has a head pointer and a tail pointer. The tail pointer of queue A points to the last message in the queue. There are n messages stored in queue A, namely a1, a2, a3...a n At this time, the capacity of queue A is n. When message a n+1 When it arrives, the tail pointer points to the next available position for insertion. n+1 After being stored in queue A, the tail pointer of queue A is message a n+1 The storage location. Figure 6 As shown, when message a n+2 When it arrives, the tail pointer continues to point to the next insertable position. You can set the head pointer and tail pointer of the target queue, and adjust the capacity of the target queue by changing the position of the tail pointer of the target queue.

[0094] The capacity of the target queue is dynamically adjusted based on the amount of messages to be sent corresponding to the target queue, so that the target queue can accommodate more messages to be sent, thereby improving the message forwarding efficiency of the target queue.

[0095] Figure 7The structural block diagram of the device according to the embodiment of the present disclosure is schematically shown.

[0096] like Figure 7 As shown, the device 700 of this embodiment includes:

[0097] The determination unit 701 is used to determine a target duration corresponding to a target queue, where the target queue is one of a plurality of queues, and the plurality of queues are used to store and forward messages.

[0098] The forwarding unit 702 is used to forward the to-be-sent messages in the target queue according to the target duration, and forward the to-be-sent messages in the next queue when the target duration has expired, where the next queue is one of the multiple queues.

[0099] In some embodiments, the determination unit 701 may also be configured to increase the target duration by a first value when the amount of to-be-sent messages corresponding to the target queue is greater than the target capacity.

[0100] In some embodiments, the determination unit 702 can also be used to determine a first value based on the ratio of the message processing volume of the target queue and the total message processing volume of multiple queues, the message processing volume of the target queue includes the forwarded message volume and the to-be-sent message volume corresponding to the target queue, and the total message processing volume of multiple queues includes the forwarded message volume and the to-be-sent message volume corresponding to the multiple queues.

[0101] In some embodiments, the determination unit 701 can also be used to perform the following steps: in response to the completion of forwarding of a message to be sent in the target queue, obtaining the message processing volume of the target queue; when it is determined that the message processing volume of the target queue has increased and the amount of messages to be sent corresponding to the target queue is greater than the target capacity, increasing the target duration by a first value.

[0102] In some embodiments, the determination unit 702 can also be used to determine the target duration based on the ratio of the message processing volume of the target queue and the total message processing volume of multiple queues, the message processing volume of the target queue includes the forwarded message volume and the to-be-sent message volume corresponding to the target queue, and the total message processing volume of multiple queues includes the forwarded message volume and the to-be-sent message volume corresponding to the multiple queues.

[0103] In some embodiments, the device further comprises a receiving unit. The receiving unit is used to perform the following steps: receiving a target message to be sent; determining a target priority corresponding to the target message to be sent; and storing the target message to be forwarded in the target queue when the target priority corresponds to a priority interval of the target queue.

[0104] Figure 8 A schematic block diagram of an electronic device that can be used to implement the method of the embodiment of the present disclosure is schematically shown.

[0105] like Figure 8 As shown, the electronic device 800 according to an embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include an onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0106] In RAM 803, various programs and data required for the operation of electronic device 800 are stored. Processor 801, ROM 802 and RAM 803 are connected to each other via bus 804. Processor 801 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 802 and / or RAM 803. It should be noted that the program can also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 can also implement the method provided by the embodiment of the present disclosure by executing the program stored in the one or more memories.

[0107] According to an embodiment of the present disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to the bus 804. The electronic device 800 may further include one or more of the following components connected to the I / O interface 805: an input portion 806 including a keyboard, a mouse, etc.; an output portion 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 808 including a hard disk, etc.; and a communication portion 809 including a network interface card such as a LAN card, a modem, etc. The communication portion 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage portion 808 as needed.

[0108] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.

[0109] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 802 and / or RAM 803 described above and / or one or more memories other than ROM 802 and RAM 803.

[0110] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiment of the present disclosure.

[0111] The above functions defined in the system / device of the embodiment of the present disclosure are executed when the computer program is executed by the processor 801. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0112] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 809, and / or installed from a removable medium 811. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0113] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the processor 801, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.

[0114] It should be noted that the collection, storage, use, processing, transmission, provision, disclosure and application of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, necessary confidentiality measures have been taken, and they do not violate public order and good morals. In the technical solution of this disclosure, the user's authorization or consent is obtained before obtaining or collecting user personal information.

[0115] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).

[0116] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0117] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or coupled in a variety of ways, even if such combinations and / or couplings are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or coupled in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or couplings fall within the scope of the present disclosure.

[0118] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A message processing method, comprising: Determine a target duration corresponding to a target queue, where the target queue is one of a plurality of queues, and the plurality of queues are used to store and forward messages; Forwarding the to-be-sent messages in the target queue according to the target duration; When the target duration has expired, forwarding the to-be-sent messages in the next queue, where the next queue is one of the multiple queues.

2. The method according to claim 1, further comprising: When the amount of messages to be sent corresponding to the target queue is greater than the target capacity, the target duration is increased by a first value.

3. The method according to claim 2, further comprising: The first value is determined according to the ratio of the message processing volume of the target queue and the total message processing volume of the multiple queues, the message processing volume of the target queue includes the forwarded message volume and the to-be-sent message volume corresponding to the target queue, and the total message processing volume of the multiple queues includes the forwarded message volume and the to-be-sent message volume corresponding to the multiple queues.

4. The method according to claim 2, wherein when the amount of messages to be sent corresponding to the target queue is greater than the target capacity, increasing the target duration by a first value comprises: In response to the completion of forwarding of a to-be-sent message in the target queue, acquiring a message processing volume of the target queue, the message processing volume of the target queue including a forwarded message volume and a to-be-sent message volume corresponding to the target queue; When it is determined that the message processing volume of the target queue increases and the amount of messages to be sent corresponding to the target queue is greater than the target capacity, the target duration is increased by the first value.

5. According to the method of claim 1, the step of determining the target duration corresponding to the target queue comprises: The target duration is determined according to the ratio of the message processing volume of the target queue and the total message processing volume of the multiple queues, the message processing volume of the target queue includes the forwarded message volume and the to-be-sent message volume corresponding to the target queue, and the total message processing volume of the multiple queues includes the forwarded message volume and the to-be-sent message volume corresponding to the multiple queues.

6. According to the method of claim 5, the ratio of the target duration to the polling periods of the multiple queues corresponds to the ratio of the message processing volume of the target queue to the total message processing volume of the multiple queues.

7. According to the method of claim 1, the priority of the messages to be sent in the target queue is higher than the priority of the messages to be sent in the next queue.

8. The method according to claim 7, wherein each of the plurality of queues corresponds to a specific priority interval, and the method further comprises: Receive the target message to be sent; Determine the target priority corresponding to the target message to be sent; When the target priority corresponds to the priority interval of the target queue, the target to-be-forwarded message is stored in the target queue.

9. The method according to any one of claims 1 to 8, further comprising: The capacity of the target queue is adjusted based on the amount of messages to be sent corresponding to the target queue.

10. A message processing device, comprising: A determination unit, configured to determine a target duration corresponding to a target queue, wherein the target queue is one of a plurality of queues, and the plurality of queues are configured to store and forward messages; A forwarding unit is used to forward the to-be-sent messages in the target queue according to the target duration, and when the target duration has expired, forward the to-be-sent messages in the next queue, where the next queue is one of the multiple queues.