[go: up one dir, main page]

WO2013000114A1 - Rate limit method and device for leaky bucket - Google Patents

Rate limit method and device for leaky bucket Download PDF

Info

Publication number
WO2013000114A1
WO2013000114A1 PCT/CN2011/076463 CN2011076463W WO2013000114A1 WO 2013000114 A1 WO2013000114 A1 WO 2013000114A1 CN 2011076463 W CN2011076463 W CN 2011076463W WO 2013000114 A1 WO2013000114 A1 WO 2013000114A1
Authority
WO
WIPO (PCT)
Prior art keywords
bucket
sub
tokens
packet
total
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
Application number
PCT/CN2011/076463
Other languages
French (fr)
Chinese (zh)
Inventor
殷俊杰
刘毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to PCT/CN2011/076463 priority Critical patent/WO2013000114A1/en
Publication of WO2013000114A1 publication Critical patent/WO2013000114A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

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/21Flow control; Congestion control using leaky-bucket
    • 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

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 speed limit of a leaky bucket, which can flexibly limit the rate of packets according to the weight priority, thereby improving the quality of the data network and the user.
  • a leaky bucket which can flexibly limit the rate of packets according to the weight priority, thereby improving the quality of the data network and the user.
  • 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 weighted priority, the total leaky bucket is divided into multiple sub-leak buckets according to the number of weight priorities and the proportional parameter.
  • the ratio parameter is determined according to the requirement of each weight priority traffic absorption jitter, and the capacity of each sub-leak bucket is equal to the total leak bucket capacity, and the packet weight priority corresponds to the sub-leak bucket weight priority, 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 parameter of the packet;
  • the method further includes: updating parameters related to the leak rate limit, including the total leak bucket and the number of tokens after each sub-leak rate limit.
  • the parameters related to the rate limit of the leaky bucket include: the capacity of the total leaky bucket, the weight priority factor, the total token addition rate, the time when the last speed limit occurs, the number of tokens in the total leaky bucket, and each sub-leak bucket Number of tokens in ,
  • 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 a capacity of each sub-leakage bucket or a ratio of sub-leakage bucket capacity division.
  • 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-leakage bucket according to the calculated total number of tokens and the 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 tokens added is added; If the total leaky bucket is full, the weighted priority sub-leak buckets are full. Otherwise, the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the sub-leak buckets provided for each weight priority are added. The number of tokens, and then add a token to the sub-leak bucket according to the number of tokens added to each weight priority sub-leak bucket.
  • 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 weight priority of the packet, and the packet weight priority corresponds to the sub-leakage bucket weight priority;
  • the packet information receiving module is configured to receive information about the packet, where the information about the packet includes at least: a packet length of the packet and a priority parameter of the packet;
  • the token adding module is configured to receive information about the packet in the packet information receiving module. After that, the parameters related to the leak rate limit of the leaky bucket are obtained from the parameter storage module; and the total number of tokens to be added is calculated according to the obtained parameters related to the speed limit of the leaky bucket; and the total number of tokens and the sub-leaked bucket according to the calculation The weight priority adds tokens to 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, 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 weight priority of the packet.
  • 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 parameter related to the leak rate limit of the leaked bucket stored by the parameter storage module includes: a total leaky bucket capacity, a weight priority factor, a total token addition rate, a time when the last speed limit occurs, a total leaky bucket, and each sub-leak bucket Number of tokens in ,
  • 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: a capacity of each sub-leaked bucket or a proportion of a sub-leaked bucket capacity.
  • 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 weight priority sub-leak buckets are full, otherwise the total number of tokens to be added will be weighted according to the weight. The proportion relationship of the priority factors is divided, and the number of tokens added to each of the weight priority sub-leak buckets is obtained, and then the number of tokens added to each weight priority sub-leak bucket is added to the sub-leak bucket. The token is added.
  • the packet processing module forwards, discards, or marks the packet according to the packet length of the packet and the number of tokens in the sub-leak bucket corresponding to the weight priority of the packet:
  • the method and the device for limiting the rate of the leaking buckets of the present invention treat the packets with different weight priorities differently, and divide the total leaking bucket into multiple sub-leaked buckets according to the requirements of the weighting jitter of each weight priority traffic, where each weight priority corresponds to the A sub-leak bucket, when the token is added, the tokens added to the sub-leak bucket are different according to the corresponding weight priorities.
  • the tokens added to the high-weight priority sub-leak bucket are more than provided.
  • the token added by the low-weight priority sub-leak bucket performs forwarding, discarding, or marking operations on the received packet according to the token in the sub-leak bucket corresponding to the packet weight priority.
  • the present invention compensates for the insufficiency of the packet loss rate of the traditional buckets, and the packets with different weight priorities have a fixed proportion of pass and drop probabilities under the same rate limit, that is, high-weight priority packets.
  • the present invention can flexibly limit the rate of packets according to the weight priority, thereby improving the data network.
  • Quality of service and user experience in addition, The hardware design of the function can save 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 weight priority corresponds to a sub-leak bucket in the total leaky bucket, and is added to the sub-leak bucket when the token is added.
  • the tokens are different according to the corresponding weight priorities.
  • the tokens added to the high-weight priority sub-leak bucket are more than the tokens added to the low-weight priority sub-leak bucket.
  • the token in the sub-leak bucket corresponding to the weight priority of the packet performs a forwarding, discarding or marking operation.
  • the packet for the rate limit of the leaky bucket may be divided according to at least two weight priorities (for example, according to the packet type), and correspondingly, the leaked bucket capacity is divided into at least two sub-weights according to different weight priorities.
  • the packet weight priority corresponds to the sub-leak bucket weight priority.
  • each sub-leak bucket can be divided according to the proportional relationship of the weight priority factor (such as the weight priority factors respectively, wl, w2, w3 wn ), or can be divided according to actual needs, in general,
  • the capacity of the high-weight priority sub-leaked bucket is large, and the capacity of the low-weight priority sub-leaked bucket is small, and the sum of all sub-leaked buckets is equal to the total leaky bucket capacity, that is, the total leaky bucket capacity is expressed as BS
  • the token addition rate of the sub-leak bucket is divided according to the proportional relationship of the weight priority factors (wl, w2, w3, ..., wn), if the total token addition rate is expressed as IR (Information Rate), the token addition rate of the sub-leak bucket is expressed as IR1, IR2, IR3...IRn, respectively, and they satisfy the following relationship:
  • IR1 IR*wl
  • IR2 IR*w2
  • IR3 IR*w3
  • IRn IR*wn
  • IR IR1 + IR2 + IR3 + ... + IRn.
  • 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 parameter 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 referred to as the total rate limit rate, is the sum of the rate of each sub-leaked token add-on;
  • 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.
  • the time difference between the time when the current rate limit occurs and the time when the last rate limit occurs is calculated, and the product of the time difference and the total token addition rate is calculated, and the total number of tokens to be added is obtained.
  • Step 203 Add a token to the total leak bucket and each sub-leak bucket according to the calculated total number of tokens and the weight priority of the sub-leak 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 weighted priority sub-leak buckets are full, otherwise the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the sub-leakage provided to each weight priority is obtained.
  • the bucket adds the number of tokens, and then adds a token to the sub-leak bucket according to the number of tokens added to each weight priority sub-leak bucket to obtain the number of tokens of the current ownership heavy priority sub-leak bucket.
  • the total number of tokens to be added is represented.
  • the token addition amount of each sub-leak bucket is expressed as delta_tokenl, delta_token2, delta_token3, ..., delta_tokenn respectively, then the gate satisfies the relationship under the mouth:
  • Delta-token 1 delta-token *wl
  • Delta_token2 delta-token *w2
  • Delta—token delta—token 1+ delta_token2 + ... + delta—tokenn.
  • the token when the token is added, if the sub-leaked bucket is full, but the token provided for the sub-leaked bucket is still left, the remaining token is discarded, and the sub-leaked bucket is ordered.
  • the number of cards is the corresponding sub-leaked bucket capacity, and the number of tokens in the total leaky bucket is also reduced by the corresponding number of discards; 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 the number of tokens in the sub-leaked bucket obtained in step 201 and correspondingly added. The sum of the number of tokens.
  • Step 204 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 weight priority of the packet.
  • the corresponding sub-leak bucket is selected according to the packet weight priority, and then the number of tokens in the sub-leak 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.
  • the principle of the rate limit of the leaky buckets in the present invention is as shown in FIG. 3, and it can be seen that for the packets with different weight priorities, the number of tokens of the sub-leak buckets of each weight priority is strictly according to the weight priority factor (wl, w2). The proportional relationship of , w3, ..., wn ) is added, so the messages of different weight priorities can be passed according to the proportional relationship of the weight priority factors (wl, w2, w3, ..., wn ). When the rate limit of the packet is leaked, the rate limit can be differentiated according to the weight priority of the packet.
  • 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 is divided into multiple sub-leaked buckets according to the weight priority of the packet, and the packet weight priority corresponds to the sub-leakage bucket weight priority;
  • 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 parameter 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 Calculating the total number of tokens to be added; and adding tokens to the total leaky bucket and each of the sub-leakage buckets according to the calculated total number of tokens and the weight priority of the sub-leakage 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, 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 weight priority of the packet.
  • 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 parameter related to the leak rate limit of the leaked bucket stored by the parameter storage module includes: a total leaky bucket capacity, a weight priority factor, a total token addition rate, a time when the last speed limit occurs, a total leaky bucket, and each sub-leak bucket Number of tokens in ,
  • 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: a capacity of each sub-leaked bucket or a proportion of a sub-leaked bucket capacity.
  • 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 token adding module adds a token to the total leaking bucket and each sub-leaked bucket according to the calculated total number of tokens and the 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 tokens added is added; If the total leaky bucket is full, the weighted priority sub-leak buckets are full. Otherwise, the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the sub-leak buckets provided for each weight priority are added.
  • the number of tokens and then add a token to the sub-leak bucket according to the number of tokens added to each weight priority sub-leak bucket.
  • the token is added, if the sub-leak bucket is full, but is provided to If there is any remaining token added by the sub-leak bucket, the remaining tokens are discarded, and the total leaky bucket also reduces the number of discarded tokens accordingly.
  • the packet processing module forwards, or 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 weight priority of the packet:
  • the present invention makes up for the shortage of the packet priority of the traditional leaky bucket speed limit mode for the shared speed limit leaky bucket, so that different priority packets are in the same Under the condition of speed limit, there is a fixed proportion of pass and drop probability, which improves the combination, and the hardware design of part of the scheduling function can be omitted, thereby 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

