WO2017211265A1 - Speed limiting method and apparatus, and storage medium - Google Patents

Speed limiting method and apparatus, and storage medium Download PDF

Info

Publication number
WO2017211265A1
WO2017211265A1 PCT/CN2017/087298 CN2017087298W WO2017211265A1 WO 2017211265 A1 WO2017211265 A1 WO 2017211265A1 CN 2017087298 W CN2017087298 W CN 2017087298W WO 2017211265 A1 WO2017211265 A1 WO 2017211265A1
Authority
WO
WIPO (PCT)
Prior art keywords
tokens
token bucket
data packet
token
remaining
Prior art date
Application number
PCT/CN2017/087298
Other languages
French (fr)
Chinese (zh)
Inventor
杨巧顺
许煜芝
蔡立勇
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2017211265A1 publication Critical patent/WO2017211265A1/en

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/215Flow control; Congestion control using token-bucket

Definitions

  • the present invention relates to the field of communications, and in particular to a speed limiting method and apparatus, and a storage medium.
  • the token bucket algorithm is one of the most commonly used algorithms in Traffic Shaping and Rate Limiting. Typically, the token bucket algorithm is used to control the amount of data sent to the network and to allow burst data to be sent. However, the traditional token bucket algorithm has a certain deviation for the limitation of small traffic, such as:
  • the speed limit is accurate for the speed limit granularity of 1600 kbps, but for many services requiring a minimum granularity of 64 kbps or less, the speed limit obviously cannot meet the speed limit requirement.
  • the speed limit accuracy is very high, there are mainly two solutions: one is to reduce the filling period, and the other is to reduce the filling rate.
  • the embodiment of the invention provides a speed limiting method and device, and a storage medium, to at least solve the problem of how to achieve the high speed limit accuracy requirement in the related art.
  • a rate limiting method including: detecting a packet length of a token bucket, wherein the number of tokens in the token bucket includes a fractional part and an integer part; When the length of the data packet is less than the preset number of tokens, the data packet passes the check.
  • the method further includes: filling the token bucket with a specified number of tokens according to a predetermined period, and updating the remaining tokens in the token bucket to the following number: the preset order A sum of the number of cards and the specified number, wherein the specified number of tokens includes a fractional part and an integer part.
  • the method further includes: when the number of remaining tokens is greater than the capacity of the token bucket, updating the remaining number of tokens in the token bucket to the following number: the token bucket Capacity.
  • the method further includes: updating the remaining number of tokens in the token bucket to the following number: a difference between the preset number of tokens and the length of the data packet value.
  • the method further includes: discarding the data packet when the data packet length is greater than the number of tokens in the token bucket.
  • a rate limiting apparatus including: a detecting module configured to detect a packet length that passes through a token bucket, wherein the number of tokens in the token bucket includes a fractional part and An integer portion; a determining module configured to pass the check when determining that the data packet length is less than a preset number of tokens.
  • the determining module is further configured to fill the token bucket with a specified number of tokens according to a predetermined period, and update the remaining tokens in the token bucket to the following number: the preset A sum of the number of tokens and the specified number, wherein the specified number of tokens includes a fractional part and an integer part.
  • the number of remaining tokens is greater than the capacity of the token bucket, The number of remaining tokens in the token bucket is updated to the following number: the capacity of the token bucket.
  • the number of remaining tokens in the token bucket is updated to the following number: a difference between the preset number of tokens and the length of the data packet.
  • the determining module is further configured to discard the data packet when the data packet length is greater than the number of tokens in the token bucket.
  • a rate limiting apparatus comprising a processor and a memory for storing a computer program executable on the processor,
  • processor is configured to perform the steps of the method described above when the computer program is executed.
  • a computer readable storage medium having stored thereon a computer program, wherein the computer program is executed by a processor to implement the steps of the method described above.
  • the token bucket is used to limit the rate of the data packet.
  • the number of tokens in the token bucket according to the embodiment of the present invention includes a fractional part and an integer part, the token having the fractional part is used.
  • the bucket can achieve the purpose of speed limit of the data packet with higher precision, solves the problem that the high speed limit accuracy cannot be realized in the related art, and greatly improves the accuracy of the token bucket speed limit.
  • FIG. 1 is a flow chart of a speed limiting method according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of a token bucket speed limit according to an alternative embodiment of the present invention.
  • FIG. 3 is a schematic diagram of token bucket token filling in an alternative embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a filling rate metering method 1 according to an alternative embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a second method of filling rate measurement according to an alternative embodiment of the present invention.
  • FIG. 6 is a structural block diagram of a speed limiting device according to an embodiment of the present invention.
  • Token bucket is a common flow control technology.
  • the token bucket itself has no discard and priority policies.
  • the token bucket algorithm is one of the most commonly used algorithms for network traffic shaping and rate limiting. Typically, the token bucket algorithm is used to control the amount of data sent to the network and to allow burst data to be sent.
  • the capacity of the token bucket described in the foregoing embodiment is the depth of the token bucket in the related art, and the unit is bit.
  • the abstract meaning is similar to the depth of the bucket.
  • PON Passive Optical Network
  • FIG. 1 is a flowchart of a speed limiting method according to an embodiment of the present invention. As shown in FIG. 1 , the process includes the following steps. :
  • Step S102 detecting a data packet length that passes through the token bucket, where the number of tokens in the token bucket includes a fractional part and an integer part;
  • Step S104 when it is determined that the data packet length is less than the preset number of tokens, the data packet passes the check.
  • the number of tokens with a fractional part is used to limit the rate of the packets passing through the token bucket, which solves the problem that the speed limit of the token bucket is low in the related art, and the order is greatly improved.
  • the accuracy of the speed limit of the barrel is greatly improved.
  • the number of remaining tokens in the token bucket is updated to the following number: the difference between the preset number of tokens and the length of the data packet.
  • the number of remaining tokens in the token bucket needs to be supplemented with the number of tokens after the token bucket has verified the data packet.
  • the token bucket is filled with the specified number of tokens according to a predetermined period. And updating the remaining number of tokens in the token bucket to the following number: a sum of the preset number of tokens and the specified number, wherein the specified number of tokens includes a fractional part and an integer part. The number of tokens with a fractional part is added when the number of tokens is added to the token bucket.
  • the number of remaining tokens in the token bucket is updated to the following number: capacity of the token bucket.
  • the capacity of the token bucket is the depth of the token bucket in the related technology, which indicates the maximum number of tokens stored in the token bucket, similar to the meaning of the capacity of the bucket.
  • the data packet length is less than the number of tokens, and the data packet is verified. If the data packet length is greater than the number of tokens, the data packet is limited in speed, and the data packet is lost.
  • the rate limit is improved by modifying the filling rate. Accuracy.
  • the maximum rate of the 1G PON optical network (1G Ethernet-PON, EPON for short) is considered.
  • the tokens are filled, ie each fill can be filled to exactly 1/8, 1/16, 1/32, or even smaller token units.
  • the maximum speed limit requirement is 3.75G (upstream 1.25G, downlink 2.5G shares one token bucket), the filling rate requirement is:
  • the total bandwidth calculated in the case of the token has an 8-bit fractional portion in the embodiment of the present invention, that is, 1/256 tokens can be filled per padding period.
  • FIG. 2 is a schematic diagram of a token bucket speed limit according to an alternative embodiment of the present invention.
  • the token speed limit bucket includes a token bucket capable of automatically filling a token, and the token bucket is limited by speed. Fill token memory, token bucket capacity memory, and residual token memory.
  • the speed limit token bucket compare whether the packet length (in bytes) is greater than the number of tokens in the remaining token bucket. If the packet length is greater than the number of tokens, the packet is discarded. In this way, the speed limit effect is achieved; if the packet length is less than the remaining number of tokens, the data packet passes, and the number of remaining tokens in the remaining token bucket is subtracted from the packet length to obtain a new remaining token number.
  • FIG. 3 is a schematic diagram of token bucket token filling in an alternative embodiment of the present invention.
  • the filling of the rate-limiting token bucket is filled in a fixed period. For example, if the filling period is 1000, then every 1000 clocks. The period fills the token bucket with one token, and finally adds the number of filled tokens plus the number of tokens in the remaining token buckets as the new number of remaining tokens.
  • the number of remaining tokens and the filling rate in the token bucket are both decimal places, and the lower 8 bits are decimal places.
  • FIG. 4 is a schematic diagram of a filling rate metering method 1 according to an alternative embodiment of the present invention. As shown in FIG. 4, assuming that the minimum speed limit of 6.25 kbps is currently reached, the filling rate is
  • FIG. 5 is a schematic diagram of a second method of filling rate measurement according to an alternative embodiment of the present invention.
  • the filling rate is 2343.75
  • the integer part 2343 is shifted to the left by 8 bits.
  • the lower 8 bits record the fractional part, that is, 0.75 tokens.
  • the final padding rate token bucket memory measurement method is as shown in FIG. 5, the lower 8 bits record 0.75 tokens, and the high 24 bits record 2343 tokens.
  • the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present invention which is essential or contributes to the prior art, can be embodied in the form of a software product stored in a storage medium (such as a read only memory (ROM, Read). Only Memory)/Random Access Memory (RAM), including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the present invention.
  • a storage medium such as a read only memory (ROM, Read). Only Memory)/Random Access Memory (RAM)
  • a speed limiting device is also provided in the embodiment, and the device is used to implement the above embodiments and preferred embodiments, and the description thereof has been omitted.
  • the term "module” A combination of software and/or hardware that can implement a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
  • FIG. 6 is a structural block diagram of a speed limiting apparatus according to an embodiment of the present invention. As shown in FIG. 6, the apparatus includes:
  • the detecting module 62 is configured to detect a data packet length that passes through the token bucket, where the number of tokens in the token bucket includes a fractional part and an integer part;
  • the determining module 64 is connected to the detecting module 62 and configured to pass the check when determining that the data packet length is less than the preset number of tokens.
  • the determining module 64 is further configured to fill the token bucket with a specified number of tokens according to a predetermined period, and update the remaining number of tokens in the token bucket to the following number: the preset number of tokens And the specified number of sum values, wherein the specified number of tokens includes a fractional part and an integer part.
  • the number of remaining tokens is greater than the capacity of the token bucket, the number of remaining tokens in the token bucket is updated to the following number: capacity of the token bucket.
  • the number of remaining tokens in the token bucket is updated to the following number: a difference between the preset number of tokens and the length of the data packet.
  • the determining module 64 is further configured to discard the data packet when the data packet length is greater than the number of tokens in the token bucket.
  • each of the above modules may be implemented by software or hardware.
  • the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the above modules are in any combination.
  • the forms are located in different processors.
  • the speed limiting apparatus includes: a processor and a memory for storing a computer program executable on the processor, wherein the processor is configured to execute the computer program, execute the embodiment 1 steps of the method.
  • the processor may be an integrated circuit chip with signal processing capabilities.
  • each step of the above method may be completed by an integrated logic circuit of hardware in a processor or an instruction in a form of software.
  • the above processor may be a general purpose processor, a digital signal processor (DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, or the like.
  • the processor may implement or perform the methods, steps, and logic blocks disclosed in the embodiments of the present invention.
  • a general purpose processor can be a microprocessor or any conventional processor or the like.
  • the steps of the method disclosed in the embodiment of the present invention may be directly implemented as a hardware decoding processor, or may be performed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a storage medium, the storage medium being located in the memory, the processor reading the information in the memory, and completing the steps of the foregoing methods in combination with the hardware thereof.
  • Embodiments of the present invention also provide a computer readable storage medium, such as a memory including a computer program executable by a processor of a rate limiting device to perform the steps described in the foregoing methods.
  • the computer readable storage medium may be a magnetic random access memory (FRAM), a ROM, a Programmable Read-Only Memory (PROM), an Erasable programmable read only memory (EPROM, Erasable).
  • Programmable Read-Only Memory Programmable Read-Only Memory
  • Flash Memory Magnetic Surface Memory, Optical Disk, or Read Only Disc (CD-ROM) Memory such as Compact Disc Read-Only Memory; or various devices including one or any combination of the above memories.
  • the computer readable storage medium stores a computer program, wherein when the computer program is executed by the processor, the following steps are implemented:
  • the processor executes the method steps described in Embodiment 1 according to the computer program stored in the storage medium.
  • modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the embodiment of the present invention can use a token bucket to limit a data packet.
  • the number of tokens in the token bucket includes a fractional part and an integer part, so that the token bucket can be used to use the token bucket.
  • the speed limit is higher, which solves the problem that the high speed limit accuracy cannot be realized in the related art, and the accuracy of the token bucket speed limit is greatly improved.

Abstract

Provided are a speed limiting method and apparatus, and a storage medium. The method comprises: detecting the length of a data packet passing through a token bucket, wherein the number of tokens in the token bucket comprises a decimal part and an integral part; and when it is determined that the length of the data packet is less than a pre-set token number, the data packet passing verification. By means of the technical solution, the problem in the relevant art that a high speed limiting precision cannot be realized is solved, and the speed limiting precision of a token bucket is greatly improved.

Description

限速方法及装置、存储介质Speed limiting method and device, storage medium
相关申请的交叉引用Cross-reference to related applications
本申请基于申请号为201610397490.2、申请日为2016年06月06日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。The present application is filed on the basis of the Chinese Patent Application No. No. No. No. No. No. No. No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
技术领域Technical field
本发明涉及通信领域,具体而言,涉及一种限速方法及装置、存储介质。The present invention relates to the field of communications, and in particular to a speed limiting method and apparatus, and a storage medium.
背景技术Background technique
在互联网领域,限流技术被用作控制网络接口收发通信数据的速率,可以用来优化性能,减少延迟和提高带宽等。In the Internet world, current limiting technology is used to control the rate at which network interfaces send and receive communication data, which can be used to optimize performance, reduce latency, and increase bandwidth.
令牌桶算法是网络流量整形(Traffic Shaping)和速率限制(Rate Limiting)中最常使用的一种算法。典型情况下,令牌桶算法用来控制发送到网络上的数据的数目,并允许突发数据的发送。但是传统的令牌桶算法针对小流量的限制存在一定的偏差,如:The token bucket algorithm is one of the most commonly used algorithms in Traffic Shaping and Rate Limiting. Typically, the token bucket algorithm is used to control the amount of data sent to the network and to allow burst data to be sent. However, the traditional token bucket algorithm has a certain deviation for the limitation of small traffic, such as:
假设系统主频为200MHZ,速率填充周期设置为1000(1000为典型值,1000个时钟填充一次令牌),每个填充周期填充1个令牌(一个令牌等于一个字节),那么总带宽为:[(200×106)/1000]×8=1600kbps。Suppose the system clocked at 200 MHz, the rate fill period is set to 1000 (1000 is typical, 1000 clocks are filled with one token), and each fill period is filled with 1 token (one token is equal to one byte), then the total bandwidth It is: [(200 × 10 6 ) / 1000] × 8 = 1600 kbps.
此时,针对限速颗粒度为1600kbps时,限速才准确,但是对于很多业务要求最小颗粒度达到64kbps甚至更小的限速要求时,这种限速显然是不能达到限速要求的。相关技术中针对这种对限速精度要求很高的问题,主要有如下两种解决方法:一种是缩小填充周期,另一种是降低填充速率。 At this time, the speed limit is accurate for the speed limit granularity of 1600 kbps, but for many services requiring a minimum granularity of 64 kbps or less, the speed limit obviously cannot meet the speed limit requirement. In the related art, for such a problem that the speed limit accuracy is very high, there are mainly two solutions: one is to reduce the filling period, and the other is to reduce the filling rate.
针对相关技术中如何达到高限速精度要求的问题,目前还没有有效的解决方案。There is currently no effective solution to the problem of how to achieve high speed limit accuracy requirements in the related art.
发明内容Summary of the invention
本发明实施例提供了一种限速方法及装置、存储介质,以至少解决相关技术中如何达到高限速精度要求的问题。The embodiment of the invention provides a speed limiting method and device, and a storage medium, to at least solve the problem of how to achieve the high speed limit accuracy requirement in the related art.
根据本发明的一个实施例,提供了一种限速方法,包括:检测经过令牌桶的数据包长度,其中,所述令牌桶中的令牌数包括小数部分和整数部分;在确定所述数据包长度小于预设令牌数时,所述数据包通过检验。According to an embodiment of the present invention, a rate limiting method is provided, including: detecting a packet length of a token bucket, wherein the number of tokens in the token bucket includes a fractional part and an integer part; When the length of the data packet is less than the preset number of tokens, the data packet passes the check.
可选地,所述方法还包括:按照预定周期向所述令牌桶中填充指定数量的令牌,并将所述令牌桶中的剩余令牌数更新为以下数目:所述预设令牌数与所述指定数量的和值,其中,所述指定数量的令牌包括小数部分和整数部分。Optionally, the method further includes: filling the token bucket with a specified number of tokens according to a predetermined period, and updating the remaining tokens in the token bucket to the following number: the preset order A sum of the number of cards and the specified number, wherein the specified number of tokens includes a fractional part and an integer part.
可选地,所述方法还包括:在所述剩余令牌数大于所述令牌桶的容量时,将所述令牌桶的中的剩余令牌数更新为以下数目:所述令牌桶的容量。Optionally, the method further includes: when the number of remaining tokens is greater than the capacity of the token bucket, updating the remaining number of tokens in the token bucket to the following number: the token bucket Capacity.
可选地,所述数据包通过检验之后,所述方法还包括:将所述令牌桶中的剩余令牌数更新为以下数目:所述预设令牌数与所述数据包长度的差值。Optionally, after the data packet passes the verification, the method further includes: updating the remaining number of tokens in the token bucket to the following number: a difference between the preset number of tokens and the length of the data packet value.
可选地,在检测经过令牌桶的数据包长度之后,所述方法还包括:在所述数据包长度大于所述令牌桶中的令牌数时,将所述数据包丢弃。Optionally, after detecting the length of the data packet passing through the token bucket, the method further includes: discarding the data packet when the data packet length is greater than the number of tokens in the token bucket.
根据本发明的另一个实施例,提供了一种限速装置,包括:检测模块,配置为检测经过令牌桶的数据包长度,其中,所述令牌桶中的令牌数包括小数部分和整数部分;确定模块,配置为在确定所述数据包长度小于预设令牌数时,所述数据包通过检验。According to another embodiment of the present invention, a rate limiting apparatus is provided, including: a detecting module configured to detect a packet length that passes through a token bucket, wherein the number of tokens in the token bucket includes a fractional part and An integer portion; a determining module configured to pass the check when determining that the data packet length is less than a preset number of tokens.
可选地,所述确定模块还配置为按照预定周期向所述令牌桶中填充指定数量的令牌,并将所述令牌桶中的剩余令牌数更新为以下数目:所述预设令牌数与所述指定数量的和值,其中,所述指定数量的令牌包括小数部分和整数部分。可选地,在所述剩余令牌数大于所述令牌桶的容量时,将 所述令牌桶的中的剩余令牌数更新为以下数目:所述令牌桶的容量。Optionally, the determining module is further configured to fill the token bucket with a specified number of tokens according to a predetermined period, and update the remaining tokens in the token bucket to the following number: the preset A sum of the number of tokens and the specified number, wherein the specified number of tokens includes a fractional part and an integer part. Optionally, when the number of remaining tokens is greater than the capacity of the token bucket, The number of remaining tokens in the token bucket is updated to the following number: the capacity of the token bucket.
可选地,所述数据包通过检验之后,将所述令牌桶中的剩余令牌数更新为以下数目:所述预设令牌数与所述数据包长度的差值。Optionally, after the data packet passes the verification, the number of remaining tokens in the token bucket is updated to the following number: a difference between the preset number of tokens and the length of the data packet.
可选地,在检测经过令牌桶的数据包长度之后,所述确定模块还配置为在所述数据包长度大于所述令牌桶中的令牌数时,将所述数据包丢弃。Optionally, after detecting the length of the data packet passing through the token bucket, the determining module is further configured to discard the data packet when the data packet length is greater than the number of tokens in the token bucket.
根据本发明的又一个实施例,提供了一种限速装置,包括处理器和用于存储能够在处理器上运行的计算机程序的存储器,In accordance with yet another embodiment of the present invention, a rate limiting apparatus is provided comprising a processor and a memory for storing a computer program executable on the processor,
其中,所述处理器用于运行所述计算机程序时,执行以上所述方法的步骤。Wherein the processor is configured to perform the steps of the method described above when the computer program is executed.
根据本发明的又一个实施例,还提供了一种计算机可读存储介质,其上存储有计算机程序,其中,该计算机程序被处理器执行时实现以上所述方法的步骤。According to still another embodiment of the present invention, there is also provided a computer readable storage medium having stored thereon a computer program, wherein the computer program is executed by a processor to implement the steps of the method described above.
通过本发明实施例,使用令牌桶对数据包进行限速,这里,由于本发明实施例记载的令牌桶中的令牌数包括小数部分和整数部分,所以,使用存在小数部分的令牌桶即可实现对数据包进行精度更高的限速的目的,解决了相关技术中不能实现高限速精度的问题,大幅提高了令牌桶限速的精度。In the embodiment of the present invention, the token bucket is used to limit the rate of the data packet. Here, since the number of tokens in the token bucket according to the embodiment of the present invention includes a fractional part and an integer part, the token having the fractional part is used. The bucket can achieve the purpose of speed limit of the data packet with higher precision, solves the problem that the high speed limit accuracy cannot be realized in the related art, and greatly improves the accuracy of the token bucket speed limit.
附图说明DRAWINGS
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The drawings described herein are intended to provide a further understanding of the invention, and are intended to be a part of the invention. In the drawing:
图1是根据本发明实施例的一种限速方法的流程图;1 is a flow chart of a speed limiting method according to an embodiment of the present invention;
图2是根据本发明可选实施例的令牌桶限速原理图;2 is a schematic diagram of a token bucket speed limit according to an alternative embodiment of the present invention;
图3是根据本发明可选实施例中的令牌桶令牌填充示意图;3 is a schematic diagram of token bucket token filling in an alternative embodiment of the present invention;
图4是根据本发明可选实施例的填充速率计量方法一的示意图;4 is a schematic diagram of a filling rate metering method 1 according to an alternative embodiment of the present invention;
图5是根据本发明可选实施例的填充速率计量方法二的示意图;5 is a schematic diagram of a second method of filling rate measurement according to an alternative embodiment of the present invention;
图6是根据本发明实施例的一种限速装置的结构框图。 FIG. 6 is a structural block diagram of a speed limiting device according to an embodiment of the present invention.
具体实施方式detailed description
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。The invention will be described in detail below with reference to the drawings in conjunction with the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It is to be understood that the terms "first", "second" and the like in the specification and claims of the present invention are used to distinguish similar objects, and are not necessarily used to describe a particular order or order.
令牌桶是一种常用的流量控制技术。令牌桶本身没有丢弃和优先级策略,令牌桶算法是网络流量整形和速率限制中最常使用的一种算法。典型情况下,令牌桶算法用来控制发送到网络上的数据的数目,并允许突发数据的发送。Token bucket is a common flow control technology. The token bucket itself has no discard and priority policies. The token bucket algorithm is one of the most commonly used algorithms for network traffic shaping and rate limiting. Typically, the token bucket algorithm is used to control the amount of data sent to the network and to allow burst data to be sent.
在上述实施例中记载的令牌桶的容量即相关技术中的令牌桶深度,单位为bit,抽象的意义类似于水桶的深度。The capacity of the token bucket described in the foregoing embodiment is the depth of the token bucket in the related art, and the unit is bit. The abstract meaning is similar to the depth of the bucket.
实施例1Example 1
本申请的实施例应用于无源光纤网络(Passive Optical Network,简称为PON)。需要说明的是,本申请文件记载的技术方案可以应用于上述场景但不局限于上述场景。The embodiment of the present application is applied to a Passive Optical Network (PON). It should be noted that the technical solutions described in this application can be applied to the above scenarios, but are not limited to the above scenarios.
在本实施例中提供了一种运行于上述网络架构的一种限速方法,图1是根据本发明实施例的一种限速方法的流程图,如图1所示,该流程包括如下步骤:In this embodiment, a rate limiting method is provided in the network architecture. FIG. 1 is a flowchart of a speed limiting method according to an embodiment of the present invention. As shown in FIG. 1 , the process includes the following steps. :
步骤S102,检测经过令牌桶的数据包长度,其中,该令牌桶中的令牌数包括小数部分和整数部分;Step S102, detecting a data packet length that passes through the token bucket, where the number of tokens in the token bucket includes a fractional part and an integer part;
步骤S104,在确定该数据包长度小于预设令牌数时,该数据包通过检验。Step S104, when it is determined that the data packet length is less than the preset number of tokens, the data packet passes the check.
通过上述步骤,采用带有小数部分的令牌数对经过令牌桶的数据包进行限速,解决了相关技术中使用令牌桶限速精度低的问题,大幅提高了令 牌桶限速的精度。Through the above steps, the number of tokens with a fractional part is used to limit the rate of the packets passing through the token bucket, which solves the problem that the speed limit of the token bucket is low in the related art, and the order is greatly improved. The accuracy of the speed limit of the barrel.
在上述可选实施例对通过令牌桶的数据包限速之后,将该令牌桶中的剩余令牌数更新为以下数目:该预设令牌数与该数据包长度的差值。令牌桶的剩余令牌数在令牌桶检验过数据包之后,需要补充令牌数,在本发明的一个可选实施例中,按照预定周期向该令牌桶中填充指定数量的令牌,并将该令牌桶中的剩余令牌数更新为以下数目:该预设令牌数与该指定数量的和值,其中,该指定数量的令牌包括小数部分和整数部分。在向令牌桶补充令牌数时补充的就是带小数部分的令牌数。可选地,在该剩余令牌数大于该令牌桶的容量时,将该令牌桶的中的剩余令牌数更新为以下数目:该令牌桶的容量。令牌桶的容量即相关技术中令牌桶深度,表示令牌桶中最大存储的令牌数目,类似水桶的容量表示的含义。After the rate limit of the data packet passing through the token bucket is limited, the number of remaining tokens in the token bucket is updated to the following number: the difference between the preset number of tokens and the length of the data packet. The number of remaining tokens in the token bucket needs to be supplemented with the number of tokens after the token bucket has verified the data packet. In an optional embodiment of the present invention, the token bucket is filled with the specified number of tokens according to a predetermined period. And updating the remaining number of tokens in the token bucket to the following number: a sum of the preset number of tokens and the specified number, wherein the specified number of tokens includes a fractional part and an integer part. The number of tokens with a fractional part is added when the number of tokens is added to the token bucket. Optionally, when the number of remaining tokens is greater than the capacity of the token bucket, the number of remaining tokens in the token bucket is updated to the following number: capacity of the token bucket. The capacity of the token bucket is the depth of the token bucket in the related technology, which indicates the maximum number of tokens stored in the token bucket, similar to the meaning of the capacity of the bucket.
可选地,数据包长度小于令牌数目,该数据包通过检验,如果数据包长度大于令牌数,将该数据包进行限速,将该数据包丢失。Optionally, the data packet length is less than the number of tokens, and the data packet is verified. If the data packet length is greater than the number of tokens, the data packet is limited in speed, and the data packet is lost.
在本发明的一个可选实施例中,在系统主频为200MHZ及填充周期1000(1000为典型值,1000个时钟填充一次令牌)固定不变的情况下,通过修改填充速率来提高限速准确度。In an optional embodiment of the present invention, when the system frequency is 200 MHz and the filling period is 1000 (1000 is a typical value, 1000 clocks are filled with a token), the rate limit is improved by modifying the filling rate. Accuracy.
在相关技术中,令牌桶算法都是以一个字节作为最小计算单元,填充速率是以字节为单位进行令牌填充,为了达到更小的颗粒度,通常都是通过增大或者缩小填充周期来达到精度要求,如为了达到64kbps的颗粒度要求,将填充周期设置为(主频200×106)/(64×103/8)=25000(表示25000个时钟填充一次令牌),但当限速达到20Mbps时甚至更高时,每个周期填充(20×106×25000)/[(200×106)×8]=312字节,这种填充方式由于填充周期过长,对小字节数据包造成波动性丢包。In the related art, the token bucket algorithm uses one byte as the minimum calculation unit, and the padding rate is token filling in units of bytes. In order to achieve smaller granularity, it is usually done by increasing or decreasing the padding. Cycle to meet the accuracy requirements, such as to achieve the 64kbps granularity requirement, set the fill period to (main frequency 200 × 10 6 ) / (64 × 10 3 / 8) = 25000 (indicating 25000 clocks to fill a token), However, when the speed limit reaches 20 Mbps or even higher, each period is filled (20 × 10 6 × 25000) / [(200 × 10 6 ) × 8] = 312 bytes. This filling method is too long due to the filling period. Causes volatility drops on small byte packets.
本发明的一个可选实施例,为了让数据包平滑的通过,同时考虑到1G PON光网络最大速率(1G以太无源光网络(Ethernet-PON,简称为EPON) 上下行共2Gbps速率,1G无源光接入系统(Gigabit-Capable PON,简称为GPON)上下行共3.75Gbps速率),保留了较小的填充周期,将填充周期令牌单位精确到1/n个令牌进行填充,即每次填充可以精确到1/8、1/16、1/32,甚至更小的令牌单位进行填充。In an optional embodiment of the present invention, in order to smooth the data packet, the maximum rate of the 1G PON optical network (1G Ethernet-PON, EPON for short) is considered. Uplink and downlink total 2Gbps rate, 1G passive optical access system (Gigabit-Capable PON, referred to as GPON) uplink and downlink total 3.75Gbps rate), retaining a small filling period, the filling period token unit is accurate to 1/n The tokens are filled, ie each fill can be filled to exactly 1/8, 1/16, 1/32, or even smaller token units.
如对于相关技术中大部分GPON光网络最高限速要求为3.75G(上行1.25G,下行2.5G共用一个令牌桶)而言,填充速率要求为:For example, for most GPON optical networks in the related art, the maximum speed limit requirement is 3.75G (upstream 1.25G, downlink 2.5G shares one token bucket), the filling rate requirement is:
(3.75×109)/([(200×106)/1000]×8)=2343.75字节,整数部分2343只占11个bit位。所以对于32位操作系统,如果令牌的小数部分用8个bit表示,整数部分用24bit表示,已经可以达到最大限速要求。(3.75 × 10 9 ) / ([(200 × 10 6 ) / 1000] × 8) = 2343.75 bytes, the integer part 2343 only accounts for 11 bits. So for a 32-bit operating system, if the fractional part of the token is represented by 8 bits and the integer part is represented by 24 bits, the maximum speed limit requirement can already be reached.
而对8bit小数部分,最小颗粒度可以达到6.25kbps,计算如下::1600/256=6.25kbps,1600在本申请文件背景技术中有记载,(是在填充周期为1000,每个填充周期填充一个令牌的情况下算出的总带宽),对于本发明的实施例中有8bit的小数部分,即每个填充周期可以填充1/256个令牌。For the 8-bit fractional part, the minimum granularity can reach 6.25 kbps, and the calculation is as follows: 1600/256=6.25 kbps, 1600 is described in the background of the present application, (it is filled in a filling period of 1000, and each filling period is filled with one The total bandwidth calculated in the case of the token) has an 8-bit fractional portion in the embodiment of the present invention, that is, 1/256 tokens can be filled per padding period.
图2是根据本发明可选实施例的令牌桶限速原理图,如图2所示,令牌限速桶中包含一个能自动填充令牌的令牌桶,该令牌桶由限速填充令牌存储器,令牌桶容量存储器,剩余令牌存储器组成。FIG. 2 is a schematic diagram of a token bucket speed limit according to an alternative embodiment of the present invention. As shown in FIG. 2, the token speed limit bucket includes a token bucket capable of automatically filling a token, and the token bucket is limited by speed. Fill token memory, token bucket capacity memory, and residual token memory.
当数据包经过限速令牌桶时,先比较数据包长度(以字节为单位)是否大于剩余令牌桶中令牌数,如果数据包长度大于令牌数,则将该数据包丢弃,以此达到限速效果;如果数据包长度小于剩余令牌数,则数据包通过,此时将剩余令牌桶中的剩余令牌数减去数据包长度得到新的剩余令牌数。When the data packet passes the speed limit token bucket, compare whether the packet length (in bytes) is greater than the number of tokens in the remaining token bucket. If the packet length is greater than the number of tokens, the packet is discarded. In this way, the speed limit effect is achieved; if the packet length is less than the remaining number of tokens, the data packet passes, and the number of remaining tokens in the remaining token bucket is subtracted from the packet length to obtain a new remaining token number.
图3是根据本发明可选实施例中的令牌桶令牌填充示意图,如图3所示,限速令牌桶的填充:按固定周期填充,比如填充周期为1000,则每1000个时钟周期为令牌桶填充一次令牌,最后将填充的令牌数加上剩余令牌桶中的令牌数作为新的剩余令牌数。 3 is a schematic diagram of token bucket token filling in an alternative embodiment of the present invention. As shown in FIG. 3, the filling of the rate-limiting token bucket is filled in a fixed period. For example, if the filling period is 1000, then every 1000 clocks. The period fills the token bucket with one token, and finally adds the number of filled tokens plus the number of tokens in the remaining token buckets as the new number of remaining tokens.
需要强调的是,在本申请文件中令牌桶中剩余令牌数和填充速率都是带小数位的,低8位为小数位。It should be emphasized that in the present application file, the number of remaining tokens and the filling rate in the token bucket are both decimal places, and the lower 8 bits are decimal places.
图4是根据本发明可选实施例的填充速率计量方法一的示意图,如图4所示,假设当前达到最小限速6.25kbps,则填充速率为4 is a schematic diagram of a filling rate metering method 1 according to an alternative embodiment of the present invention. As shown in FIG. 4, assuming that the minimum speed limit of 6.25 kbps is currently reached, the filling rate is
(6.25×103)/([(200×106)/1000]×8)=0.00390625字节,将整数部分0左移8位,低8位记录小数部分,即0.00390625个令牌,最后填充速率令牌桶存储器计量方法为图4所示,低8bit记录0.00390625个令牌,高24个bit记录0个令牌。(6.25×10 3 )/([(200×10 6 )/1000]×8)=0.00390625 bytes, shift the integer part 0 to the left by 8 bits, the lower 8 bits record the fractional part, ie 0.00390625 tokens, and finally fill The rate token bucket memory measurement method is shown in Figure 4. The low 8 bits record 0.00390625 tokens, and the high 24 bits record 0 tokens.
图5是根据本发明可选实施例的填充速率计量方法二的示意图,如图5所示,假设当前达到最大限速为3.75G,则填充速率为2343.75,将整数部分2343左移8位,低8位记录小数部分,即0.75个令牌,最后填充速率令牌桶存储器计量方法为图5所示,低8bit记录0.75个令牌,高24个bit记录2343个令牌。5 is a schematic diagram of a second method of filling rate measurement according to an alternative embodiment of the present invention. As shown in FIG. 5, assuming that the current maximum speed limit is 3.75G, the filling rate is 2343.75, and the integer part 2343 is shifted to the left by 8 bits. The lower 8 bits record the fractional part, that is, 0.75 tokens. The final padding rate token bucket memory measurement method is as shown in FIG. 5, the lower 8 bits record 0.75 tokens, and the high 24 bits record 2343 tokens.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如只读存储器(ROM,Read Only Memory)/随机存取存储器(RAM,Random Access Memory)、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例该的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, can be embodied in the form of a software product stored in a storage medium (such as a read only memory (ROM, Read). Only Memory)/Random Access Memory (RAM), including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the present invention. Various embodiments of the method.
实施例2Example 2
在本实施例中还提供了一种限速装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块” 可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。A speed limiting device is also provided in the embodiment, and the device is used to implement the above embodiments and preferred embodiments, and the description thereof has been omitted. As used below, the term "module" A combination of software and/or hardware that can implement a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
图6是根据本发明实施例的一种限速装置的结构框图,如图6所示,该装置包括:FIG. 6 is a structural block diagram of a speed limiting apparatus according to an embodiment of the present invention. As shown in FIG. 6, the apparatus includes:
检测模块62,配置为检测经过令牌桶的数据包长度,其中,该令牌桶中的令牌数包括小数部分和整数部分;The detecting module 62 is configured to detect a data packet length that passes through the token bucket, where the number of tokens in the token bucket includes a fractional part and an integer part;
确定模块64,与检测模块62连接,配置为在确定该数据包长度小于预设令牌数时,该数据包通过检验。The determining module 64 is connected to the detecting module 62 and configured to pass the check when determining that the data packet length is less than the preset number of tokens.
可选地,该确定模块64还配置为按照预定周期向该令牌桶中填充指定数量的令牌,并将该令牌桶中的剩余令牌数更新为以下数目:该预设令牌数与该指定数量的和值,其中,该指定数量的令牌包括小数部分和整数部分。可选地,在该剩余令牌数大于该令牌桶的容量时,将该令牌桶的中的剩余令牌数更新为以下数目:该令牌桶的容量。Optionally, the determining module 64 is further configured to fill the token bucket with a specified number of tokens according to a predetermined period, and update the remaining number of tokens in the token bucket to the following number: the preset number of tokens And the specified number of sum values, wherein the specified number of tokens includes a fractional part and an integer part. Optionally, when the number of remaining tokens is greater than the capacity of the token bucket, the number of remaining tokens in the token bucket is updated to the following number: capacity of the token bucket.
可选地,该数据包通过检验之后,将该令牌桶中的剩余令牌数更新为以下数目:该预设令牌数与该数据包长度的差值。Optionally, after the data packet passes the verification, the number of remaining tokens in the token bucket is updated to the following number: a difference between the preset number of tokens and the length of the data packet.
可选地,在检测经过令牌桶的数据包长度之后,该确定模块64还配置为在该数据包长度大于该令牌桶中的令牌数时,将该数据包丢弃。Optionally, after detecting the length of the data packet passing through the token bucket, the determining module 64 is further configured to discard the data packet when the data packet length is greater than the number of tokens in the token bucket.
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述各个模块以任意组合的形式分别位于不同的处理器中。It should be noted that each of the above modules may be implemented by software or hardware. For the latter, the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the above modules are in any combination. The forms are located in different processors.
在一具体实施例中,所述限速装置,包括:处理器和用于存储能够在处理器上运行的计算机程序的存储器,其中,所述处理器用于运行所述计算机程序时,执行实施例1所述方法的步骤。In a specific embodiment, the speed limiting apparatus includes: a processor and a memory for storing a computer program executable on the processor, wherein the processor is configured to execute the computer program, execute the embodiment 1 steps of the method.
这里,所述处理器可能是一种集成电路芯片,具有信号的处理能力。 在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器、数字信号处理器(DSP,Digital Signal Processor),或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。处理器可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本发明实施例所公开的方法的步骤,可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于存储介质中,该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成前述方法的步骤。Here, the processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in a processor or an instruction in a form of software. The above processor may be a general purpose processor, a digital signal processor (DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, or the like. The processor may implement or perform the methods, steps, and logic blocks disclosed in the embodiments of the present invention. A general purpose processor can be a microprocessor or any conventional processor or the like. The steps of the method disclosed in the embodiment of the present invention may be directly implemented as a hardware decoding processor, or may be performed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, the storage medium being located in the memory, the processor reading the information in the memory, and completing the steps of the foregoing methods in combination with the hardware thereof.
实施例3Example 3
本发明的实施例还提供了一种计算机可读存储介质,例如包括计算机程序的存储器,上述计算机程序可由限速装置的处理器执行,以完成前述方法所述步骤。计算机可读存储介质可以是磁性随机存取存储器(FRAM,ferromagnetic random access memory)、ROM、可编程只读存储器(PROM,Programmable Read-Only Memory)、可擦除可编程只读存储器(EPROM,Erasable Programmable Read-Only Memory)、电可擦除可编程只读存储器(EEPROM,Electrically Erasable Programmable Read-Only Memory)、快闪存储器(Flash Memory)、磁表面存储器、光盘、或只读光盘(CD-ROM,Compact Disc Read-Only Memory)等存储器;也可以是包括上述存储器之一或任意组合的各种设备。Embodiments of the present invention also provide a computer readable storage medium, such as a memory including a computer program executable by a processor of a rate limiting device to perform the steps described in the foregoing methods. The computer readable storage medium may be a magnetic random access memory (FRAM), a ROM, a Programmable Read-Only Memory (PROM), an Erasable programmable read only memory (EPROM, Erasable). Programmable Read-Only Memory), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash Memory, Magnetic Surface Memory, Optical Disk, or Read Only Disc (CD-ROM) Memory such as Compact Disc Read-Only Memory; or various devices including one or any combination of the above memories.
进一步地,所述计算机可读存储介质上存储有计算机程序,其中,该计算机程序被处理器执行时实现以下步骤:Further, the computer readable storage medium stores a computer program, wherein when the computer program is executed by the processor, the following steps are implemented:
S1,检测经过令牌桶的数据包长度,其中,该令牌桶中的令牌数包括小数部分和整数部分;S1. Detect a packet length of the token bucket, where the number of tokens in the token bucket includes a fractional part and an integer part.
S2,在确定该数据包长度小于预设令牌数时,该数据包通过检验。 S2. When it is determined that the data packet length is less than the preset number of tokens, the data packet passes the verification.
可选地,在本实施例中,处理器根据存储介质中已存储的计算机程序执行上述实施例1记载的方法步骤。Optionally, in this embodiment, the processor executes the method steps described in Embodiment 1 according to the computer program stored in the storage medium.
可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。For example, the specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the optional embodiments, and details are not described herein again.
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。It will be apparent to those skilled in the art that the various modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein. The steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above description is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.
工业实用性Industrial applicability
本发明实施例能够使用令牌桶对数据包进行限速,这里,所述令牌桶中的令牌数包括小数部分和整数部分,如此,使用存在小数部分的令牌桶即可对数据包进行精度更高的限速,解决了相关技术中不能实现高限速精度的问题,大幅提高了令牌桶限速的精度。 The embodiment of the present invention can use a token bucket to limit a data packet. Here, the number of tokens in the token bucket includes a fractional part and an integer part, so that the token bucket can be used to use the token bucket. The speed limit is higher, which solves the problem that the high speed limit accuracy cannot be realized in the related art, and the accuracy of the token bucket speed limit is greatly improved.

Claims (12)

  1. 一种限速方法,包括:A speed limiting method comprising:
    检测经过令牌桶的数据包长度,其中,所述令牌桶中的令牌数包括小数部分和整数部分;Detecting a packet length of the token bucket, where the number of tokens in the token bucket includes a fractional part and an integer part;
    在确定所述数据包长度小于预设令牌数时,所述数据包通过检验。When it is determined that the data packet length is less than the preset number of tokens, the data packet passes the check.
  2. 根据权利要求1所述的方法,其中,所述方法还包括:The method of claim 1 wherein the method further comprises:
    按照预定周期向所述令牌桶中填充指定数量的令牌,并将所述令牌桶中的剩余令牌数更新为以下数目:所述预设令牌数与所述指定数量的和值,其中,所述指定数量的令牌包括小数部分和整数部分。Filling the token bucket with a specified number of tokens according to a predetermined period, and updating the remaining number of tokens in the token bucket to the following number: the preset token number and the specified number of sum values Wherein the specified number of tokens comprises a fractional part and an integer part.
  3. 根据权利要求2所述的方法,其中,所述方法还包括:The method of claim 2, wherein the method further comprises:
    在所述剩余令牌数大于所述令牌桶的容量时,将所述令牌桶的中的剩余令牌数更新为以下数目:所述令牌桶的容量。When the number of remaining tokens is greater than the capacity of the token bucket, the number of remaining tokens in the token bucket is updated to the following number: the capacity of the token bucket.
  4. 根据权利要求1所述的方法,其中,所述数据包通过检验之后,所述方法还包括:The method of claim 1, wherein after the data packet passes the verification, the method further comprises:
    将所述令牌桶中的剩余令牌数更新为以下数目:所述预设令牌数与所述数据包长度的差值。Updating the number of remaining tokens in the token bucket to the following number: a difference between the preset number of tokens and the length of the data packet.
  5. 根据权利要求1所述的方法,其中,在检测经过令牌桶的数据包长度之后,所述方法还包括:The method of claim 1, wherein after detecting the length of the data packet passing through the token bucket, the method further comprises:
    在所述数据包长度大于所述令牌桶中的令牌数时,将所述数据包丢。When the length of the data packet is greater than the number of tokens in the token bucket, the data packet is lost.
  6. 一种限速装置,包括:A speed limiting device comprising:
    检测模块,配置为检测经过令牌桶的数据包长度,其中,所述令牌桶中的令牌数包括小数部分和整数部分;a detecting module, configured to detect a data packet length that passes through the token bucket, where the number of tokens in the token bucket includes a fractional part and an integer part;
    确定模块,配置为在确定所述数据包长度小于预设令牌数时,所述数据包通过检验。And a determining module configured to pass the verification when determining that the data packet length is less than a preset number of tokens.
  7. 根据权利要求6所述的装置,其中,所述确定模块还配置为按照预 定周期向所述令牌桶中填充指定数量的令牌,并将所述令牌桶中的剩余令牌数更新为以下数目:所述预设令牌数与所述指定数量的和值,其中,所述指定数量的令牌包括小数部分和整数部分。The apparatus of claim 6 wherein said determining module is further configured to follow Filling the token bucket with a specified number of tokens, and updating the remaining number of tokens in the token bucket to the following number: a sum of the preset number of tokens and the specified number, Wherein the specified number of tokens includes a fractional part and an integer part.
  8. 根据权利要求7所述的装置,其中,在所述剩余令牌数大于所述令牌桶的容量时,将所述令牌桶的中的剩余令牌数更新为以下数目:所述令牌桶的容量。The apparatus according to claim 7, wherein when the number of remaining tokens is greater than the capacity of the token bucket, the number of remaining tokens in the token bucket is updated to the following number: the token The capacity of the bucket.
  9. 根据权利要求6所述的装置,其中,所述数据包通过检验之后,将所述令牌桶中的剩余令牌数更新为以下数目:所述预设令牌数与所述数据包长度的差值。The apparatus according to claim 6, wherein, after the data packet passes the verification, the number of remaining tokens in the token bucket is updated to the following number: the preset number of tokens and the length of the data packet Difference.
  10. 根据权利要求6所述的装置,其中,在检测经过令牌桶的数据包长度之后,所述确定模块还配置为在所述数据包长度大于所述令牌桶中的令牌数时,将所述数据包丢弃。The apparatus according to claim 6, wherein after detecting a packet length of the token bucket, the determining module is further configured to: when the packet length is greater than the number of tokens in the token bucket, The data packet is discarded.
  11. 一种限速装置,包括:处理器和用于存储能够在处理器上运行的计算机程序的存储器,A speed limiting device includes: a processor and a memory for storing a computer program executable on the processor,
    其中,所述处理器用于运行所述计算机程序时,执行权利要求1至5所述方法的步骤。Wherein the processor is operative to perform the steps of the method of claims 1 to 5 when the computer program is run.
  12. 一种计算机可读存储介质,其上存储有计算机程序,其中,该计算机程序被处理器执行时实现权利要求1至5所述方法的步骤。 A computer readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the steps of the method of claims 1 to 5.
PCT/CN2017/087298 2016-06-06 2017-06-06 Speed limiting method and apparatus, and storage medium WO2017211265A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610397490.2 2016-06-06
CN201610397490.2A CN107465629A (en) 2016-06-06 2016-06-06 Method for limiting speed and device

Publications (1)

Publication Number Publication Date
WO2017211265A1 true WO2017211265A1 (en) 2017-12-14

Family

ID=60545736

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/087298 WO2017211265A1 (en) 2016-06-06 2017-06-06 Speed limiting method and apparatus, and storage medium

Country Status (2)

Country Link
CN (1) CN107465629A (en)
WO (1) WO2017211265A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113163236A (en) * 2020-01-22 2021-07-23 武汉瓯越网视有限公司 Data transmission method, device, equipment and storage medium based on frequency control
CN114915596A (en) * 2022-05-10 2022-08-16 北京奇艺世纪科技有限公司 Data transmission method, device, equipment and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109587072A (en) * 2019-01-04 2019-04-05 中企动力科技股份有限公司 Distributed system overall situation speed limiting system and method
CN111865675B (en) * 2020-07-09 2023-05-30 广州虎牙科技有限公司 Container receiving and dispatching speed limiting method, device and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1663195A (en) * 2002-06-17 2005-08-31 英特尔公司 Token bucket parameters computation for guaranteed services in a data network
CN101026561A (en) * 2007-02-09 2007-08-29 中兴通讯股份有限公司 Token bucket fill rate configuration method and device
US20070223375A1 (en) * 2006-03-23 2007-09-27 Fujitsu Limited Shaper circuit and shaper circuit combination
CN101778043A (en) * 2010-01-19 2010-07-14 华为技术有限公司 Method and device for dividing filling rate interval based on token bucket algorithm

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8411573B2 (en) * 2009-02-25 2013-04-02 Eden Rock Communications, Llc Systems and methods for hybrid rate-limiting schemes based on protocol data unit characteristics
CN104980367B (en) * 2014-04-03 2019-04-30 深圳市中兴微电子技术有限公司 A kind of limiting speed of token bucket method and apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1663195A (en) * 2002-06-17 2005-08-31 英特尔公司 Token bucket parameters computation for guaranteed services in a data network
US20070223375A1 (en) * 2006-03-23 2007-09-27 Fujitsu Limited Shaper circuit and shaper circuit combination
CN101026561A (en) * 2007-02-09 2007-08-29 中兴通讯股份有限公司 Token bucket fill rate configuration method and device
CN101778043A (en) * 2010-01-19 2010-07-14 华为技术有限公司 Method and device for dividing filling rate interval based on token bucket algorithm

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113163236A (en) * 2020-01-22 2021-07-23 武汉瓯越网视有限公司 Data transmission method, device, equipment and storage medium based on frequency control
CN114915596A (en) * 2022-05-10 2022-08-16 北京奇艺世纪科技有限公司 Data transmission method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN107465629A (en) 2017-12-12

Similar Documents

Publication Publication Date Title
WO2017211265A1 (en) Speed limiting method and apparatus, and storage medium
RU2724136C1 (en) Data processing method and device
CN111262795B (en) Service interface-based current limiting method and device, electronic equipment and storage medium
CN106375404B (en) Data storage control method, date storage method, data capture method and device
CN106339222B (en) A kind of service implementing method and device
US9699028B2 (en) Method and device for updating client
JP2020515197A (en) Block data verification method and device
CN107426432A (en) Resource allocation method and Related product
WO2012109911A1 (en) Method and apparatus for monitoring network traffic
CN106464733B (en) The method and device of virtual resource in a kind of adjustment cloud computing
CN110659905A (en) Transaction verification method, device, terminal equipment and storage medium
CN104866339A (en) Distributed persistent management method, system and device of FOTA data
CN111490947A (en) Data packet transmitting method, data packet receiving method, system, device and medium
CN115102908B (en) Method for generating network message based on bandwidth control and related device
CN106789723B (en) Method and device for limiting forwarding speed of multi-core network
CN112235422B (en) Data processing method and device, computer readable storage medium and electronic device
CN111047050A (en) Distributed parallel training method, equipment and storage medium
CN110784336A (en) Multi-device intelligent timing delay scene setting method and system based on Internet of things
CN112217657A (en) Data transmission method, data processing method, device and medium based on SD-WAN system
CN109889418B (en) Data transmission method and device based on CAN bus
CN113220481A (en) Request processing and feedback method and device, computer equipment and readable storage medium
CN112995060B (en) Flow control method based on hardware counter
CN107517166A (en) Flow control methods, device and access device
CN114070798B (en) Message transmission method, device and equipment
CN112783635A (en) Resource limit adjusting method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17809704

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17809704

Country of ref document: EP

Kind code of ref document: A1