CN111385218A - Packet loss and flow control method, storage medium and equipment for message queue overload - Google Patents

Packet loss and flow control method, storage medium and equipment for message queue overload Download PDF

Info

Publication number
CN111385218A
CN111385218A CN201811625671.1A CN201811625671A CN111385218A CN 111385218 A CN111385218 A CN 111385218A CN 201811625671 A CN201811625671 A CN 201811625671A CN 111385218 A CN111385218 A CN 111385218A
Authority
CN
China
Prior art keywords
message
message queue
packet
time
overload
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811625671.1A
Other languages
Chinese (zh)
Other versions
CN111385218B (en
Inventor
黄金强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Baiguoyuan Information Technology Co Ltd
Original Assignee
Guangzhou Baiguoyuan Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Baiguoyuan Information Technology Co Ltd filed Critical Guangzhou Baiguoyuan Information Technology Co Ltd
Priority to CN201811625671.1A priority Critical patent/CN111385218B/en
Publication of CN111385218A publication Critical patent/CN111385218A/en
Application granted granted Critical
Publication of CN111385218B publication Critical patent/CN111385218B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/23Bit dropping
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/32Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/32Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames
    • H04L47/323Discarding or blocking control packets, e.g. ACK packets
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present invention relates to the field of computer message processing technologies, and in particular, to a packet loss method for message queue overload, a flow control method for message queue, a computer-readable storage medium, and a computer device. The packet loss method for the overload message queue comprises the following steps: when the message queue is in an overload state, carrying out delay processing on the message packets in the message queue; timing the time of the message packet entering the message queue and leaving the message queue, judging whether the message queue is in an overload state according to the enqueue time and the dequeue time of the message packet, and judging whether the timing time exceeds a buffer period; and selectively losing the message packet according to a packet loss strategy when the buffering period is exceeded and the message queue is in an overload state. According to the packet loss method for the message queue overload, the packet loss operation is not immediately executed in the buffering period, so that the packet loss number is reduced, the retransmission request times of the client side are reduced, and the availability of the system is improved.

Description

Packet loss and flow control method, storage medium and equipment for message queue overload
Technical Field
The present invention relates to the field of computer message processing technologies, and in particular, to a packet loss method for message queue overload, a flow control method for message queue, a computer-readable storage medium, and a computer device.
Background
At present, many background processes of electronic equipment process messages in a queue through multiple threads, if the message amount suddenly increases in a certain period of time and exceeds the processing capacity of the process, or some messages trigger operations such as slow query and the like, the message delay of the queue increases, and if the message delay is too long, overtime retransmission of a client is triggered.
In the prior art, a Delay control (Codel) algorithm is introduced, queue congestion is solved by adopting a packet loss mode, the Codel algorithm can migrate between different states according to different conditions, if an overtime packet exists in a previous normal period, a next period enters an observation period, if messages in the observation period are all overtime, a queue enters an overload state, if the overtime of one message is higher than a preset threshold, the message is discarded, but each observation period of the Codel is short and is very sensitive to packet loss, so that a system can discard the messages accumulated in the queue even if the system has the capability of finishing processing the messages accumulated in the queue due to the sensitivity of packet loss conditions, so that a large amount of packet loss phenomena are caused, and the system availability is reduced.
Disclosure of Invention
The invention provides a packet loss method for message queue overload, a flow control method for message queue, a computer readable storage medium and computer equipment, which are used for reducing the number of packet loss, reducing the retransmission times of client requests and improving the availability of a system.
The embodiment of the present application first provides a packet loss method for overloading a message queue, including:
when the message queue is in an overload state, carrying out delay processing on the message packets in the message queue;
timing the time of the message packet entering the message queue and leaving the message queue, judging whether the message queue is in an overload state according to the enqueue time and the dequeue time of the message packet, and judging whether the timing time exceeds a buffer period;
and selectively losing the message packet according to a packet loss strategy when the buffering period is exceeded and the message queue is in an overload state.
Preferably, the packet loss method further includes:
and when the buffering period is exceeded and the message queue is not in the overload state, carrying out state monitoring on the message packets in the message queue in the overload recovery monitoring period.
Preferably, after the step of selectively discarding the message packet according to the packet discarding policy, the method further includes:
if the message queue has a message packet which is not overtime, entering an overload recovery monitoring period, and carrying out state monitoring on the message queue;
and in the overload recovery monitoring period, when a message packet in an overtime state exists in the message queue, executing a step of selectively losing the message packet according to a packet loss strategy.
Preferably, before the step of determining whether the timing time exceeds the buffer period, the method further includes:
determining the delay time of the message packet according to the enqueue time and the dequeue time of the message packet;
establishing a distribution model of the delay time of each process according to the delay time of each message packet belonging to the same process;
the buffer period duration is determined based on a distribution model of the delay times.
Preferably, the step of determining the duration of the buffering period based on the distribution model of the delay time comprises:
if the distribution models of the processes are consistent, determining the duration of the buffer period according to the variance of the distribution models of the processes;
and if the distribution models of the processes are inconsistent, performing data fitting on the delay time of each message packet in the process to obtain a distribution curve, and determining the buffer period duration according to the slope of the distribution curve.
Preferably, the step of determining the duration of the buffering period according to the slope of the profile includes:
obtaining the slope of a distribution curve corresponding to the current moment;
when the slope of the distribution curve is positive, calculating the duration of a buffer period according to the variance of a process distribution model;
and when the slope of the distribution curve is negative, calculating a second time length required by the delay time to be reduced to the preset delay time according to the slope of the distribution curve corresponding to the current moment, and determining the buffer period time length according to the second time length.
Preferably, the step of determining whether the message queue is in an overload state according to the enqueue time and the dequeue time of the message packet includes:
acquiring the enqueue time of a message packet entering a message queue and the dequeue time of the message packet leaving the message queue, and determining the delay time of the message packet according to the time difference between the enqueue time and the dequeue time of the message packet;
comparing the delay time with a threshold range of preset delay time, and determining whether the message packet is in an overtime state according to a comparison result;
if all message packets are in the overtime state in the buffer period, the message queue is in the overload state.
Further, an embodiment of the present application further provides a method for controlling flow of a message queue, including:
judging the overtime state of each message packet in the message queue according to the enqueue time and the dequeue time of the message packet;
if the message packet in the message queue is overtime, starting timing operation of an overload buffering period, and if all the message packets are detected to be overtime in the overload buffering period, enabling the message queue to enter an overload state;
and performing packet loss operation according to the packet loss method of any one of the above.
Preferably, the flow control of the message queue further includes:
and if the overtime message packet is not detected in the overload buffer period, the message queue is in a normal state.
Preferably, after the step of performing packet loss operation, the method further includes:
and if the packet loss operation is not detected in the overload recovery buffering period, the message queue is recovered to a normal state.
Further, an embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium is used for storing computer instructions, and when the computer instructions are run on a computer, the computer is caused to execute the packet dropping method according to any of the above technical solutions or the flow control method for the message queue according to any of the above technical solutions.
Still further, an embodiment of the present application further provides a computer device, where the computer device includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the steps of the packet loss method or the flow control method for the message queue according to any technical scheme.
Compared with the prior art, the scheme provided by the application at least has the following advantages:
according to the packet loss method for message queue overload, the buffering period is introduced when the message queue is in the overload state, and packet loss operation is not performed in the buffering period, namely the buffering period is used as the buffering time of packet loss, so that the number of packet loss is reduced, the times of requesting to upload requests again by a client side are reduced, and the availability and reliability of a system are improved.
According to the packet loss method for the message queue overload, the time length of the variable buffering period is calculated in real time according to the distribution of the message delay time in the message queue, and compared with the fixed buffering period, the optimal packet loss time can be dynamically determined by setting the variable buffering period, so that meaningless packet loss is reduced.
According to the flow control method for the message queue, whether the message queue enters an overload state is judged according to the overtime state of the message packet, if so, packet loss is carried out according to the packet loss scheme to control the queue flow, and due to the fact that a buffer period mechanism is introduced into the packet loss scheme, the packet loss quantity and the packet loss time of the message queue can be controlled, and accurate control over the message queue flow is achieved.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a flowchart illustrating a packet loss method for overloading a message queue according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps for determining whether a message queue is in an overload state according to an enqueue time and a dequeue time of a message packet according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a process for determining a duration of a buffering period according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating the steps for determining the duration of the buffering period according to the slope of the distribution curve according to another embodiment of the present invention;
FIG. 5 is a diagram illustrating a distribution curve synthesized according to delay times of message packets according to an embodiment of the present invention;
fig. 6 is a schematic diagram of an implementation process of a packet loss method for overloading a message queue according to an embodiment of the present invention;
fig. 7 is a flowchart illustrating a flow control method for a message queue according to an embodiment of the present invention;
fig. 8 is a schematic diagram illustrating an implementation process of a flow control method for a message queue according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative only and should not be construed as limiting the invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, the first live video image may be referred to as a second live video image, and similarly, the second live video image may be referred to as a first live video image, without departing from the scope of the present disclosure. Both the first live video image and the second live video image are live video images, but they are not the same live video image.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
Those skilled in the art will appreciate that an execution server as used herein includes both devices having wireless signal receivers, devices having only wireless signal receivers without transmit capability, and devices having receive and transmit hardware, devices having receive and transmit hardware capable of performing two-way communications over a two-way communications link. Such a device may include: a cellular or other communication device having a single line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which may combine voice, data processing, facsimile and/or data communication capabilities; a PDA (Personal Digital Assistant), which may include a radio frequency receiver, a pager, internet/intranet access, a web browser, a notepad, a calendar and/or a GPS (Global Positioning System) receiver; a conventional laptop and/or palmtop computer or other device having and/or including a radio frequency receiver. As used herein, a client can be portable, transportable, installed in a vehicle (aeronautical, maritime, and/or land-based), or situated and/or configured to operate locally and/or in a distributed fashion at any other location(s) on earth and/or in space.
Some of the terms used in the examples of this application are defined below:
packet loss, in this embodiment, refers to communication data packet loss, that is, message packet loss. The message queue refers to a temporary buffer area in the computer system for storing messages received from the outside and waiting for processing by the internal message processing unit. Delay time, refers to the time difference between the enqueue time when a packet of messages enters the message queue and the dequeue time when it leaves the queue.
The invention firstly provides a packet loss method for overloading a message queue, the flow diagram of which is shown in figure 1, and the method comprises the following steps:
s110, when the message queue is in an overload state, carrying out delay processing on the message packets in the message queue;
s120, timing the time when the message packet arrives at the message queue and leaves the message queue, judging whether the message queue is in an overload state according to the enqueue time and the dequeue time of the message packet, and judging whether the timing time exceeds a buffer period;
and S130, selectively losing the message packet according to a packet loss strategy when the buffering period is exceeded and the message queue is in an overload state.
According to the method and the device, when the message queue is in the overload state, a buffer period is set for processing the message queue, when the buffer period is exceeded and the queue is still in the overload state, packet loss operation is performed according to a packet loss strategy, and the sensitivity of the packet loss operation to time is reduced.
Generally, the system comprises a plurality of processes, each process comprises a plurality of message packets, the message packets enter a queue from one end of a message queue and leave the message queue from the other end, each message packet is attached with enqueue time information and dequeue time information, the delay time of the message packet in the message queue is obtained through the difference of the enqueue time information and the dequeue time information, the other end of the message queue is connected with a plurality of processing threads, and the processes in the queue are processed in parallel through multiple threads, so that the processing efficiency of the processes is improved.
In an embodiment, the process of executing the packet loss method with an overloaded message queue is as follows:
s110, when the message queue is in an overload state, the message packets in the message queue are subjected to delay processing.
Acquiring the enqueue time and the dequeue time of the message packets entering the queue and leaving the queue, calculating the time difference between the dequeue time and the enqueue time, acquiring the delay time of each message packet, if the delay time of the message packet exceeds the preset time of the delay time, indicating that the message packet is overtime, and setting the preset time according to the actual situation, such as setting the preset time to be 5ms, 10ms and other numerical values.
In one embodiment, before the step of placing the message queue in an overload state, the method further includes: detecting that overtime message packets exist in the message queue, entering an overload monitoring period, and if detecting that all the message packets in the message queue are overtime in the overload monitoring period, the message queue is in an overload state; and if no overtime message packet is detected in the overload monitoring period, the message queue is in a normal state.
When the message queue is in an overload state, all the message packets in the message queue are in a timeout state, and the message packets in the message queue are subjected to delay processing.
S120, timing the time of the message packet entering the message queue and leaving the message queue, judging whether the message queue is in an overload state according to the enqueue time and the dequeue time of the message packet, and judging whether the timing time exceeds the buffer period.
When the message queue is in an overload state, the system enters a buffering period, starts the timing operation of the buffering period, and monitors the enqueue time and the dequeue time of each message packet in the message queue in the buffering period. In one embodiment, the step of determining whether the message queue is in an overload state according to the enqueue time and the dequeue time of the message packet includes the following sub-steps, and the flow diagram is shown in fig. 2:
s210, obtaining the enqueue time of the message packet entering the message queue and the dequeue time of the message packet leaving the message queue, and determining the delay time of the message packet according to the time difference between the enqueue time and the dequeue time of the message packet;
s220, comparing the delay time with a threshold range of preset delay time, and determining whether the message packet is in an overtime state according to a comparison result;
s230, if all the message packets are in the timeout state in the buffering period, the message queue is in the overload state.
Specifically, the system enters a buffering period, starts timing of the buffering period, obtains time information of each message packet entering a message queue and leaving the message queue, obtains dequeuing time of each message packet in the buffering period and a timestamp representing the enqueuing time of the message packet on the message packet, calculates a time difference between the dequeuing time and the enqueuing time, wherein the time difference is delay time of the message packet in the message queue, and if the delay time exceeds a preset time length, the message packet is indicated to be overtime. The timeout state of each message packet in the buffering period is detected in the above manner, and if each message packet in the buffering period is in the timeout state, the process proceeds to step S130, and if a message packet that is not timed out is detected in the buffering period, the process proceeds to step S140.
According to the method and the device, the time difference between the enqueue time and the dequeue time of the message packet is compared with the preset delay time, whether the current message queue is overloaded or not is judged according to the comparison result of all the dequeued message packets in the message queue in the buffer period, the mode is simple, the result is accurate, and whether follow-up packet loss operation is carried out or not can be determined based on the judgment result.
In one embodiment, before the step of determining whether the timing time exceeds the buffering period, the method further includes determining the duration of the buffering period, and a flowchart of the method is shown in fig. 3, and includes the following sub-steps:
s310, determining the delay time of the message packet according to the enqueue time and the dequeue time of the message packet;
s320, establishing a distribution model of the delay time of each process according to the delay time of each message packet belonging to the same process.
And if the delay time distribution of each message packet in the process is in normal distribution, performing data fitting according to the delay time of each message packet to obtain the distribution function of each process, and obtaining the mathematical expected value and the maximum value of the distribution function and the variance of the distribution function.
And S330, determining the duration of the buffer period based on the distribution model of the delay time.
In one embodiment, the step of determining the duration of the buffering period based on a distribution model of delay times comprises: if the distribution models of the processes are consistent, determining the duration of the buffer period according to the variance of the distribution models of the processes; and if the distribution models of the processes are inconsistent, performing data fitting on the delay time of each message packet in the process to obtain a distribution curve, and determining the buffer period duration according to the slope of the distribution curve.
Determining the type of the buffer period according to whether the distribution model of each process has consistency, wherein the consistency of the distribution models of the plurality of processes is as follows: the types of the distribution functions representing the distribution models are consistent, the difference between the maximum values of the distribution functions is within a preset threshold range, if the distribution functions of the two processes are normal distribution and the maximum values of the distribution functions are the same, the distribution models of the two processes are consistent, a fixed buffer period is set for a system comprising the two processes, and the duration of the fixed buffer period is set according to the variance of the distribution functions.
The variance is the average of the square value of the difference between each sample value and the average of the whole sample values, represents the deviation degree from the center, and is used for measuring the fluctuation of data, namely the larger the variance is under the condition that the current data deviates from the average and the sample capacity is the same, the more the data fluctuation is, the more unstable the data is.
The lack of consistency among the distribution models of multiple processes means that: the types of the distribution functions are different, or the maximum values of the distribution functions of the processes have larger difference, if the distribution models of the processes are inconsistent, the buffer period duration is determined according to the delay time distribution of the message packets in the processes.
In one embodiment, the step of determining the duration of the buffer period based on the slope of the profile comprises the following sub-steps, the flow chart of which is schematically shown in fig. 4:
s410, obtaining the slope of the distribution curve corresponding to the current moment;
s420, when the slope of the distribution curve is positive, calculating the duration of a buffer period according to the variance of the process distribution model;
and S430, when the slope of the distribution curve is negative, calculating a second duration time required by the delay time to be reduced to the preset delay time according to the slope of the distribution curve corresponding to the current moment, and determining the duration of the buffer period according to the second duration time.
Specifically, the delay time of each message packet in the process is obtained, data fitting is performed on each delay time to obtain a delay curve, the fitting algorithm comprises linear fitting or nonlinear fitting, the fitting algorithm is selected according to actual conditions to perform fitting, the slope of the delay curve corresponding to the current moment is obtained, if the slope of the delay curve corresponding to the current moment is a positive value, the maximum value of the current distribution function is obtained, the buffer period duration is determined according to the maximum value of the current distribution function, if the slope of the delay curve corresponding to the current moment is a negative value, the delay time corresponding to the current moment is obtained, a second duration for reducing the delay time corresponding to the current moment to a preset delay time is calculated according to the distribution function, and the second duration is the buffer period duration. The second time length is determined according to the difference between the delay time corresponding to the current time and the preset delay time, so that the second time length is not a fixed time length and is a variable time length.
In one embodiment, when the distribution models of the processes do not have consistency, the process of determining the buffer period duration according to the delay time of each message packet in the process is as follows: a distribution curve synthesized according to the delay time of each message packet is shown in fig. 5, assuming that the cycle of each buffer period (labeled 1 to 5 in fig. 5 as 5 buffer periods) is 100ms, detecting that there is an overtime message packet in the queue in one cycle (labeled 1 in fig. 5), the next cycle (labeled 2 in fig. 5) is an observation period, and detecting that all dequeued message packets in the observation period are overtime, indicating that the message queue enters an overload state, selecting the message delay time of the past N cycles to perform data fitting, performing data fitting calculation if the message delay time information of the 1 st, 2 nd and 3 th cycles in fig. 5 is selected, obtaining the distribution curve of the delay time, if the buffer period duration corresponding to a current time is to be obtained, determining the slope of the fitting curve corresponding to the time, and if the slope of the fitting curve corresponding to the current time is a positive value, if the delay time of the message packet is degraded, and the delay time on the distribution curve corresponding to the next time is continuously increased, a buffer period with a fixed duration is set according to the maximum value or the variance of the current distribution function, where the buffer period is the first buffer period, and if the fixed duration of the first buffer period is 1200ms, the buffer period is set. If the slope of the fitting curve corresponding to the current moment is a negative value, which indicates that the delay time of the message packet is decreasing, and the delay condition of the message packet is improved, a second time length required for decreasing the current delay time along the current distribution curve to a preset delay time is calculated, where the second time length is a second buffer period time length, and the preset delay time is set according to the actual condition of the device, and if the preset delay time is set to be 5ms, the delay time of the message packet belongs to an acceptable range within 5ms, and is in a normal processing state.
Further, if the slope of the current fitting curve is a negative value, in order to avoid the second duration being too long, an upper limit duration is set for the second buffering period, in this embodiment, it is preferable to set the upper limit duration of the second buffering period to be three times the fixed duration, such as: the fixed duration of the buffering period is 1200ms, the duration of the second buffering period does not exceed 3600ms, and the method can reduce the waiting duration of the user and feed back the request result to the user in time.
And S130, selectively losing the message packet according to a packet loss strategy when the buffering period is exceeded and the message queue is in an overload state.
And when the timing information shows that the current time exceeds the buffer period duration and the message queue is still in an overload state, selectively losing the message according to a packet loss strategy.
The packet loss strategy in the embodiment of the application may adopt a tail dropping mode to treat all information packets equally, does not distinguish the grades of the information packets, and drops the information packets at the tail of the queue until the queue is free from congestion, or may adopt a random mode to drop the information packets.
In an embodiment, as shown in fig. 6, in an implementation process of a packet dropping method with an overloaded message queue, the packet dropping method with an overloaded message queue further includes: and S140, when the buffering period is exceeded and the message queue is not in the overload state, entering an overload recovery monitoring period, and monitoring the state of the message packets in the message queue in the overload recovery monitoring period.
The exceeding of the buffer period and the message queue not being in an overload state comprises: message packets that have not timed out are detected within the buffer period.
In one embodiment, after the step of selectively dropping the message packet according to the packet dropping policy, the method further includes: s150, if the message queue has the message packet which is not overtime, entering an overload recovery monitoring period, and carrying out state detection on the message queue; and S160, in the overload recovery monitoring period, when the message queue has the message packet in the overtime state, executing the step of selectively losing the message packet according to a packet loss strategy.
Further, an embodiment of the present application further provides a flow control method for a message queue, a flowchart of which is shown in fig. 7, and the method includes:
s710, judging the overtime state of each message packet in the message queue according to the enqueue time and the dequeue time of the message packet;
s720, if the information packet in the message queue is overtime, starting the timing operation of the overload buffering period, and if all the information packets are detected to be overtime in the overload buffering period, the message queue enters an overload state;
s730, perform packet loss operation according to the packet loss method in any of the above technical solutions.
In this embodiment, whether the message queue enters the overload state is judged according to the timeout state of the message packet, and if the message queue is overloaded, packet loss is performed according to the packet loss scheme to control the queue flow.
In an embodiment, the implementation process of the method for controlling flow of the message queue is as shown in fig. 8, except that in steps S710 to S730, the method for controlling flow of the message queue further includes S740 and S740, and if no timeout message packet is detected in the overload buffer period, the message queue is in a normal state.
In an embodiment, as shown in fig. 8, after the step of performing packet loss operation, the method further includes:
and S750, if the packet loss operation is not detected in the overload recovery buffering period, the message queue is recovered to a normal state.
The embodiment of the application provides two ways to determine whether the message queue is in a normal state, one way is that no overtime message packet is detected in the overload buffering period, and the other way is that no packet loss operation is detected in the overload recovery buffering period, which both indicate that the congestion problem of the message queue is solved and the message queue is recovering to normal without performing the packet loss operation, and form a complete closed-loop scheme with the scheme provided in steps S710 to S730, so as to realize the flow control of the message queue.
Further, an embodiment of the present application further provides a computer-readable storage medium, on which computer instructions are stored, and the computer instructions, when executed by a processor, implement the steps of the packet dropping method according to any one of the above technical solutions or the flow control method for the message queue according to any one of the above technical solutions. The storage medium includes, but is not limited to, any type of disk (including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks), ROMs (Read-Only memories), RAMs (Random AcceSS memories), EPROMs (EraSable Programmable Read-Only memories), EEPROMs (Electrically EraSable Programmable Read-Only memories), flash memories, magnetic cards, or optical cards. That is, a storage medium includes any medium that stores or transmits information in a form readable by a device (e.g., a computer). Which may be a read-only memory, magnetic or optical disk, or the like.
Still further, an embodiment of the present application further provides a computer device, where the computer device includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for controlling flow of a message queue according to any one of the above items.
FIG. 9 is a block diagram illustrating a computer device 900 according to an example embodiment. For example, computer device 900 may be provided as a server. Referring to fig. 9, computer device 900 includes a processing component 922, which further includes one or more processors, and memory resources, represented by memory 932, for storing instructions, such as applications, that are executable by processing component 922. The application programs stored in memory 932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 922 is configured to execute instructions to perform the steps of the flow control method of the message queue described above.
The computer device 900 may also include a power component 926 configured to perform power management of the computer device 900, a wired or wireless network interface 950 configured to connect the computer device 900 to a network, and an input/output (I/O) interface 958. Computer device 900 may operate based on an operating system stored in memory 932, such as WindowsServerTM, Mac OSXTM, UnixTM, LinuxTM, FreeBSDTM, or the like. It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
It should be understood that each functional unit in the embodiments of the present invention may be integrated into one processing module, each unit may exist alone physically, or two or more units may be integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (12)

1. A packet loss method for overloading a message queue, comprising:
when the message queue is in an overload state, carrying out delay processing on the message packets in the message queue;
timing the time of the message packet entering the message queue and leaving the message queue, judging whether the message queue is in an overload state according to the enqueue time and the dequeue time of the message packet, and judging whether the timing time exceeds a buffer period;
and selectively losing the message packet according to a packet loss strategy when the buffering period is exceeded and the message queue is in an overload state.
2. The packet loss method according to claim 1, further comprising:
and when the buffering period is exceeded and the message queue is not in the overload state, carrying out state monitoring on the message packets in the message queue in the overload recovery monitoring period.
3. The packet loss method according to claim 1, wherein after the step of selectively dropping the message packet according to the packet loss policy, the method further comprises:
if the message queue has a message packet which is not overtime, entering an overload recovery monitoring period, and carrying out state monitoring on the message queue;
and in the overload recovery monitoring period, when a message packet in an overtime state exists in the message queue, executing a step of selectively losing the message packet according to a packet loss strategy.
4. The packet loss method according to claim 1, wherein before the step of determining whether the timing time exceeds a buffering period, the method further comprises:
determining the delay time of the message packet according to the enqueue time and the dequeue time of the message packet;
establishing a distribution model of the delay time of each process according to the delay time of each message packet belonging to the same process;
the buffer period duration is determined based on a distribution model of the delay times.
5. The packet loss method according to claim 4, wherein the step of determining the buffer duration based on the distribution model of delay time comprises:
if the distribution models of the processes are consistent, determining the duration of the buffer period according to the variance of the distribution models of the processes;
and if the distribution models of the processes are inconsistent, performing data fitting on the delay time of each message packet in the process to obtain a distribution curve, and determining the buffer period duration according to the slope of the distribution curve.
6. The packet loss method according to claim 5, wherein the step of determining the buffer period duration according to the slope of the distribution curve comprises:
obtaining the slope of a distribution curve corresponding to the current moment;
when the slope of the distribution curve is positive, calculating the duration of a buffer period according to the variance of a process distribution model;
and when the slope of the distribution curve is negative, calculating a second time length required by the delay time to be reduced to the preset delay time according to the slope of the distribution curve corresponding to the current moment, and determining the buffer period time length according to the second time length.
7. The packet dropping method according to claim 1, wherein the step of determining whether the message queue is in the overload state according to the enqueue time and the dequeue time of the message packet comprises:
acquiring the enqueue time of a message packet entering a message queue and the dequeue time of the message packet leaving the message queue, and determining the delay time of the message packet according to the time difference between the enqueue time and the dequeue time of the message packet;
comparing the delay time with a threshold range of preset delay time, and determining whether the message packet is in an overtime state according to a comparison result;
if all message packets are in the overtime state in the buffer period, the message queue is in the overload state.
8. A method for controlling flow of a message queue, comprising:
judging the overtime state of each message packet in the message queue according to the enqueue time and the dequeue time of the message packet;
if the message packet in the message queue is overtime, starting timing operation of an overload buffering period, and if all the message packets are detected to be overtime in the overload buffering period, enabling the message queue to enter an overload state;
performing packet loss operation according to the packet loss method of any one of claims 1 to 7.
9. The message queue flow control method according to claim 8, further comprising:
and if the overtime message packet is not detected in the overload buffer period, the message queue is in a normal state.
10. The method for controlling flow of message queue according to claim 8, wherein after the step of performing packet dropping operation, the method further comprises:
and if the packet loss operation is not detected in the overload recovery buffering period, the message queue is recovered to a normal state.
11. A computer-readable storage medium for storing computer instructions which, when executed on a computer, cause the computer to perform the packet dropping method according to any one of claims 1 to 7 or the flow control method for a message queue according to any one of claims 8 to 10.
12. A computer device, characterized in that the computer device comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the steps of the packet dropping method according to any one of claims 1 to 7 or the flow control method for a message queue according to any one of claims 8 to 10.
CN201811625671.1A 2018-12-28 2018-12-28 Packet loss and flow control method for overload of message queue, storage medium and equipment Active CN111385218B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811625671.1A CN111385218B (en) 2018-12-28 2018-12-28 Packet loss and flow control method for overload of message queue, storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811625671.1A CN111385218B (en) 2018-12-28 2018-12-28 Packet loss and flow control method for overload of message queue, storage medium and equipment

Publications (2)

Publication Number Publication Date
CN111385218A true CN111385218A (en) 2020-07-07
CN111385218B CN111385218B (en) 2023-08-15

Family

ID=71222854

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811625671.1A Active CN111385218B (en) 2018-12-28 2018-12-28 Packet loss and flow control method for overload of message queue, storage medium and equipment

Country Status (1)

Country Link
CN (1) CN111385218B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500391A (en) * 2021-12-28 2022-05-13 上海弘积信息科技有限公司 Method for dealing with instantaneous overlarge flow
CN114553777A (en) * 2020-11-10 2022-05-27 浙江宇视科技有限公司 Method, device, medium and electronic equipment for processing messages in system
CN114866196A (en) * 2021-01-19 2022-08-05 武汉斗鱼鱼乐网络科技有限公司 Data packet retransmission method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104102693A (en) * 2014-06-19 2014-10-15 广州华多网络科技有限公司 Object processing method and device
CN105119843A (en) * 2015-08-13 2015-12-02 中国航天科工集团第三研究院第八三五七研究所 A method for setting a message buffer queue length
EP3035615A1 (en) * 2014-12-17 2016-06-22 Alcatel Lucent Method for queue management
CN107766160A (en) * 2017-09-26 2018-03-06 平安科技(深圳)有限公司 Queue message processing method and terminal device
CN107995127A (en) * 2017-12-13 2018-05-04 深圳乐信软件技术有限公司 A kind of method and device for overload protection

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104102693A (en) * 2014-06-19 2014-10-15 广州华多网络科技有限公司 Object processing method and device
EP3035615A1 (en) * 2014-12-17 2016-06-22 Alcatel Lucent Method for queue management
CN105119843A (en) * 2015-08-13 2015-12-02 中国航天科工集团第三研究院第八三五七研究所 A method for setting a message buffer queue length
CN107766160A (en) * 2017-09-26 2018-03-06 平安科技(深圳)有限公司 Queue message processing method and terminal device
CN107995127A (en) * 2017-12-13 2018-05-04 深圳乐信软件技术有限公司 A kind of method and device for overload protection

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114553777A (en) * 2020-11-10 2022-05-27 浙江宇视科技有限公司 Method, device, medium and electronic equipment for processing messages in system
CN114553777B (en) * 2020-11-10 2024-03-12 浙江宇视科技有限公司 Method, device, medium and electronic equipment for processing messages in system
CN114866196A (en) * 2021-01-19 2022-08-05 武汉斗鱼鱼乐网络科技有限公司 Data packet retransmission method and device, electronic equipment and storage medium
CN114500391A (en) * 2021-12-28 2022-05-13 上海弘积信息科技有限公司 Method for dealing with instantaneous overlarge flow

Also Published As

Publication number Publication date
CN111385218B (en) 2023-08-15

Similar Documents

Publication Publication Date Title
US9923821B2 (en) Managing communication congestion for internet of things devices
US10057150B2 (en) Managing communication congestion for internet of things devices
US10097379B2 (en) Managing communication congestion for internet of things devices
US9749888B1 (en) System for network characteristic assessment
CN111385218A (en) Packet loss and flow control method, storage medium and equipment for message queue overload
CN107995127B (en) Overload protection method and device
US9270624B2 (en) Cloud messaging services optimization through adaptive message compression
CN110247856B (en) Server resource release method and device
US8761012B2 (en) Packet relay apparatus and method of relaying packet
US20030229693A1 (en) Self-correcting monitor
US8369324B1 (en) Variable compression queue
US8081644B2 (en) Method and device for controlling a queue buffer
CN107872396B (en) Communication method with timeout control, processing device, terminal device and server
US20210390848A1 (en) System, server computer, and vehicle-mounted device
WO2017192341A1 (en) Modified slow start for background connections
CN113315720B (en) Data flow control method, system and equipment
WO2017192414A1 (en) Adaptive gain reduction for background connections
US20220053373A1 (en) Communication apparatus, communication method, and program
WO2024001763A1 (en) Data transmission processing method and device, storage medium, and electronic device
US9948564B2 (en) Data streaming scheduler for dual chipset architectures that includes a high performance chipset and a low performance chipset
WO2017192342A1 (en) Initial and periodic slowdowns for background connections
JP2009278532A (en) Transmission apparatus and congestion control method
EP3425862B1 (en) Automatically cycling among packet traffic flows subjecting them to varying drop probabilities in a packet network
CN112230880B (en) Data transmission control method and device, FPGA and medium
CN114389999B (en) Network transmission method, device, equipment and storage medium based on data packet

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant