A message transmission method and device

By periodically sampling the message transmission delay and calculating the ideal maximum depth, the sending interval and queue depth are dynamically adjusted to solve the message queue congestion problem caused by rate mismatch in the message middleware, and achieve stable control of the message channel and resource efficiency. use.

CN113676419BActive Publication Date: 2024-08-27THE PEOPLES BANK OF CHINA NAT CLEARING CENT
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202111032154.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-03
Publication Date
2024-08-27
Estimated Expiration
2041-09-03

AI Technical Summary

Technical Problem

In the existing technology, when message middleware processes message transmission, the rate of the sender and the receiver does not match due to differences in network bandwidth and machine performance, resulting in message queue congestion. Existing detection methods rely on preset thresholds and memory usage. The sending interval and queue depth cannot be adjusted in real time, and cannot be adapted to complex network scenarios.

Method used

By periodically sampling the message transmission delay, the average message transmission delay and the ideal maximum depth are calculated, the sending interval and queue depth are dynamically adjusted, and only the sending end is controlled, keeping the message channel at a stable value and maximizing the use of computing resources.

Benefits of technology

Real-time congestion control of message channels is achieved, adapting to different network scenarios, maximizing resource utilization and reducing resource utilization costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113676419B
    Figure CN113676419B
Patent Text Reader

Abstract

The present invention provides a message transmission method and device, the method comprising: calculating the average message transmission delay in the previous cycle; calculating the ideal maximum depth of the message queue of the current cycle according to multiple average message transmission delays; and controlling the message channel according to the average message transmission delay and the ideal maximum depth. The present invention periodically samples the message transmission delay and uses it as a basis to adjust the sending interval and the sending queue depth, and only controls the sending end to better control the message channel congestion, thereby achieving the purpose of maximizing the use of computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a message transmission method and device. Background Art

[0002] In the prior art, message middleware is a tool used for asynchronous communication between systems. It focuses on sending and receiving data and integrates distributed systems using an efficient and reliable asynchronous message delivery mechanism. It is mainly used to solve problems such as application decoupling, asynchronous messaging, and traffic peak shaving.

[0003] It is understandable that the message middleware transmits messages through the message channel, and the message identifiers in the intermediate state are all saved in the channel sending queue. However, in actual applications, the rates of the sending and receiving ends often do not match due to network bandwidth or machine performance differences. Specifically, when the sending speed is too fast, messages may accumulate in the sending queue, causing congestion; when the sending speed is too slow, resources will be wasted and it will not be able to transmit quickly. Therefore, it is necessary to perform congestion control on the sending channel to match the processing rate of the sending and receiving ends. Existing methods for detecting queue congestion control include judging repeated ACKs, detecting the number of messages in the queue and the rate of change, and detecting memory usage. When an abnormal situation is detected, it is considered that the channel is congested and corresponding abnormal processing is performed.

[0004] In the conventional message transmission method described above, the number of messages in the message queue and the rate of change of the number of messages are detected. Generally, they are compared with the pre-set message number threshold and message rate threshold. If they are higher or lower than the threshold, they are considered abnormal and corresponding abnormal handling is performed. The number of messages and the rate of change are relatively dependent on the actual number of messages in the current queue. Only when the messages reach a certain level of stability will the number of messages and the rate of change have reference significance. In addition, the pre-set thresholds are difficult to confirm manually in advance and cannot adapt to various complex network scenarios.

[0005] The method of handling message channel congestion by detecting the consumer's own memory usage also has disadvantages: when the memory usage reaches the set feedback trigger condition, the producer is notified to adjust the message sending window to achieve the effect of flow control. There are many factors affecting the consumer's memory usage, and it cannot be clearly reflected that the receiving capacity is insufficient. It depends on the consumer to actively notify the producer. If the producer does not actively adjust, there may be a certain delay, causing congestion.

[0006] In summary, there is an urgent need in the prior art for a method that can adjust the sending interval and sending queue depth of a message channel in real time to achieve a better solution to message transmission. Summary of the invention

[0007] According to the message transmission method and device provided by the present invention, by periodically sampling the message transmission delay and adjusting the sending interval and the sending queue depth based on it, only the sending end can be controlled (without controlling the message receiving end), so that the message channel congestion can be better controlled, and the above value can be maintained at a stable value under the current machine and bandwidth load, so as to maximize the use of computing resources, and this periodic sampling method also has low resource utilization.

[0008] In order to achieve the above object, the present invention provides a message transmission method, comprising:

