WO2013000112A1 - 一种漏桶限速方法及装置 - Google Patents
一种漏桶限速方法及装置 Download PDFInfo
- Publication number
- WO2013000112A1 WO2013000112A1 PCT/CN2011/076461 CN2011076461W WO2013000112A1 WO 2013000112 A1 WO2013000112 A1 WO 2013000112A1 CN 2011076461 W CN2011076461 W CN 2011076461W WO 2013000112 A1 WO2013000112 A1 WO 2013000112A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- bucket
- sub
- tokens
- total
- packet
- 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.)
- Ceased
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/215—Flow control; Congestion control using token-bucket
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/24—Traffic characterised by specific attributes, e.g. priority or QoS
- H04L47/2408—Traffic characterised by specific attributes, e.g. priority or QoS for supporting different services, e.g. a differentiated services [DiffServ] type of service
Definitions
- the present invention relates to the field of data networks, and in particular, to a method and an apparatus for speed limit of a leaky bucket. Background technique
- the packet In existing data networks, network congestion is often caused by the burstiness of packet traffic. In order to avoid network congestion and improve the quality of service (QoS) of the data network, the packet needs to be rate-limited at the receiving end. If the rate of the packet is lower than the specified rate, the packet is received normally. If the rate exceeds the specified rate, the packet is discarded or the packet is marked.
- QoS quality of service
- the commonly used method is to use the leaky bucket to limit the rate of packets.
- the commonly used standards based on the leaky bucket algorithm are RFC2697 and RFC2698, namely single-rate three-color double-barrel and dual-rate three-color double-barrel, RFC standard leaky bucket.
- the speed limit principle is shown in Figure 1. Specifically, the token is continuously filled into the leaky bucket at a specified rate until the leaky bucket is full. When the packet arrives, the packet length of the packet is compared with the number of tokens in the leaky bucket. If there are enough tokens in the leaky bucket, the packet is allowed to pass, and the packet of the packet is subtracted from the leaky bucket. The number of tokens corresponding to the long one; if the tokens in the leaky bucket are not enough, the text will be discarded, or the text will be marked.
- the main purpose of the present invention is to provide a method and a device for rate limiting a leaky bucket, which can flexibly limit the rate of packets according to an absolute priority, thereby improving data network service quality and users.
- a method and a device for rate limiting a leaky bucket which can flexibly limit the rate of packets according to an absolute priority, thereby improving data network service quality and users.
- a method for limiting the speed of a leaky bucket When a rate limit is set for a group of packets with different absolute priorities, the total leaky bucket is divided into multiple sub-leak buckets according to the number of absolute priorities and the proportional parameter.
- the ratio parameter is determined according to the requirement of the absolute priority traffic absorption jitter, and the capacity of each sub-leakage bucket is equal to the total leaky bucket capacity, and the absolute priority of the packet corresponds to the absolute priority of the sub-leakage bucket, and the method includes :
- the parameter related to the rate limit of the leaking bucket is obtained, and the related information of the packet includes at least: a packet length of the packet and a priority of the packet;
- the method further includes: updating a parameter related to the leaky bucket speed limit.
- the parameters related to the rate limit of the leaky bucket include: the capacity of the total leaky bucket, the proportion of each sub-leakage capacity, the total token addition rate, the time when the last speed limit occurs, the total leaky bucket, and each of the sub-leakage buckets. Number of tokens,
- the parameters related to the rate limit of the leaking bucket are: updating the time when the last speed limit occurs is the current time, and updating the total leaked bucket and the number of tokens in each of the sub-leak buckets are the number of tokens after the speed limit operation.
- Calculating the total number of tokens to be added according to the obtained parameters related to the rate limit of the leaky bucket is: calculating a time difference between a time when the current rate limit occurs and a time when the last rate limit occurs, and calculating the time difference and the total token
- the product of the addition rate is taken as the total number of tokens that need to be added.
- the token is added to the total leaky bucket and each sub-leaked bucket according to the calculated total number of tokens and the absolute priority of the sub-leaked bucket:
- the first step the total number of tokens calculated is added to the total leaky bucket. If the total leaky bucket is full, the total number of tokens of the leaky bucket is the total leaky bucket capacity, otherwise the total number of tokens added is added; If the total leaky bucket is full, the absolute priority sub-leaked buckets are full. Otherwise, the tokens are added in descending order of the absolute priority of the sub-leaked buckets. After the sub-leaked buckets with the absolute priority are full, Add a token to the sub-absent sub-leak bucket until the total number of tokens that need to be added is exhausted.
- a leaky bucket speed limiting device includes: a total leaking bucket, a message receiving module, a token adding module, a parameter storage module, and a message processing module;
- the total leaky bucket divides the total leaky bucket into a plurality of sub-leaked buckets according to the number of absolute priorities of the packet and the proportional parameter, and the absolute priority of the text corresponds to the absolute priority of the sub-leakage bucket;
- the packet information receiving module is configured to receive related information of the packet, where the information about the packet includes at least: a packet length of the packet and a priority of the packet;
- the token adding module is configured to: after the packet information receiving module receives the related information of the packet, acquire a parameter related to the rate limit of the leaked bucket from the parameter storage module; and obtain a parameter related to the rate limit of the leaked bucket according to the acquired parameter Calculate the total number of tokens to be added; and add tokens to the sub-leak bucket based on the calculated total number of tokens and the absolute priority of the sub-leak buckets;
- the parameter storage module is configured to maintain a parameter related to a leak rate limit of the leaky bucket
- the message processing module The number of tokens in the sub-leak bucket, forwarding, or discarding, or marking the message.
- the parameter storage module is further configured to update a parameter related to a leak rate limit of the leaky bucket after the packet processing module forwards, or discards, or marks the message.
- the parameters related to the rate limit of the leaky bucket stored by the parameter storage module include: the capacity of the total leaky bucket, the proportion of each sub-leaked bucket capacity, the total token addition rate, the time when the last speed limit occurs, the total leaky bucket, and each The number of tokens in the child leak bucket,
- the parameters related to the parameter limit of the leaking bucket are: updating the current time when the last speed limit occurs to the current time, and updating the total leaky bucket and the number of tokens in each sub-leaked bucket as the speed limit operation Number of cards.
- the token adding module calculates the total number of tokens to be added according to the obtained parameters related to the rate limit of the leaky bucket:
- the time difference between the time when the current rate limit occurs and the time when the last rate limit occurred is calculated, and the product of the time difference and the total token addition rate is calculated as the total number of tokens to be added.
- the total number of tokens calculated is added to the total leaky bucket. If the total leaky bucket is full, the total number of tokens of the leaky bucket is the total leaky bucket capacity, otherwise the total number of tokens added is added; If the total leaky bucket is full, the absolute priority sub-leaked buckets are full. Otherwise, the tokens are added in descending order of the absolute priority of the sub-leaked buckets. After the sub-leaked buckets with the absolute priority are full, Add a token to the sub-absent sub-leak bucket until the total number of tokens that need to be added is exhausted.
- the packet processing module forwards, discards, or marks the packet according to the packet length of the received packet and the number of tokens in the sub-leak bucket corresponding to the absolute priority of the packet:
- the method and device for limiting the speed of the leaky bucket of the present invention treat the packets of different absolute priorities differently, and divide the total leaky bucket into multiple sub-leaked buckets according to the requirements of the absorption jitter of the absolute priority traffic, and each absolute priority corresponds to the For a sub-leaked bucket, the tokens of the sub-leaked bucket are added in the order of the corresponding absolute priority. For the received packet, the token in the sub-leaked bucket corresponding to the absolute priority of the packet is forwarded and discarded. Or mark the operation.
- the present invention compensates for the insufficiency of the packet loss rate of the traditional buckets, and the packets of different priorities have the absolute priority order of passing and discarding probabilities, that is, the high-priority packets.
- the present invention can flexibly limit the rate of packets according to the absolute priority, thereby improving the data network service.
- the combination of the quality machine can save the hardware design of the scheduling function, thereby saving the hardware resources of the network.
- Figure 1 is a schematic diagram of the principle of the leaky bucket speed limit of the existing RFC standard
- FIG. 2 is a schematic flow chart of a method for speed limit of a leaky bucket according to the present invention
- FIG. 3 is a schematic diagram of a principle of a speed limit of a leaky bucket according to the present invention.
- FIG. 4 is a schematic flow chart of a method for speed limit of a leaky bucket according to the present invention. detailed description
- each absolute priority corresponds to one sub-leak bucket in the total leaky bucket, and the tokens of the sub-leaked bucket are added according to the order of the corresponding absolute priorities.
- the forwarding, discarding, or marking operation is performed according to the token in the sub-leak bucket corresponding to the absolute priority of the packet.
- the priority is divided into two sub-leak buckets according to different absolute priorities, and the packet priority corresponds to the sub-leakage bucket priority.
- each sub-leaked bucket can be divided according to actual needs.
- the sub-leaked bucket corresponding to the high absolute priority has a large capacity
- the sub-leaked bucket corresponding to the low absolute priority has a small capacity
- all sub-leakages The sum of the barrel capacities is equal to the total leaky barrel capacity, that is, the total leaky barrel capacity is expressed as BS
- Step 201 After receiving the related information of the packet, obtain parameters related to the rate limit of the leaky bucket.
- the information related to the packet includes: a packet length of the packet and a priority of the packet, where the parameter related to the leak rate limit may include, but is not limited to:
- the total token addition rate also known as the total rate limit rate, is the sum of the absolute priority rate limits
- the capacity of each sub-leaked bucket can be further obtained according to the capacity of the total leaky bucket and the proportion of each sub-leaked bucket capacity. In practical applications, both hardware and software implementations need to maintain the above parameter configuration.
- Step 202 Calculate the total number of tokens to be added according to the obtained parameters related to the rate limit of the leaky bucket.
- Step 203 Add a token to the total leaky bucket and each of the sub-leakage buckets according to the calculated total number of tokens, where the token addition to the sub-leakage bucket is further performed according to the absolute priority relationship of each sub-leakage bucket.
- the total number of tokens calculated is added to the total leaky bucket. If the total leaky bucket is full, the total number of tokens of the leaky bucket is the total leaky bucket capacity, otherwise, the total number of tokens added;
- the second step if the total leaky bucket is full, the absolute priority sub-leaked buckets are full, otherwise the tokens of the sub-drained buckets are added in descending order of absolute priority, and the sub-leaked buckets with high absolute priority are added. After the expiration, add a token to the sub-leak bucket of the absolute priority.
- sub-leak buckets are named SP1 bucket, SP2 bucket, and SP3 bucket in descending order of absolute priority
- the total number of tokens to be added is first added to the SP1 bucket of the highest priority. If the SP1 bucket is not full, the number of tokens of all other absolute priority sub-leak buckets will remain unchanged; if the SP1 sub-leakage bucket is full, the token overflowing the SP1 sub-leaked bucket is added to the secondary absolute priority SP2 bucket. , and so on, until the total number of tokens that need to be added is exhausted, resulting in the number of tokens for all child leaky buckets. The number of tokens in, forward, or discard, or mark the message.
- the corresponding sub-leaked bucket is selected according to the absolute priority of the packet, and then the number of tokens in the sub-leaked bucket is compared with the packet length of the packet to determine whether to forward the packet. If the number of tokens in the leaky bucket is greater than or equal to the packet length of the packet, the packet is forwarded, and the number of tokens in the total leaky bucket and the sub-leaked bucket is decreased and the packet length is long. Corresponding number; if the number of tokens in the sub-leaked bucket is smaller than the packet length of the packet, discarding the packet or marking the packet, the total leaking bucket and all the sub-leaked buckets The number of tokens does not change.
- step 203 the low SP leaky bucket acquires the token, and after the SP bucket of the relatively high priority is full, the high priority packet is consumed. Card, the total added token will be given priority to the high priority sub-leaked bucket, so that the low-priority sub-leaked bucket token will not be increased, and will soon be consumed cleanly, and only wait for a certain period of time to have a high priority report.
- the low-priority sub-leak bucket When there is less time, it is possible for the low-priority sub-leak bucket to acquire the token after the high-priority sub-leak bucket is full, so that the low-priority message can obtain the token, so through the present invention,
- the high-priority packets will be given priority over the low-priority packets.
- the speed limit can be differentiated based on the absolute priority of the packets.
- Step 205 Update the parameters related to the leak rate limit of the leaky bucket.
- the present invention also provides a leaky bucket speed limiting device, which includes: a total leaking bucket, a message information receiving module, a token adding module, a parameter storage module, and a message processing module;
- the total leaky bucket divides the total leaky bucket into multiple sub-leakage buckets according to the number of absolute priority of the packet and the proportional parameter, and the proportional parameter must be determined according to the requirements of the absolute priority traffic absorption jitter, and the packet absolute priority Corresponding to the absolute priority of the sub-leakage bucket;
- the packet information receiving module is configured to receive related information of the packet, where the information about the packet includes at least: a packet length of the packet and a priority of the packet;
- the token adding module is configured to: after the packet information receiving module receives the related information of the packet, acquire a parameter related to the rate limit of the leaked bucket from the parameter storage module; and obtain a parameter related to the rate limit of the leaked bucket according to the acquired parameter Calculate the total number of tokens to be added; and add tokens to the sub-leak bucket based on the calculated total number of tokens and the absolute priority of the sub-leak buckets;
- the parameter storage module is configured to maintain a parameter related to a leak rate limit of the leaky bucket; the number of tokens in the sub-leak bucket, forward, or discard, or mark the message.
- the parameter storage module is further configured to update a parameter related to the rate limit of the leaky bucket after the packet processing module forwards, or discards, or marks the message.
- the parameters related to the rate limit of the leaky bucket stored by the parameter storage module include: the capacity of the total leaky bucket, the proportion of each sub-leaked bucket capacity, the total token addition rate, the time when the last speed limit occurs, and the total leaky bucket and each The number of tokens in the child leak bucket,
- the parameters related to the parameter limit of the leaking bucket are: updating the current time when the last speed limit occurs to the current time, and updating the total leaky bucket and the number of tokens in each sub-leaked bucket as the speed limit operation Number of cards.
- the token adding module calculates the total number of tokens to be added according to the obtained parameters related to the rate limit of the leaky bucket:
- the time difference between the time when the current rate limit occurs and the time when the last rate limit occurred is calculated, and the product of the time difference and the total token addition rate is calculated as the total number of tokens to be added.
- the total number of tokens calculated is added to the total leaky bucket. If the total leaky bucket is full, the total number of tokens of the leaky bucket is the total leaky bucket capacity, otherwise the total number of tokens added is added; If the total leaky bucket is full, the absolute priority sub-leaked buckets are full. Otherwise, the tokens are added in descending order of the absolute priority of the sub-leaked buckets. After the sub-leaked buckets with the absolute priority are full, Add a token to the sub-absent sub-leak bucket until the total number of tokens that need to be added is exhausted. The number of tokens in the child leaking bucket, forwarding, or discarding, or marking the message as:
- the present invention proposes a method and a device for distinguishing the rate limit of the leaked bucket with the absolute priority of the packet, which can distinguish the speed limit of the packets with different absolute priorities, and make up for the traditional leaky bucket.
- the rate-limiting mode does not reflect the difference in packet priority for a group of data services that share the rate-limiting leaky bucket. Therefore, the packets of different priorities have the absolute priority order of passing and discarding probability under the same rate limit.
- the quality of the network service is provided; and the present invention separates the speed-limiting leaky buckets of the absolute priorities by the sub-leakage buckets, so that the residual tokens of the absolute priorities do not preempt each other; and the present invention will report
- the combination of the speed limit and priority scheduling ideas can save the hardware design of some scheduling functions, thus saving network hardware resources.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明公开了一种漏桶限速方法,对于共用同一漏桶但具有不同绝对优先级的一组报文进行限速的时候,将总漏桶按照绝对优先级的个数及比例参数分割为多个子漏桶,比例参数根据各绝对优先级流量吸收抖动的要求而定,各子漏桶的容量和等于总漏桶容量;收到报文相关信息后,获取与漏桶限速相关的参数,计算需要添加的总令牌数;根据计算的总令牌数和总漏桶在接受添加总令牌后的状态以及子漏桶的绝对优先级对子漏桶进行令牌添加;根据报文的包长及绝对优先级对应的子漏桶中的令牌数转发、或丟弃、或标记所述报文。本发明还相应地公开了一种漏桶限速装置。本发明能按照绝对优先级对报文进行灵活限速,从而提高数据网络服务质量及用户体验。
Description
一种漏桶 P½方法及装置 技术领域
本发明涉及数据网络领域, 尤其涉及一种漏桶限速方法及装置。 背景技术
在现有的数据网络中, 由于报文流量的突发性, 常常会导致网络拥塞。 为了避免网络拥塞, 提高数据网络的服务质量(Quality of service, QoS ), 需要在接收端对报文进行限速, 如果报文的速率低于规定的速率, 则正常 接收报文; 如果报文的速率超过规定的速率, 则将报文丟弃, 或对报文进 行标记。
目前普遍釆用的方法是利用漏桶对报文进行限速, 常用的基于漏桶算 法的标准有 RFC2697和 RFC2698 , 即单速率三色双桶和双速率三色双桶 , RFC标准的漏桶限速原理如图 1所示, 具体为: 按规定的速率不断地向漏 桶中填充令牌, 直到漏桶装满为止。 当报文到来时, 将报文的包长跟漏桶 中的令牌数进行比较, 如果漏桶中有足够的令牌, 则报文允许通过, 同时 从漏桶中减去报文的包长所对应的令牌数; 如果漏桶中的令牌不够, 则将 才艮文丟弃, 或对艮文进行标记。
可以看出, RFC2697和 RFC2698虽然能够对报文进行限速, 但是在限 速的过程中无法区别优先级高低不同的报文的服务质量, 所以, 现有报文 限速方法不够灵活, 不利于提高数据网络服务质量及用户体验。 发明内容
有鉴于此, 本发明的主要目的在于提供一种漏桶限速方法及装置, 能 按照绝对优先级对报文进行灵活限速, 从而提高数据网络服务质量及用户
体验。
为达到上述目的, 本发明的技术方案是这样实现的:
一种漏桶限速方法, 对于共用同一漏桶但具有不同绝对优先级的一组 报文进行限速的时候, 将总漏桶按照绝对优先级的个数及比例参数分割为 多个子漏桶, 所述比例参数根据各绝对优先级流量吸收抖动的要求而定, 且各子漏桶的容量和等于总漏桶容量, 报文绝对优先级与子漏桶绝对优先 级相对应, 该方法包括:
收到报文的相关信息后, 获取与漏桶限速相关的参数, 所述报文的相 关信息至少包括: 报文的包长和报文的优先级;
根据获取的与漏桶限速相关的参数计算需要添加的总令牌数;
数, 转发、 或丟弃、 或标记所述报文。
所述转发、 或丟弃、 或标记报文之后, 该方法还包括: 更新与漏桶限 速相关的参数。
所述与漏桶限速相关的参数包括: 总漏桶的容量、 各子漏桶容量划分 比例、 总令牌添加速率、 上一次限速发生的时刻、 总漏桶及各子漏桶中的 令牌数,
所述更新与漏桶限速相关的参数为: 更新上一次限速发生的时刻为当 前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速运算后的令牌数。
所述根据获取的与漏桶限速相关的参数计算需要添加的总令牌数为: 计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。
所述根据计算的总令牌数及子漏桶的绝对优先级对总漏桶及各子漏桶 进行令牌添加为:
第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则各绝对优先级子漏桶均满, 否则按照子漏桶绝对优先级由高到低 的顺序进行令牌添加, 绝对优先级高的子漏桶加满后, 再向次绝对优先级 的子漏桶添加令牌, 直至需要添加的总令牌数耗尽。
根据所述报文的绝对优先级选择对应的子漏桶, 将所述子漏桶中的 f令、 牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大于或等于所述 报文的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的令牌数减少 与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌 数不变。
一种漏桶限速装置, 包括: 总漏桶、 报文信息接收模块、 令牌添加模 块、 参数存储模块、 报文处理模块; 其中,
所述总漏桶,按照报文绝对优先级的个数及比例参数将总漏桶分割为多 个子漏桶, 文绝对优先级与子漏桶绝对优先级相对应;
所述报文信息接收模块, 用于接收报文的相关信息, 所述报文的相关 信息至少包括: 报文的包长和报文的优先级;
所述令牌添加模块, 用于在报文信息接收模块接收到报文的相关信息 后, 从参数存储模块获取与漏桶限速相关的参数; 以及根据获取的与漏桶 限速相关的参数计算需要添加的总令牌数; 以及根据计算的总令牌数及子 漏桶的绝对优先级对子漏桶进行令牌添加;
所述参数存储模块, 用于维护与漏桶限速相关的参数;
所述报文处理模块,
子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文。
所述参数存储模块, 还用于在报文处理模块转发、 或丟弃、 或标记报 文之后, 更新与漏桶限速相关的参数。
所述参数存储模块存储的与漏桶限速相关的参数包括: 总漏桶的容量、 各子漏桶容量划分比例、 总令牌添加速率、 上一次限速发生的时刻、 总漏 桶及各子漏桶中的令牌数,
所述参数存储模块更新与漏桶限速相关的参数为: 更新上一次限速发 生的时刻为当前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速运算 后的令牌数。
所述令牌添加模块根据获取的与漏桶限速相关的参数计算需要添加的 总令牌数为:
计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。
所述令牌添加模块根据计算的总令牌数及子漏桶的绝对优先级对子漏 桶进行令牌添加为:
第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则各绝对优先级子漏桶均满, 否则按照子漏桶绝对优先级由高到低 的顺序进行令牌添加, 绝对优先级高的子漏桶加满后, 再向次绝对优先级 的子漏桶添加令牌, 直至需要添加的总令牌数耗尽。
所述报文处理模块根据所收到报文的包长及所述报文的绝对优先级对 应的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文为:
根据所述报文的绝对优先级选择对应的子漏桶, 将所述子漏桶中的令 牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大于或等于所述 报文的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的令牌数减少
与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌 数不变。
本发明漏桶限速方法及装置, 对不同绝对优先级的报文区别对待, 将 总漏桶根据各绝对优先级流量吸收抖动的要求分割成多个子漏桶, 每一绝 对优先级对应其中的一个子漏桶, 子漏桶的令牌添加按照相应绝对优先级 的高低顺序进行, 对于接收到的报文, 根据该报文绝对优先级对应的子漏 桶中的令牌执行转发、 丟弃或标记操作。 本发明弥补了传统漏桶限速不能 体现报文优先级区别的不足, 使得不同优先级的报文在同一限速条件下有 着绝对优先级顺序的通过与丟弃概率, 即高优先级报文在网络拥塞情况下 有相对高的通过概率, 而低优先级的报文则有相对高的丟弃概率, 所以, 本发明能按照绝对优先级对报文进行灵活限速, 从而提高数据网络服务质 机的结合, 可以省去调度功能的硬件设计, 从而可节省网络的硬件资源。 附图说明
图 1为现有 RFC标准的漏桶限速原理示意图;
图 2为本发明漏桶限速方法流程示意图;
图 3为本发明涉及的漏桶限速原理示意图;
图 4为本发明漏桶限速方法的详细流程示意图。 具体实施方式
本发明的基本思想是对一组具有不同绝对优先级的报文, 每一绝对优 先级对应总漏桶中的一个子漏桶, 子漏桶的令牌添加按照相应绝对优先级 的先后顺序进行, 对于接收到的报文, 根据该报文绝对优先级对应的子漏 桶中的令牌执行转发、 丟弃或标记操作。
priority )进行划分(例如按照报文类型划分), 相应的, 将漏桶容量按照不 同的绝对优先级划分为至少两个子漏桶, 报文优先级与子漏桶优先级相对 应。
需要说明的是, 各子漏桶的容量可根据实际需求进行划分, 一般的, 高绝对优先级对应的子漏桶容量较大, 低绝对优先级对应的子漏桶容量较 小, 所有子漏桶容量之和等于总的漏桶的容量, 即将总的漏桶容量表示为 BS, 将子漏桶的容量分别表示为 BS1、 BS2、 BS3... BSn, 则它们满足如下 关系: BS = BS1+BS2 + BS3 + ... + BSn。
图 2为本发明漏桶限速方法流程示意图, 如图 2所示, 该方法包括: 步骤 201 : 收到报文的相关信息后, 获取与漏桶限速相关的参数。
这里, 所述报文的相关信息至少包括: 报文的包长和报文的优先级, 所述与漏桶限速相关的参数可以但不限于包括:
( 1 ) 总漏桶的容量;
( 2 )各子漏桶容量划分比例;
( 3 )总令牌添加速率, 也称为总的限速速率, 其值为各绝对优先级限 速速率之和;
( 4 )上一次限速发生的时刻;
( 5 )总漏桶及各子漏桶中的令牌数, 如果之前发生了限速运算, 指上 一次同组报文发生限速运算后的令牌数。
根据总漏桶的容量和各子漏桶容量划分比例可以进一步获取各子漏桶 的容量。 实际应用中, 无论硬件还是软件实现都需要维护以上参数配置。
步骤 202: 根据获取的与漏桶限速相关的参数计算需要添加的总令牌 数。
具体的, 计算当前限速发生的时刻与上一次限速发生的时刻的时间差 ,
再计算该时间差与总令牌添加速率的乘积, 得到需要添加的总令牌数。 步骤 203: 根据计算的总令牌数对总漏桶及各子漏桶进行令牌添加, 其 中对子漏桶的令牌添加还要根据各子漏桶的绝对优先级关系来进行。
具体的, 第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏桶满, 则各绝对优先级子漏桶均满, 否则子漏桶的令牌添加按照 绝对优先级由高到低的顺序进行, 绝对优先级高的子漏桶加满后, 再向次 绝对优先级的子漏桶添加令牌。 如果将这些子漏桶按照绝对优先级由高到 低的顺序依次命名为 SP1桶、 SP2桶、 SP3桶..., 则将须添加的总令牌数首 先加入最高优先级的 SP1桶中, 如果 SP1桶未满, 则所有其它次绝对优先 级子漏桶的令牌数将不变; 如果 SP1子漏桶满, 则将溢出 SP1子漏桶的令 牌加入到次绝对优先级 SP2桶中, 以此类推, 直至需要添加的总令牌数耗 尽, 从而得到所有子漏桶的令牌数。 中的令牌数, 转发、 或丟弃、 或标记所述报文。
具体的, 先根据报文绝对优先级选择对应的子漏桶, 然后将所述子漏 桶中的令牌数与所述报文的包长进行比较, 决定是否转发所述报文, 如果 所述子漏桶中的令牌数大于或等于所述报文的包长, 则转发所述报文, 同 时总漏桶及所述子漏桶中的令牌数减少与所述报文包长相应的数目; 如果 所述子漏桶中的令牌数小于所述报文的包长, 则丟弃所述报文或者对所述 报文进行标记, 总漏桶及所有子漏桶中的令牌数不变。
本发明涉及的漏桶限速原理如图 3所示, 由于在步骤 203中, 低 SP漏 桶获取令牌须在优先级相对高的 SP漏桶满之后, 高优先级的报文一旦消耗 令牌, 总的添加令牌将优先给高优先级子漏桶, 这样低优先级子漏桶令牌 得不到增加, 很快就会消耗干净, 也就只有等到某段时间内高优先级报文
来的比较少的时候, 低优先级子漏桶才有可能在高优先级子漏桶满了以后 获取令牌, 这样低优先级的报文才可以获取令牌通过, 所以, 通过本发明, 高优先级的报文的通过机会将绝对优先于低优先级的报文, 这样在对数据 报文进行漏桶限速的时候, 便可以实现根据报文绝对优先级来区分限速服 务。
步骤 205: 更新与漏桶限速相关的参数。
这里, 主要指更新上一次限速发生的时刻为当前时刻, 以及更新总漏 桶及各子漏桶中的令牌数为限速运算后的令牌数。
需要说明的是, 如果釆用硬件实现本发明, 则限速计算的逻辑及参数 存储资源将随子漏桶的数目的增多而线性的增多, 需要根据实际的需求进 行综合评估。 本发明漏桶限速方法的详细流程如图 4所示。
本发明还相应地提出一种漏桶限速装置, 包括: 总漏桶、 报文信息接 收模块、 令牌添加模块、 参数存储模块、 报文处理模块; 其中,
所述总漏桶,按照报文绝对优先级的个数及比例参数将总漏桶分割为多 个子漏桶, 比例参数必须根据各绝对优先级流量吸收抖动的要求而定, 报 文绝对优先级与子漏桶绝对优先级相对应;
所述报文信息接收模块, 用于接收报文的相关信息, 所述报文的相关 信息至少包括: 报文的包长和报文的优先级;
所述令牌添加模块, 用于在报文信息接收模块接收到报文的相关信息 后, 从参数存储模块获取与漏桶限速相关的参数; 以及根据获取的与漏桶 限速相关的参数计算需要添加的总令牌数; 以及根据计算的总令牌数及子 漏桶的绝对优先级对子漏桶进行令牌添加;
所述参数存储模块, 用于维护与漏桶限速相关的参数; 子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文。
所述参数存储模块, 还用于在报文处理模块转发、 或丟弃、 或标记报 文之后, 更新与漏桶限速相关的参数。
所述参数存储模块存储的与漏桶限速相关的参数包括: 总漏桶的容量、 各子漏桶容量划分比例、 总令牌添加速率、 上一次限速发生的时刻和总漏 桶及各子漏桶中的令牌数,
所述参数存储模块更新与漏桶限速相关的参数为: 更新上一次限速发 生的时刻为当前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速运算 后的令牌数。
所述令牌添加模块根据获取的与漏桶限速相关的参数计算需要添加的 总令牌数为:
计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。
所述令牌添加模块根据计算的总令牌数及子漏桶的绝对优先级对总漏 桶及子漏桶进行令牌添加为:
第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则各绝对优先级子漏桶均满, 否则按照子漏桶绝对优先级由高到低 的顺序进行令牌添加, 绝对优先级高的子漏桶加满后, 再向次绝对优先级 的子漏桶添加令牌, 直至需要添加的总令牌数耗尽。 的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文为:
根据所述报文的绝对优先级选择对应的子漏桶, 将所述子漏桶中的令 牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大于或等于所述 报文的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的令牌数减少 与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述报文的包长,
则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌 数不变。
本发明在 RFC漏桶算法标准的基础上, 提出一种可区分报文绝对优先 级的漏桶限速的方法和装置, 可以对不同绝对优先级的报文区分限速, 弥 补了传统漏桶限速方式对于共用限速漏桶的一组数据业务不能体现报文优 先级区别的不足, 使得不同优先级的报文在同一限速条件下有着绝对优先 级顺序的通过与丟弃概率, 提高了网络服务质量; 并且, 本发明由于划分 了子漏桶, 可以将各绝对优先级的限速漏桶独立起来, 使得各绝对优先级 的残留令牌不互相抢占; 并且, 本发明由于将报文的限速与优先级调度思 想进行了结合, 可以省去部分调度功能的硬件设计, 从而可节省网络硬件 资源。
以上所述, 仅为本发明的较佳实施例而已, 并非用于限定本发明的保 护范围。
Claims
1、 一种漏桶限速方法, 其特征在于, 对于共用同一漏桶但具有不同绝 对优先级的一组报文进行限速的时候, 将总漏桶按照绝对优先级的个数及 比例参数分割为多个子漏桶, 所述比例参数根据各绝对优先级流量吸收抖 动的要求而定, 且各子漏桶的容量和等于总漏桶容量, 报文绝对优先级与 子漏桶绝对优先级相对应, 该方法包括:
收到报文的相关信息后, 获取与漏桶限速相关的参数, 所述报文的相 关信息至少包括: 报文的包长和报文的优先级;
根据获取的与漏桶限速相关的参数计算需要添加的总令牌数; 根据计算的总令杵
2、 根据权利要求 1所述的漏桶限速方法, 其特征在于, 所述转发、 或 丟弃、 或标记 "^文之后, 该方法还包括: 更新与漏桶限速相关的参数。
3、 根据权利要求 2所述的漏桶限速方法, 其特征在于,
所述与漏桶限速相关的参数包括: 总漏桶的容量、 各子漏桶容量划分 比例、 总令牌添加速率、 上一次限速发生的时刻、 总漏桶及各子漏桶中的 令牌数,
所述更新与漏桶限速相关的参数为: 更新上一次限速发生的时刻为当 前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速运算后的令牌数。
4、 根据权利要求 3所述的漏桶限速方法, 其特征在于, 所述根据获取 的与漏桶限速相关的参数计算需要添加的总令牌数为:
计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。
5、 根据权利要求 1至 4任一项所述的漏桶限速方法, 其特征在于, 所 述根据计算的总令牌数及子漏桶的绝对优先级对总漏桶及各子漏桶进行令 牌添加为:
第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则各绝对优先级子漏桶均满, 否则按照子漏桶绝对优先级由高到低 的顺序进行令牌添加, 绝对优先级高的子漏桶加满后, 再向次绝对优先级 的子漏桶添加令牌, 直至需要添加的总令牌数耗尽。
6、 根据权利要求 5所述的漏桶限速方法, 其特征在于, 所述根据报文 的包长及报文的绝对优先级对应的子漏桶中的令牌数, 转发、 或丟弃、 或 标记所述>¾文为:
根据所述报文的绝对优先级选择对应的子漏桶, 将所述子漏桶中的令 牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大于或等于所述 报文的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的令牌数减少 与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌 数不变。
7、 一种漏桶限速装置, 其特征在于, 该装置包括: 总漏桶、 报文信息 接收模块、 令牌添加模块、 参数存储模块、 报文处理模块; 其中,
所述总漏桶,按照报文绝对优先级的个数及比例参数将总漏桶分割为多 个子漏桶, 文绝对优先级与子漏桶绝对优先级相对应;
所述报文信息接收模块, 用于接收报文的相关信息, 所述报文的相关 信息至少包括: 报文的包长和报文的优先级;
所述令牌添加模块, 用于在报文信息接收模块接收到报文的相关信息 后, 从参数存储模块获取与漏桶限速相关的参数; 以及根据获取的与漏桶 限速相关的参数计算需要添加的总令牌数; 以及根据计算的总令牌数及子 漏桶的绝对优先级对子漏桶进行令牌添加;
所述参数存储模块, 用于维护与漏桶限速相关的参数; 子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文。
8、 根据权利要求 7所述的漏桶限速装置, 其特征在于,
所述参数存储模块, 还用于在报文处理模块转发、 或丟弃、 或标记报 文之后, 更新与漏桶限速相关的参数。
9、 根据权利要求 8所述的漏桶限速装置, 其特征在于,
所述参数存储模块存储的与漏桶限速相关的参数包括: 总漏桶的容量、 各子漏桶容量划分比例、 总令牌添加速率、 上一次限速发生的时刻、 总漏 桶及各子漏桶中的令牌数,
所述参数存储模块更新与漏桶限速相关的参数为: 更新上一次限速发 生的时刻为当前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速运算 后的令牌数。
10、 根据权利要求 9所述的漏桶限速装置, 其特征在于,
所述令牌添加模块根据获取的与漏桶限速相关的参数计算需要添加的 总令牌数为:
计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。
11、 根据权利要求 7至 10任一项所述的漏桶限速装置, 其特征在于, 所述令牌添加模块根据计算的总令牌数及子漏桶的绝对优先级对子漏 桶进行令牌添加为:
第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则各绝对优先级子漏桶均满, 否则按照子漏桶绝对优先级由高到低 的顺序进行令牌添加, 绝对优先级高的子漏桶加满后, 再向次绝对优先级 的子漏桶添加令牌, 直至需要添加的总令牌数耗尽。
12、 根据权利要求 11所述的漏桶限速装置, 其特征在于,
所述报文处理模块根据所收到报文的包长及所述报文的绝对优先级对 应的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文为:
根据所述报文的绝对优先级选择对应的子漏桶, 将所述子漏桶中的令 牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大于或等于所述 报文的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的令牌数减少 与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌 数不变。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2011/076461 WO2013000112A1 (zh) | 2011-06-28 | 2011-06-28 | 一种漏桶限速方法及装置 |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2011/076461 WO2013000112A1 (zh) | 2011-06-28 | 2011-06-28 | 一种漏桶限速方法及装置 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2013000112A1 true WO2013000112A1 (zh) | 2013-01-03 |
Family
ID=47423352
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2011/076461 Ceased WO2013000112A1 (zh) | 2011-06-28 | 2011-06-28 | 一种漏桶限速方法及装置 |
Country Status (1)
| Country | Link |
|---|---|
| WO (1) | WO2013000112A1 (zh) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2015043537A1 (en) * | 2013-09-29 | 2015-04-02 | Hangzhou H3C Technologies Co., Ltd. | Defending against flow attacks |
| CN112398748A (zh) * | 2021-01-21 | 2021-02-23 | 全时云商务服务股份有限公司 | 基于mq的智能限流方法、装置及计算机可读介质 |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101478491A (zh) * | 2009-02-10 | 2009-07-08 | 中兴通讯股份有限公司 | 一种实现分组业务区分服务的方法及装置 |
| CN101557348A (zh) * | 2009-05-25 | 2009-10-14 | 杭州华三通信技术有限公司 | 一种基于令牌桶的报文转发方法及装置 |
| CN101997766A (zh) * | 2009-08-31 | 2011-03-30 | 中兴通讯股份有限公司 | 一种基于优先级的令牌桶限速的方法及系统 |
-
2011
- 2011-06-28 WO PCT/CN2011/076461 patent/WO2013000112A1/zh not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101478491A (zh) * | 2009-02-10 | 2009-07-08 | 中兴通讯股份有限公司 | 一种实现分组业务区分服务的方法及装置 |
| CN101557348A (zh) * | 2009-05-25 | 2009-10-14 | 杭州华三通信技术有限公司 | 一种基于令牌桶的报文转发方法及装置 |
| CN101997766A (zh) * | 2009-08-31 | 2011-03-30 | 中兴通讯股份有限公司 | 一种基于优先级的令牌桶限速的方法及系统 |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2015043537A1 (en) * | 2013-09-29 | 2015-04-02 | Hangzhou H3C Technologies Co., Ltd. | Defending against flow attacks |
| CN104519021A (zh) * | 2013-09-29 | 2015-04-15 | 杭州华三通信技术有限公司 | 防止恶意流量攻击的方法及装置 |
| CN104519021B (zh) * | 2013-09-29 | 2018-07-20 | 新华三技术有限公司 | 防止恶意流量攻击的方法及装置 |
| CN112398748A (zh) * | 2021-01-21 | 2021-02-23 | 全时云商务服务股份有限公司 | 基于mq的智能限流方法、装置及计算机可读介质 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN107005485B (zh) | 一种确定路由的方法、对应装置及系统 | |
| US11463346B2 (en) | Data processing method, device, and system | |
| CN104272680B (zh) | 用信号通知拥塞 | |
| CN104980367B (zh) | 一种令牌桶限速方法和装置 | |
| EP2862301B1 (en) | Multicast to unicast conversion technique | |
| CN102075444B (zh) | 一种保障多类型业务服务质量的网络系统及方法 | |
| CN109039936B (zh) | 传输速率控制方法、装置、发送设备和接收设备 | |
| WO2018210117A1 (zh) | 一种拥塞控制方法、网络设备及其网络接口控制器 | |
| WO2013000116A1 (zh) | 一种漏桶限速方法及装置 | |
| CN101369962B (zh) | 转发报文的方法和网络设备 | |
| CN101217495A (zh) | 用于t-mpls网络环境下的流量监控方法和装置 | |
| CN114079638B (zh) | 多协议混合网络的数据传输方法、装置和存储介质 | |
| CN101997766A (zh) | 一种基于优先级的令牌桶限速的方法及系统 | |
| EP3930259A1 (en) | Bandwidth adjustment per label-switched path | |
| CN111224888A (zh) | 发送报文的方法及报文转发设备 | |
| CN102752192B (zh) | 基于SCTP的ForCES传输映射层的带宽分配方法 | |
| WO2018121535A1 (zh) | 一种负载均衡处理方法及装置 | |
| CN101958847A (zh) | 一种分布式qos路由的选择方法 | |
| CN105490962A (zh) | 一种基于OpenFlow网络的QoS管理方法 | |
| CN103701721B (zh) | 报文传输方法及装置 | |
| EP2888842A1 (en) | Congestion notification in a network | |
| CN110086728A (zh) | 发送报文的方法、第一网络设备及计算机可读存储介质 | |
| CN107135164A (zh) | 拥塞控制方法及装置 | |
| CN101534254B (zh) | 一种队列报告方法、装置和无源光网络系统 | |
| CN116266826A (zh) | 一种分布式机器学习的网络优化系统、方法及电子设备 |
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: 11868611 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: 11868611 Country of ref document: EP Kind code of ref document: A1 |