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

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

Info

Publication number
CN111385218B
CN111385218B CN201811625671.1A CN201811625671A CN111385218B CN 111385218 B CN111385218 B CN 111385218B CN 201811625671 A CN201811625671 A CN 201811625671A CN 111385218 B CN111385218 B CN 111385218B
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.)
Active
Application number
CN201811625671.1A
Other languages
Chinese (zh)
Other versions
CN111385218A (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

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 application relates to the field of computer message processing technologies, and in particular, to a packet loss method for overload of a message queue, a flow control method for a message queue, a computer readable storage medium, and a computer device. The packet loss method for overload of the message queue comprises the following steps: when a message queue is in an overload state, carrying out delay processing on a message packet 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 enqueuing time and the dequeuing time of the message packet, and judging whether the timing time exceeds a buffer period; and when the buffer period is exceeded and the message queue is in an overload state, selectively losing the message packets according to a packet loss strategy. The method for packet loss of overload of the message queue does not immediately execute packet loss operation in the buffer period, so as to reduce the number of packet loss, reduce the number of retransmission requests of the client and improve the availability of the system.

Description

Packet loss and flow control method for overload of message queue, storage medium and equipment
Technical Field
The application relates to the technical field of computer message processing, in particular to a packet loss method for overload of a message queue, a flow control method for the message queue, a computer readable storage medium and computer equipment.
Background
At present, many background processes of electronic equipment process messages in a queue through multithreading, if the message quantity is suddenly increased in a certain period of time and exceeds the processing capacity of the process, or certain messages trigger operations such as slow inquiry, the message delay of the queue is increased, the message delay is excessively long and can trigger timeout retransmission of a client, meanwhile, when the process returns a long-time processing result or an inquiry result to the client, the result can be regarded as expired invalid data, and the client can resend the inquiry or processing operation, so that the whole service process always processes past messages in the queue, and the message queue is jammed and even the system collapses.
In the prior art, a Delay control (codec) algorithm is introduced, a packet loss mode is adopted to solve queue congestion, the codec algorithm can migrate between different states according to different conditions, if a timeout packet exists in a previous normal period, the next period enters an observation period, if all messages in the observation period are overtime, the queue enters an overload state, if the overtime of one message is higher than a preset threshold, the message is discarded, but because each observation period of the codec is shorter, the message is very sensitive to packet loss, even if the system has the capability of processing the message accumulated in the queue, the system can discard the message due to the sensitivity of packet loss conditions, so that a large number of packet loss phenomena are caused, and the usability of the system is reduced.
Disclosure of Invention
The application provides a packet loss method for overload of a message queue, a flow control method for the message queue, a computer readable storage medium and computer equipment, which are used for reducing the number of packet loss, reducing the number of retransmission requests of a client and improving the usability of a system.
The embodiment of the application firstly provides a packet loss method for overload of a message queue, which comprises the following steps:
when a message queue is in an overload state, carrying out delay processing on a message packet 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 enqueuing time and the dequeuing time of the message packet, and judging whether the timing time exceeds a buffer period;
and when the buffer period is exceeded and the message queue is in an overload state, selectively losing the message packets according to a packet loss strategy.
Preferably, the packet loss method further includes:
and when the buffer period is exceeded and the message queue is not in an overload state, monitoring the state of the message packets in the message queue in the overload recovery monitoring period.
Preferably, after the step of selectively dropping the message packet according to the packet dropping policy, the method further includes:
if the message queue has a non-overtime message packet, entering an overload recovery monitoring period, and carrying out state monitoring on the message queue;
and in the overload recovery monitoring period, when the message packets in the overtime state exist in the message queue, executing the step of selectively losing the message packets according to the packet loss strategy.
Preferably, before the step of determining whether the counted time exceeds the buffer period, the method further includes:
determining 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 time.
Preferably, the step of determining the buffer period duration based on the distribution model of the delay time includes:
if the distribution models of the processes are consistent, determining the buffer period duration according to the variance of the process distribution model;
if the distribution models of the processes are inconsistent, carrying out 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 buffer period duration according to the slope of the distribution curve includes:
acquiring the slope of a distribution curve corresponding to the current moment;
when the slope of the distribution curve is positive, calculating the buffer period duration according to the variance of the process distribution model;
and 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 buffer period duration according to the second duration time.
Preferably, the step of determining whether the message queue is in an overload state according to the enqueuing time and the dequeuing time of the message packet includes:
the enqueuing time of the message packet entering the message queue and the dequeuing time of the message packet leaving the message queue are obtained, and the delay time of the message packet is determined according to the time difference between the enqueuing time and the dequeuing time of the message packet;
comparing the delay time with a threshold range of a preset delay time, and determining whether the message packet is in a timeout state according to a comparison result;
if all the message packets are in the overtime state in the buffer period, the message queue is in the overload state.
Further, the embodiment of the application also provides a flow control method of the message queue, which comprises the following steps:
judging the overtime state of each message packet in the message queue according to the enqueuing time and the dequeuing time of the message packet;
if the information packets in the message queue are overtime, starting timing operation on the overload buffer period, and if all the information packets are detected to be overtime in the overload buffer period, the message queue enters an overload state;
the packet loss operation is carried out according to any one of the packet loss methods.
Preferably, the flow control of the message queue further comprises:
if no overtime message packet is detected in the overload buffer period, the message queue is in a normal state.
Preferably, after the step of performing the packet loss operation, the method further includes:
and if the packet loss operation is not detected in the overload recovery buffer period, the message queue is recovered to a normal state.
Still further, an embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium is configured to store computer instructions, when the computer readable storage medium runs on a computer, to cause the computer to execute the packet loss method according to any one of the foregoing technical solutions or the flow control method of the message queue according to any one of the foregoing technical solutions.
Still further, an embodiment of the present application provides a computer apparatus, including:
one or more processors;
storage means 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 of the message queue according to any one of the above technical solutions.
Compared with the prior art, the scheme provided by the application has at least the following advantages:
according to the method for packet loss of message queue overload provided by the embodiment of the application, the buffer period is introduced when the message queue is in an overload state, and the packet loss operation is not performed in the buffer period, namely, the buffer period is used as the buffer time for packet loss, so that the number of packet loss is reduced, the number of times of re-uploading requests requested by a client is further reduced, and the availability and reliability of a system are improved.
According to the method for packet loss of message queue overload provided by the embodiment of the application, the duration of the variable buffer period is calculated in real time according to the distribution of message delay time in the message queue, and compared with the fixed buffer period, the variable buffer period is set to dynamically determine the optimal packet loss time, so that unnecessary packet loss is reduced.
According to the flow control method of the message queue, whether the message queue enters an overload state is judged through the overtime state of the message packet, if so, packet loss is carried out according to the packet loss scheme to control the flow of the queue, and the packet loss number and the packet loss time of the message queue can be controlled due to the fact that the buffer period mechanism is introduced in the packet loss scheme, so that the flow of the message queue is accurately controlled.
Additional aspects and advantages of the application 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 application.
Drawings
The foregoing and/or additional aspects and advantages of the application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which:
fig. 1 is a flow chart of a packet loss method for overload of a message queue according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating steps for determining whether a message queue is in an overload state according to an enqueuing time and a dequeuing time of a message packet according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating a method for determining a buffer duration according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating steps for determining a buffer duration according to a slope of a distribution curve according to another embodiment of the present application;
FIG. 5 is a schematic diagram of a distribution curve according to delay time fit of each message packet according to an embodiment of the present application;
fig. 6 is a schematic diagram of an implementation process of a packet loss method with overload message queues according to an embodiment of the present application;
FIG. 7 is a flow chart illustrating a flow control method of a message queue according to an embodiment of the present application;
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 application;
fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. 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 the terms first, second, etc. as used herein may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another element. For example, a first live video image may be referred to as a second live video image, and similarly, a second live video image may be referred to as a first live video image, without departing from the scope of the application. 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 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 application belongs unless defined otherwise. 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.
As will be appreciated by those skilled in the art, the execution server as used herein includes both devices of wireless signal receivers having only wireless signal receivers without transmitting capabilities and devices of receiving and transmitting hardware having devices capable of executing 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; a PCS (Personal Communications Service, personal communication system) that may combine voice, data processing, facsimile and/or data communication capabilities; a PDA (Personal Digital Assistant ) that can include a radio frequency receiver, pager, internet/intranet access, web browser, notepad, calendar and/or GPS (Global Positioning System ) receiver; a conventional laptop and/or palmtop computer or other appliance that has and/or includes a radio frequency receiver. As used herein, a client may be portable, transportable, installed in a vehicle (aeronautical, maritime, and/or land-based), or adapted and/or configured to operate locally and/or in a distributed fashion, at any other location(s) on earth and/or in space.
Some terms used in the embodiments of the present application are defined as follows:
the packet loss refers to the loss of a communication data packet, namely the loss of a message packet in the embodiment of the application. Message queues refer to temporary buffers in a computer system that hold messages received from outside and wait for processing by an internal message processing unit. Delay time refers to the time difference between the enqueue time of a message packet into a message queue and the dequeue time of the message packet out of the queue.
The application firstly provides a packet loss method for overload of a message queue, a flow diagram of which is shown in figure 1, comprising the following steps:
s110, when a message queue is in an overload state, carrying out delay processing on a message packet in the message queue;
s120, timing the time of the message packet reaching 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 S130, selectively losing the message packets according to a packet loss strategy when the buffer period is exceeded and the message queue is in an overload state.
When the message queue is in an 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, the packet loss operation is carried out according to the packet loss strategy, so that the sensitivity of the packet loss operation to time is reduced, namely, when the message queue is in the overload state, the packet loss operation is not immediately carried out, but the message queue is detected to be still in the overload state again after the buffer period is buffered, the packet loss operation is triggered, the number of the discarded message packets in the whole processing process is reduced, and the retransmission operation of a user is further reduced.
In general, a system includes a plurality of processes, each process includes 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 enqueuing and dequeuing time information, delay time of the message packets in the message queue is obtained through a difference between the enqueuing and dequeuing time information, the other end of the message queue is connected with a plurality of processing threads, and processes in the queue are processed in parallel through multithreading, so that process processing efficiency is accelerated.
In one embodiment, the method for packet loss with overload message queue is implemented as follows:
s110, when the message queue is in an overload state, carrying out delay processing on the message packets in the message queue.
The enqueue time and the dequeue time of the message packet entering the queue and leaving the queue are obtained, the time difference between the enqueue time and the dequeue time is calculated, the delay time of each message packet is obtained, if the delay time of the message packet exceeds the preset duration of the delay time, the message packet is overtime, and the preset duration is set according to actual conditions, for example, the preset duration is set to be 5ms, 10ms and other numerical values.
In one embodiment, before the step of overload state, the message queue further includes: detecting that overtime message packets exist in the message queue, entering an overload monitoring period, and if all the message packets in the message queue are overtime in the overload monitoring period, the message queue is in an overload state; 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 delay processing is carried out on the message packets in the message queue.
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 a buffering period.
When the message queue is in an overload state, the system enters a buffer period, starts timing operation of the buffer period, and monitors the enqueue time and dequeue time of each message packet in the message queue in the buffer period. In one embodiment, the step of determining whether the message queue is in an overload state according to the enqueuing time and the dequeuing time of the message packet includes the following substeps, and the flow chart is shown in fig. 2:
s210, obtaining the enqueuing time of the message packet entering the message queue and the dequeuing 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 enqueuing time and the dequeuing time of the message packet;
s220, comparing the delay time with a threshold range of a preset delay time, and determining whether the message packet is in a timeout state according to a comparison result;
s230, if all the message packets are in the overtime state in the buffer period, the message queue is in the overload state.
Specifically, the system enters a buffer period, starts timing the buffer period, obtains time information of each message packet entering the message queue and leaving the message queue, obtains the dequeue time of each message packet in the buffer period and a time stamp on the message packet, which characterizes the enqueuing time of the message packet, calculates the time difference between the enqueuing time and the dequeue time, wherein the time difference is the delay time of the message packet in the message queue, and if the delay time exceeds a preset duration, the time of the message packet is overtime. The overtime state of each message packet in the buffer period is detected in the above manner, if each message packet in the buffer period is in the overtime state, the step S130 is entered, and if the non-overtime message packet is detected in the buffer period, the step S140 is entered.
The embodiment of the application compares the time difference between the enqueuing time and the dequeuing time of the message packets with the preset delay time, judges whether the current message queue is overloaded according to the comparison results of all the message packets dequeued from the message queue in the buffer period, has simple mode and accurate result, and can determine whether the subsequent packet loss operation is carried out or not based on the judgment result.
In one embodiment, before the step of determining whether the timing time exceeds the buffering period, determining the duration of the buffering period, where a flow chart is shown in fig. 3, includes the following sub-steps:
s310, determining delay time of the message packet according to the enqueue time and the dequeue time of the message packet;
s320, a distribution model of the delay time of each process is built according to the delay time of each message packet belonging to the same process.
Counting the delay time of each message packet in the same process to obtain a distribution model of each process about the delay time, wherein the distribution model can be a distribution function or a distribution curve of the delay time, if the delay time distribution of each message packet in the process is normal distribution, performing data fitting according to the delay time of each message packet to obtain a distribution function of each process, and obtaining a mathematical expected value, a maximum value and a variance of the distribution function.
S330, determining the buffer period duration 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 the delay time comprises: if the distribution models of the processes are consistent, determining the buffer period duration according to the variance of the process distribution model; if the distribution models of the processes are inconsistent, carrying out 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 models of the processes have consistency, wherein the consistency of the distribution models of the processes means that: the types of the distribution functions of the characterization distribution models are consistent, the difference between the maximum values of the distribution functions is in 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 said to be 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 square values of differences between each sample value and the average of all sample values, and represents the degree of deviation from the center, and is used for measuring fluctuation of data, namely, the larger the variance, the larger the fluctuation of data is, and the more unstable the fluctuation of data is, namely, the size of the current data deviating from the average is, and the sample capacity is the same.
The lack of consistency between the distribution models of the multiple processes means that: and if the distribution models of the processes are inconsistent, the buffer period duration is determined according to the delay time distribution of each message packet in the process.
In one embodiment, the step of determining the buffer period duration according to the slope of the distribution curve includes the following substeps, the flow chart of which is shown in fig. 4:
s410, obtaining the slope of a distribution curve corresponding to the current moment;
s420, when the slope of the distribution curve is positive, calculating the buffer period duration 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 buffer period duration according to the second duration time.
Specifically, delay time of each message packet in a process is obtained, data fitting is carried out on each delay time to obtain a delay curve, the fitting algorithm comprises linear fitting or nonlinear fitting, a 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 positive, 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 negative, the delay time corresponding to the current moment is obtained, the second duration of the delay time corresponding to the current moment from the current moment to the 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 value 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 there is no consistency between the distribution models of the multiple processes, the process of determining the buffer period duration according to the delay time of each message packet in the process is as follows: the distribution curve fitted according to the delay time of each message packet is shown in fig. 5, assuming that the period of each buffer period (the reference numbers 1 to 5 in fig. 5 are 5 buffer periods) is 100ms, detecting that a timeout information packet exists in the queue in one period (the 1 period in fig. 5), the next period (the reference number 2 in fig. 5) is an observation period, detecting that all the queued 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 periods to perform data fitting, for example, selecting the message delay time information of the 1 st, 2 nd and 3 th periods in fig. 5 to perform data fitting calculation, obtaining the distribution curve of the delay time, determining the slope of the fitting curve corresponding to the time if the buffer period duration corresponding to the current moment is to obtain, determining the slope of the fitting curve corresponding to the current moment, if the slope of the fitting curve corresponding to obtain the current moment is positive, indicating that the delay time of the message packet has deterioration condition, continuously increasing the delay time on the distribution curve corresponding to the next moment, setting the buffer period of a fixed duration according to the maximum value or variance of the current distribution function, for the buffer period, for the first buffer period, for which is the first buffer period, for which can be set to be the fixed buffer period for 1200ms. 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 from the current delay time to a preset delay time along the current distribution curve is calculated, wherein the second time length is a second buffer time length, the preset delay time is set according to the actual condition of the equipment, if the preset delay time can be set to be 5ms, namely, the delay time of the message packet is within 5ms and belongs to an acceptable range, and the message packet is in a normal processing state.
Further, if the slope of the current fitted curve is a negative value, in order to avoid the second period from being too long, an upper limit period is set for the second buffer period, and in this embodiment, the upper limit period of the second buffer period is preferably set to be three times the fixed period, for example: the fixed duration of the buffer period is 1200ms, and the duration of the second buffer period does not exceed 3600 ms.
And S130, when the buffer period is exceeded and the message queue is in an overload state, selectively losing the message packets according to a packet loss strategy.
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 packets of the messages according to a packet loss strategy.
The packet loss strategy in the embodiment of the application can equally treat all the information packets in a tail part discarding mode without distinguishing the grades of the information packets, and discard the information packets at the tail part of the queue until the queue is decongested when the overload occurs, or discard the information packets in a random mode.
In one embodiment, as shown in fig. 6, in addition to steps S110 to S130, the implementation process of the packet loss method for overload of the message queue further includes: and S140, when the buffer period is exceeded and the message queue is not in an overload state, entering an overload recovery monitoring period, and carrying out state monitoring on the message packets in the message queue in the overload recovery monitoring period.
The exceeding the buffer period and the message queue not being in an overload state includes: a message packet that has not timed out is detected during 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 a non-overtime message packet, entering an overload recovery monitoring period, and carrying out state detection on the message queue; and S160, executing the step of selectively losing the message packets according to a packet loss strategy when the message packets in the overtime state exist in the message queue in the overload recovery monitoring period.
Further, the embodiment of the application also provides a flow control method of the message queue, a flow diagram of which is shown in fig. 7, comprising:
s710, judging the overtime state of each message packet in the message queue according to the enqueue time and dequeue time of the message packet;
s720, if the information packets in the message queue are overtime, starting timing operation on the overload buffer period, and if all the information packets are detected to be overtime in the overload buffer period, the message queue enters an overload state;
s730, performing packet loss operation according to the packet loss method in any one of the above technical schemes.
According to the embodiment, whether the message queue enters an overload state is judged through the overtime state of the message packet, if so, the packet is lost according to the packet loss scheme to control the flow of the queue, and the buffer period mechanism is introduced into the packet loss scheme, so that the unnecessary packet loss quantity can be remarkably reduced, the quantity of retransmission messages in a system is reduced, and the availability of the system is improved.
In one embodiment, as shown in fig. 8, in addition to steps S710 to S730, the implementation process of the flow control method of the message queue further includes S740, and if no timeout message packet is detected in the overload buffer period, the message queue is in a normal state.
In one embodiment, as shown in fig. 8, after the step of performing the packet loss operation, the method further includes:
and S750, if the packet loss operation is not detected in the overload recovery buffer period, the message queue is recovered to a normal state.
The embodiment of the application provides two ways for judging whether the message queue is in a normal state, wherein one way is that no overtime message packet is detected in an overload buffering period, and the other way is that no packet loss operation is detected in an overload recovery buffering period, which indicates that the message queue has solved the congestion problem, is recovering to be normal, does not need to carry out the packet loss operation, and forms a complete closed loop scheme with the scheme provided in the steps S710 to S730, thereby realizing the flow control of the message queue.
Still further, an embodiment of the present application further provides a computer readable storage medium, on which computer instructions are stored, where the instructions, when executed by a processor, implement a packet loss method according to any one of the foregoing technical solutions or a flow control method for a message queue according to any one of the foregoing technical solutions. Wherein 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 Memory), RAMs (Random AcceSS Memory ), EPROMs (EraSable Programmable Read-Only Memory), EEPROMs (Electrically EraSable Programmable Read-Only Memory), flash Memory, 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). And may be a read-only memory, a magnetic or optical disk, etc.
Still further, an embodiment of the present application further provides a computer apparatus, including:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of flow control for a message queue of any of the preceding claims.
Fig. 9 is a block diagram illustrating a system for 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 that further includes one or more processors, and memory resources represented by memory 932, for storing instructions, such as application programs, 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, processing component 922 is configured to execute instructions to perform the steps of the flow control method of message queues described above.
The computer device 900 may also include a power supply component 926 configured to perform power management for 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. The computer device 900 may operate based on an operating system stored in memory 932, such as Windows ServerTM, 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, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
It should be understood that each functional unit in the embodiments of the present application may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules.
The foregoing is only a partial embodiment of the present application, and it should be noted that it will be apparent to those skilled in the art that modifications and adaptations can be made without departing from the principles of the present application, and such modifications and adaptations are intended to be comprehended within the scope of the present application.