[0009] Calculate the average message transmission delay in the previous cycle;

[0010] Calculate the ideal maximum depth of the message queue in the current cycle based on multiple average message transmission delays;

[0011] The message channel is controlled according to the average message transmission delay and the ideal maximum depth.

[0012] In one embodiment, calculating the average message transmission delay in the previous period includes:

[0013] Calculating the message transmission delay of the plurality of messages in the previous cycle according to the processing performance parameters of the transceiver machine, the network bandwidth and the queue depth of the transceiver;

[0014] The average message transmission delay in the previous period is calculated according to the message transmission delays of the multiple messages.

[0015] In one embodiment, the calculating the ideal maximum depth of the message queue of the current period according to the average message transmission delay includes:

[0016] Calculate the number of concurrent messages and the network transmission delay according to the average message transmission delay;

[0017] The ideal maximum depth is calculated according to the number of concurrent messages and the network transmission delay.

[0018] In one embodiment, controlling the message channel according to the average message transmission delay and the ideal maximum depth includes:

[0019] Comparing the average message transmission delay in the multiple cycles with the sending interval time in the current cycle;

[0020] When the average message transmission delay in the multiple cycles is greater than the sending interval in the current cycle, and the sending interval in the current cycle reaches the preset message sending interval upper limit, the message queue depth in the current cycle is compared with the preset message queue maximum depth;

[0021] When the message queue depth in the current cycle is not greater than the preset maximum message queue depth, the preset maximum message queue depth is reduced to the message queue depth value in the current cycle.

[0022] In one embodiment, comparing the average message transmission delays in the multiple cycles with the sending interval time in the current cycle includes:

[0023] When the average message transmission delay in the multiple cycles is greater than the sending interval in the current cycle, and the sending interval in the current cycle does not reach the preset message sending interval upper limit, the sending interval in the current cycle is increased to the preset message sending interval upper limit.

[0024] In one embodiment, comparing the average message transmission delays in the multiple cycles with the sending interval time in the current cycle further includes:

[0025] When the average message transmission delays in the multiple cycles are not greater than the sending interval time in the current cycle, comparing the average message transmission delay in the current cycle with the average message transmission delay in the previous cycle;

[0026] If the average message transmission delay in the current cycle is greater than the average message transmission delay in the previous cycle, the message sending interval in the current cycle is increased to the preset message sending interval upper limit;

[0027] If the average message transmission delay in the current cycle is not greater than the average message transmission delay in the previous cycle, the message sending interval in the current cycle is reduced to a preset message sending interval lower limit.

[0028] In one embodiment, when the ideal maximum depth is greater than a preset maximum depth of the message queue in the current cycle, the message queue depth in the current cycle is increased to the preset maximum depth value of the message queue;

[0029] When the ideal maximum depth is not greater than the preset maximum depth of the message queue in the current cycle, the preset maximum depth of the message queue is reduced to the message queue depth value in the current cycle.

[0030] In a second aspect, the present invention provides a message transmission device, the device comprising:

[0031] The average delay calculation module is used to calculate the average message transmission delay in the previous cycle;

[0032] An ideal maximum depth calculation module is used to calculate the ideal maximum depth of the message queue of the current cycle according to multiple average message transmission delays;

[0033] A message channel control module is used to control the message channel according to the average message transmission delay and the ideal maximum depth.

[0034] In one embodiment, the average delay calculation module includes:

[0035] A transmission delay calculation unit, used to calculate the message transmission delay of the plurality of messages in the previous cycle according to the processing performance parameters of the transceiver machine, the network bandwidth and the queue depth of the transceiver;

[0036] The average delay calculation unit is used to calculate the average message transmission delay in the previous cycle according to the message transmission delays of the multiple messages.

[0037] In one embodiment, the ideal maximum depth calculation module includes:

[0038] A message concurrency calculation unit, used to calculate the number of concurrent messages and the network transmission delay according to the average message transmission delay;

[0039] The ideal maximum depth calculation unit is used to calculate the ideal maximum depth according to the number of concurrent messages and the network transmission delay.

[0040] In one embodiment, the message channel control module includes:

[0041] A first comparing unit, configured to compare the average message transmission delay in the multiple cycles with the sending interval time in the current cycle;

[0042] A second comparison unit is used to compare the message queue depth in the current cycle with a preset maximum message queue depth when the average message transmission delay in the multiple cycles is greater than the sending interval in the current cycle and the sending interval in the current cycle reaches a preset upper limit of the message sending interval;