The present invention discloses a rate limit method for leaky buckets. When rate limit is performed for a set of messages which share a same leaky bucket but have different weight priorities, a total leaky bucket is divided into multiple sub-leaky buckets according to the number of the weight priorities and a scaling parameter, wherein the scaling parameter must be determined according to the requirements of jitter absorption by each weight priority traffic. After message-related information is received, parameters related to leaky bucket rate limit are obtained and the total number of tokens required to be added is calculated. According to the calculated total number of tokens, the status of the total leaky bucket after accepting the addition of the total tokens and the weight priority factor parameters of the sub-leaky buckets, the tokens are added to the sub-leaky buckets. According to the packet length of the received message and the number of tokens of the sub-leaky bucket corresponding to the weight priority of the message, the message is forwarded, discarded or marked. The present invention also discloses a rate limit device for leaky buckets accordingly. The present invention enables flexible rate limit for messages according to weight priorities, thereby improving quality of service of data network and user experience.

Description

一种漏桶 P½方法及装置 技术领域  Method and device for leaking barrel P1⁄2

本发明涉及数据网络领域, 尤其涉及一种漏桶限速方法及装置。 背景技术  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

在现有的数据网络中, 由于报文流量的突发性, 常常会导致网络拥塞。 为了避免网络拥塞, 提高数据网络的服务质量(Quality of service, QoS ), 需要在接收端对报文进行限速, 如果报文的速率低于规定的速率, 则正常 接收报文; 如果报文的速率超过规定的速率, 则将报文丟弃, 或对报文进 行标记。  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.

目前普遍釆用的方法是利用漏桶对报文进行限速, 常用的基于漏桶算 法的标准有 RFC2697和 RFC2698 , 即单速率三色双桶和双速率三色双桶 , RFC标准的漏桶限速原理如图 1所示, 具体为: 按规定的速率不断地向漏 桶中填充令牌, 直到漏桶装满为止。 当报文到来时, 将报文的包长跟漏桶 中的令牌数进行比较, 如果漏桶中有足够的令牌, 则报文允许通过, 同时 从漏桶中减去报文的包长所对应的令牌数; 如果漏桶中的令牌不够, 则将 才艮文丟弃, 或对艮文进行标记。  At present, 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.

可以看出, RFC2697和 RFC2698虽然能够对报文进行限速, 但是在限 速的过程中无法区别优先级高低不同的报文的服务质量, 所以, 现有报文 限速方法不够灵活, 不利于提高数据网络服务质量及用户体验。 发明内容  It can be seen that although RFC2697 and RFC2698 can limit the rate of packets, the service quality of packets with different priorities cannot be distinguished in the process of rate limiting. Therefore, the rate limit method of existing packets is not flexible enough. Improve data network service quality and user experience. Summary of the invention

有鉴于此, 本发明的主要目的在于提供一种漏桶限速方法及装置, 能 按照权重优先级对报文进行灵活限速, 从而提高数据网络服务质量及用户 体验。 In view of the above, the main purpose of the present invention is to provide a method and a device for speed limit of a leaky bucket, which can flexibly limit the rate of packets according to the weight priority, thereby improving the quality of the data network and the user. Experience.

为达到上述目的, 本发明的技术方案是这样实现的:  In order to achieve the above object, the technical solution of the present invention is achieved as follows:

一种漏桶限速方法, 对于共用同一漏桶但具有不同权重优先级的一组 报文进行限速的时候, 将总漏桶按照权重优先级的个数及比例参数分割为 多个子漏桶, 所述比例参数根据各权重优先级流量吸收抖动的要求而定, 且各子漏桶的容量和等于总漏桶容量, 报文权重优先级与子漏桶权重优先 级相对应, 该方法包括:  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 weighted priority, the total leaky bucket is divided into multiple sub-leak buckets according to the number of weight priorities and the proportional parameter. The ratio parameter is determined according to the requirement of each weight priority traffic absorption jitter, and the capacity of each sub-leak bucket is equal to the total leak bucket capacity, and the packet weight priority corresponds to the sub-leak bucket weight priority, and the method includes :

收到报文的相关信息后, 获取与漏桶限速相关的参数, 所述报文的相 关信息至少包括: 报文的包长和报文的优先级参数;  After receiving the related information of the packet, 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 parameter of the packet;

根据获取的与漏桶限速相关的参数计算需要添加的总令牌数; 根据计算的总令牌数及子漏桶的权重优先级对子漏桶进行令牌添加; 根据所述报文的包长及所述报文的权重优先级对应的子漏桶中的令牌 数, 转发、 或丟弃、 或标记所述报文。  Calculating the total number of tokens to be added according to the obtained parameter related to the rate limit of the leaked bucket; adding a token to the sub-leakage bucket according to the calculated total number of tokens and the weight priority of the sub-leaked bucket; The packet length and the number of tokens in the sub-leak bucket corresponding to the weight priority of the packet, forwarding, or discarding, or marking the packet.

所述转发、 或丟弃、 或标记报文之后, 该方法还包括: 更新与漏桶限 速相关的参数, 其中包括总漏桶及各子漏桶限速后的令牌数。  After the packet is forwarded, discarded, or marked, the method further includes: updating parameters related to the leak rate limit, including the total leak bucket and the number of tokens after each sub-leak rate limit.

所述与漏桶限速相关的参数包括: 总漏桶的容量、 权重优先级因子、 总令牌添加速率、 上一次限速发生的时刻和总漏桶中的令牌数及各子漏桶 中的令牌数,  The parameters related to the rate limit of the leaky bucket include: the capacity of the total leaky bucket, the weight priority factor, the total token addition rate, the time when the last speed limit occurs, the number of tokens in the total leaky bucket, and each sub-leak bucket Number of tokens in ,

所述更新与漏桶限速相关的参数为: 更新上一次限速发生的时刻为当 前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速后的数量。  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 a capacity of each sub-leakage bucket or a ratio of sub-leakage bucket capacity division.

所述根据获取的与漏桶限速相关的参数计算需要添加的总令牌数为: 计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。 所述根据计算的总令牌数及子漏桶的权重优先级对总漏桶及各子漏桶 进行令牌添加为: 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-leakage bucket according to the calculated total number of tokens and the weight priority of the sub-leaked bucket:

第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则各权重优先级子漏桶均满, 否则将需要添加的总令牌数按照权重 优先级因子的比例关系划分, 得出提供给各个权重优先级子漏桶进行添加 的令牌数, 然后按照所述提供给各个权重优先级子漏桶进行添加的令牌数 对子漏桶进行令牌添加, 进行令牌添加时, 如果有的子漏桶已满, 但提供 给所述子漏桶进行添加的令牌还有剩余, 则丟弃所述剩余的令牌, 同时总 漏桶的令牌数也相应减少丟弃的令牌数。  In 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 weighted priority sub-leak buckets are full. Otherwise, the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the sub-leak buckets provided for each weight priority are added. The number of tokens, and then add a token to the sub-leak bucket according to the number of tokens added to each weight priority sub-leak bucket. When the token is added, if some sub-leak buckets are full, but provide If there is any remaining token added to the sub-leak bucket, the remaining tokens are discarded, and the number of tokens of the total leaky bucket also reduces the number of discarded tokens.

所述根据报文的包长及报文的权重优先级对应的子漏桶中的令牌数, 转发、 或丟弃、 或标记所述 文为:  Transmitting, or discarding, or marking the packet according to the packet length of the packet and the number of tokens in the sub-leak bucket corresponding to the weight priority of the packet:

根据报文的权重优先级选择对应的子漏桶, 将所述子漏桶中的令牌数 与所述报文的包长进行比较, 所述子漏桶中的令牌数大于或等于所述报文 的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的令牌数减少与所 述报文包长相应的数目; 所述子漏桶中的令牌数小于所述报文的包长, 则 丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌数 不变。  Selecting a corresponding sub-leak bucket according to the weight priority of the packet, and comparing the number of tokens in the sub-leak bucket with the packet length of the packet, where the number of tokens in the sub-leak bucket is greater than or equal to The packet length of the packet is forwarded, and the number of tokens in the total leaky bucket and the sub-leak bucket is reduced by a number corresponding to the packet length; the token in the sub-leak bucket If the number is smaller than the packet length of the packet, the packet is discarded or the packet is marked, and the number of tokens in the total leaky bucket and all the sub-leaked buckets is unchanged.

一种漏桶限速装置, 包括: 总漏桶、 报文信息接收模块、 令牌添加模 块、 参数存储模块、 报文处理模块; 其中,  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 weight priority of the packet, and the packet weight priority corresponds to the sub-leakage bucket weight priority;

所述报文信息接收模块, 用于接收报文的相关信息, 所述报文的相关 信息至少包括: 报文的包长和报文的优先级参数;  The packet information receiving module is configured to receive information about the packet, where the information about the packet includes at least: a packet length of the packet and a priority parameter of the packet;

所述令牌添加模块, 用于在报文信息接收模块接收到报文的相关信息 后, 从参数存储模块获取与漏桶限速相关的参数; 以及根据获取的与漏桶 限速相关的参数计算需要添加的总令牌数; 以及根据计算的总令牌数及子 漏桶的权重优先级对子漏桶进行令牌添加; The token adding module is configured to receive information about the packet in the packet information receiving module. After that, the parameters related to the leak rate limit of the leaky bucket are obtained from the parameter storage module; and the total number of tokens to be added is calculated according to the obtained parameters related to the speed limit of the leaky bucket; and the total number of tokens and the sub-leaked bucket according to the calculation The weight priority adds tokens to 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, 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 weight priority of the packet.

所述参数存储模块, 还用于在报文处理模块转发、 或丟弃、 或标记报 文之后, 更新与漏桶限速相关的参数。  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 parameter related to the leak rate limit of the leaked bucket stored by the parameter storage module includes: a total leaky bucket capacity, a weight priority factor, a total token addition rate, a time when the last speed limit occurs, a total leaky bucket, and each sub-leak bucket Number of tokens in ,

所述参数存储模块更新与漏桶限速相关的参数为: 更新上一次限速发 生的时刻为当前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速后的 数量。  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: a capacity of each sub-leaked bucket or a proportion of a sub-leaked bucket capacity.

所述令牌添加模块根据获取的与漏桶限速相关的参数计算需要添加的 总令牌数为:  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 token adding module adds a token to the sub-leakage bucket according to the calculated total number of tokens and the weight priority of the sub-leak bucket:

第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则各权重优先级子漏桶均满, 否则将需要添加的总令牌数按照权重 优先级因子的比例关系划分, 得出提供给各个权重优先级子漏桶进行添加 的令牌数, 然后按照所述提供给各个权重优先级子漏桶进行添加的令牌数 对子漏桶进行令牌添加, 进行令牌添加时, 如果有的子漏桶已满, 但提供 给所述子漏桶进行添加的令牌还有剩余, 则丟弃所述剩余的令牌, 同时总 漏桶的令牌数也相应减少丟弃的令牌数。 In 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 weight priority sub-leak buckets are full, otherwise the total number of tokens to be added will be weighted according to the weight. The proportion relationship of the priority factors is divided, and the number of tokens added to each of the weight priority sub-leak buckets is obtained, and then the number of tokens added to each weight priority sub-leak bucket is added to the sub-leak bucket. The token is added. When the token is added, if some sub-leaked buckets are full, but the tokens added to the sub-leaked buckets are still left, the remaining tokens are discarded, and the total leaked buckets are discarded. The number of tokens also reduces the number of tokens discarded.

所述报文处理模块根据报文的包长及报文的权重优先级对应的子漏桶 中的令牌数, 转发、 或丟弃、 或标记所述报文为:  The packet processing module forwards, discards, or marks the packet according to the packet length of the packet and the number of tokens in the sub-leak bucket corresponding to the weight priority of the packet:

根据所述报文的权重优先级选择对应的子漏桶, 将所述子漏桶中的令 牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大于或等于所述 报文的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的令牌数减少 与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌 数不变。  Selecting a corresponding sub-leak bucket according to the weight priority of the packet, and comparing the number of tokens in the sub-leak bucket with the packet length of the packet, where the number of tokens in the sub-leak bucket is greater than or If the packet length is equal to the packet length, the packet is forwarded, and the number of tokens in the total leaky bucket and the sub-leaked bucket is reduced by a number corresponding to the packet length; If the number of tokens is smaller than the packet length of the packet, the packet is discarded or marked, and the number of tokens in the total leaky bucket and all sub-leaked buckets is unchanged.

本发明漏桶限速方法及装置, 对不同权重优先级的报文区别对待, 将 总漏桶根据各权重优先级流量吸收抖动的要求分割成多个子漏桶, 每一权 重优先级对应其中的一个子漏桶, 在进行令牌添加时, 提供给子漏桶进行 添加的令牌按照相应权重优先级的不同而不同, 一般提供给高权重优先级 子漏桶添加的令牌多于提供给低权重优先级子漏桶添加的令牌, 对于接收 到的报文, 根据该报文权重优先级对应的子漏桶中的令牌执行转发、 丟弃 或标记操作。 本发明弥补了传统漏桶限速不能体现报文优先级区别的不足, 使得不同权重优先级的报文在同一限速条件下有着固定比例的通过与丟弃 概率, 即高权重优先级报文在网络拥塞情况下有相对高的通过概率, 而低 权重优先级的报文则有相对高的丟弃概率, 所以, 本发明能按照权重优先 级对报文进行灵活限速, 从而提高数据网络服务质量及用户体验, 此外, 度功能的硬件设计, 从而可节省网络的硬件资源。 附图说明 The method and the device for limiting the rate of the leaking buckets of the present invention treat the packets with different weight priorities differently, and divide the total leaking bucket into multiple sub-leaked buckets according to the requirements of the weighting jitter of each weight priority traffic, where each weight priority corresponds to the A sub-leak bucket, when the token is added, the tokens added to the sub-leak bucket are different according to the corresponding weight priorities. Generally, the tokens added to the high-weight priority sub-leak bucket are more than provided. The token added by the low-weight priority sub-leak bucket performs forwarding, discarding, or marking operations on the received packet according to the token in the sub-leak bucket corresponding to the packet weight priority. The present invention compensates for the insufficiency of the packet loss rate of the traditional buckets, and the packets with different weight priorities have a fixed proportion of pass and drop probabilities under the same rate limit, that is, high-weight priority packets. In the case of network congestion, there is a relatively high probability of passing, while a packet with a low weight has a relatively high probability of dropping. Therefore, the present invention can flexibly limit the rate of packets according to the weight priority, thereby improving the data network. Quality of service and user experience, in addition, The hardware design of the function can save the hardware resources of the network. DRAWINGS

图 1为现有 RFC标准的漏桶限速原理示意图;  Figure 1 is a schematic diagram of the principle of the leaky bucket speed limit of the existing RFC standard;

图 2为本发明漏桶限速方法流程示意图;  2 is a schematic flow chart of a method for speed limit of a leaky bucket according to the present invention;

图 3为本发明涉及的漏桶限速原理示意图;  3 is a schematic diagram of a principle of a speed limit of a leaky bucket according to the present invention;

图 4为本发明漏桶限速方法详细流程示意图。 具体实施方式  FIG. 4 is a schematic flow chart of a method for speed limit of a leaky bucket according to the present invention. detailed description

本发明的基本思想是: 对一组具有不同权重优先级的报文, 每一权重 优先级对应总漏桶中的一个子漏桶, 在进行令牌添加时, 提供给子漏桶进 行添加的令牌按照相应权重优先级的不同而不同, 一般提供给高权重优先 级子漏桶添加的令牌多于提供给低权重优先级子漏桶添加的令牌, 对于接 收到的报文, 根据该报文权重优先级对应的子漏桶中的令牌执行转发、 丟 弃或标记操作。  The basic idea of the present invention is: for a group of packets having different weight priorities, each weight priority corresponds to a sub-leak bucket in the total leaky bucket, and is added to the sub-leak bucket when the token is added. The tokens are different according to the corresponding weight priorities. Generally, the tokens added to the high-weight priority sub-leak bucket are more than the tokens added to the low-weight priority sub-leak bucket. For the received packets, according to the received packets, The token in the sub-leak bucket corresponding to the weight priority of the packet performs a forwarding, discarding or marking operation.

本发明中, 漏桶限速所针对的报文可以按照至少两个权重优先级进行 划分(例如按照报文类型划分), 相应的, 将漏桶容量按照不同的权重优先 级划分为至少两个子漏桶, 报文权重优先级与子漏桶权重优先级相对应。  In the present invention, the packet for the rate limit of the leaky bucket may be divided according to at least two weight priorities (for example, according to the packet type), and correspondingly, the leaked bucket capacity is divided into at least two sub-weights according to different weight priorities. In the leaky bucket, the packet weight priority corresponds to the sub-leak bucket weight priority.

需要说明的是, 各子漏桶的容量可以按照权重优先级因子 (如各权重 优先级因子分别为 wl、 w2、 w3 wn ) 的比例关系进行划分, 也可根 据实际需求进行划分, 一般的, 高权重优先级子漏桶的容量较大, 低权重 优先级子漏桶的容量较小, 所有子漏桶容量之和等于总的漏桶的容量, 即 将总的漏桶容量表示为 BS , 将子漏桶的容量分别表示为 BS1、 BS2、 BS3... BSn, 则它们满足如下关系: BS = BS1+BS2 + BS3 + ... + BSn。  It should be noted that the capacity of each sub-leak bucket can be divided according to the proportional relationship of the weight priority factor (such as the weight priority factors respectively, wl, w2, w3 wn ), or can be divided according to actual needs, in general, The capacity of the high-weight priority sub-leaked bucket is large, and the capacity of the low-weight priority sub-leaked bucket is small, and the sum of all sub-leaked buckets is equal to the total leaky bucket capacity, that is, the total leaky bucket capacity is expressed as BS, The capacities of the sub-leak barrels are expressed as BS1, BS2, BS3, ..., BSn, respectively, and they satisfy the following relationship: BS = BS1 + BS2 + BS3 + ... + BSn.

本发明中, 子漏桶的令牌的添加速率按照权重优先级因子 ( wl,w2,w3,...,wn ) 的比例关系来划分, 如果总的令牌添加速率表示为 IR (Information Rate),子漏桶的令牌添加速率分别表示为 IR1,IR2,IR3... IRn, 则它们满足如下关系: In the present invention, the token addition rate of the sub-leak bucket is divided according to the proportional relationship of the weight priority factors (wl, w2, w3, ..., wn), if the total token addition rate is expressed as IR (Information Rate), the token addition rate of the sub-leak bucket is expressed as IR1, IR2, IR3...IRn, respectively, and they satisfy the following relationship:

IR1 =IR*wl;  IR1 =IR*wl;

IR2 = IR*w2;  IR2 = IR*w2;

IR3 = IR*w3;  IR3 = IR*w3;

IRn = IR*wn; IRn = IR*wn;

IR = IR1+IR2 + IR3 + ... + IRn。  IR = IR1 + IR2 + IR3 + ... + IRn.

图 2为本发明漏桶限速方法流程示意图, 如图 2所示, 该方法包括: 步骤 201: 收到报文的相关信息后, 获取与漏桶限速相关的参数。  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 the following steps: Step 201: After receiving the related information of the packet, obtain parameters related to the rate limit of the leaky bucket.

这里, 所述报文的相关信息至少包括: 报文的包长和报文的优先级参 数, 所述与漏桶限速相关的参数可以但不限于包括:  Here, the information related to the packet includes: a packet length of the packet and a priority parameter of the packet, where the parameter related to the leak rate limit may include, but is not limited to:

(1) 总漏桶的容量;  (1) The capacity of the total leaky bucket;

(2)权重优先级因子;  (2) weight priority factor;

(3)总令牌添加速率, 也称为总的限速速率, 其值为各子漏桶令牌添 力口速率之和;  (3) The total token addition rate, also referred to as the total rate limit rate, is the sum of the rate of each sub-leaked token add-on;

(4)上一次限速发生的时刻;  (4) The moment when the last speed limit occurred;

(5)总漏桶及各子漏桶中的令牌数, 如果之前发生了限速运算, 指上 一次同组报文发生限速运算后的令牌数。  (5) The number of tokens in the total leaky bucket and each sub-leakage bucket. If the speed limit calculation occurred before, it refers to the number of tokens after the last speed limit operation of the same group of packets.

如果按照权重优先级因子进行子漏桶容量划分, 则可以进一步根据总 漏桶的容量和权重优先级因子获取各子漏桶的容量; 如果根据实际需求进 行子漏桶容量划分, 则与漏桶限速相关的参数还需要包括各子漏桶的容量 或子漏桶容量划分比例, 根据总漏桶的容量和各子漏桶容量划分比例可以 获取各子漏桶的容量, 但无论如何, 各子漏桶容量均须满足各权重优先级 流量吸收抖动的要求。 实际应用中, 无论硬件还是软件实现都需要维护以 上参数配置。 步骤 202: 根据获取的与漏桶限速相关的参数计算需要添加的总令牌 数。 If the sub-leakage capacity is divided according to the weight priority factor, the capacity of each sub-leakage can be further obtained according to the capacity of the total leaked bucket and the weight priority factor; if the sub-leakage capacity is divided according to the actual demand, the leaky bucket is The speed-related parameters also need to include the capacity of each sub-leaked bucket or the proportion of the sub-leaked bucket capacity. The capacity of each sub-leaked bucket can be obtained according to the total leaky bucket capacity and the proportion of each sub-leaked bucket capacity, but in any case, each The sub-leakage capacity must meet the requirements of the weight-absorption jitter of each weight priority. 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.

具体的, 计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算该时间差与总令牌添加速率的乘积, 得到需要添加的总令牌数。  Specifically, the time difference between the time when the current rate limit occurs and the time when the last rate limit occurs is calculated, and the product of the time difference and the total token addition rate is calculated, and the total number of tokens to be added is obtained.

步骤 203:根据计算的总令牌数及子漏桶的权重优先级对总漏桶及各子 漏桶进行令牌添加。  Step 203: Add a token to the total leak bucket and each sub-leak bucket according to the calculated total number of tokens and the weight priority of the sub-leak bucket.

具体的, 第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏桶满, 则各权重优先级子漏桶均满, 否则将需要添加的总令牌数 按照权重优先级因子的比例关系划分, 得出提供给各个权重优先级子漏桶 进行添加的令牌数, 然后按照所述提供给各个权重优先级子漏桶进行添加 的令牌数对子漏桶进行令牌添加, 得到当前所有权重优先级子漏桶的令牌 数。  Specifically, in 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; In the second step, if the total leaky bucket is full, the weighted priority sub-leak buckets are full, otherwise the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the sub-leakage provided to each weight priority is obtained. The bucket adds the number of tokens, and then adds a token to the sub-leak bucket according to the number of tokens added to each weight priority sub-leak bucket to obtain the number of tokens of the current ownership heavy priority sub-leak bucket.

例如, 如果子漏桶的令牌添加数目严格按照权重优先级因子 ( wl,w2,w3,...,wn )的比例关系来获取总令牌添加数目,将需要添加的总令 牌数表示为 delta_token,将各子漏桶的令牌添加量分别表示为 delta_tokenl, delta_token2, delta_token3 , ... , delta_tokenn , 则它门满足 ^口下关系:  For example, if the number of token additions of the child leaky bucket is strictly in accordance with the proportional relationship of the weight priority factor (wl, w2, w3, ..., wn) to obtain the total number of token additions, the total number of tokens to be added is represented. For delta_token, the token addition amount of each sub-leak bucket is expressed as delta_tokenl, delta_token2, delta_token3, ..., delta_tokenn respectively, then the gate satisfies the relationship under the mouth:

delta—token 1 = delta—token *wl;  Delta-token 1 = delta-token *wl;

delta_token2 = delta—token *w2;  Delta_token2 = delta-token *w2;

delta_token3 = delta—token *w3; delta_tokenn = delta—token*舊;  Delta_token3 = delta-token *w3; delta_tokenn = delta-token* old;

delta—token = delta—token 1+ delta_token2 + ... + delta—tokenn.  Delta—token = delta—token 1+ delta_token2 + ... + delta—tokenn.

需要说明的是, 进行令牌添加时, 如果子漏桶已满, 但提供给该子漏 桶进行添加的令牌还有剩余, 则丟弃所述剩余的令牌, 该子漏桶的令牌数 为对应的子漏桶容量, 同时总漏桶中令牌数也减少相应丟弃的数量; 如果 子漏桶未满, 但提供给该子漏桶进行添加的令牌已经耗完, 则该子漏桶的 令牌数为步骤 201中获取的该子漏桶中的令牌数与相应添加的令牌数之和。 It should be noted that, when the token is added, if the sub-leaked bucket is full, but the token provided for the sub-leaked bucket is still left, the remaining token is discarded, and the sub-leaked bucket is ordered. The number of cards is the corresponding sub-leaked bucket capacity, and the number of tokens in the total leaky bucket is also reduced by the corresponding number of discards; 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 the number of tokens in the sub-leaked bucket obtained in step 201 and correspondingly added. The sum of the number of tokens.

步骤 204:根据所述报文的包长及所述报文的权重优先级对应的子漏桶 中的令牌数, 转发、 或丟弃、 或标记所述报文。  Step 204: 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 weight priority of the packet.

具体的, 先根据报文权重优先级选择对应的子漏桶, 然后将所述子漏 桶中的令牌数与所述报文的包长进行比较, 决定是否转发所述报文, 如果 所述子漏桶中的令牌数大于或等于所述报文的包长, 则转发所述报文, 同 时总漏桶及所述子漏桶中的令牌数减少与所述报文包长相应的数目; 如果 所述子漏桶中的令牌数小于所述报文的包长, 则丟弃所述报文或者对所述 报文进行标记, 总漏桶及所有子漏桶中的令牌数不变。  Specifically, the corresponding sub-leak bucket is selected according to the packet weight priority, and then the number of tokens in the sub-leak 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.

