WO2013000113A1 - 一种漏桶限速方法及装置 - Google Patents

一种漏桶限速方法及装置 Download PDF

Info

Publication number
WO2013000113A1
WO2013000113A1 PCT/CN2011/076462 CN2011076462W WO2013000113A1 WO 2013000113 A1 WO2013000113 A1 WO 2013000113A1 CN 2011076462 W CN2011076462 W CN 2011076462W WO 2013000113 A1 WO2013000113 A1 WO 2013000113A1
Authority
WO
WIPO (PCT)
Prior art keywords
bucket
sub
tokens
priority
leak
Prior art date
Application number
PCT/CN2011/076462
Other languages
English (en)
French (fr)
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 中兴通讯股份有限公司
Priority to PCT/CN2011/076462 priority Critical patent/WO2013000113A1/zh
Publication of WO2013000113A1 publication Critical patent/WO2013000113A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • 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/21Flow control; Congestion control using leaky-bucket

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 limiting the speed of a leaky bucket, which can flexibly limit the rate of packets according to the absolute priority and the weight priority, thereby improving the data network service. Quality and user experience.
  • a method for limiting the speed of a leaky bucket When a rate limit is set for a group of packets that share the same leaky bucket but have different absolute priorities and different weight priorities, the total leaked buckets are numbered according to the total number of priorities and the proportional parameters. Divided into a plurality of sub-leaked buckets, the ratio parameter is determined according to the requirements of each priority flow absorbing jitter, and the capacity of each sub-leaked bucket is equal to the total leaky bucket capacity, and the packet absolute priority/message weight priority and sub- The leaked bucket absolute priority/sub-drain bucket weight priority corresponds to the method, 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 absolute priority and the weight priority sub-leakage bucket capacity division ratio, the weight priority factor, the total token addition rate, and the time when the last speed limit occurs. And the number of tokens in the total leaky bucket and each sub-leaked bucket,
  • 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 leaky bucket and the number of tokens in each of the sub-leakage buckets as the speed limit.
  • the parameter related to the rate limit of the leaky bucket further includes one or more of the following: a capacity of each weight priority sub-leak bucket, an absolute priority, and a weight priority sub-leak bucket capacity division ratio, and an overflow setting operation.
  • Proportion parameter preset overflow plus number of times. 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 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, all absolute priority and weight priority sub-leaked buckets are full, otherwise the total number of tokens to be added is added in descending order of absolute priority sub-drain bucket priority from highest to lowest. After the sub-leak bucket with the highest priority is full, add the token to the sub-leak bucket of the absolute priority, until all the absolute priority sub-leak buckets are full or the tokens to be added are exhausted, and all absolute priorities are obtained. The class leaks the current number of tokens and adds the remaining total tokens to the weight priority sub-leak bucket.
  • the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the number of tokens provided for each weight priority sub-leak bucket is added;
  • the overflowed token is assigned to other underweight priority sub-leak buckets according to the weight priority factor proportional relationship or a preset proportional relationship.
  • the priority sub-leak bucket continues to be added for the third time, ..., until the ownership priority priority sub-leak bucket has no overflow token, or reaches the preset mutual overflow addition number; and if the preset mutual overflow is reached, The number of times, the overflow token of the sub-leak bucket will be discarded, and the total number of leaky tokens is also reduced by the corresponding number of discards.
  • the number of tokens in the child leaking bucket, forwarding, or discarding, or marking the message as:
  • 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 is divided into multiple sub-leaked buckets according to the number of all priorities and the proportional parameter, and the capacity of each sub-leaked bucket is equal to the total leaky bucket capacity, and the packet absolute priority/message weight priority and sub- The leaked bucket absolute priority/sub-drain bucket weight priority corresponds to;
  • 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 that need to be added; and the total number of tokens and sub-calculations The absolute priority and weight priority of the leaky bucket are added to the sub-leak bucket;
  • the parameter storage module is configured to maintain a parameter related to a leak rate limit of the leaky bucket
  • the packet processing module is configured to forward, discard, or mark the report according to the packet length of the packet and the absolute priority of the packet or the number of tokens in the sub-leak bucket corresponding to the weight priority. Text.
  • 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 leak rate limit of the leaked bucket stored by the parameter storage module include: the capacity of the total leaky bucket, the proportion of each priority sub-leakage bucket capacity, the weight priority factor, the total token addition rate, and the last speed limit occurrence.
  • the number of tokens in the time slot and each child leaking bucket includes: the capacity of the total leaky bucket, the proportion of each priority sub-leakage bucket capacity, the weight priority factor, the total token addition rate, and the last speed limit occurrence.
  • the parameter storage module updates the parameters related to the leak rate limit of the leaking bucket as follows: the time when the last time limit rate is updated is the current time, and the number of the tokens in the total leaky bucket and each sub-leaked bucket is updated after the speed limit.
  • the parameter related to the leak rate limit of the leaked bucket stored by the parameter storage module further includes one or more of the following: a capacity of each weight priority sub-leak bucket, a proportion of each priority sub-leak bucket capacity, and an overflow setting operation.
  • the distribution ratio parameter and the number of preset overflows are added.
  • 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, all absolute priority and weight priority sub-leaked buckets are full, otherwise the total number of tokens to be added is added in descending order of absolute priority sub-drain bucket priority from highest to lowest.
  • the sub-leak bucket with the highest priority is full, add the token to the sub-leak bucket of the absolute priority, until all the absolute priority sub-leak buckets are full or the tokens to be added are exhausted, and all absolute priority sub-childs are obtained. Missing the current number of tokens in the bucket, and adding the remaining total tokens to the weight priority sub-leak bucket.
  • the tokens added to the weight priority sub-leak bucket are divided according to the proportional relationship of the weight priority factors, and the number of tokens provided for each weight priority sub-leak bucket is obtained; The number of tokens added by the weight priority sub-leak bucket is added to the sub-leak bucket. If there is a sub-leak bucket full but the token provided for the sub-leak bucket to be added remains, the discard is discarded. The remaining tokens, as well as the total number of leaky tokens, are also reduced by the corresponding number of drops.
  • the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the number of tokens provided for each weight priority sub-leak bucket is added;
  • the token adding module allocates the overflowed token to the other underweight weights by the overflow operation to:
  • the overflowed token is assigned to other underweight priority sub-leak buckets according to the weight priority factor proportional relationship or a preset proportional relationship. After the second addition is completed, there is an overflow token, and the weight is not full.
  • the priority sub-leakage bucket continues to be added for the third time, ... until the ownership priority priority sub-leakage bucket has no overflow token, or reaches the preset number of mutual overflow additions.
  • the method and device for limiting the speed of the leaky bucket of the present invention treats the packets with different absolute priorities and weight priorities differently, and divides the total leaky bucket into multiple sub-leaked buckets according to the requirements of the absorption jitter of each priority flow, and each sub-leaked bucket Corresponding to an absolute priority or weight priority, if there is an overflow token after the token addition level is completely full, the overflow token is added to the weight priority sub-leakage according to the weight priority factor, and then For the received packet, the forwarding, discarding, or marking operation is performed according to the token in the sub-leak bucket corresponding to the absolute priority or the weight priority of the packet.
  • the invention can make up for the shortage of the priority of the packet in the traditional leaking bucket, so that the packets with different absolute priorities or different weight priorities are under the same speed limit condition, and some have strict priority order. Abandon the probability, some have a fixed proportion of pass and drop probability, so the speed limit is more flexible, and can improve the data network service quality and user experience;
  • the present invention organically limits the rate limit and scheduling of data packets. Combined, the hardware design of the scheduling function can be omitted, thereby saving network hardware resources.
  • 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 for adding a token to an absolute priority leaky bucket according to the present invention
  • FIG. 4 is a schematic diagram of an implementation manner of adding a token to a weighted priority leaky bucket according to the present invention
  • FIG. 6 is a schematic diagram of a principle of a speed limit of a leaky bucket according to the present invention.
  • FIG. 7 is a schematic flow chart of a method for speed limiting a leaky bucket according to an embodiment of the present invention. detailed description
  • each absolute priority or weight priority corresponds to a sub-leak bucket in the total leaky bucket, and the absolute priority sub-subject is performed. If there is an overflow token after the leaky bucket is full, the overflow token is added to the weight priority sub-leakage bucket according to the weight priority factor, and then, for the received packet, according to the absolute priority or weight priority of the packet.
  • the token in the sub-leak bucket corresponding to the level performs a forwarding, discarding or marking operation.
  • the packet for the rate limit of the leaky bucket may be divided according to at least one absolute priority and at least two weight priorities (for example, according to the packet type), and correspondingly, the leaked bucket capacity is determined according to different absolute priorities.
  • the priority of the class and the weight are divided into at least three sub-leaked buckets, and the absolute priority/message weight priority of the packet corresponds to the sub-drain absolute priority/sub-drain weight priority.
  • the capacity of the SP sub-leak buckets is represented as BS_spl, BS_sp2, ... BS_spn, respectively;
  • the remaining part of the capacity is divided into m weight priority sub-leak buckets according to actual needs.
  • the weight priority sub-leak bucket capacity may be divided according to a weight priority factor (such as each weight priority factor respectively wl, w2, w3 wn), or may be divided according to actual needs, generally, high
  • the weight priority sub-leak bucket has a larger capacity, and the low-weight priority sub-leak bucket has a smaller capacity.
  • 2 is a schematic flowchart of a method for speed limit of a leaky bucket according to the present invention. As shown in FIG. 2, the method includes: 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 capacity of each sub-leakage bucket can be further obtained according to the capacity of the total leaky bucket and the ratio of the absolute priority sub-leakage buckets.
  • the capacity of each sub-leak bucket can be further obtained according to the total leaked bucket capacity and the weight priority factor; if the sub-leak is performed according to the actual demand
  • the parameters related to the rate limit of the leaky bucket need to include the capacity of each weight priority sub-leak bucket or the weight priority sub-leak bucket capacity division ratio. According to the total leaky bucket capacity, the absolute priority sub-leakage bucket capacity.
  • the ratio of the division ratio and the sub-leakage capacity of each weight priority can obtain the capacity of each sub-leaked bucket, but in any case, the capacity of each sub-leakage bucket must meet the requirements of the absorption jitter of each priority flow;
  • the related parameters may also include an allocation ratio parameter additionally set by the overflow operation and/or a preset mutual overflow addition number. 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 Perform token addition on the total leaky bucket and each sub-leakage bucket according to the calculated total number of tokens and the absolute priority and weight priority of the sub-leaked 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 added tokens is added. In the second step, if the total leaky bucket is full, all absolute priority and weight priority sub-leak buckets are full, otherwise the total number of tokens to be added is in the order of absolute priority and post-weight priority. Until the total token added is exhausted.
  • FIG. 3 is a schematic diagram of the principle of adding tokens to an absolute priority leaky bucket according to the present invention. As shown in FIG. 3, if the absolute priority sub-leakage buckets in the leaky bucket are sequentially named SP1 buckets and SP2 buckets in descending order of priority.
  • SP3 bucket... then the token is first added to the SP1 bucket, if the SP1 bucket is full, then added to the SP2 bucket; if the SP1 and SP2 buckets are full, then add to the SP3 bucket..., and so on, until all absolute If the priority sub-leak bucket is full or the token to be added is exhausted, the current number of tokens of all absolute priority sub-leak buckets is obtained; if the total token still has remaining, the remaining tokens are added to the weight priority. In the class leaky bucket, otherwise the number of tokens added to the weight priority sub-leak bucket is zero.
  • delta_token the number of tokens added to each weight priority sub-leak bucket is further divided according to the proportional relationship of the weight priority factors;
  • the number of tokens added by the priority sub-leak bucket is represented as delta_token 1, delta_token2, delta_token3, ..., delta_tokenm, respectively, and the four gates satisfy the following relationship:
  • Delta-token 1 delta-token *wl
  • Delta_token2 delta-token *w2
  • Delta_token3 delta-token *w3
  • delta-tokenm delta_token*wm
  • Delta—token delta—token 1+ delta_token2 + ... + delta—tokenm. It should be noted that when adding a token to a weight priority sub-leak bucket, there are two different implementation manners:
  • the number of tokens of the sub-leaked bucket is the corresponding sub-leaked bucket capacity. At the same time, the total number of leaked tokens is also reduced by the corresponding number of discarded packets. If the sub-leaked bucket is not full, but the token provided for the sub-leaked bucket has been exhausted, the number of tokens of the sub-leaked bucket is step 201. The sum of the number of tokens in the sub-leak bucket obtained in the sub-leak bucket is the sum of the number of tokens added.
  • the principle of token addition to the weight-priority leak bucket described in this embodiment is as shown in FIG. 4 .
  • the overflowed tokens may be weighted by the priority factor The proportional relationship or the pre-set proportional relationship is assigned to other sub-leaked buckets.
  • the number of tokens of the sub-leaked bucket is the corresponding sub- Leaked bucket capacity, after the second addition is over, if there is still an overflow token, the third sub-leakage continues to be added for the third time, and so on until all sub-leaked buckets have no overflow token, or reach the preset
  • the number of times of overflow is added (also referred to as the number of iterations), and the number of tokens of all the sub-leak buckets is obtained.
  • the principle of token addition to the weighted priority leaky bucket described in this embodiment is as shown in FIG. 5.
  • the overflow calculation of the overflow sub-bucket tokens is up to N-1, and if the preset mutual overflow addition times are reached, the sub-leakage overflows. The token will be discarded, and the total number of leaky tokens will also be reduced by the corresponding number of drops.
  • Step 204 Forward, or discard, or mark the packet according to the packet length of the packet and the weight of the packet or the number of tokens in the sub-leak bucket corresponding to the absolute priority.
  • the corresponding sub-leak bucket is selected according to the packet weight priority or the absolute priority, and then the number of tokens in the sub-leak bucket is compared with the packet length of the packet, and whether the packet is forwarded is determined. If the number of tokens in the sub-leaked bucket is greater than or equal to the packet length of the packet, forwarding the packet, and reducing the number of tokens in the total leaky bucket and the sub-leaked bucket Packet length corresponding 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-leakage buckets The number of cards does not change.
  • the principle of the speed limit of the leaky bucket involved in the present invention is as shown in FIG. 6. It can be seen that the present invention assigns the total token to the absolute priority sub-leak bucket one by one, and then distributes it to the weight priority sub-leakage bucket proportionally.
  • a leaky bucket rate limit service can be implemented for absolute priority and weight priority packets.
  • Step 205 Update the parameters related to the leak rate limit of the leaky bucket.
  • FIG. 7 A detailed process of the method for limiting the speed of the leaky bucket in the embodiment of the present invention is as shown in FIG. 7. It should be noted that if the present invention is implemented by using hardware, the logic and parameter storage resources of the speed limit calculation will vary with the number of sub-leaked buckets. The increase and the increase in linearity require a comprehensive assessment based on actual needs.
  • 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 is divided into multiple sub-leaked buckets according to the number of all priorities and the proportional parameter, and the capacity of each sub-leaked bucket is equal to the total leaky bucket capacity, and the packet absolute priority/message weight priority and sub- The leaked bucket absolute priority/sub-drain bucket weight priority corresponds to;
  • 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 buckets based on the calculated total number of tokens and the absolute priority and weight 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 packet processing module is configured to forward, or discard, or mark the packet according to the packet length of the packet and the number of tokens in the sub-leak bucket corresponding to the absolute priority or the weight priority of the packet. 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 the absolute priority sub-drain bucket capacity, the weight priority factor, the total token addition rate, and the last speed limit. The number of tokens in the time slot and each child leaking 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 parameter related to the leak rate limit of the leaked bucket stored by the parameter storage module further includes one or more of the following: a capacity of each weight priority sub-leak bucket, a weight priority sub-leak bucket capacity division ratio, and an overflow operation separately set.
  • the distribution ratio parameter and the number of preset overflows are added.
  • 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, all absolute priority and weight priority sub-leaked buckets are full, otherwise the total number of tokens to be added is added in descending order of absolute priority sub-drain bucket priority from highest to lowest. After the sub-leak bucket with the highest priority is full, add the token to the sub-leak bucket of the absolute priority, until all the absolute priority sub-leak buckets are full or the tokens to be added are exhausted, and all absolute priorities are obtained. The level leaks the current number of tokens, and adds the remaining tokens to be added to the weight priority sub-leak bucket.
  • the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the number of tokens provided for each weight priority sub-leak bucket is added;
  • the overflowed token is assigned to other underweight priority sub-leak buckets according to the weight priority factor proportional relationship or a preset proportional relationship. After the second addition is completed, there is an overflow token, and the weight is not full.
  • the priority sub-leakage bucket continues to be added for the third time, ... until the ownership priority priority sub-leakage bucket has no overflow token, or reaches the preset number of mutual overflow additions.
  • the number of tokens in the sub-leak bucket corresponding to the priority, forwarding, or discarding, or marking the packet as follows: selecting the corresponding sub-leak bucket according to the absolute priority or weight priority of the packet, The number of tokens in the sub-leak bucket is compared with the packet length of the packet.
  • the packet is forwarded.
  • the number of tokens in the leaky bucket and the sub-leak bucket is reduced by a number corresponding to the packet length; the number of tokens in the sub-leak bucket is smaller than If the packet length of the packet is long, the packet is discarded or marked, and the number of tokens in the total leaked bucket and all the sub-leaked buckets is unchanged.
  • the present invention proposes to assign the total token to the absolute priority sub-leak bucket one by one, and then allocates proportionally to
  • the weighted priority sub-leaked bucket solution can implement the leaky bucket rate-limiting service for the absolute priority and the weight-priority packets. It can make up for the traditional leaky bucket speed limit mode. Insufficient difference in packet priority, so that packets of different priorities are under the same rate limit, some have strict priority order of pass and drop probability, and some have a fixed proportion of pass and drop probability.
  • the quality of the network service at the same time, the method organically combines the rate limit of the data packet with the scheduling, the hardware design of the scheduling function can be omitted, thereby significantly saving the 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虽然能够对报文进行限速, 但是在限 速的过程中无法区别优先级高低不同的报文的服务质量, 所以, 现有报文 限速方法不够灵活, 不利于提高数据网络服务质量及用户体验。 发明内容