Claims (9)

1. A packet loss method for overload of a message queue, comprising:
when a message queue is in an overload state, carrying out delay processing on a message packet in the message queue;
timing the time when the message packet enters the message queue and leaves the message queue, judging whether the message queue is in an overload state according to the enqueuing time and the dequeuing time of the message packet, determining the delay time of the message queue according to the enqueuing time and the dequeuing 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, determining the duration of a buffer period based on the distribution model of the delay time, and judging whether the timing time exceeds the buffer period;
the step of determining the buffer period duration based on the distribution model of the delay time comprises the following steps:
if the distribution models of the processes are consistent, determining the buffer period duration according to the variance of the process distribution model;
if the distribution models of the processes are inconsistent, carrying out data fitting on the delay time of each message packet in the process to obtain a distribution curve, and obtaining the slope of the distribution curve corresponding to the current moment;
when the slope of the distribution curve is positive, calculating the buffer period duration according to the variance of the process distribution model;
when the slope of the distribution curve is negative, calculating a second duration time required by the delay time to be reduced to a preset delay time according to the slope of the distribution curve corresponding to the current moment, and determining a buffer period duration according to the second duration time;
and when the buffer period is exceeded and the message queue is in an overload state, selectively losing the message packets according to a packet loss strategy.
2. The packet loss method according to claim 1, further comprising:
and when the buffer period is exceeded and the message queue is not in an overload state, monitoring the state of the message packets in the message queue in the overload recovery monitoring period.
3. The method for packet loss according to claim 1, further comprising, after the step of selectively dropping the message packet according to a packet loss policy:
if the message queue has a non-overtime message packet, entering an overload recovery monitoring period, and carrying out state monitoring on the message queue;
and in the overload recovery monitoring period, when the message packets in the overtime state exist in the message queue, executing the step of selectively losing the message packets according to the packet loss strategy.
4. The method for packet loss according to claim 1, wherein 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 comprises:
the enqueuing time of the message packet entering the message queue and the dequeuing time of the message packet leaving the message queue are obtained, and the delay time of the message packet is determined according to the time difference between the enqueuing time and the dequeuing time of the message packet;
comparing the delay time with a threshold range of a preset delay time, and determining whether the message packet is in a timeout state according to a comparison result;
if all the message packets are in the overtime state in the buffer period, the message queue is in the overload state.
5. A method for flow control of a message queue, comprising:
judging the overtime state of each message packet in the message queue according to the enqueuing time and the dequeuing time of the message packet;
if the information packets in the message queue are overtime, starting timing operation on the overload buffer period, and if all the information packets are detected to be overtime in the overload buffer period, the message queue enters an overload state;
the packet loss operation is performed according to the packet loss method according to any one of claims 1 to 4.
6. The method of flow control for a message queue of claim 5, further comprising:
if no overtime message packet is detected in the overload buffer period, the message queue is in a normal state.
7. The method for controlling flow of a message queue as claimed in claim 5, wherein after said step of performing a packet loss operation, further comprising:
and if the packet loss operation is not detected in the overload buffer period, the message queue is restored to the normal state.
8. A computer readable storage medium storing computer instructions which, when run on a computer, cause the computer to perform the packet loss method of any one of the preceding claims 1 to 4 or the flow control method of the message queue of any one of the preceding claims 5 to 7.
9. A computer device, the computer device comprising:
one or more processors;
storage means for storing one or more programs,
the 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 loss method of any of claims 1 to 4 or the flow control method of the message queue of any of claims 5 to 7.
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 CN111385218A (en) 2020-07-07
CN111385218B true 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

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