本发明涉及的漏桶限速原理如图 3 所示, 可以看出, 对于不同权重优 先级的报文, 由于各个权重优先级子漏桶的令牌数严格按照权重优先级因 子(wl, w2, w3, ..., wn )的比例关系进行添加, 所以各个不同权重优先级的报 文便能按照权重优先级因子(wl, w2, w3, ..., wn )的比例关系来通过, 这样在 对报文进行漏桶限速的时候, 可根据报文的权重优先级来区分限速。  The principle of the rate limit of the leaky buckets in the present invention is as shown in FIG. 3, and it can be seen that for the packets with different weight priorities, the number of tokens of the sub-leak buckets of each weight priority is strictly according to the weight priority factor (wl, w2). The proportional relationship of , w3, ..., wn ) is added, so the messages of different weight priorities can be passed according to the proportional relationship of the weight priority factors (wl, w2, w3, ..., wn ). When the rate limit of the packet is leaked, the rate limit can be differentiated according to the weight priority of the packet.

步骤 205: 更新与漏桶限速相关的参数。  Step 205: Update the parameters related to the leak rate limit of the leaky bucket.

这里, 主要指更新上一次限速发生的时刻为当前时刻, 以及更新总漏 桶及各子漏桶中的令牌数为限速后的数量。  Here, it mainly refers to updating the current time when the last speed limit occurs as the current time, and updating the total leaky bucket and the number of tokens in each sub-leaked bucket as the speed limit.

需要说明的是, 如果釆用硬件实现本发明, 则限速计算的逻辑及参数 存储资源将随子漏桶的数目的增多而线性的增多, 需要根据实际的需求进 行综合评估。 本发明漏桶限速方法详细流程如图 4所示。  It should be noted that if the present invention is implemented by hardware, the logic and parameter storage resources of the speed limit calculation will increase linearly with the number of sub-leakage buckets, and comprehensive evaluation needs to be performed according to actual needs. The detailed flow of the method for limiting the speed of the leaky bucket of the present invention is shown in FIG.

本发明还相应地提出一种漏桶限速装置, 包括: 总漏桶、 报文信息接 收模块、 令牌添加模块、 参数存储模块、 报文处理模块; 其中,  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 weight priority of the packet, and the packet weight priority corresponds to the sub-leakage bucket weight priority; 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 parameter 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 Calculating the total number of tokens to be added; and adding tokens to the total leaky bucket and each of the sub-leakage buckets according to the calculated total number of tokens and the weight priority of the sub-leakage 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, 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 weight priority of the packet.

所述参数存储模块, 还用于在报文处理模块转发、 或丟弃、 或标记报 文之后, 更新与漏桶限速相关的参数。  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 parameter related to the leak rate limit of the leaked bucket stored by the parameter storage module includes: a total leaky bucket capacity, a weight priority factor, a total token addition rate, a time when the last speed limit occurs, a total leaky bucket, and each sub-leak bucket Number of tokens in ,

所述参数存储模块更新与漏桶限速相关的参数为: 更新上一次限速发 生的时刻为当前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速后的 数量。  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: a capacity of each sub-leaked bucket or a proportion of a sub-leaked bucket capacity.

所述令牌添加模块根据获取的与漏桶限速相关的参数计算需要添加的 总令牌数为:  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 token adding module adds a token to the total leaking bucket and each sub-leaked bucket according to the calculated total number of tokens and the weight priority of the sub-leaked bucket: In 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 weighted priority sub-leak buckets are full. Otherwise, the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the sub-leak buckets provided for each weight priority are added. The number of tokens, and then add a token to the sub-leak bucket according to the number of tokens added to each weight priority sub-leak bucket. When the token is added, if the sub-leak bucket is full, but is provided to If there is any remaining token added by the sub-leak bucket, the remaining tokens are discarded, and the total leaky bucket also reduces the number of discarded tokens accordingly.

所述报文处理模块根据所收到报文的包长及所述报文的权重优先级对 应的子漏桶中的令牌数转发、 或丟弃、 或标记所述报文为:  The packet processing module forwards, or 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 weight priority of the packet:

根据所述报文的权重优先级选择对应的子漏桶, 将所述子漏桶中的令 牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大于或等于所述 报文的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的令牌数减少 与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌 数不变。  Selecting a corresponding sub-leak bucket according to the weight priority of the packet, and comparing the number of tokens in the sub-leak bucket with the packet length of the packet, where the number of tokens in the sub-leak bucket is greater than or If the packet length is equal to the packet length, the packet is forwarded, and the number of tokens in the total leaky bucket and the sub-leaked bucket is reduced by a number corresponding to the packet length; If the number of tokens is smaller than the packet length of the packet, the packet is discarded or marked, and the number of tokens in the total leaky bucket and all sub-leaked buckets is unchanged.

本发明在 RFC漏桶算法标准的基础上, 弥补了传统漏桶限速方式对于 共用限速漏桶的一组数据业务不能体现报文优先级区别的不足, 使得不同 优先级的报文在同一限速条件下有着固定比例的通过与丟弃概率, 提高了 结合, 可以省去部分调度功能的硬件设计, 从而可节省网络硬件资源。  On the basis of the RFC leaky bucket algorithm standard, the present invention makes up for the shortage of the packet priority of the traditional leaky bucket speed limit mode for the shared speed limit leaky bucket, so that different priority packets are in the same Under the condition of speed limit, there is a fixed proportion of pass and drop probability, which improves the combination, and the hardware design of part of the scheduling function can be omitted, thereby saving network hardware resources.

以上所述, 仅为本发明的较佳实施例而已, 并非用于限定本发明的保 护范围。  The above is only the preferred embodiment of the present invention and is not intended to limit the scope of the present invention.

Claims

