CN112291158A - Flow control method and device - Google Patents

Flow control method and device Download PDF

Info

Publication number
CN112291158A
CN112291158A CN202011193502.2A CN202011193502A CN112291158A CN 112291158 A CN112291158 A CN 112291158A CN 202011193502 A CN202011193502 A CN 202011193502A CN 112291158 A CN112291158 A CN 112291158A
Authority
CN
China
Prior art keywords
flow
target
value
preset
written
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.)
Pending
Application number
CN202011193502.2A
Other languages
Chinese (zh)
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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202011193502.2A priority Critical patent/CN112291158A/en
Publication of CN112291158A publication Critical patent/CN112291158A/en
Pending legal-status Critical Current

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/22Traffic shaping
    • H04L47/225Determination of shaping rate, e.g. using a moving window
    • 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/25Flow control; Congestion control with rate being modified by the source upon detecting a change of network conditions

Landscapes

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

Abstract

The present disclosure provides a flow control method and apparatus, which can detect a flow value generated in a unit time of a target system, record a flow value, which is greater than or equal to a first preset threshold and has a time interval with a last recorded target flow value smaller than a preset time interval, as a target flow value, and adjust a flow upper limit of the target system based on the target flow value when the number of the target flow values is greater than or equal to a preset number. The embodiment of the disclosure can effectively reflect that the target system has high flow rate in a short time and is in a risk state; furthermore, when the number of the target flow values is greater than or equal to the preset number, the upper flow limit of the target system is adjusted according to the recorded target flow values, so that the situation that the upper flow limit of the target system is reduced due to transient fluctuation of the flow can be reduced, and the target system can provide more stable service.

Description