[0043] The first maximum depth reducing unit is used to reduce the preset maximum depth of the message queue to the message queue depth value in the current cycle when the message queue depth in the current cycle is not greater than the preset maximum depth of the message queue.

[0044] In one embodiment, the first comparison unit further includes:

[0045] The first interval time increasing unit is used to increase the sending interval time in the current cycle to the preset message sending interval time upper limit when the average message transmission delay in the multiple cycles is greater than the sending interval time in the current cycle and the sending interval time in the current cycle does not reach the preset message sending interval time upper limit.

[0046] In one embodiment, the first comparison unit further includes:

[0047] a third comparing unit, configured to compare the average message transmission delay in the current cycle with the average message transmission delay in the previous cycle when the average message transmission delay in the multiple cycles is not greater than the sending interval in the current cycle;

[0048] A second time interval increasing unit is used to increase the message sending interval in the current cycle to a preset message sending interval upper limit when the average message transmission delay in the current cycle is greater than the average message transmission delay in the previous cycle;

[0049] The time interval reduction unit is used to reduce the message sending interval in the current cycle to a preset message sending interval lower limit if the average message transmission delay in the current cycle is not greater than the average message transmission delay in the previous cycle.

[0050] In one embodiment, the message channel control module further includes:

[0051] A queue depth increasing unit, configured to increase the message queue depth in the current cycle to the preset message queue maximum depth value when the ideal maximum depth is greater than the preset message queue maximum depth in the current cycle;

[0052] The second maximum depth reducing unit is configured to reduce the preset maximum depth of the message queue to the message queue depth value in the current cycle when the ideal maximum depth is not greater than the preset maximum depth of the message queue in the current cycle.

[0053] In a third aspect, the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the message transmission method are implemented when the processor executes the program.

[0054] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the message transmission method when executed by a processor.

[0055] From the above description, it can be seen that the message transmission method and device provided by the embodiment of the present invention first calculate the average message transmission delay in the previous cycle; then, calculate the ideal maximum depth of the message queue of the current cycle according to multiple average message transmission delays; finally, control the message channel according to the average message transmission delay and the ideal maximum depth. By periodically sampling the message transmission delay and adjusting the sending interval and the sending queue depth based on it, only the sending end can be controlled (without controlling the message receiving end), and the message channel congestion can be better controlled, and the above value can be maintained at a stable value under the current machine and bandwidth load, so as to maximize the use of computing resources, and this periodic sampling method also has low resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0057] Figure 1 A schematic diagram of a flow chart of a message transmission method provided in an embodiment of the present invention;

[0058] Figure 2 1 is a flow chart of step 100 in an embodiment of the present invention;

[0059] Figure 3 200 is a flowchart of step 200 in an embodiment of the present invention;

[0060] Figure 4 Schematic diagram of the process of step 300 in an embodiment of the present invention Figure 1 ;

[0061] Figure 5 301 is a flowchart of step 301 in an embodiment of the present invention;

[0062] Figure 6 Schematic diagram of the process of step 300 in an embodiment of the present invention Figure 2 ;

[0063] Figure 7 A schematic diagram of a flow chart of a message transmission method provided in a specific application example of the present invention;

[0064] Figure 8 A logic judgment diagram of a message transmission method provided in a specific application example of the present invention;

[0065] Fig. 9 Schematic diagram of the process of step S2 in a specific application example of the present invention;

[0066] Fig.10 It is a schematic diagram of the process of step a) in a specific application example of the present invention;

[0067] Fig.11 It is a schematic diagram of the process of step c) in a specific application example of the present invention;

[0068] Fig.12 It is a flow chart of step S3 in a specific application example of the present invention;

[0069] Fig.13 It is a structural schematic diagram of a needle message transmission device in an embodiment of the present invention;

[0070] Fig.14 1 is a schematic diagram of the structure of the average delay calculation module 10 in an embodiment of the present invention;

[0071] Fig.15 Schematic diagram of the structure of the ideal maximum depth calculation module 20 in an embodiment of the present invention;

[0072] Fig.16 The structure of the ideal message channel control module 30 in the embodiment of the present invention is shown as follows: Figure 1 ;

[0073] Fig.17 Schematic diagram of the structure of the ideal first comparison unit 301 in the embodiment of the present invention Figure 1 ;

[0074] Fig.18 Schematic diagram of the structure of the ideal first comparison unit 301 in the embodiment of the present invention Figure 1 ;

[0075] Fig.19 The structure of the ideal message channel control module 30 in the embodiment of the present invention is shown as follows: Figure 2 ;