权利要求书 Claim 1、 一种漏桶限速方法, 其特征在于, 对于共用同一漏桶但具有不同权 重优先级的一组报文进行限速的时候, 将总漏桶按照权重优先级的个数及 比例参数分割为多个子漏桶, 所述比例参数根据各权重优先级流量吸收抖 动的要求而定, 且各子漏桶的容量和等于总漏桶容量, 报文权重优先级与 子漏桶权重优先级相对应, 该方法包括:  A method for limiting the speed of a leaky bucket, wherein when the rate limit is set for a group of packets sharing the same leaky bucket but having different weight priorities, the number of weighted buckets according to the weight priority and the proportional parameter are used. Dividing into multiple sub-leaked buckets, the ratio parameter is determined according to the requirements of each weight priority traffic absorption jitter, and the capacity of each sub-leak bucket is equal to the total leaked bucket capacity, the packet weight priority and the sub-drain bucket weight priority. Correspondingly, the method includes: 收到报文的相关信息后, 获取与漏桶限速相关的参数, 所述报文的相 关信息至少包括: 报文的包长和报文的优先级参数;  After receiving the related information of the packet, 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 parameter of the packet; 根据获取的与漏桶限速相关的参数计算需要添加的总令牌数; 根据计算的总令牌数及子漏桶的权重优先级对子漏桶进行令牌添加; 根据所述报文的包长及所述报文的权重优先级对应的子漏桶中的令牌 数, 转发、 或丟弃、 或标记所述报文。  Calculating the total number of tokens to be added according to the obtained parameter related to the rate limit of the leaked bucket; adding a token to the sub-leakage bucket according to the calculated total number of tokens and the weight priority of the sub-leaked bucket; The packet length and the number of tokens in the sub-leak bucket corresponding to the weight priority of the packet, forwarding, or discarding, or marking the packet. 2、 根据权利要求 1所述的漏桶限速方法, 其特征在于, 所述转发、 或 丟弃、 或标记报文之后, 该方法还包括: 更新与漏桶限速相关的参数, 其 中包括总漏桶及各子漏桶限速后的令牌数。  The method for limiting the rate of a leaky bucket according to claim 1, wherein after the forwarding, or discarding, or marking the message, the method further comprises: updating parameters related to the rate limit of the leaky bucket, including The number of tokens after the total leaky bucket and each sub-leakage speed limit. 3、 根据权利要求 2所述的漏桶限速方法, 其特征在于,  3. The leaky barrel speed limiting method according to claim 2, wherein 所述与漏桶限速相关的参数包括: 总漏桶的容量、 权重优先级因子、 总令牌添加速率、 上一次限速发生的时刻和总漏桶中的令牌数及各子漏桶 中的令牌数,  The parameters related to the rate limit of the leaky bucket include: the capacity of the total leaky bucket, the weight priority factor, the total token addition rate, the time when the last speed limit occurs, the number of tokens in the total leaky bucket, and each sub-leak bucket Number of tokens in , 所述更新与漏桶限速相关的参数为: 更新上一次限速发生的时刻为当 前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速后的数量。  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. 4、 根据权利要求 3所述的漏桶限速方法, 其特征在于, 所述与漏桶限 速相关的参数还包括各子漏桶的容量或子漏桶容量划分比例。  The method for limiting the speed of a leaky bucket according to claim 3, wherein the parameter related to the speed limit of the leaky bucket further comprises a capacity of each sub-drain bucket or a ratio of sub-leakage bucket capacity division. 5、 根据权利要求 3所述的漏桶限速方法, 其特征在于, 所述根据获取 的与漏桶限速相关的参数计算需要添加的总令牌数为: 计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。 The method for limiting the speed of the leaky bucket according to claim 3, wherein the total number of tokens to be added according to the obtained parameters related to the speed limit of the leaky bucket is: The time difference between the time when the current rate limit occurs and the time when the last speed 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. 6、 根据权利要求 1至 5任一项所述的漏桶限速方法, 其特征在于, 所 述根据计算的总令牌数及子漏桶的权重优先级对总漏桶及各子漏桶进行令 牌添加为:  The method for rate limiting a leaky bucket according to any one of claims 1 to 5, wherein the total number of tokens and the priority of the sub-leaked buckets are based on the total leaky bucket and each of the sub-leakage buckets. Add the token as: 第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则各权重优先级子漏桶均满, 否则将需要添加的总令牌数按照权重 优先级因子的比例关系划分, 得出提供给各个权重优先级子漏桶进行添加 的令牌数, 然后按照所述提供给各个权重优先级子漏桶进行添加的令牌数 对子漏桶进行令牌添加, 进行令牌添加时, 如果有的子漏桶已满, 但提供 给所述子漏桶进行添加的令牌还有剩余, 则丟弃所述剩余的令牌, 同时总 漏桶的令牌数也相应减少丟弃的令牌数。  In 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 weighted priority sub-leak buckets are full. Otherwise, the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the sub-leak buckets provided for each weight priority are added. The number of tokens, and then add a token to the sub-leak bucket according to the number of tokens added to each weight priority sub-leak bucket. When the token is added, if some sub-leak buckets are full, but provide If there is any remaining token added to the sub-leak bucket, the remaining tokens are discarded, and the number of tokens of the total leaky bucket also reduces the number of discarded tokens. 7、 根据权利要求 6所述的漏桶限速方法, 其特征在于, 所述根据报文 的包长及报文的权重优先级对应的子漏桶中的令牌数, 转发、 或丟弃、 或 标记所述>¾文为:  The method for rate limiting the leaky bucket according to claim 6, wherein the packet length and the number of tokens in the sub-leak bucket corresponding to the weight priority of the packet are forwarded, or discarded. , or mark the >3⁄4 text as: 根据报文的权重优先级选择对应的子漏桶, 将所述子漏桶中的令牌数 与所述报文的包长进行比较, 所述子漏桶中的令牌数大于或等于所述报文 的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的令牌数减少与所 述报文包长相应的数目; 所述子漏桶中的令牌数小于所述报文的包长, 则 丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌数 不变。  Selecting a corresponding sub-leak bucket according to the weight priority of the packet, and comparing the number of tokens in the sub-leak bucket with the packet length of the packet, where the number of tokens in the sub-leak bucket is greater than or equal to The packet length of the packet is forwarded, and the number of tokens in the total leaky bucket and the sub-leak bucket is reduced by a number corresponding to the packet length; the token in the sub-leak bucket If the number is smaller than the packet length of the packet, the packet is discarded or the packet is marked, and the number of tokens in the total leaky bucket and all the sub-leaked buckets is unchanged. 8、 一种漏桶限速装置, 其特征在于, 该装置包括: 总漏桶、 报文信息 接收模块、 令牌添加模块、 参数存储模块、 报文处理模块; 其中,  A leaky bucket speed limiting device, the device comprising: 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 weight priority of the packet, and the weight of the packet is prioritized. The level corresponds to the sub-leak bucket weight priority; 所述报文信息接收模块, 用于接收报文的相关信息, 所述报文的相关 信息至少包括: 报文的包长和报文的优先级参数;  The packet information receiving module is configured to receive information about the packet, where the information about the packet includes at least: a packet length of the packet and a priority parameter 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 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, 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 weight priority of the packet. 9、 根据权利要求 8所述的漏桶限速装置, 其特征在于,  9. The leaky barrel speed limiting device according to claim 8, wherein: 所述参数存储模块, 还用于在报文处理模块转发、 或丟弃、 或标记报 文之后, 更新与漏桶限速相关的参数。  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. 10、 根据权利要求 9所述的漏桶限速装置, 其特征在于,  10. The leaky barrel speed limiting device according to claim 9, wherein: 所述参数存储模块存储的与漏桶限速相关的参数包括: 总漏桶的容量、 权重优先级因子、 总令牌添加速率、 上一次限速发生的时刻和总漏桶及各 子漏桶中的令牌数,  The parameter related to the leak rate limit of the leaked bucket stored by the parameter storage module includes: a total leaky bucket capacity, a weight priority factor, a total token addition rate, a time when the last speed limit occurs, a total leaky bucket, and each sub-leak bucket Number of tokens in , 所述参数存储模块更新与漏桶限速相关的参数为: 更新上一次限速发 生的时刻为当前时刻, 以及更新总漏桶及各子漏桶中的令牌数为限速后的 数量。  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. 11、 根据权利要求 10所述的漏桶限速装置, 其特征在于, 所述参数存 储模块存储的与漏桶限速相关的参数还包括: 各子漏桶的容量或子漏桶容 量划分比例。  The leaky bucket speed limiting device according to claim 10, wherein the parameters related to the leaky bucket speed limit stored by the parameter storage module further include: a capacity of each sub-leaked bucket or a sub-leakage bucket capacity division ratio . 12、 根据权利要求 10所述的漏桶限速装置, 其特征在于,  12. The leaky barrel speed limiting device according to claim 10, wherein: 所述令牌添加模块根据获取的与漏桶限速相关的参数计算需要添加的 总令牌数为: The token adding module calculates the required addition according to the obtained parameter related to the leak rate limit of the leaky bucket. The total number of tokens is: 计算当前限速发生的时刻与上一次限速发生的时刻的时间差, 再计算 所述时间差与总令牌添加速率的乘积作为需要添加的总令牌数。  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. 13、 根据权利要求 8至 12任一项所述的漏桶限速装置, 其特征在于, 所述令牌添加模块根据计算的总令牌数及子漏桶的权重优先级对子漏 桶进行令牌添加为:  The leaky bucket speed limit device according to any one of claims 8 to 12, wherein the token adding module performs the sub-leak bucket according to the calculated total number of tokens and the weight priority of the sub-leak bucket The token is added as: 第一步, 将计算的总令牌数添加至总漏桶, 如果总漏桶满, 则总漏桶 的令牌数为总漏桶容量, 否则为总令牌添加后的数量; 第二步, 如果总漏 桶满, 则各权重优先级子漏桶均满, 否则将需要添加的总令牌数按照权重 优先级因子的比例关系划分, 得出提供给各个权重优先级子漏桶进行添加 的令牌数, 然后按照所述提供给各个权重优先级子漏桶进行添加的令牌数 对子漏桶进行令牌添加, 进行令牌添加时, 如果有的子漏桶已满, 但提供 给所述子漏桶进行添加的令牌还有剩余, 则丟弃所述剩余的令牌, 同时总 漏桶的令牌数也相应减少丟弃的令牌数。  In 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 weighted priority sub-leak buckets are full. Otherwise, the total number of tokens to be added is divided according to the proportional relationship of the weight priority factors, and the sub-leak buckets provided for each weight priority are added. The number of tokens, and then add a token to the sub-leak bucket according to the number of tokens added to each weight priority sub-leak bucket. When the token is added, if some sub-leak buckets are full, but provide If there is any remaining token added to the sub-leak bucket, the remaining tokens are discarded, and the number of tokens of the total leaky bucket also reduces the number of discarded tokens. 14、 根据权利要求 13所述的漏桶限速装置, 其特征在于,  14. The leaky barrel speed limiting device according to claim 13, wherein: 所述报文处理模块根据报文的包长及报文的权重优先级对应的子漏桶 中的令牌数, 转发、 或丟弃、 或标记所述报文为:  The packet processing module forwards, discards, or marks the packet according to the packet length of the packet and the number of tokens in the sub-leak bucket corresponding to the weight priority of the packet: 根据所述报文的权重优先级选择对应的子漏桶, 将所述子漏桶中的令 牌数与所述报文的包长进行比较, 所述子漏桶中的令牌数大于或等于所述 报文的包长, 则转发所述报文, 同时总漏桶及所述子漏桶中的令牌数减少 与所述报文包长相应的数目; 所述子漏桶中的令牌数小于所述报文的包长, 则丟弃所述报文或者对所述报文进行标记, 总漏桶及所有子漏桶中的令牌 数不变。  Selecting a corresponding sub-leak bucket according to the weight priority of the packet, and comparing the number of tokens in the sub-leak bucket with the packet length of the packet, where the number of tokens in the sub-leak bucket is greater than or If the packet length is equal to the packet length, the packet is forwarded, and the number of tokens in the total leaky bucket and the sub-leaked bucket is reduced by a number corresponding to the packet length; If the number of tokens is smaller than the packet length of the packet, the packet is discarded or marked, and the number of tokens in the total leaky bucket and all sub-leaked buckets is unchanged.
PCT/CN2011/076463 2011-06-28 2011-06-28 Rate limit method and device for leaky bucket Ceased WO2013000114A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/076463 WO2013000114A1 (en) 2011-06-28 2011-06-28 Rate limit method and device for leaky bucket

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/076463 WO2013000114A1 (en) 2011-06-28 2011-06-28 Rate limit method and device for leaky bucket