有鉴于此, 本发明的主要目的在于提供一种漏桶限速方法及装置, 能 按照绝对优先级和权重优先级对报文进行灵活限速, 从而提高数据网络服 务质量及用户体验。
为达到上述目的, 本发明的技术方案是这样实现的:
一种漏桶限速方法, 对于共用同一漏桶但具有不同绝对优先级及不同 权重优先级混合的一组报文进行限速的时候, 将总漏桶按照所有优先级的 个数及比例参数分割为多个子漏桶, 所述比例参数根据各优先级流量吸收 抖动的要求而定, 且各子漏桶的容量和等于总漏桶容量, 报文绝对优先级 / 报文权重优先级与子漏桶绝对优先级 /子漏桶权重优先级相对应, 该方法包 括:
收到报文的相关信息后, 获取与漏桶限速相关的参数, 所述报文的相 关信息至少包括: 报文的包长和报文的优先级;
根据获取的与漏桶限速相关的参数计算需要添加的总令牌数; 根据计算的总令牌数及子漏桶的绝对优先级和权重优先级对总漏桶及 各子漏桶进行令牌添加; 漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文。
所述转发、 或丟弃、 或标记报文之后, 该方法还包括: 更新与漏桶限 速相关的参数。
所述与漏桶限速相关的参数包括: 总漏桶的容量、 绝对优先级及权重 优先级子漏桶容量划分比例、 权重优先级因子、 总令牌添加速率、 上一次 限速发生的时刻和总漏桶及各子漏桶中的令牌数,
所述更新与漏桶限速相关的参数为: 更新上一次限速发生的时刻为当 前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速后的数量。
所述与漏桶限速相关的参数还包括以下一项或多项: 各权重优先级子 漏桶的容量、 绝对优先级及权重优先级子漏桶容量划分比例、 互溢运算另 外设置的分配比例参数、 预设互溢添加次数。 所述根据获取的与漏桶限速相关的参数计算需要添加的总令牌数为: 计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。
所述根据计算的总令牌数及子漏桶的绝对优先级和权重优先级对总漏 桶及各子漏桶进行令牌添加为:
第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则所有绝对优先级及权重优先级子漏桶均满, 否则将需要添加的总 令牌数按照绝对优先级子漏桶优先级由高到低的顺序进行令牌添加, 绝对 优先级高的子漏桶加满后, 再向次绝对优先级的子漏桶添加令牌, 直至所 有绝对优先级子漏桶均满或需要添加的令牌耗尽, 得到所有绝对优先级子 漏桶当前的令牌数, 并将剩余的总令牌添加到权重优先级子漏桶中。
所述将剩余需要添加的令牌添加到权重优先级子漏桶中为:
将所述剩余需要添加的令牌按照权重优先级因子的比例关系划分, 得 出提供给各个权重优先级子漏桶进行添加的令牌数;
按照所述提供给各个权重优先级子漏桶进行添加的令牌数对子漏桶进 行令牌添加, 如果有子漏桶已满但提供给所述子漏桶进行添加的令牌还有 剩余, 则丟弃所述剩余的令牌, 同时总漏桶令牌数也相应减少丟弃的数量。
所述将剩余需要添加的令牌添加到权重优先级子漏桶中为:
将需要添加的总令牌数按照权重优先级因子的比例关系划分, 得出提 供给各个权重优先级子漏桶进行添加的令牌数;
按照所述提供给各个权重优先级子漏桶进行添加的令牌数对权重优先 级子漏桶进行令牌添加, 所有权重优先级子漏桶获取相应的添加令牌后, 将溢出的令牌分配给其它未满的权重优先级子漏桶。
所述将溢出的令牌经过互溢运算分配给其它未满的权重优先级子漏桶 为:
将溢出的令牌按照权重优先级因子比例关系或者预先设置的比例关系 分配给其它未满的权重优先级子漏桶, 第二次添加结束后, 还有溢出令牌, 则对未满的权重优先级子漏桶继续进行第三次添加, ... ..., 直至所有权重 优先级子漏桶无溢出令牌、 或达到预设的互溢添加次数; 且如果达到预设 互溢添加次数, 则子漏桶的溢出令牌将丟弃, 同时总漏桶令牌数也减少相 应丟弃的数量。 的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文为:
根据所述报文的绝对优先级或权重优先级选择对应的子漏桶, 将所述 子漏桶中的令牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大 于或等于所述报文包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的 令牌数减少与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述 报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子 漏桶中的令牌数不变。
一种漏桶限速装置, 包括: 总漏桶、 报文信息接收模块、 令牌添加模 块、 参数存储模块、 报文处理模块; 其中,
所述总漏桶, 按照所有优先级的个数及比例参数分割为多个子漏桶, 且各子漏桶的容量和等于总漏桶容量, 报文绝对优先级 /报文权重优先级与 子漏桶绝对优先级 /子漏桶权重优先级相对应;
所述报文信息接收模块, 用于接收报文的相关信息, 所述报文的相关 信息至少包括: 报文的包长和报文的优先级;
所述令牌添加模块, 用于在报文信息接收模块接收到报文的相关信息 后, 从参数存储模块获取与漏桶限速相关的参数; 以及根据获取的与漏桶 限速相关的参数计算需要添加的总令牌数; 以及根据计算的总令牌数及子 漏桶的绝对优先级和权重优先级对子漏桶进行令牌添加;
所述参数存储模块, 用于维护与漏桶限速相关的参数;
所述报文处理模块, 用于根据报文的包长及所述报文的绝对优先级或 权重优先级对应的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文。
所述参数存储模块, 还用于在报文处理模块转发、 或丟弃、 或标记报 文之后, 更新与漏桶限速相关的参数。
所述参数存储模块存储的与漏桶限速相关的参数包括: 总漏桶的容量、 各优先级子漏桶容量划分比例、 权重优先级因子、 总令牌添加速率、 上一 次限速发生的时刻和各子漏桶中的令牌数,
所述参数存储模块更新与漏桶限速相关的参数为: 更新上一次限速发 生的时刻为当前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速后的 数量。
所述参数存储模块存储的与漏桶限速相关的参数还包括以下一项或多 项: 各权重优先级子漏桶的容量、 各优先级子漏桶容量划分比例、 互溢运 算另外设置的分配比例参数、 预设互溢添加次数。
所述令牌添加模块根据获取的与漏桶限速相关的参数计算需要添加的 总令牌数为:
计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。
所述令牌添加模块根据计算的总令牌数及子漏桶的绝对优先级和权重 优先级对总漏桶及各子漏桶进行令牌添加为:
第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则所有绝对优先级及权重优先级子漏桶均满, 否则将需要添加的总 令牌数按照绝对优先级子漏桶优先级由高到低的顺序进行令牌添加, 绝对 优先级高的子漏桶加满后, 再向次绝对优先级的子漏桶添加令牌, 直至所 有绝对优先级子漏桶均满或需要添加的令牌耗尽, 得到所有绝对优先级子 漏桶当前的令牌数, 并将剩余的总令牌添加到权重优先级子漏桶中。
所述令牌添加模块将剩余需要添加的令牌添加到权重优先级子漏桶中 为:
将所述剩余需要添加到权重优先级子漏桶的令牌按照权重优先级因子 的比例关系划分, 得出提供给各个权重优先级子漏桶进行添加的令牌数; 按照所述提供给各个权重优先级子漏桶进行添加的令牌数对子漏桶进 行令牌添加, 如果有子漏桶已满但提供给所述子漏桶进行添加的令牌还有 剩余, 则丟弃所述剩余的令牌, 同时总漏桶令牌数也减少相应丟弃的数量。
所述令牌添加模块将剩余需要添加的令牌添加到权重优先级子漏桶中 为:
将需要添加的总令牌数按照权重优先级因子的比例关系划分, 得出提 供给各个权重优先级子漏桶进行添加的令牌数;
按照所述提供给各个权重优先级子漏桶进行添加的令牌数对权重优先 级子漏桶进行令牌添加, 所有权重优先级子漏桶获取相应的添加令牌后, 将溢出的令牌分配给其它未满的权重优先级子漏桶。
所述令牌添加模块将溢出的令牌经过互溢运算分配给其它未满的权重 优先级子漏桶为:
将溢出的令牌按照权重优先级因子比例关系或者预先设置的比例关系 分配给其它未满的权重优先级子漏桶, 第二次添加结束后, 还有溢出令牌, 则对未满的权重优先级子漏桶继续进行第三次添加, ... ..., 直至所有权重 优先级子漏桶无溢出令牌、 或达到预设的互溢添加次数。 重优先级对应的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文为: 根据所述报文的绝对优先级或权重优先级选择对应的子漏桶, 将所述 子漏桶中的令牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大 于或等于所述报文包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的 令牌数减少与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述 报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子 漏桶中的令牌数不变。
本发明漏桶限速方法及装置, 对不同绝对优先级以及权重优先级的报 文区别对待, 将总漏桶根据各优先级流量吸收抖动的要求分割成多个子漏 桶, 每一个子漏桶对应着一个绝对优先级或权重优先级, 在进行令牌添加 级子漏桶全满后如果还有溢出令牌, 再将溢出令牌根据权重优先级因子添 加到权重优先级子漏桶, 之后, 对于接收到的报文, 根据该报文绝对优先 级或权重优先级对应的子漏桶中的令牌执行转发、 丟弃或标记操作。 本发 明弥补了传统漏桶限速不能体现报文优先级区别的不足, 使得不同绝对优 先级或不同权重优先级的报文在同一限速条件下, 有的具有严格优先级顺 序的通过与丟弃概率, 有的具有固定比例的通过与丟弃概率, 从而限速更 加灵活, 能够提高数据网络服务质量及用户体验; 此外, 本发明由于将数 据报文的限速与调度思想进行了有机的结合, 可以省去调度功能的硬件设 计, 从而可节省网络的硬件资源。 附图说明
图 1为现有 RFC标准的漏桶限速原理示意图;
图 2为本发明漏桶限速方法流程示意图;
图 3为本发明对绝对优先级漏桶进行令牌添加的原理示意图; 图 4为本发明对权重优先级漏桶进行令牌添加的一种实施方式示意图; 图 5 为本发明对权重优先级漏桶进行令牌添加的另一种实施方式示意 图;
图 6为本发明涉及的漏桶限速原理示意图;
图 7为本发明实施例一种漏桶限速方法的详细流程示意图。 具体实施方式
本发明的基本思想是: 对一组混合有不同绝对优先级及权重优先级的 报文, 每一绝对优先级或权重优先级对应总漏桶中的一个子漏桶, 在进行 绝对优先级子漏桶全满后如果还有溢出令牌, 再将溢出令牌根据权重优先 级因子添加到权重优先级子漏桶, 之后, 对于接收到的报文, 根据该报文 绝对优先级或权重优先级对应的子漏桶中的令牌执行转发、 丟弃或标记操 作。
本发明中, 漏桶限速所针对的报文可以按照至少一个绝对优先级和至 少两个权重优先级进行划分(例如按照报文类型划分), 相应的, 将漏桶容 量按照不同的绝对优先级和权重优先级划分为至少三个子漏桶, 报文绝对 优先级 /报文权重优先级与子漏桶绝对优先级 /子漏桶权重优先级相对应。
如果将总的漏桶容量 BS的一部分按照实际需要划分为 n个绝对优先级 ( SP )子漏桶, SP子漏桶的容量分别表示为 BS_spl、 BS_sp2、 ... BS_spn; 将总的漏桶容量的剩余部分根据实际需要划分为 m个权重优先级子漏桶, 权重优先级子漏桶的容量分别表示为 BS_wl、 BS_w2、 ... BS_wm, 则它们 满足如下关系: BS = BS_spl+BS_sp2+... +BS_spn+ BS_wl+BS_w2+... +BS_wm。
其中, 权重优先级子漏桶的容量可以按照权重优先级因子 (如各权重 优先级因子分别为 wl、 w2、 w3 wn ) 的比例关系进行划分, 也可根 据实际需求进行划分, 一般的, 高权重优先级子漏桶的容量较大, 低权重 优先级子漏桶的容量较小。 图 2为本发明漏桶限速方法流程示意图, 如图 2所示, 该方法包括: 步骤 201 : 收到报文的相关信息后, 获取与漏桶限速相关的参数。
这里, 所述报文的相关信息至少包括: 报文的包长和报文的优先级, 所述与漏桶限速相关的参数可以但不限于包括:
( 1 ) 总漏桶的容量;
( 2 )绝对优先级子漏桶容量划分比例;
( 3 )权重优先级因子;
( 4 ) 总令牌添加速率;
( 5 )上一次限速发生的时刻;
( 6 )总漏桶及各子漏桶中的令牌数, 如果之前发生了限速运算, 指上 一次同组报文发生限速运算后的令牌数。
对于绝对优先级子漏桶, 可以根据总漏桶的容量和各绝对优先级子漏 桶容量划分比例可以进一步获取各子漏桶的容量。 对于权重优先级子漏桶, 如果按照权重优先级因子进行子漏桶容量划分, 则可以进一步根据总漏桶 的容量和权重优先级因子获取各子漏桶的容量; 如果根据实际需求进行子 漏桶容量划分, 则与漏桶限速相关的参数还需要包括各权重优先级子漏桶 的容量或权重优先级子漏桶容量划分比例, 根据总漏桶的容量、 绝对优先 级子漏桶容量划分比例和各权重优先级子漏桶容量划分比例可以获取各子 漏桶的容量, 但无论如何, 各子漏桶容量均须满足各优先级流量吸收抖动 的要求; 此外, 与漏桶限速相关的参数还可以包括互溢运算另外设置的分 配比例参数和 /或预设互溢添加次数。 实际应用中, 无论硬件还是软件实现 都需要维护以上参数配置。
步骤 202: 根据获取的与漏桶限速相关的参数计算需要添加的总令牌 数。
具体的, 计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算该时间差与总令牌添加速率的乘积, 得到需要添加的总令牌数。 步骤 203:根据计算的总令牌数及子漏桶的绝对优先级和权重优先级对 总漏桶及各子漏桶进行令牌添加。
本发明中, 第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏桶满, 则所有绝对优先级及权重优先级子漏桶均满, 否则将需要 添加的总令牌数按照先绝对优先级、 后权重优先级的顺序来进行, 直至添 加的总令牌消耗完。
图 3 为本发明对绝对优先级漏桶进行令牌添加的原理示意图, 如图 3 所示, 如果将漏桶中的绝对优先级子漏桶按照优先级高低顺序依次命名为 SP1桶、 SP2桶、 SP3桶... , 则令牌首先添加到 SP1桶, 如果 SP1桶满, 再添加到 SP2桶; 如果 SP1与 SP2桶都满,再添加到 SP3桶...,依次类推, 直到所有绝对优先级子漏桶均满或需要添加的令牌耗尽, 得到所有绝对优 先级子漏桶当前的令牌数; 如果这时总令牌还有剩余, 则将剩余的令牌添 加到权重优先级子漏桶中, 否则添加到权重优先级子漏桶中的令牌数为零。
如果将添加到权重优先级子漏桶的令牌数目表示为 delta_token, 则进 一步按照权重优先级因子的比例关系划分提供给各权重优先级子漏桶进行 添加的令牌数; 将提供给各权重优先级子漏桶进行添加的令牌数分别表示 为 delta—token 1、 delta_token2、 delta_token3, ... 、 delta—tokenm, 则它 4门 满足如下关系:
delta—token 1 = delta—token *wl;
delta_token2 = delta—token *w2;
delta_token3 = delta—token *w3; delta—tokenm = delta_token*wm;
delta—token = delta—token 1+ delta_token2 + ... + delta—tokenm. 需要说明的是, 在向权重优先级子漏桶添加令牌时, 存在以下两种不 同的实施方式:
1 )如果子漏桶已满, 但提供给该子漏桶进行添加的令牌还有剩余, 则 丟弃所述剩余的令牌, 该子漏桶的令牌数为对应的子漏桶容量, 同时总漏 桶令牌数也减少相应丟弃数量; 如果子漏桶未满, 但提供给该子漏桶进行 添加的令牌已经耗完, 则该子漏桶的令牌数为步骤 201 中获取的该子漏桶 中的令牌数与相应添加的令牌数之和, 该实施方式所述的对权重优先级漏 桶进行令牌添加的原理如图 4所示。
2 )在所有子漏桶获取相应的添加令牌后, 如果某一个或几个子漏桶已 满, 但提供给其进行添加的令牌还有剩余, 则溢出的令牌可以按照权重优 先级因子比例关系或者预先设置的比例关系分配给其它未满的子漏桶, 若 其它未满子漏桶在第二次添加溢出令牌后已满, 则该子漏桶的令牌数为对 应的子漏桶容量, 第二次添加结束后, 如果还有溢出令牌, 则对未满的子 漏桶继续进行第三次添加, 如此类推直至所有子漏桶无溢出令牌、 或达到 预设的互溢添加次数(也可称为迭代次数), 得到所有子漏桶的令牌数, 该 实施方式所述的对权重优先级漏桶进行令牌添加的原理如图 5 所示。 需要 说明的是, 若子漏桶的数目为 N, 则溢出子漏桶令牌的互溢运算迭代计算 的次数最多为 N-1 ,且如果达到预设互溢添加次数, 则子漏桶的溢出令牌将 丟弃, 同时总漏桶令牌数也减少相应丟弃的数量。
步骤 204:根据所述报文的包长及所述报文的权重优先级或绝对优先级 对应的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文。
具体的, 先根据报文权重优先级或绝对优先级选择对应的子漏桶, 然 后将所述子漏桶中的令牌数与所述报文的包长进行比较, 决定是否转发所 述报文, 如果所述子漏桶中的令牌数大于或等于所述报文的包长, 则转发 所述报文, 同时总漏桶及所述子漏桶中的令牌数减少与所述报文包长相应 的数目; 如果所述子漏桶中的令牌数小于所述报文的包长, 则丟弃所述报 文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌数不变。
本发明涉及的漏桶限速原理如图 6所示, 可以看出, 本发明将总令牌 先逐一分给绝对优先级子漏桶, 然后再按比例分配给权重优先级子漏桶, 从而可以实现对绝对优先级以及权重优先级报文的漏桶限速区分服务。
步骤 205: 更新与漏桶限速相关的参数。
这里, 主要指更新上一次限速发生的时刻为当前时刻, 以及更新总漏 桶及各子漏桶中的令牌数为限速运算后的令牌数。
本发明实施例一种漏桶限速方法的详细流程如图 7所示, 需要说明的 是, 如果釆用硬件实现本发明, 则限速计算的逻辑及参数存储资源将随子 漏桶的数目的增多而线性的增多, 需要根据实际的需求进行综合评估。
本发明还相应地提出一种漏桶限速装置, 包括: 总漏桶、 报文信息接 收模块、 令牌添加模块、 参数存储模块、 报文处理模块; 其中,
所述总漏桶, 按照所有优先级的个数及比例参数分割为多个子漏桶, 且各子漏桶的容量和等于总漏桶容量, 报文绝对优先级 /报文权重优先级与 子漏桶绝对优先级 /子漏桶权重优先级相对应;
所述报文信息接收模块, 用于接收报文的相关信息, 所述报文的相关 信息至少包括: 报文的包长和报文的优先级;
所述令牌添加模块, 用于在报文信息接收模块接收到报文的相关信息 后, 从参数存储模块获取与漏桶限速相关的参数; 以及根据获取的与漏桶 限速相关的参数计算需要添加的总令牌数; 以及根据计算的总令牌数及子 漏桶的绝对优先级和权重优先级对子漏桶进行令牌添加;
所述参数存储模块, 用于维护与漏桶限速相关的参数;
所述报文处理模块, 用于根据报文的包长, 及所述报文的绝对优先级 或权重优先级对应的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文。 所述参数存储模块, 还用于在报文处理模块转发、 或丟弃、 或标记报 文之后, 更新与漏桶限速相关的参数。
所述参数存储模块存储的与漏桶限速相关的参数包括: 总漏桶的容量、 绝对优先级子漏桶容量划分比例、 权重优先级因子、 总令牌添加速率、 上 一次限速发生的时刻和各子漏桶中的令牌数,
所述参数存储模块更新与漏桶限速相关的参数为: 更新上一次限速发 生的时刻为当前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速运算 后的令牌数。
所述参数存储模块存储的与漏桶限速相关的参数还包括以下一项或多 项: 各权重优先级子漏桶的容量、 权重优先级子漏桶容量划分比例、 互溢 运算另外设置的分配比例参数、 预设互溢添加次数。
所述令牌添加模块根据获取的与漏桶限速相关的参数计算需要添加的 总令牌数为:
计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。
所述令牌添加模块根据计算的总令牌数及子漏桶的绝对优先级和权重 优先级对总漏桶及各子漏桶进行令牌添加为:
第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则所有绝对优先级及权重优先级子漏桶均满, 否则将需要添加的总 令牌数按照绝对优先级子漏桶优先级由高到低的顺序进行令牌添加, 绝对 优先级高的子漏桶加满后, 再向次绝对优先级的子漏桶添加令牌, 直至所 有绝对优先级子漏桶均满或需要添加的令牌耗尽, 得到所有绝对优先级子 漏桶当前的令牌数, 并将剩余需要添加的令牌添加到权重优先级子漏桶中。
所述令牌添加模块将剩余需要添加的令牌添加到权重优先级子漏桶中 为:
将所述剩余需要添加的令牌按照权重优先级因子的比例关系划分, 得 出提供给各个权重优先级子漏桶进行添加的令牌数;
按照所述提供给各个权重优先级子漏桶进行添加的令牌数对子漏桶进 行令牌添加, 子漏桶已满但提供给所述子漏桶进行添加的令牌还有剩余, 则丟弃所述剩余的令牌, 同时总漏桶令牌数也相应减少丟弃的数量。
所述令牌添加模块将剩余需要添加的令牌添加到权重优先级子漏桶中 为:
将需要添加的总令牌数按照权重优先级因子的比例关系划分, 得出提 供给各个权重优先级子漏桶进行添加的令牌数;
按照所述提供给各个权重优先级子漏桶进行添加的令牌数对权重优先 级子漏桶进行令牌添加, 所有权重优先级子漏桶获取相应的添加令牌后, 将溢出的令牌分配给其它未满的权重优先级子漏桶。
所述令牌添加模块将溢出的令牌分配给其它未满的权重优先级子漏桶 为:
将溢出的令牌按照权重优先级因子比例关系或者预先设置的比例关系 分配给其它未满的权重优先级子漏桶, 第二次添加结束后, 还有溢出令牌, 则对未满的权重优先级子漏桶继续进行第三次添加, ... ..., 直至所有权重 优先级子漏桶无溢出令牌、 或达到预设的互溢添加次数。 重优先级对应的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文为: 根据所述报文的绝对优先级或权重优先级选择对应的子漏桶, 将所述 子漏桶中的令牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大 于或等于所述报文的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中 的令牌数减少与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所 述报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有 子漏桶中的令牌数不变。
本发明在对一组既具有绝对优先级又具有权重优先级的报文进行漏桶 限速的时候, 提出了将总令牌先逐一分给绝对优先级子漏桶, 然后再按比 例分配给权重优先级子漏桶的解决方案, 可以实现对绝对优先级以及权重 优先级报文的漏桶限速区分服务; 弥补了传统漏桶限速方式对于共用限速 漏桶的一组数据业务不能体现报文优先级区别的不足, 使得不同优先级的 报文在同一限速条件下, 有的具有严格优先级顺序的通过与丟弃概率, 有 的具有固定比例的通过与丟弃概率, 提高了网络服务质量; 同时本方法由 于将数据报文的限速与调度进行了有机的结合, 可以省去调度功能的硬件 设计, 从而显著的节省了网络硬件资源。
以上所述, 仅为本发明的较佳实施例而已, 并非用于限定本发明的保 护范围。