[0076] Fig. 20 It is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

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

[0078] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0079] The embodiment of the present invention provides a specific implementation of a message transmission method, see Figure 1 , the method specifically includes the following contents:

[0080] Step 100: Calculate the average message transmission delay in the previous cycle.

[0081] Specifically, the average message transmission delay in the previous cycle is calculated periodically and dynamically. It should be noted that the "periodically" here, i.e., a calculation cycle and the "cycle" in step 100, both refer to a time interval. The message transmission process can be simplified as the process of placing the message into the sending queue → network transmission message → receiving end processing the sending receipt → network transmission receipt → sending end confirming the receipt and deleting the local cache message. The time difference between the start time of placing the message into the sending queue and the end time of confirming the receipt is the overall transmission delay of the message, and the transmission delay of at most multiple messages in a cycle is obtained by averaging to obtain the average message transmission delay.

[0082] Step 200: Calculate the ideal maximum depth of the message queue of the current cycle according to multiple average message transmission delays.

[0083] It is understandable that the depth of the message sending queue determines the number of concurrent sends. When it is too high, it will cause accumulation and affect the processing speed of the sender. When it is too low, it will cause idleness. Therefore, the ideal maximum depth of the sending queue is positively correlated with the network transmission delay (the overall transmission delay minus the processing time of the receiving end), and negatively correlated with the post-receiving processing time of the receiving end. The processing time of the receiving end is carried to the message sending end through the receipt for its reference. Then, according to the above relationship and the lower limit of the constant depth (the lower limit of the constant depth is generally set according to the empirical value, and the bandwidth and machine memory of the actual use environment can be comprehensively considered. When the bandwidth is high and the machine memory is large, the upper and lower limits of the preset sending interval can be lowered, and the upper and lower limits of the maximum depth of the sending queue can be increased) the ideal maximum depth value of the queue can be obtained.

[0084] Step 300: Control the message channel according to the average message transmission delay and the ideal maximum depth.

[0085] Specifically, the average message transmission delay in the most recent period is calculated by sampling, and this is used as a reference. The sending interval and the maximum depth of the sending queue are adjusted according to the average message transmission delay to control the message channel.

[0086] From the above description, it can be seen that the message transmission method provided by the embodiment of the present invention first calculates the average message transmission delay in the previous cycle; then, the ideal maximum depth of the message queue of the current cycle is calculated based on multiple average message transmission delays; finally, the message channel is controlled based on the average message transmission delay and the ideal maximum depth. By periodically sampling the message transmission delay and adjusting the sending interval and the sending queue depth based on it, only the sending end can be controlled (without controlling the message receiving end), and the message channel congestion can be better controlled, and the above value can be maintained at a stable value under the current machine and bandwidth load, maximizing the use of computing resources, and this periodic sampling method also has low resource utilization.

[0087] In one embodiment, see Figure 2 , step 100 comprises:

[0088] Step 101: Calculate the message transmission delay of multiple messages in the previous cycle according to the processing performance parameters of the transceiver machine, the network bandwidth and the queue depth of the transceiver;

[0089] It is understandable that the transmission delay of a single message refers to the time from when the message is sent out by the local end to when the local end confirms that the message has been received by the other end. The entire process is affected by factors such as the processing performance of the sending and receiving machines, the network bandwidth, and the queue depth of the sending and receiving ends.

[0090] Specifically, the transmission delay of each message is the time difference between the time when the local end sends the message and the time when the local end confirms the receipt of the message by the other end. It is affected by factors such as processing performance and bandwidth.

[0091] Step 102: Calculate the average message transmission delay in the previous cycle according to the message transmission delays of the multiple messages.

[0092] Preferably, the average message transmission delay is calculated by using the message transmission delays in a plurality of stable periods, wherein the stable period refers to a period in which the average message transmission delay varies less (less than a preset threshold time).

[0093] In one embodiment, see Figure 3 , step 200 further comprises:

[0094] Step 201: Calculate the number of concurrent messages and the network transmission delay according to the average message transmission delay;

[0095] Step 202: Calculate the ideal maximum depth according to the number of concurrent messages and network transmission delay.

[0096] In one embodiment, see Figure 4 , step 300 further comprises:

[0097] Step 301: Compare the average message transmission delay in the multiple cycles with the sending interval time in the current cycle;

[0098] Step 302: When the average message transmission delay in the multiple cycles is greater than the sending interval in the current cycle, and the sending interval in the current cycle reaches the preset message sending interval upper limit, the message queue depth in the current cycle is compared with the preset message queue maximum depth;

