Message sending control method, device, computing device and storage medium
By monitoring the network status in real time and adjusting the time window and frequency dynamically, the network burden and message loss caused by instability in the network conditions are solved, and the message sending efficiency and resource utilization are optimized.
Patent Information
- Application Number
- CN202411494577.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2044-10-24
AI Technical Summary
In the prior art, due to unstable network conditions in the network communication system, the message transmission frequency cannot be dynamically adjusted, resulting in increased network burden and lost messages, and the available bandwidth cannot be fully utilized.
By monitoring network status parameters in real time, dynamically adjusting the time window and message sending frequency, using sliding time window mechanism and network status dynamic adjustment algorithm, optimize message sending efficiency and reduce delay and network burden.
It realizes the stability and efficiency of message transmission under different network conditions, reduces the risk of message loss, and reduces the network burden and system maintenance costs.
Smart Images

Figure CN119211149B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology, and in particular to a message sending control method, device, computing equipment and storage medium. Background Art
[0002] In network communication systems, the message transmission rate between clients and servers directly impacts communication efficiency and system stability, requiring appropriate rate limiting to ensure service quality. Common rate limiting algorithms include fixed window, sliding window, and leaky bucket. In the fixed window algorithm, the client sends messages according to a fixed time window or frequency. Rate limiting is triggered when the number of accesses reaches a preset threshold. The sliding window algorithm improves on the fixed window algorithm by dividing the time window into multiple small periods. As time progresses, expired data in these small periods is deleted, enabling more precise traffic control. However, due to unstable network conditions, such as increased latency, bandwidth fluctuations, and increased packet loss rates, if network conditions suddenly deteriorate while the client continues to send data at a fixed frequency, the data may accumulate in the network, exceeding the server's processing capacity or exceeding the network's carrying capacity. In this case, the server may mistakenly interpret the client's transmission speed as excessive (i.e., overspeeding). This misjudgment, combined with the mismatch between network conditions, can lead to network congestion or message loss.
[0003] Therefore, this static time window setting cannot adapt to changes in network conditions in real time, resulting in a large number of messages being sent at a fixed frequency when network conditions deteriorate, increasing the network burden; when network conditions improve, the client cannot adjust the sending frequency in time, resulting in inadequate utilization of available bandwidth.
[0004] In the prior art, Chinese patent publication CN117715097A discloses a network communication connection method that includes time-window-based ACK retransmission, time-sharing transmission, and information-based adaptive bit rate methods (transmission power adaptation, rate adaptation, and flow control adaptation). While this solution can enhance communication adaptability, it is not flexible enough to deal with sudden changes in network status. It focuses on one-way parameter adjustment rather than comprehensive network status feedback. Summary of the Invention
[0005] In order to solve the problems existing in the existing technology, this solution proposes a message sending control method, device, computing device and storage medium. By real-time monitoring and adapting to changes in network conditions, dynamically adjusting the time window and the message sending volume within the time window, it can ensure the stability and efficiency of message sending under different network conditions.
[0006] According to a first aspect of the present invention, a message sending control method is provided, comprising: initializing a time window, a sending frequency, and a network status of a communication gateway; monitoring network status parameters in real time, and updating the network status based on the network status parameters; adjusting the time window size according to the network status, and reallocating the message sending frequency.
[0007] The above technical solution can dynamically adapt to changes in network status, optimize message sending efficiency, reduce the risk of message loss, and reduce delays and network burden.
[0008] Optionally, in the message sending control method provided by the present invention, the communication time period of the gateway is divided into multiple time windows, and the number of messages in each time window is counted; based on the expected network bandwidth and service load, the number of messages sent in each time window is set; the network monitoring parameters including Ping time, bandwidth and packet loss rate are set, and the network status is initialized to good.
[0009] Optionally, in the message sending control method provided by the present invention, the client periodically sends ping requests to the target server to calculate the round-trip time and network delay time; measures the upload speed and download speed to calculate the bandwidth utilization rate; counts the number of data packets sent and received to calculate the packet loss rate; evaluates the network jitter based on the statistical value of the round-trip time, compares the packet loss rate, bandwidth utilization rate, and network delay time with preset standard thresholds, and determines the network status.
[0010] Optionally, in the message sending control method provided by the present invention, heterogeneity analysis is performed on client devices and communication protocols, and different standard thresholds are set for different categories of devices and protocols; the monitored network parameters are compared with the corresponding standard thresholds to determine the network status.
[0011] The above technical solution uses heterogeneity analysis to set standard thresholds for different devices and protocols, making network status judgment more accurate and improving adaptability to various devices and communication protocols.
[0012] Optionally, in the message sending control method provided by the present invention, historical monitoring data is collected and input into a trained machine learning model to predict network status.
[0013] The above technical solution uses historical monitoring data and machine learning models to improve the accuracy of network status prediction and identify potential problems in advance.
[0014] Optionally, in the message sending control method provided by the present invention, the network status is divided into three levels: good, general, and poor according to the packet loss rate, bandwidth utilization rate, and network delay time; when the network status is good, the time window size is set to the first time threshold according to the first segmentation granularity; when the network status is general, the time window size is set to the second time threshold according to the second segmentation granularity; when the network status is poor, the time window size is set to the third time threshold according to the third segmentation granularity, and the first time threshold is less than the second time threshold, and the second time threshold is less than the third time threshold; based on the adjusted time window size, the number of messages sent by each gateway in the time window is calculated; the time window of each gateway and the number of messages sent in the time window are updated, and the client obtains the message with the corresponding number of messages sent from the message queue and sends it to the server.
[0015] In the above technical solution, when the network condition is good, a larger time window allows a higher message sending frequency, and when the network condition is poor, the network load is reduced by narrowing the time window, thereby optimizing the overall performance.
[0016] Optionally, in the message sending control method provided by the present invention, feedback data on the network status from each communication gateway is collected; and the time window and message sending frequency are adjusted according to the feedback data.
[0017] The above technical solution can be adjusted according to actual feedback data, timely discover and solve network fluctuation problems, thereby improving the stability and reliability of the system.
[0018] According to a second aspect of the present invention, a message transmission control device is provided, comprising: an initialization module, a monitoring module, and an adaptive adjustment module. The initialization module is configured to initialize the time window, transmission frequency, and network status of a communication gateway; the monitoring module is configured to monitor network status parameters in real time and update the network status based on the parameters; and the adaptive adjustment module is configured to adjust the time window size and reallocate the message transmission frequency based on the network status.
[0019] According to a third aspect of the present invention, a computing device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the message sending control method according to the first aspect.
[0020] According to a fourth aspect of the present invention, there is provided a computer-readable storage medium, comprising a computer program stored therein that can be loaded by a processor and execute the message sending control method according to the first aspect.
[0021] The message sending control method and device provided by the present invention can produce at least the following beneficial effects:
[0022] 1. By dynamically adjusting the time window size based on network conditions, network congestion and server misjudgment caused by the instantaneous sending of a large number of messages can be effectively avoided, thereby ensuring the stability of message transmission; 2. Under good network conditions, bandwidth can be fully utilized and the message sending frequency can be increased, thereby optimizing the use of network resources, reducing the need for manual intervention, and lowering the system maintenance cost.
[0023] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:
[0025] Figure 1 shows a structural diagram of a computing device 100 according to one embodiment of the present invention;
[0026] Figure 2 FIG2 shows a flow chart of a message sending control method 200 according to an embodiment of the present invention;
[0027] Figure 3 FIG. 4 is a schematic structural diagram of a message sending control device 300 according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] This solution uses a sliding time window mechanism and a network status dynamic adjustment algorithm to automatically adjust the time window size to adapt to changes in network status and optimize message transmission efficiency.
[0029] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0030] Figure 1 FIG. 1 shows a block diagram of a computing device 100 according to an embodiment of the present invention. Figure 1As shown, computing device 100 may include memory 106 and processor 104. A memory bus 108 may be used for communication between processor 104 and system memory 106.
[0031] Memory 106 may include an operating system 120, applications 122, and program data 124. Applications 122 may be arranged to execute instructions on the operating system by one or more processors 104 using program data 124. Applications 122 include program instructions for implementing various user desired functions.
[0032] When the computing device 100 is started, the processor 104 reads and executes the program instructions of the operating system 120 from the memory 106. Applications 122 run on top of the operating system 120, utilizing the interfaces provided by the operating system 120 and the underlying hardware to implement various user-desired functions. When a user launches an application 122, the application 122 is loaded into the memory 106, and the processor 104 reads and executes the program instructions of the application 122 from the memory 106.
[0033] The computing device 100 also includes a storage device 132 and an output device 142 connected to a storage interface bus 134. An interface bus 140 facilitates communication from various interface devices (e.g., output device 142, peripheral interface 144, and communication device 146) via the bus / interface controller 130.
[0034] The peripheral interface 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I / O ports 158. The communication device 146 may include a network controller 160, which may be arranged to facilitate communication with one or more other computing devices 162 via a network communication link via one or more communication ports 164. In the computing device 100 according to the present invention, the application 122 includes instructions for executing the message sending control method 200 of the present invention.
[0035] Figure 2 FIG. 2 shows a flow chart of a message sending control method 200 according to an embodiment of the present invention. Figure 2 As shown, the method 200 begins at step S210, where the time window, sending frequency and network status of the communication gateway are initialized.
[0036] For example, locate the time window setting option in the gateway configuration interface. The default initialization time window size is Tgwi = 1s, and obtain the number of messages allowed to be sent per second. The communication time period of the gateway (such as 1 second or several seconds) can be divided into multiple smaller time windows, and the number of messages in each time window is counted. For example, one window is 100ms, and the number of message transmissions is restricted within each small window. By evenly distributing the message transmission volume through these windows, it is possible to avoid misjudgment of overspeed by the server due to instantaneous large amounts of message transmissions. Therefore, the time window size can be 1s, 500ms, 100ms, etc., and the transmission frequency TPSgwi within each time window is set based on the expected network bandwidth and service load.
[0037] Initialize the configuration network monitoring parameters, such as Ping time, bandwidth, packet loss rate, etc., and initialize the network status of each gateway as Sgwi = 1, indicating that the network status is good.
[0038] In step S220, the network status parameters are monitored in real time, and the network status is updated based on the network status parameters.
[0039] According to an embodiment of the present invention, the client periodically sends ping requests (small data packets) to the target server, and calculates the round-trip time and network latency time. The round-trip time (RTT) is the total time it takes for a data packet to be sent and a reply to be received, and the network latency is closely related to the round-trip time.
[0040] Measure the upload speed and download speed, and calculate the bandwidth utilization rate. The network load situation can be evaluated by calculating the ratio of the actually used bandwidth to the total available bandwidth. Count the number of data packets sent and received, and calculate the packet loss rate. The packet loss rate is equal to the number of lost data packets / the total number of sent data packets.
[0041] Evaluate the network jitter situation based on the statistical value of the round-trip time, compare the packet loss rate, bandwidth utilization rate, and network latency time with preset thresholds respectively, and judge the network status. For example, when RTT <= 1000ms, update the network status to good, S gwi = 1. When 1000ms < RTT <= 3000ms, update the network status to average, S gwi = 2. When RTT > 3000ms, update the network status to poor, S gwi = 3. Record the network status of each gateway in the cache S gw1 、S gw2 ……S gwi ……S gwn .
[0042] To better understand and optimize network performance, this solution also analyzes the heterogeneity of different client devices and communication protocols, setting different standard thresholds for different types of devices and protocols. The monitored network parameters are compared with the corresponding standard thresholds to determine the network status.
[0043] Furthermore, historical monitoring data can be collected and fed into a trained machine learning model to predict network status. Utilizing historical monitoring data and machine learning models can improve the accuracy of network status predictions and identify potential problems in advance.
[0044] Finally, step S230 is executed to adjust the time window size according to the network status and reallocate the message sending frequency.
[0045] The dynamic adjustment algorithm reduces the time window size when network conditions are good, allowing for more frequent message transmission. When network conditions are poor, the time window size is increased, reducing the message transmission frequency to reduce network load. Different granularity is used depending on the network conditions.
[0046] In one embodiment of the present invention, the network status may be divided into three levels: good, average, and poor according to the real-time monitored packet loss rate, bandwidth usage, and network delay time.
[0047] When the network status is good, the time window size is set to the first time threshold according to the first segmentation granularity; when the network status is general, the time window size is set to the second time threshold according to the second segmentation granularity; when the network status is poor, the time window size is set to the third time threshold according to the third segmentation granularity, the first time threshold is smaller than the second time threshold, and the second time threshold is smaller than the third time threshold.
[0048] For example, when the network condition is good, S gwi =1, each second is divided into 10 100-millisecond intervals, and the time window is 100 milliseconds. gwi = 100ms. When the network condition is normal, S gwi =2, every 3 seconds is divided into 10 300 millisecond intervals, the time window is 300 milliseconds, T gwi =300ms. When the network condition is poor, S gwi =3, every 6 seconds is divided into 10 600 milliseconds, the time window is 600 milliseconds, T gwi =600ms.
[0049] Based on the adjusted time window size, calculate the number of messages sent by each gateway within the time window. This depends on the time window size and the number of messages processed per second (TPS). gwi, if each message takes 10 milliseconds to process on average, then a maximum of 10 messages can be sent in a 100 millisecond window.
[0050] Update the time window of each gateway and the number of messages sent within the time window. The client obtains the corresponding number of messages from the message queue and sends them to the server.
[0051] Different communication gateways may face different network environments. We can collect feedback data on network status from each communication gateway and adjust the time window and message sending frequency based on this feedback data. This allows for personalized optimization, ensuring each gateway performs optimally in its specific environment.
[0052] Figure 3 FIG. 3 shows a schematic structural diagram of a message sending control device 300 according to an embodiment of the present invention. Figure 3 As shown, the apparatus 300 may include an initialization module 310 , a monitoring module 320 and an adaptive adjustment module 330 .
[0053] Among them, the initialization module 310 can initialize the time window, sending frequency and network status of the communication gateway. Specifically, the initialization module can divide the communication time period of the gateway into multiple time windows and count the number of messages in each time window. Based on the expected network bandwidth and service load, the number of messages sent in each time window is set. By dividing the time period into multiple time windows, the message sending tasks are evenly distributed to different time windows, and the number of messages sent in each time window is set according to the expected bandwidth and load, the network bandwidth can be fully utilized and bandwidth waste can be reduced. Set network monitoring parameters including Ping time, bandwidth and packet loss rate, and initialize the network status to good. This helps to establish a stable baseline for subsequent monitoring and adjustment of strategies.
[0054] The monitoring module 320 can monitor network status parameters in real time and update the network status based on these parameters. For example, the client periodically sends ping requests to the target server to calculate the round-trip time and network delay; measures upload and download speeds to calculate bandwidth utilization; counts the number of packets sent and received to calculate the packet loss rate; and evaluates network jitter based on the round-trip time statistics. The packet loss rate, bandwidth utilization, and network delay are compared with preset standard thresholds to determine the network status.
[0055] The adaptive adjustment module 330 can adjust the time window size and reallocate the message sending frequency according to the network status. According to one embodiment of the present invention, the adaptive adjustment module can classify the network status into three levels: good, average, and poor based on the packet loss rate, bandwidth utilization, and network delay time.
[0056] When the network status is good, the time window size is set to the first time threshold according to the first segmentation granularity; when the network status is general, the time window size is set to the second time threshold according to the second segmentation granularity; when the network status is poor, the time window size is set to the third time threshold according to the third segmentation granularity, the first time threshold is smaller than the second time threshold, and the second time threshold is smaller than the third time threshold.
[0057] Based on the adjusted time window size, the number of messages sent by each gateway within the time window is calculated; the time window of each gateway and the number of messages sent within the time window are updated, and the client obtains the corresponding number of messages sent from the message queue and sends them to the server.
[0058] The message sending control method and device provided by the present invention can produce at least the following beneficial effects:
[0059] 1. By dynamically adjusting the time window size based on network conditions, network congestion and server misjudgment caused by the instantaneous sending of a large number of messages can be effectively avoided, thereby ensuring the stability of message transmission;
[0060] 2. Under good network conditions, it can fully utilize bandwidth and increase the frequency of message sending, thereby optimizing the use of network resources, reducing the need for manual intervention, and reducing the maintenance cost of the system.
[0061] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.
[0062] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved and are not intended to imply that the objects so described must have a given order in time, space, ranking, or in any other manner.
Claims
1. A message sending control method, characterized in that: include: Initialize the time window, sending frequency and network status of the communication gateway; Monitoring network status parameters in real time, and updating the network status based on the network status parameters; The network status is divided into three levels: good, average, and poor based on packet loss rate, bandwidth usage, and network delay time; When the network status is good, the time window size is set to a first time threshold according to the first segmentation granularity; When the network status is normal, the time window size is set to a second time threshold according to the second segmentation granularity; When the network state is poor, the time window size is set to a third time threshold according to the third segmentation granularity, the first time threshold is less than the second time threshold, and the second time threshold is less than the third time threshold; When the network status is good, reduce the time window size and increase the message sending frequency; when the network status is poor, increase the time window size and reduce the message sending frequency; Update the time window and message sending frequency of each gateway, and the client obtains the corresponding number of messages from the message queue and sends them to the gateway.
2. The message sending control method according to claim 1, wherein: The step of initializing the time window, sending frequency and network status of the communication gateway includes: Divide the gateway's communication time period into multiple time windows and count the number of messages in each time window; Set the number of messages to be sent within each time window based on expected network bandwidth and service load; Set network monitoring parameters including ping time, bandwidth, and packet loss rate, and initialize the network status to good.
3. The message sending control method according to claim 1, wherein: The step of monitoring the network status parameters in real time and updating the network status based on the network status parameters comprises: The client periodically sends ping requests to the target server and calculates the round-trip time and network delay; Measure upload and download speeds and calculate bandwidth usage; Count the number of data packets sent and received and calculate the packet loss rate; The network jitter is evaluated based on the statistical value of the round-trip time, and the packet loss rate, bandwidth utilization rate, and network delay time are compared with preset standard thresholds to determine the network status.
4. The message sending control method according to claim 3, wherein: The step of monitoring the network status parameters in real time and updating the network status based on the network status parameters comprises: Perform heterogeneity analysis on client devices and communication protocols, and set different standard thresholds for different categories of devices and protocols; Compare the monitored network parameters with the corresponding standard thresholds to determine the network status.
5. The message sending control method according to claim 3, wherein: The step of monitoring the network status parameters in real time and updating the network status based on the network status parameters further comprises: Collect historical monitoring data and input the historical monitoring data into a trained machine learning model to predict network status.
6. The message sending control method according to claim 1, wherein: The method further comprises: Collect feedback data on network status from each communication gateway; The time window and message sending frequency are adjusted according to the feedback data.
7. A message sending control device, characterized in that: include: Initialization module, used to initialize the time window, sending frequency and network status of the communication gateway; A monitoring module, configured to monitor network status parameters in real time and update the network status based on the network status parameters; An adaptive adjustment module is used to divide the network status into three levels: good, general, and poor according to the packet loss rate, bandwidth utilization rate, and network delay time; when the network status is good, the time window size is set to the first time threshold according to the first segmentation granularity; when the network status is general, the time window size is set to the second time threshold according to the second segmentation granularity; when the network status is poor, the time window size is set to the third time threshold according to the third segmentation granularity, the first time threshold is less than the second time threshold, and the second time threshold is less than the third time threshold; when the network status is good, the time window size is reduced and the message sending frequency is increased; when the network status is poor, the time window size is increased and the message sending frequency is reduced; the time window and the message sending frequency of each gateway are updated, and the client obtains the corresponding number of messages from the message queue and sends them to the gateway.
8. A computing device, characterized in that include: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the message sending control method according to any one of claims 1 to 6.
9. A readable storage medium storing program instructions, characterized in that: When the program instructions are read and executed by a computing device, the computing device is caused to execute the message sending control method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Network communication connection method
CN117715097A
Intelligent terminal sensor scheduling method based on reinforcement learning
CN111459627A
Congestion control method and device and training method and device of congestion control model
CN114866489A