Claims

权利要求书
1、 一种漏桶限速方法, 其特征在于, 对于共用同一漏桶但具有不同绝 对优先级及不同权重优先级混合的一组报文进行限速的时候, 将总漏桶按 照所有优先级的个数及比例参数分割为多个子漏桶, 所述比例参数根据各 优先级流量吸收抖动的要求而定, 且各子漏桶的容量和等于总漏桶容量, 报文绝对优先级 /报文权重优先级与子漏桶绝对优先级 /子漏桶权重优先级 相对应, 该方法包括:
收到报文的相关信息后, 获取与漏桶限速相关的参数, 所述报文的相 关信息至少包括: 报文的包长和报文的优先级;
根据获取的与漏桶限速相关的参数计算需要添加的总令牌数; 根据计算的总令牌数及子漏桶的绝对优先级和权重优先级对总漏桶及 各子漏桶进行令牌添加; 漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文。
2、 根据权利要求 1所述的漏桶限速方法, 其特征在于, 所述转发、 或 丟弃、 或标记 "^文之后, 该方法还包括: 更新与漏桶限速相关的参数。
3、 根据权利要求 2所述的漏桶限速方法, 其特征在于,
所述与漏桶限速相关的参数包括: 总漏桶的容量、 绝对优先级及权重 优先级子漏桶容量划分比例、 权重优先级因子、 总令牌添加速率、 上一次 限速发生的时刻和总漏桶及各子漏桶中的令牌数,
所述更新与漏桶限速相关的参数为: 更新上一次限速发生的时刻为当 前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速后的数量。
4、 根据权利要求 3所述的漏桶限速方法, 其特征在于, 所述与漏桶限 速相关的参数还包括以下一项或多项: 各权重优先级子漏桶的容量、 绝对 优先级及权重优先级子漏桶容量划分比例、 互溢运算另外设置的分配比例 参数、 预设互溢添加次数。
5、 根据权利要求 4所述的漏桶限速方法, 其特征在于, 所述根据获取 的与漏桶限速相关的参数计算需要添加的总令牌数为:
计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。
6、 根据权利要求 5所述的漏桶限速方法, 其特征在于,
所述根据计算的总令牌数及子漏桶的绝对优先级和权重优先级对总漏 桶及各子漏桶进行令牌添加为:
第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则所有绝对优先级及权重优先级子漏桶均满, 否则将需要添加的总 令牌数按照绝对优先级子漏桶优先级由高到低的顺序进行令牌添加, 绝对 优先级高的子漏桶加满后, 再向次绝对优先级的子漏桶添加令牌, 直至所 有绝对优先级子漏桶均满或需要添加的令牌耗尽, 得到所有绝对优先级子 漏桶当前的令牌数, 并将剩余的总令牌添加到权重优先级子漏桶中。
7、 根据权利要求 6所述的漏桶限速方法, 其特征在于,
所述将剩余需要添加的令牌添加到权重优先级子漏桶中为:
将所述剩余需要添加的令牌按照权重优先级因子的比例关系划分, 得 出提供给各个权重优先级子漏桶进行添加的令牌数;
按照所述提供给各个权重优先级子漏桶进行添加的令牌数对子漏桶进 行令牌添加, 如果有子漏桶已满但提供给所述子漏桶进行添加的令牌还有 剩余, 则丟弃所述剩余的令牌, 同时总漏桶令牌数也相应减少丟弃的数量。
8、 根据权利要求 6所述的漏桶限速方法, 其特征在于, 所述将剩余需 要添加的令牌添加到权重优先级子漏桶中为:
将需要添加的总令牌数按照权重优先级因子的比例关系划分, 得出提 供给各个权重优先级子漏桶进行添加的令牌数;
按照所述提供给各个权重优先级子漏桶进行添加的令牌数对权重优先 级子漏桶进行令牌添加, 所有权重优先级子漏桶获取相应的添加令牌后, 将溢出的令牌分配给其它未满的权重优先级子漏桶。
9、 根据权利要求 8所述的漏桶限速方法, 其特征在于, 所述将溢出的 令牌经过互溢运算分配给其它未满的权重优先级子漏桶为:
将溢出的令牌按照权重优先级因子比例关系或者预先设置的比例关系 分配给其它未满的权重优先级子漏桶, 第二次添加结束后, 还有溢出令牌, 则对未满的权重优先级子漏桶继续进行第三次添加, ... ..., 直至所有权重 优先级子漏桶无溢出令牌、 或达到预设的互溢添加次数; 且如果达到预设 互溢添加次数, 则子漏桶的溢出令牌将丟弃, 同时总漏桶令牌数也减少相 应丟弃的数量。
10、 根据权利要求 1至 9任一项所述的漏桶限速方法, 其特征在于, 漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文为:
根据所述报文的绝对优先级或权重优先级选择对应的子漏桶, 将所述 子漏桶中的令牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大 于或等于所述报文包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的 令牌数减少与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述 报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子 漏桶中的令牌数不变。
11、 一种漏桶限速装置, 其特征在于, 该装置包括: 总漏桶、 报文信 息接收模块、 令牌添加模块、 参数存储模块、 报文处理模块; 其中,
所述总漏桶, 按照所有优先级的个数及比例参数分割为多个子漏桶, 且各子漏桶的容量和等于总漏桶容量, 报文绝对优先级 /报文权重优先级与 子漏桶绝对优先级 /子漏桶权重优先级相对应;
所述报文信息接收模块, 用于接收报文的相关信息, 所述报文的相关 信息至少包括: 报文的包长和报文的优先级;
所述令牌添加模块, 用于在报文信息接收模块接收到报文的相关信息 后, 从参数存储模块获取与漏桶限速相关的参数; 以及根据获取的与漏桶 限速相关的参数计算需要添加的总令牌数; 以及根据计算的总令牌数及子 漏桶的绝对优先级和权重优先级对子漏桶进行令牌添加;
所述参数存储模块, 用于维护与漏桶限速相关的参数;
所述报文处理模块, 用于根据报文的包长及所述报文的绝对优先级或 权重优先级对应的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文。
12、 根据权利要求 11所述的漏桶限速装置, 其特征在于,
所述参数存储模块, 还用于在报文处理模块转发、 或丟弃、 或标记报 文之后, 更新与漏桶限速相关的参数。
13、 根据权利要求 12所述的漏桶限速装置, 其特征在于,
所述参数存储模块存储的与漏桶限速相关的参数包括: 总漏桶的容量、 各优先级子漏桶容量划分比例、 权重优先级因子、 总令牌添加速率、 上一 次限速发生的时刻和各子漏桶中的令牌数,
所述参数存储模块更新与漏桶限速相关的参数为: 更新上一次限速发 生的时刻为当前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速后的 数量。
14、 根据权利要求 13所述的漏桶限速装置, 其特征在于, 所述参数存 储模块存储的与漏桶限速相关的参数还包括以下一项或多项: 各权重优先 级子漏桶的容量、 各优先级子漏桶容量划分比例、 互溢运算另外设置的分 配比例参数、 预设互溢添加次数。
15、 根据权利要求 14所述的漏桶限速装置, 其特征在于, 所述令牌添加模块根据获取的与漏桶限速相关的参数计算需要添加的 总令牌数为:
计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。
16、 根据权利要求 15所述的漏桶限速装置, 其特征在于, 所述令牌添 加模块根据计算的总令牌数及子漏桶的绝对优先级和权重优先级对总漏桶 及各子漏桶进行令牌添加为:
第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则所有绝对优先级及权重优先级子漏桶均满, 否则将需要添加的总 令牌数按照绝对优先级子漏桶优先级由高到低的顺序进行令牌添加, 绝对 优先级高的子漏桶加满后, 再向次绝对优先级的子漏桶添加令牌, 直至所 有绝对优先级子漏桶均满或需要添加的令牌耗尽, 得到所有绝对优先级子 漏桶当前的令牌数, 并将剩余的总令牌添加到权重优先级子漏桶中。
17、 根据权利要求 16所述的漏桶限速装置, 其特征在于, 所述令牌添 加模块将剩余需要添加的令牌添加到权重优先级子漏桶中为:
将所述剩余需要添加到权重优先级子漏桶的令牌按照权重优先级因子 的比例关系划分, 得出提供给各个权重优先级子漏桶进行添加的令牌数; 按照所述提供给各个权重优先级子漏桶进行添加的令牌数对子漏桶进 行令牌添加, 如果有子漏桶已满但提供给所述子漏桶进行添加的令牌还有 剩余, 则丟弃所述剩余的令牌, 同时总漏桶令牌数也减少相应丟弃的数量。
18、 根据权利要求 16所述的漏桶限速装置, 其特征在于, 所述令牌添 加模块将剩余需要添加的令牌添加到权重优先级子漏桶中为:
将需要添加的总令牌数按照权重优先级因子的比例关系划分, 得出提 供给各个权重优先级子漏桶进行添加的令牌数; 按照所述提供给各个权重优先级子漏桶进行添加的令牌数对权重优先 级子漏桶进行令牌添加, 所有权重优先级子漏桶获取相应的添加令牌后, 将溢出的令牌分配给其它未满的权重优先级子漏桶。
19、 根据权利要求 18所述的漏桶限速装置, 其特征在于, 所述令牌添 加模块将溢出的令牌经过互溢运算分配给其它未满的权重优先级子漏桶 为:
将溢出的令牌按照权重优先级因子比例关系或者预先设置的比例关系 分配给其它未满的权重优先级子漏桶, 第二次添加结束后, 还有溢出令牌, 则对未满的权重优先级子漏桶继续进行第三次添加, ... ..., 直至所有权重 优先级子漏桶无溢出令牌、 或达到预设的互溢添加次数。
20、 根据权利要求 11至 19任一项所述的漏桶限速装置, 其特征在于, 重优先级对应的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述报文为: 根据所述报文的绝对优先级或权重优先级选择对应的子漏桶, 将所述 子漏桶中的令牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大 于或等于所述报文包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的 令牌数减少与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述 报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子 漏桶中的令牌数不变。
PCT/CN2011/076462 2011-06-28 2011-06-28 一种漏桶限速方法及装置 WO2013000113A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/076462 WO2013000113A1 (zh) 2011-06-28 2011-06-28 一种漏桶限速方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/076462 WO2013000113A1 (zh) 2011-06-28 2011-06-28 一种漏桶限速方法及装置