[0099] Step 303: When the message queue depth in the current cycle is not greater than the preset maximum message queue depth, reduce the preset maximum message queue depth to the message queue depth value in the current cycle.

[0100] In one embodiment, see Figure 5 , step 301 further comprises:

[0101] Step 3011: When the average message transmission delay in the multiple cycles is greater than the sending interval in the current cycle, and the sending interval in the current cycle does not reach the preset message sending interval upper limit, the sending interval in the current cycle is increased to the preset message sending interval upper limit.

[0102] It can be seen that step 302 and step 304 are two counterexamples when the sending interval in the current cycle reaches and does not reach the preset message sending interval upper limit under the premise of "when the average message transmission delay in the multiple cycles is greater than the sending interval in the current cycle".

[0103] In one embodiment, see Figure 6 , step 301 further comprises:

[0104] Step 3012: When the average message transmission delay in the multiple cycles is not greater than the sending interval in the current cycle, the average message transmission delay in the current cycle is compared with the average message transmission delay in the previous cycle;

[0105] Step 3013: if the average message transmission delay in the current cycle is greater than the average message transmission delay in the previous cycle, the message sending interval in the current cycle is increased to a preset upper limit of the message sending interval;

[0106] Step 3014: if the average message transmission delay in the current cycle is not greater than the average message transmission delay in the previous cycle, the message sending interval in the current cycle is reduced to a preset lower limit of the message sending interval.

[0107] In one embodiment, based on the result of any one of steps 3011 to 3014:

[0108] When the ideal maximum depth is greater than a preset maximum depth of the message queue in the current cycle, increasing the message queue depth in the current cycle to the preset maximum depth value of the message queue;

[0109] When the ideal maximum depth is not greater than the preset maximum depth of the message queue in the current cycle, the preset maximum depth of the message queue is reduced to the message queue depth value in the current cycle.

[0110] To further illustrate this solution, this application provides a specific application example of the message transmission method, see Figure 7 as well as Figure 8 , this specific application example specifically includes the following contents.

[0111] S1: Periodically sample and calculate the average message transmission delay of the channel in the most recent fixed time period, and save the average message transmission delay of the previous period. The average message transmission delay in n stable periods (where the average message transmission delay has a small variation range) can be used to calculate an ideal maximum depth of the sending queue (ideal maximum depth) that matches it.

[0112] S2: preset upper and lower limits of message sending interval and maximum depth of sending queue, as well as current message sending interval and current maximum depth of sending queue. The default values ​​are their respective upper limits. At the end of each cycle, the average message transmission delay is compared with the current message sending interval. For details, see Fig. 9 , step S2 comprises:

[0113] a) If the average message transmission delay is greater than the current message sending interval and the current message sending interval has reached the upper limit of the message sending interval, it is necessary to determine the current sending queue depth and the current sending queue maximum depth; see Fig.10 , step a) comprises:

[0114] i. If the current send queue depth is less than or equal to the maximum send queue depth, the current send queue maximum depth is reduced proportionally to the lower limit of the send queue maximum depth or the current send queue depth;

[0115] ii. The current send queue depth is not greater than the maximum send queue depth;

[0116] b) if the average message transmission delay is greater than the current message sending interval and the current message sending interval has not reached the upper limit of the message sending interval, then the current message sending interval is increased proportionally;

[0117] c) If the average message transmission delay is less than or equal to the current message sending interval, determine the difference between the current average message transmission delay and the average message transmission delay of the previous period; see Fig.11 , step c) further comprises:

[0118] c1: If the current average transmission delay is greater than the average message transmission delay in the previous period, the current message sending interval is increased proportionally until the upper limit is reached;

[0119] c2: If the current average transmission delay is less than or equal to the average message transmission delay of the previous cycle, the current message sending interval is reduced proportionally until the lower limit is reached, and step S3 is entered to adjust the maximum depth of the sending queue;

[0120] d) If the sampling messages have not been transmitted in the previous cycle, the current message sending interval is increased proportionally;

[0121] e) If no message was transmitted in the previous cycle, the message sending interval will not be adjusted;

[0122] S3: After every n stable cycles, the calculated maximum depth of the sending queue is compared with the current maximum depth of the sending queue;

[0123] See also Fig.12 , further, step S3 comprises the following steps:

[0124] f) If the calculated maximum depth of the sending queue is greater than the current maximum depth of the sending queue, the current maximum depth of the sending queue is increased proportionally until the upper limit is reached;