Flow control method and device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a flow control method and apparatus.
Background
Some systems, when in use, receive a large number of access or call requests in a short time, requiring the system to have high concurrency capability to process multiple requests in parallel. Because the processing capacity of the system is limited, the system needs to be protected to prevent the system from being crashed due to too high load.
Generally, the system may be protected by limiting the flow rate and controlling the upper limit value of the request processed by the system in a unit time. However, limiting the upper limit of the traffic may cause the processing of some requests to be delayed, the efficiency of the system for processing the requests may be reduced, and how to ensure the working efficiency and safety of the system at the same time becomes an important issue in the technical field.
Disclosure of Invention
The embodiment of the disclosure at least provides a flow control method and a flow control device.
In a first aspect, an embodiment of the present disclosure provides a flow control method, including:
monitoring a flow value generated in a unit time of a target system;
recording the monitored flow value which is greater than or equal to a first preset threshold value and the time interval between the monitored flow value and the target flow value recorded last time is smaller than a preset time interval as a target flow value;
when the number of the target flow values is larger than or equal to a preset number, adjusting the upper flow limit of the target system based on the target flow values; wherein the traffic cap is used to control the number of users accessing the target system; the upper flow limit is greater than the first preset threshold.
In an optional embodiment, the recording the monitored flow value greater than or equal to the first preset threshold and having a time interval with the last recorded target flow value smaller than a preset time interval as the target flow value comprises:
sequentially writing the monitored flow values to be written which are greater than or equal to the first preset threshold value into a target queue for recording target flow values;
when monitoring a new flow value to be written, if the number of the target flow values stored in the target queue reaches the preset number, deleting the target flow value written first in the target queue, and then writing the new flow value to be written into the target queue;
and if the time interval between the new flow value to be written and the latest target flow value in the target queue is monitored to be larger than the preset time interval, emptying the target queue, and writing the new flow value to be written into the emptied target queue.
In an optional embodiment, the adjusting the upper flow limit of the target system based on the target flow value includes:
determining the average value of the latest preset number of target flow values in the target flow values;
determining a target flow upper limit value corresponding to the average value based on the average value;
and adjusting the flow upper limit of the target system based on the target flow upper limit value.
In an optional implementation manner, the determining, based on the average value, a target upper flow limit value corresponding to the average value includes:
and determining the target flow upper limit value corresponding to the average value based on the threshold value interval where the average value is located and the target flow upper limit values corresponding to different threshold value intervals.
In an optional implementation manner, the determining, based on the average value, a target upper flow limit value corresponding to the average value includes:
determining a correction weight of the upper flow limit based on the average value;
and determining the target flow upper limit based on the correction weight and the first preset threshold.
In an optional implementation manner, the determining, based on the average value, a target upper flow limit value corresponding to the average value includes:
and if the average value is larger than a second preset threshold, taking a preset flow upper limit value corresponding to the second preset threshold as the target flow upper limit value.
In a second aspect, an embodiment of the present disclosure further provides a flow control device, including:
the monitoring module is used for monitoring a flow value generated in unit time of a target system;
the recording module is used for recording the monitored flow value which is greater than or equal to a first preset threshold value and the time interval between the monitored flow value and the target flow value recorded last time is smaller than the preset time interval as the target flow value;
the adjusting module is used for adjusting the upper flow limit of the target system based on the target flow value when the number of the target flow values is larger than or equal to the preset number; wherein the traffic cap is used to control the number of users accessing the target system; the upper flow limit is greater than the first preset threshold.
In an optional implementation manner, the recording module is specifically configured to:
sequentially writing the monitored flow values to be written which are greater than or equal to the first preset threshold value into a target queue for recording target flow values;
when monitoring a new flow value to be written, if the number of the target flow values stored in the target queue reaches the preset number, deleting the target flow value written first in the target queue, and then writing the new flow value to be written into the target queue;
and if the time interval between the new flow value to be written and the latest target flow value in the target queue is monitored to be larger than the preset time interval, emptying the target queue, and writing the new flow value to be written into the emptied target queue.
In an optional implementation manner, the adjusting module is specifically configured to:
determining the average value of the latest preset number of target flow values in the target flow values;
determining a target flow upper limit value corresponding to the average value based on the average value;
and adjusting the flow upper limit of the target system based on the target flow upper limit value.
In an optional implementation manner, when determining the target flow upper limit value corresponding to the average value based on the average value, the adjusting module is specifically configured to:
and determining the target flow upper limit value corresponding to the average value based on the threshold value interval where the average value is located and the target flow upper limit values corresponding to different threshold value intervals.
In an optional implementation manner, when determining the target flow upper limit value corresponding to the average value based on the average value, the adjusting module is specifically configured to:
determining a correction weight of the upper flow limit based on the average value;
and determining the target flow upper limit based on the correction weight and the first preset threshold.
In an optional implementation manner, when determining the target flow upper limit value corresponding to the average value based on the average value, the adjusting module is specifically configured to:
and if the average value is larger than a second preset threshold, taking a preset flow upper limit value corresponding to the second preset threshold as the target flow upper limit value.
In a third aspect, an embodiment of the present disclosure further provides a computer device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect described above, or any possible implementation of the first aspect.
In a fourth aspect, this disclosed embodiment also provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps in the first aspect or any one of the possible implementation manners of the first aspect.
For the description of the effects of the flow control device, the computer device, and the computer readable storage medium, reference is made to the description of the flow control method, which is not repeated herein.
The flow control method and the flow control device provided by the embodiment of the disclosure can detect the flow value generated in the unit time of the target system, record the flow value which is greater than or equal to the first preset threshold and has the time interval with the target flow value recorded last time smaller than the preset time interval as the target flow value, and adjust the upper flow limit of the target system based on the target flow value when the number of the target flow values is greater than or equal to the preset number. Because the time interval between the recorded adjacent target flow values is smaller than the preset time interval and is greater than or equal to the first preset threshold, the high flow rate of the target system in a short time can be effectively reflected and the target system is in a risk state; furthermore, when the number of the target flow values is greater than or equal to the preset number, the upper flow limit of the target system is adjusted according to the recorded target flow values, so that the situation that the upper flow limit of the target system is reduced due to transient fluctuation of the flow can be reduced, and the target system can provide more stable service.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
Fig. 1 shows a flow chart of a flow control method provided by an embodiment of the present disclosure;
FIG. 2 illustrates a schematic diagram of a flow control device provided by an embodiment of the present disclosure;
fig. 3 shows a schematic diagram of a computer device provided by an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure, presented in the figures, is not intended to limit the scope of the claimed disclosure, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making creative efforts, shall fall within the protection scope of the disclosure.
Research shows that in order to protect the normal operation of the system, the flow of the system is generally limited when a large number of access or call requests exist, and the upper limit value of the processing request of the system in unit time is reduced, so that the system processes the limited request in the same time, and the operation pressure of the system is further reduced. The upper limit of the flow is limited to cause that the processing of some requests is delayed, the efficiency of the system for processing the requests is reduced, when the flow control is performed, the flow of the system is usually monitored, and when the flow higher than the safety threshold is monitored, the upper limit of the flow of the system is adjusted, the flow of the system often fluctuates briefly, and suddenly increases in a short period of time and then returns to normal, at this time, the system is usually judged to be in a risk state, and the upper limit of the flow is adjusted, but the system is not actually in the risk state, so that the working efficiency of the system is reduced. Therefore, how to ensure the working efficiency and safety of the system at the same time becomes an important problem in the technical field.
Based on the above research, the embodiments of the present disclosure provide a flow control method, where a time interval between adjacent recorded target flow values is smaller than a preset time interval and greater than or equal to a first preset threshold, so that it can be effectively reflected that a target system is at a risk state and has a high flow rate in a short time; furthermore, when the number of the target flow values is greater than or equal to the preset number, the upper flow limit of the target system is adjusted according to the recorded target flow values, so that the situation that the upper flow limit of the target system is reduced due to transient fluctuation of the flow can be reduced, and the target system can provide more stable service.
The above-mentioned drawbacks are the results of the inventor after practical and careful study, and therefore, the discovery process of the above-mentioned problems and the solutions proposed by the present disclosure to the above-mentioned problems should be the contribution of the inventor in the process of the present disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
To facilitate understanding of the present embodiment, first, a flow control method disclosed in an embodiment of the present disclosure is described in detail, where an execution subject of the flow control method provided in an embodiment of the present disclosure is generally a computer device with certain computing capability, and the computer device includes, for example: terminal devices or servers or other processing devices, and the servers may be distributed servers. The following describes a flow control method provided in the embodiments of the present disclosure by taking an execution subject as a server.
Referring to fig. 1, a flowchart of a flow control method provided in the embodiment of the present disclosure is shown, where the method includes steps S101 to S103, where:
s101: and monitoring the flow value generated by the target system in unit time.
In this step, the flow value generated by the target system in a unit time may be continuously monitored, where the unit time may be 1 second, and the flow value may be the number of access or call requests received by the target system in the unit time.
Here, the target system may be a distributed system, and the monitoring range may include a plurality of terminal devices in a cluster of the distributed system, and the plurality of terminal devices may be monitored by the same monitoring process.
S102: and recording the monitored flow value which is greater than or equal to the first preset threshold value and the time interval between the monitored flow value and the target flow value recorded last time is less than the preset time interval as the target flow value.
In this step, a monitored flow value that is greater than or equal to a first preset threshold and a time interval between the monitored flow value and a last recorded target flow value that is less than a preset time interval may be recorded as a target flow value, where the first preset threshold may be determined according to a flow value range that can be carried by a target system, for example, if the flow of the target system continues to exceed 5000 for a period of time and there is a risk of system crash, the first preset threshold may be set to a value lower than 5000, such as 4000, 4500, and the like.
In one possible implementation, step S102 may include:
sequentially writing the monitored flow values to be written which are greater than or equal to the first preset threshold value into a target queue for recording target flow values;
when monitoring a new flow value to be written, if the number of the target flow values stored in the target queue reaches the preset number, deleting the target flow value written first in the target queue, and then writing the new flow value to be written into the target queue;
and if the time interval between the new flow value to be written and the latest target flow value in the target queue is monitored to be larger than the preset time interval, emptying the target queue, and writing the new flow value to be written into the emptied target queue.
In this step, when the traffic value to be written which is greater than or equal to the first preset threshold value is monitored, the traffic value to be written may be written into the target queue, and the traffic value stored in the target queue is the target traffic value. The target queue may store a plurality of target traffic values, and the target traffic values in the target queue may be in chronological order.
For example, the upper limit (team) of the target queue capable of storing the traffic value may be set to 3 or 5, and when the length of team is 5, the target queue may occupy 7 storage spaces, where 5 storage spaces may be used to store the traffic value respectively, 1 storage space may be used to store the average value of the target traffic value, 1 storage space may be used to store the timestamp of the latest recorded target traffic value, each storage space may be of a positive type int, and occupies 4 bytes, and the space complexity is low.
Here, the number of storage spaces in the target queue for storing the traffic value may coincide with a preset number. When a new flow to be written is monitored, if the storage space of the target queue is full, the target flow which is written into the target queue firstly can be deleted, so that the target flow value stored in the target queue is kept in the latest state.
Further, if the time interval between the new flow value to be written and the latest target flow value in the target queue is monitored to be larger than the preset time interval, emptying the target queue, and writing the new flow value to be written into the target queue.
Illustratively, the preset time interval may be 30 minutes. When the time interval between the flow value to be written and the latest target flow value is greater than the preset time interval, the time span between the two is considered to be too large, and pressure cannot be caused on the target system.
S103: when the number of the target flow values is larger than or equal to a preset number, adjusting the upper flow limit of the target system based on the target flow values; wherein the traffic cap is used to control the number of users accessing the target system; the upper flow limit is greater than the first preset threshold.
In this step, when the number of the target flow values is greater than or equal to the preset number, the upper limit of the flow of the target system may be adjusted according to the recorded target flow values.
When the number of the target flow values is larger than or equal to the preset number, the system is considered to have high flow for many times in a short time, and the system may be affected, and then flow control is started, and the upper limit of the flow of the target system is adjusted to protect the target system, so that the target system is prevented from being incapable of normally operating due to overhigh load.
In one possible embodiment, adjusting the upper flow limit of the target system based on the target flow value includes:
determining the average value of the latest preset number of target flow values in the target flow values;
determining a target flow upper limit value corresponding to the average value based on the average value;
and adjusting the flow upper limit of the target system based on the target flow upper limit value.
In the step, the average value of the target flow value is calculated, and then the target flow upper limit value is determined based on the average value, so that the average value can integrally reflect the overall flow level of the target system in a period of time, and the problem of error flow limitation caused by uneven instantaneous flow can be reduced.
In a possible implementation manner, determining, based on the average value, a target flow upper limit value corresponding to the average value may include:
and determining the target flow upper limit value corresponding to the average value based on the threshold value interval where the average value is located and the target flow upper limit values corresponding to different threshold value intervals.
In this way, different threshold intervals may be set according to the risk degree of the flow rate of different thresholds to the system, each threshold interval may correspond to a flow rate upper limit value, and when the average value of the target flow rate is in one threshold interval, the flow rate upper limit value corresponding to the threshold interval may be used as the target flow rate upper limit value.
In a possible implementation manner, determining, based on the average value, a target flow upper limit value corresponding to the average value may include:
determining a correction weight of the upper flow limit based on the average value;
and determining the target flow upper limit based on the correction weight and the first preset threshold.
In this way, the correction weight of the upper flow limit may be determined based on the ratio between the average value and the risk flow, and the correction weight may be smaller when the average value is larger, and the flow limit to the target system may be stronger when the average value is high.
Compared with a mode of determining the target flow upper limit value according to different threshold intervals, the target flow upper limit value determined by the mode can be better adapted to the current flow of the target system, and the system safety and the working efficiency can be better coordinated.
In a possible implementation manner, determining, based on the average value, a target flow upper limit value corresponding to the average value may include:
and if the average value is larger than a second preset threshold, taking a preset flow upper limit value corresponding to the second preset threshold as the target flow upper limit value.
In this step, the average value may be directly compared with a second preset threshold, and if the average value is greater than the second preset threshold, a preset upper flow limit corresponding to the second preset threshold is used as the target upper flow limit.
Compared with the mode of determining the target flow upper limit value according to different threshold intervals and the mode of determining the target flow upper limit value according to the correction weight, the mode needs less setting, and the second preset threshold and the preset flow upper limit value can be set to relatively conservative values, so that the safety of the system can be protected better.
The flow control method provided by the embodiment of the disclosure can detect the flow value generated in the unit time of the target system, record the flow value which is greater than or equal to the first preset threshold and has the time interval with the last recorded target flow value smaller than the preset time interval as the target flow value, and adjust the upper flow limit of the target system based on the target flow value when the number of the target flow values is greater than or equal to the preset number. Because the time interval between the recorded adjacent target flow values is smaller than the preset time interval and is greater than or equal to the first preset threshold, the high flow rate of the target system in a short time can be effectively reflected and the target system is in a risk state; furthermore, when the number of the target flow values is greater than or equal to the preset number, the upper flow limit of the target system is adjusted according to the recorded target flow values, so that the situation that the upper flow limit of the target system is reduced due to transient fluctuation of the flow can be reduced, and the target system can provide more stable service.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same inventive concept, a traffic processing device corresponding to the traffic processing method is also provided in the embodiments of the present disclosure, and because the principle of solving the problem of the device in the embodiments of the present disclosure is similar to the traffic processing method in the embodiments of the present disclosure, the implementation of the device may refer to the implementation of the method, and repeated details are not described again.
Referring to fig. 2, which is a schematic diagram of an architecture of a traffic processing apparatus according to an embodiment of the present disclosure, the traffic processing apparatus 200 includes: a monitoring module 210, a recording module 220, and an adjusting module 230; wherein the content of the first and second substances,
a monitoring module 210 for monitoring a flow value generated by the target system in a unit time;
the recording module 220 is configured to record, as a target flow value, a flow value that is greater than or equal to a first preset threshold and has a time interval with a target flow value that is recorded last time that is less than a preset time interval;
an adjusting module 230, configured to adjust an upper flow limit of the target system based on the target flow value when the number of the target flow values is greater than or equal to a preset number; wherein the traffic cap is used to control the number of users accessing the target system; the upper flow limit is greater than the first preset threshold.
In the embodiment of the disclosure, the time interval between the recorded adjacent target flow values is smaller than the preset time interval and is greater than or equal to the first preset threshold, so that the high flow of the target system in a short time can be effectively reflected and the target system is in a risk state; furthermore, when the number of the target flow values is greater than or equal to the preset number, the upper flow limit of the target system is adjusted according to the recorded target flow values, so that the situation that the upper flow limit of the target system is reduced due to transient fluctuation of the flow can be reduced, and the target system can provide more stable service.
In an optional implementation manner, the recording module 220 is specifically configured to:
sequentially writing the monitored flow values to be written which are greater than or equal to the first preset threshold value into a target queue for recording target flow values;
when monitoring a new flow value to be written, if the number of the target flow values stored in the target queue reaches the preset number, deleting the target flow value written first in the target queue, and then writing the new flow value to be written into the target queue;
and if the time interval between the new flow value to be written and the latest target flow value in the target queue is monitored to be larger than the preset time interval, emptying the target queue, and writing the new flow value to be written into the emptied target queue.
In an optional implementation manner, the adjusting module 230 is specifically configured to:
determining the average value of the latest preset number of target flow values in the target flow values;
determining a target flow upper limit value corresponding to the average value based on the average value;
and adjusting the flow upper limit of the target system based on the target flow upper limit value.
In an optional implementation manner, when determining the target flow upper limit value corresponding to the average value based on the average value, the adjusting module 230 is specifically configured to:
and determining the target flow upper limit value corresponding to the average value based on the threshold value interval where the average value is located and the target flow upper limit values corresponding to different threshold value intervals.
In an optional implementation manner, when determining the target flow upper limit value corresponding to the average value based on the average value, the adjusting module 230 is specifically configured to:
determining a correction weight of the upper flow limit based on the average value;
and determining the target flow upper limit based on the correction weight and the first preset threshold.
In an optional implementation manner, when determining the target flow upper limit value corresponding to the average value based on the average value, the adjusting module 230 is specifically configured to:
and if the average value is larger than a second preset threshold, taking a preset flow upper limit value corresponding to the second preset threshold as the target flow upper limit value.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
Based on the same technical concept, the embodiment of the disclosure also provides computer equipment. Referring to fig. 3, a schematic structural diagram of a computer device 300 provided in the embodiment of the present disclosure includes a processor 301, a memory 302, and a bus 303. The memory 302 is used for storing execution instructions and includes a memory 3021 and an external memory 3022; the memory 3021 is also referred to as an internal memory, and is used for temporarily storing operation data in the processor 301 and data exchanged with an external memory 3022 such as a hard disk, the processor 301 exchanges data with the external memory 3022 through the memory 3021, and when the computer device 300 is operated, the processor 301 communicates with the memory 302 through the bus 303, so that the processor 301 executes the following instructions:
monitoring a flow value generated in a unit time of a target system;
recording the monitored flow value which is greater than or equal to a first preset threshold value and the time interval between the monitored flow value and the target flow value recorded last time is smaller than a preset time interval as a target flow value;
when the number of the target flow values is larger than or equal to a preset number, adjusting the upper flow limit of the target system based on the target flow values; wherein the traffic cap is used to control the number of users accessing the target system; the upper flow limit is greater than the first preset threshold.
In one possible embodiment, the instructions executed by the processor 301 to record, as the target flow value, the monitored flow value that is greater than or equal to the first preset threshold and whose time interval with the last recorded target flow value is smaller than the preset time interval include:
sequentially writing the monitored flow values to be written which are greater than or equal to the first preset threshold value into a target queue for recording target flow values;
when monitoring a new flow value to be written, if the number of the target flow values stored in the target queue reaches the preset number, deleting the target flow value written first in the target queue, and then writing the new flow value to be written into the target queue;
and if the time interval between the new flow value to be written and the latest target flow value in the target queue is monitored to be larger than the preset time interval, emptying the target queue, and writing the new flow value to be written into the emptied target queue.
In one possible embodiment, the processor 301 executes instructions that, when adjusting the upper flow limit of the target system based on the target flow value, include:
determining the average value of the latest preset number of target flow values in the target flow values;
determining a target flow upper limit value corresponding to the average value based on the average value;
and adjusting the flow upper limit of the target system based on the target flow upper limit value.
In a possible implementation, the determining, by the processor 301, the target upper flow limit value corresponding to the average value based on the average value includes:
and determining the target flow upper limit value corresponding to the average value based on the threshold value interval where the average value is located and the target flow upper limit values corresponding to different threshold value intervals.
In a possible implementation, the determining, by the processor 301, the target upper flow limit value corresponding to the average value based on the average value includes:
determining a correction weight of the upper flow limit based on the average value;
and determining the target flow upper limit based on the correction weight and the first preset threshold.
In a possible implementation, the determining, by the processor 301, the target upper flow limit value corresponding to the average value based on the average value includes:
and if the average value is larger than a second preset threshold, taking a preset flow upper limit value corresponding to the second preset threshold as the target flow upper limit value.
The embodiments of the present disclosure also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the flow control method in the foregoing method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute the steps of the flow control method in the foregoing method embodiments, which may be referred to specifically for the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (10)