Publications (1)

Publication Number Publication Date
WO2013000113A1 true WO2013000113A1 (zh) 2013-01-03

Family

ID=47423353

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/076462 WO2013000113A1 (zh) 2011-06-28 2011-06-28 一种漏桶限速方法及装置

Country Status (1)

Country Link
WO (1) WO2013000113A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014109214A1 (ja) * 2013-01-09 2014-07-17 東洋ゴム工業株式会社 ポリウレタンフォームパネル
CN113132254A (zh) * 2019-12-30 2021-07-16 浙江宇视科技有限公司 漏桶算法的自适应流量控制方法、装置、介质及电子设备

Citations (3)

* Cited by examiner, † Cited by third party
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 中兴通讯股份有限公司 一种基于优先级的令牌桶限速的方法及系统

Patent Citations (3)

* Cited by examiner, † Cited by third party
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 (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014109214A1 (ja) * 2013-01-09 2014-07-17 東洋ゴム工業株式会社 ポリウレタンフォームパネル
CN113132254A (zh) * 2019-12-30 2021-07-16 浙江宇视科技有限公司 漏桶算法的自适应流量控制方法、装置、介质及电子设备

Similar Documents

Publication Publication Date Title
Noormohammadpour et al. Datacenter traffic control: Understanding techniques and tradeoffs
WO2013000116A1 (zh) 一种漏桶限速方法及装置
JP5271876B2 (ja) パケット振り分け機能を有する装置及びパケット振り分け方式
US8553543B2 (en) Traffic shaping method and device
CN102917466B (zh) 通信网络中的优先调度和准入控制
WO2017078922A1 (en) Apparatus and method for network flow scheduling
CN102238068B (zh) 一种报文的传输方法和系统
US10063478B2 (en) Switching device and control method of switching device
Ali et al. Admission control-based multichannel data broadcasting for real-time multi-item queries
Ren et al. A SDN-based dynamic traffic scheduling algorithm
WO2013000113A1 (zh) 一种漏桶限速方法及装置
Saad et al. Optimal network rate allocation under end-to-end quality-of-service requirements
CN105072046B (zh) 一种基于令牌控制节点并发数据转发的延迟容忍网络拥塞避免方法
Martin et al. Network slicing for deterministic latency
Wang et al. Toward statistical QoS guarantees in a differentiated services network
Lal et al. A heuristic edf uplink scheduler for real time application in wimax communication
Karsten Approximation of generalized processor sharing with interleaved stratified timer wheels
Gushchin et al. Optimization-based network flow deadline scheduling
WO2013000112A1 (zh) 一种漏桶限速方法及装置
Li et al. Schedulability criterion and performance analysis of coordinated schedulers
Ghamkhari et al. A convex optimization framework for service rate allocation in finite communications buffers
Lemeshko et al. Researching of mathematical models based on optimal control approaches for congestion control in telecommunication network
Kuai et al. Online Virtual Network Function Scheduling Towards Deterministic Latency
WO2013000114A1 (zh) 一种漏桶限速方法及装置
Wang et al. Mutine: a mutable virtual network embedding with game-theoretic stochastic routing

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: 11868682

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: 11868682

Country of ref document: EP

Kind code of ref document: A1