Publications (1)

Publication Number Publication Date
WO2013000114A1 true WO2013000114A1 (en) 2013-01-03

Family

ID=47423354

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/076463 Ceased WO2013000114A1 (en) 2011-06-28 2011-06-28 Rate limit method and device for leaky bucket

Country Status (1)

Country Link
WO (1) WO2013000114A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107800643A (en) * 2016-08-29 2018-03-13 中兴通讯股份有限公司 Message forwarding method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101478491A (en) * 2009-02-10 2009-07-08 中兴通讯股份有限公司 Method and apparatus for implementing packet differential service
CN101557348A (en) * 2009-05-25 2009-10-14 杭州华三通信技术有限公司 Message forwarding method and device based on token bucket
CN101997766A (en) * 2009-08-31 2011-03-30 中兴通讯股份有限公司 Method and system for limiting speed of token bucket based on priority

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101478491A (en) * 2009-02-10 2009-07-08 中兴通讯股份有限公司 Method and apparatus for implementing packet differential service
CN101557348A (en) * 2009-05-25 2009-10-14 杭州华三通信技术有限公司 Message forwarding method and device based on token bucket
CN101997766A (en) * 2009-08-31 2011-03-30 中兴通讯股份有限公司 Method and system for limiting speed of token bucket based on priority

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107800643A (en) * 2016-08-29 2018-03-13 中兴通讯股份有限公司 Message forwarding method and device

Similar Documents

Publication Publication Date Title
US11228534B2 (en) Congestion control method, network device, and network interface controller
CN1297118C (en) Bandwidth monitor and control equipment
US8897130B2 (en) Network traffic management
CN102075444B (en) Network system and method for guaranteeing multi-type service quality
US10404584B2 (en) Load sharing method and router device
US7769002B2 (en) Constrained dynamic path selection among multiple communication interfaces
US20130286834A1 (en) Traffic management apparatus for controlling traffic congestion and method thereof
CN107948103B (en) Switch PFC control method and control system based on prediction
CN107005485A (en) A kind of method, corresponding intrument and system for determining route
WO2013000116A1 (en) Method and device for leaky bucket speed-limitation
WO2008125030A1 (en) A load sharing method and the apparatus
US20140219090A1 (en) Network congestion remediation utilizing loop free alternate load sharing
EP2107735A1 (en) Admission control in a packet network
WO2009039736A1 (en) Route calculating method and router
CN111224888A (en) Method for sending message and message forwarding device
CN105490962A (en) QoS management method based on OpenFlow network
CN101958847A (en) A Selection Method of Distributed QOS Routing
Wang et al. ECCO: A novel end-to-end congestion control scheme in multi-hop cognitive radio ad hoc networks
Pan et al. Improvement of BBRV2 Congestion Control Algorithm Based on Flow‐Aware ECN
CN116266826A (en) A distributed machine learning network optimization system, method and electronic equipment
CN101018203A (en) Dynamic load allocation method of the aviation telecom network
CN102780632B (en) A kind of load sharing method and flow forwarding equipment
Deng et al. An adaptive packet aggregation algorithm for wireless networks
CN106105282B (en) Systems and methods for traffic engineering using link buffer state
WO2013000114A1 (en) Rate limit method and device for leaky bucket

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

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

Country of ref document: EP

Kind code of ref document: A1