1. A method of flow control, comprising:
monitoring a flow value generated in a unit time of a target system;
recording the monitored flow value which is greater than or equal to a first preset threshold value and the time interval between the monitored flow value and the target flow value recorded last time is smaller than a preset time interval as a target flow value;
when the number of the target flow values is larger than or equal to a preset number, adjusting the upper flow limit of the target system based on the target flow values; wherein the traffic cap is used to control the number of users accessing the target system; the upper flow limit is greater than the first preset threshold.
2. The method of claim 1, wherein recording the monitored flow value as the target flow value, wherein the monitored flow value is greater than or equal to a first preset threshold value and has a time interval with a last recorded target flow value that is less than a preset time interval, comprises:
sequentially writing the monitored flow values to be written which are greater than or equal to the first preset threshold value into a target queue for recording target flow values;
when monitoring a new flow value to be written, if the number of the target flow values stored in the target queue reaches the preset number, deleting the target flow value written first in the target queue, and then writing the new flow value to be written into the target queue;
and if the time interval between the new flow value to be written and the latest target flow value in the target queue is monitored to be larger than the preset time interval, emptying the target queue, and writing the new flow value to be written into the emptied target queue.
3. The method of claim 1, wherein said adjusting the upper flow limit of the target system based on the target flow value comprises:
determining the average value of the latest preset number of target flow values in the target flow values;
determining a target flow upper limit value corresponding to the average value based on the average value;
and adjusting the flow upper limit of the target system based on the target flow upper limit value.
4. The method of claim 3, wherein the determining the target upper flow limit value corresponding to the average value based on the average value comprises:
and determining the target flow upper limit value corresponding to the average value based on the threshold value interval where the average value is located and the target flow upper limit values corresponding to different threshold value intervals.
5. The method of claim 3, wherein the determining the target upper flow limit value corresponding to the average value based on the average value comprises:
determining a correction weight of the upper flow limit based on the average value;
and determining the target flow upper limit based on the correction weight and the first preset threshold.
6. The method of claim 3, wherein the determining the target upper flow limit value corresponding to the average value based on the average value comprises:
and if the average value is larger than a second preset threshold, taking a preset flow upper limit value corresponding to the second preset threshold as the target flow upper limit value.
7. A flow control device, comprising:
the monitoring module is used for monitoring a flow value generated in unit time of a target system;
the recording module is used for recording the monitored flow value which is greater than or equal to a first preset threshold value and the time interval between the monitored flow value and the target flow value recorded last time is smaller than the preset time interval as the target flow value;
the adjusting module is used for adjusting the upper flow limit of the target system based on the target flow value when the number of the target flow values is larger than or equal to the preset number; wherein the traffic cap is used to control the number of users accessing the target system; the upper flow limit is greater than the first preset threshold.
8. The apparatus of claim 7, wherein the recording module is specifically configured to:
sequentially writing the monitored flow values to be written which are greater than or equal to the first preset threshold value into a target queue for recording target flow values;
when monitoring a new flow value to be written, if the number of the target flow values stored in the target queue reaches the preset number, deleting the target flow value written first in the target queue, and then writing the new flow value to be written into the target queue;
and if the time interval between the new flow value to be written and the latest target flow value in the target queue is monitored to be larger than the preset time interval, emptying the target queue, and writing the new flow value to be written into the emptied target queue.
9. A computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when a computer device is running, the machine-readable instructions when executed by the processor performing the steps of the flow control method of any one of claims 1 to 6.
10. A computer-readable storage medium, having stored thereon a computer program for performing the steps of the flow control method according to any one of claims 1 to 6 when executed by a processor.
CN202011193502.2A 2020-10-30 2020-10-30 Flow control method and device Pending CN112291158A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011193502.2A CN112291158A (en) 2020-10-30 2020-10-30 Flow control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011193502.2A CN112291158A (en) 2020-10-30 2020-10-30 Flow control method and device