[0125] g) If the calculated maximum depth of the sending queue is less than or equal to the current maximum depth of the sending queue, the current maximum depth of the sending queue is reduced proportionally until the lower limit value or the actual current depth of the current sending queue is reached.

[0126] In a specific application example of the present invention, a special delay structure data structure is set for the channel in the message middleware to store a certain number of message status times. When the message is finally sent, its transmission delay is calculated. At the same time, data structures such as the maximum depth of the sending queue and the sending interval are set. A special delay check thread is set to calculate the average transmission delay once every period of time, and at the same time save the historical n average transmission delays to calculate the ideal maximum depth of the sending queue. After the delay check thread calculates and obtains an effective average transmission delay in each cycle, it compares it with the current sending interval, queue depth, and historical transmission delay according to the process in the above scheme, and adjusts the sending interval and the current maximum depth of the sending queue in real time, so as to achieve congestion control at the sending end of the channel.

[0127] Based on the same inventive concept, the embodiments of the present application also provide a message transmission device, which can be used to implement the method described in the above embodiments, such as the following embodiments. Since the principle of solving the problem by the message transmission device is similar to that of the message transmission method, the implementation of the message transmission device can refer to the implementation of the message transmission method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0128] The embodiment of the present invention provides a specific implementation of a message transmission device capable of implementing the message transmission method, see Fig.13 , the message transmission device specifically includes the following contents:

[0129] The average delay calculation module 10 is used to calculate the average message transmission delay in the previous cycle;

[0130] An ideal maximum depth calculation module 20, used to calculate the ideal maximum depth of the message queue of the current cycle according to a plurality of average message transmission delays;

[0131] The message channel control module 30 is used to control the message channel according to the average message transmission delay and the ideal maximum depth.

[0132] In one embodiment, see Fig.14 , the average delay calculation module 10 includes:

[0133] The transmission delay calculation unit 101 is used to calculate the message transmission delay of the plurality of messages in the previous cycle according to the processing performance parameters of the transceiver machine, the network bandwidth and the queue depth of the transceiver;

[0134] The average delay calculation unit 102 is used to calculate the average message transmission delay in the previous period according to the message transmission delays of the multiple messages.

[0135] In one embodiment, see Fig.15 , the ideal maximum depth calculation module 20 includes:

[0136] A message concurrency calculation unit 201, configured to calculate the number of concurrent messages and the network transmission delay according to the average message transmission delay;

[0137] The ideal maximum depth calculation unit 202 is used to calculate the ideal maximum depth according to the number of concurrent messages and the network transmission delay.

[0138] In one embodiment, see Fig.16 , the message channel control module 30 includes:

[0139] A first comparison unit 301 is used to compare the average message transmission delay in the multiple cycles with the sending interval time in the current cycle;

[0140] The second comparison unit 302 is configured to compare the message queue depth in the current cycle with a preset maximum message queue depth when the average message transmission delay in the multiple cycles is greater than the sending interval in the current cycle and the sending interval in the current cycle reaches a preset upper limit of the message sending interval;

[0141] The first maximum depth reducing unit 303 is configured to reduce the preset maximum depth of the message queue to the message queue depth value in the current cycle when the message queue depth in the current cycle is not greater than the preset maximum depth of the message queue.

[0142] In one embodiment, see Fig.17, the first comparing unit 301 includes:

[0143] The first interval time increasing unit 3011 is used to increase the sending interval time in the current cycle to the preset message sending interval time upper limit when the average message transmission delay in the multiple cycles is greater than the sending interval time in the current cycle and the sending interval time in the current cycle does not reach the preset message sending interval time upper limit.

[0144] In one embodiment, see Fig.18 , the first comparing unit 301 further includes:

[0145] a third comparing unit 3012, configured to compare the average message transmission delay in the current cycle with the average message transmission delay in the previous cycle when the average message transmission delay in the multiple cycles is not greater than the sending interval in the current cycle;

[0146] The second time interval increasing unit 3013 is used to increase the message sending interval in the current cycle to a preset message sending interval upper limit when the average message transmission delay in the current cycle is greater than the average message transmission delay in the previous cycle;

[0147] The time interval reducing unit 3014 is used to reduce the message sending interval in the current cycle to a preset message sending interval lower limit if the average message transmission delay in the current cycle is not greater than the average message transmission delay in the previous cycle.

[0148] In one embodiment, see Fig.19 , the message channel control module 30 also includes:

[0149] A queue depth increasing unit 304 is configured to increase the message queue depth in the current cycle to the preset message queue maximum depth value when the ideal maximum depth is greater than the preset message queue maximum depth in the current cycle;

[0150] The second maximum depth reducing unit 305 is configured to reduce the preset maximum depth of the message queue to the message queue depth value in the current cycle when the ideal maximum depth is not greater than the preset maximum depth of the message queue in the current cycle.

[0151] From the above description, it can be seen that the message transmission device provided by the embodiment of the present invention first calculates the average message transmission delay in the previous cycle; then, the ideal maximum depth of the message queue of the current cycle is calculated based on multiple average message transmission delays; finally, the message channel is controlled based on the average message transmission delay and the ideal maximum depth. The present invention periodically samples the message transmission delay, and uses it as a basis to adjust the sending interval and the sending queue depth, so that only the sending end (without controlling the message receiving end) can be controlled, and the message channel congestion can be better controlled, and the above value can be maintained at a stable value under a current machine and bandwidth load, so as to maximize the use of computing resources, and this periodic sampling method also has low resource utilization.

[0152] The embodiment of the present application also provides a specific implementation of an electronic device that can implement all the steps in the message transmission method in the above embodiment, see Fig. 20 , electronic equipment specifically includes the following:

[0153] Processor (processor) 1201, memory (memory) 1202, communication interface (CommunicationsInterface) 1203 and bus 1204;

[0154] The processor 1201 , the memory 1202 , and the communication interface 1203 communicate with each other via the bus 1204 ; the communication interface 1203 is used to realize information transmission between relevant devices such as the server-side device, the power measurement device, and the user-side device.

[0155] The processor 1201 is used to call the computer program in the memory 1202. When the processor executes the computer program, all the steps in the message transmission method in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0156] Step 100: Calculate the average message transmission delay in the previous cycle;

[0157] Step 200: Calculate the ideal maximum depth of the message queue of the current cycle according to multiple average message transmission delays;

[0158] Step 300: Control the message channel according to the average message transmission delay and the ideal maximum depth.

[0159] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps of the message transmission method in the above embodiments. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps of the message transmission method in the above embodiments are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0160] Step 100: Calculate the average message transmission delay in the previous cycle;

[0161] Step 200: Calculate the ideal maximum depth of the message queue of the current cycle according to multiple average message transmission delays;

[0162] Step 300: Control the message channel according to the average message transmission delay and the ideal maximum depth.

[0163] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the hardware + program embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0164] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0165] Although the present application provides method operation steps such as embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in the order of the method shown in the embodiments or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment).

[0166] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0167] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0169] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A message transmission method, characterized in that: include: Calculate the average message transmission delay in the previous cycle; Calculate the ideal maximum depth of the message queue in the current cycle based on multiple average message transmission delays; Controlling a message channel according to the average message transmission delay and the ideal maximum depth; The controlling the message channel according to the average message transmission delay and the ideal maximum depth includes: Comparing the average message transmission delay in the multiple cycles with the sending interval time in the current cycle; When the average message transmission delay in the multiple cycles is greater than the sending interval in the current cycle, and the sending interval in the current cycle reaches the preset message sending interval upper limit, the message queue depth in the current cycle is compared with the preset message queue maximum depth; When the message queue depth in the current cycle is not greater than the preset maximum message queue depth, the preset maximum message queue depth is reduced to the message queue depth value in the current cycle.

2. The message transmission method according to claim 1, characterized in that: Calculating the average message transmission delay in the previous period includes: Calculating the message transmission delay of the plurality of messages in the previous cycle according to the processing performance parameters of the transceiver machine, the network bandwidth and the queue depth of the transceiver; The average message transmission delay in the previous period is calculated according to the message transmission delays of the multiple messages.

3. The message transmission method according to claim 1, characterized in that: The calculating the ideal maximum depth of the message queue of the current cycle according to the multiple average message transmission delays includes: Calculate the number of concurrent messages and the network transmission delay according to the average message transmission delay; The ideal maximum depth is calculated according to the number of concurrent messages and the network transmission delay.

4. The message transmission method according to claim 1, characterized in that: The comparing the average message transmission delays in the multiple cycles with the sending interval time in the current cycle includes: When the average message transmission delay in the multiple cycles is greater than the sending interval in the current cycle, and the sending interval in the current cycle does not reach the preset message sending interval upper limit, the sending interval in the current cycle is increased to the preset message sending interval upper limit.