Also Published As

Publication number Publication date
CN111385218A (en) 2020-07-07

Similar Documents

Publication Publication Date Title
CN111385218B (en) Packet loss and flow control method for overload of message queue, storage medium and equipment
US8340099B2 (en) Control of background data transfers
EP3135009B1 (en) Method and apparatus for network congestion control based on transmission rate gradients
CN101924603B (en) Self-adaption adjusting method, device and system of data transmission rate
US8761012B2 (en) Packet relay apparatus and method of relaying packet
US20020188648A1 (en) Active queue management with flow proportional buffering
US20190394527A1 (en) Machine learning based packet service classification methods for experience-centric cellular scheduling
US20090268747A1 (en) Communication apparatus
EP3289802B1 (en) Apparatus and method for controlling downlink throughput in communication system
US20020169880A1 (en) Method and device for robust real-time estimation of the bottleneck bandwidth in the internet
US8081644B2 (en) Method and device for controlling a queue buffer
CN108600118B (en) Message processing method and device and electronic equipment
EP1704684B1 (en) Method and device for controlling a queue buffer
US20130170342A1 (en) Data communication systems and methods
EP2664178B1 (en) Adaptive relative bit-rate manager for TCP depending flow control
WO2017192341A1 (en) Modified slow start for background connections
EP2887591A1 (en) Packet congestion processing method and apparatus
US6990073B1 (en) Data packet congestion management technique
CN113315720B (en) Data flow control method, system and equipment
US20080291833A1 (en) Method for buffer control for network device
WO2024001763A1 (en) Data transmission processing method and device, storage medium, and electronic device
CN113572655A (en) Congestion detection method and system for loss-free network
JP2009278532A (en) Transmission apparatus and congestion control method
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