Publications (1)

Publication Number Publication Date
CN112291158A true CN112291158A (en) 2021-01-29

Family

ID=74352986

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011193502.2A Pending CN112291158A (en) 2020-10-30 2020-10-30 Flow control method and device

Country Status (1)

Country Link
CN (1) CN112291158A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105357228A (en) * 2015-12-19 2016-02-24 中国人民解放军信息工程大学 Burst traffic detection method based on dynamic threshold
US20170272371A1 (en) * 2016-03-21 2017-09-21 Alibaba Group Holding Limited Flow control in connection with an access request
CN110650060A (en) * 2019-10-16 2020-01-03 中国联合网络通信集团有限公司 Processing method, equipment and storage medium for flow alarm
CN111262791A (en) * 2020-01-08 2020-06-09 江苏满运软件科技有限公司 Flow control method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105357228A (en) * 2015-12-19 2016-02-24 中国人民解放军信息工程大学 Burst traffic detection method based on dynamic threshold
US20170272371A1 (en) * 2016-03-21 2017-09-21 Alibaba Group Holding Limited Flow control in connection with an access request
CN110650060A (en) * 2019-10-16 2020-01-03 中国联合网络通信集团有限公司 Processing method, equipment and storage medium for flow alarm
CN111262791A (en) * 2020-01-08 2020-06-09 江苏满运软件科技有限公司 Flow control method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108551465B (en) Server concurrency control method and device, computer equipment and storage medium
CN111756601B (en) Microservice architecture monitoring method and device, computer equipment and readable storage medium
CN111966449B (en) Virtual machine backup management method, system, terminal and storage medium
CN108874324B (en) Access request processing method, device, equipment and readable storage medium
US11442832B2 (en) Managing synchronized reboot of a system
CN111723057A (en) File pre-reading method, device, equipment and storage medium
CN110990245A (en) Micro-service operation state judgment method and device based on call chain data
CN114143327B (en) Cluster resource quota allocation method and device and electronic equipment
CN111385359A (en) Load processing method and device of object gateway
EP2776941B1 (en) Managing capacity in a data center by suspending tenants
CN112667467A (en) Cluster self-adaptive current limiting method and device, computer equipment and storage medium
CN112291158A (en) Flow control method and device
CN115174358B (en) Monitoring processing method, system, equipment and storage medium for storage cluster interface
CN110855484A (en) Method, system, electronic device and storage medium for automatically detecting traffic change
CN111400087A (en) Control method of operating system, terminal and storage medium
CN115344214A (en) Data reading and writing method, device, server and computer readable storage medium
CN114968945A (en) Data retention management method and device, storage medium and equipment
CN112269721B (en) Method, system, equipment and readable storage medium for performance data statistics
CN111026677B (en) Cache allocation method, system, terminal and storage medium based on EMA algorithm
CN114513469A (en) Traffic shaping method and device for distributed system and storage medium
CN112463754B (en) Data node switching method and device in HDFS (Hadoop distributed File System) and computer equipment
CN115543698B (en) Data backup method, device, equipment and storage medium
CN112711386B (en) Storage capacity detection method and device of storage device and readable storage medium
CN109901923B (en) Frequency limiting method, frequency limiting device and readable storage medium
CN107357672B (en) Data processing method and device

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210129