5. The message transmission method according to claim 4, characterized in that: The comparing the average message transmission delays in the multiple cycles with the sending interval time in the current cycle also includes: When the average message transmission delays in the multiple cycles are not greater than the sending interval time in the current cycle, comparing the average message transmission delay in the current cycle with the average message transmission delay in the previous cycle; If the average message transmission delay in the current cycle is greater than the average message transmission delay in the previous cycle, the message sending interval in the current cycle is increased to the preset message sending interval upper limit; If the average message transmission delay in the current cycle is not greater than the average message transmission delay in the previous cycle, the message sending interval in the current cycle is reduced to a preset message sending interval lower limit.

6. The message transmission method according to claim 5, characterized in that: When the ideal maximum depth is greater than a preset maximum depth of the message queue in the current cycle, increasing the message queue depth in the current cycle to the preset maximum depth value of the message queue; When the ideal maximum depth is not greater than the preset maximum depth of the message queue in the current cycle, the preset maximum depth of the message queue is reduced to the message queue depth value in the current cycle.

7. A message transmission device, characterized in that: include: The average delay calculation module is used to calculate the average message transmission delay in the previous cycle; An ideal maximum depth calculation module is used to calculate the ideal maximum depth of the message queue of the current cycle according to multiple average message transmission delays; A message channel control module, used to control the message channel according to the average message transmission delay and the ideal maximum depth; The message channel control module includes: A first comparing unit, configured to compare the average message transmission delay in the multiple cycles with the sending interval time in the current cycle; A second comparison unit is used to compare the message queue depth in the current cycle with a preset maximum message queue depth when the average message transmission delay in the multiple cycles is greater than the sending interval in the current cycle and the sending interval in the current cycle reaches a preset upper limit of the message sending interval; The first maximum depth reducing unit is used to reduce the preset maximum depth of the message queue to the message queue depth value in the current cycle when the message queue depth in the current cycle is not greater than the preset maximum depth of the message queue.

8. The message transmission device according to claim 7, characterized in that: The average delay calculation module includes: A transmission delay calculation unit, used to calculate the message transmission delay of the plurality of messages in the previous cycle according to the processing performance parameters of the transceiver machine, the network bandwidth and the queue depth of the transceiver; The average delay calculation unit is used to calculate the average message transmission delay in the previous cycle according to the message transmission delays of the multiple messages.

9. The message transmission device according to claim 7, characterized in that: The ideal maximum depth calculation module includes: A message concurrency calculation unit, used to calculate the number of concurrent messages and the network transmission delay according to the average message transmission delay; The ideal maximum depth calculation unit is used to calculate the ideal maximum depth according to the number of concurrent messages and the network transmission delay.

10. The message transmission device according to claim 7, characterized in that: The first comparison unit further includes: The first interval time increasing unit is used to increase the sending interval time in the current cycle to the preset message sending interval time upper limit when the average message transmission delay in the multiple cycles is greater than the sending interval time in the current cycle and the sending interval time in the current cycle does not reach the preset message sending interval time upper limit.

11. The message transmission device according to claim 7, characterized in that: The first comparison unit further includes: a third comparing unit, configured to compare the average message transmission delay in the current cycle with the average message transmission delay in the previous cycle when the average message transmission delay in the multiple cycles is not greater than the sending interval in the current cycle; A second time interval increasing unit is used to increase the message sending interval in the current cycle to a preset message sending interval upper limit when the average message transmission delay in the current cycle is greater than the average message transmission delay in the previous cycle; The time interval reduction unit is used to reduce the message sending interval in the current cycle to a preset message sending interval lower limit if the average message transmission delay in the current cycle is not greater than the average message transmission delay in the previous cycle.

12. The message transmission device according to claim 11, characterized in that: The message channel control module also includes: A queue depth increasing unit, configured to increase the message queue depth in the current cycle to the preset message queue maximum depth value when the ideal maximum depth is greater than the preset message queue maximum depth in the current cycle; The second maximum depth reducing unit is configured to reduce the preset maximum depth of the message queue to the message queue depth value in the current cycle when the ideal maximum depth is not greater than the preset maximum depth of the message queue in the current cycle.

13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the message transmission method according to any one of claims 1 to 6 are implemented.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the message transmission method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Time-triggered network message transmission method

    CN102571559A

  • Data transmission method and network equipment

    CN108259383A

  • Data transmission method, device, system and gateway

    CN108989138A

  • Message queue monitoring method and device based on depth learning

    CN109039727A

  • Message sending control method and device

    CN110099013A