WO2012116539A1 - 一种令牌发放方法和系统 - Google Patents

一种令牌发放方法和系统 Download PDF

Info

Publication number
WO2012116539A1
WO2012116539A1 PCT/CN2011/078782 CN2011078782W WO2012116539A1 WO 2012116539 A1 WO2012116539 A1 WO 2012116539A1 CN 2011078782 W CN2011078782 W CN 2011078782W WO 2012116539 A1 WO2012116539 A1 WO 2012116539A1
Authority
WO
WIPO (PCT)
Prior art keywords
token
message
issuing
issuance
bucket
Prior art date
Application number
PCT/CN2011/078782
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 华为技术有限公司
Publication of WO2012116539A1 publication Critical patent/WO2012116539A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/215Flow control; Congestion control using token-bucket

Definitions

  • the present invention belongs to the field of communications technologies, and in particular, to a token issuing method and system. Background technique
  • Token Bucket is a common traffic measurement technology. It is used to limit and shape traffic on the service board. It can also measure the rate of traffic.
  • the working principle is that the token bucket places a token into the bucket at a speed set by the user. When the number of tokens in the bucket exceeds the capacity of the bucket, the number of tokens does not increase.
  • the packet arrives, if there are enough tokens in the token bucket to send the packet, the packet passes and continues to be sent. The token in the token bucket is reduced according to the length of the packet. If the number of tokens in the token bucket is insufficient or empty, packets that cannot get enough forwarding tokens will be discarded or marked. The number of tokens in the token bucket does not change.
  • the token bucket can only measure the interface traffic on a single service board, and cannot uniformly measure the traffic of a group of interfaces distributed on different service boards.
  • the embodiment of the invention provides a token issuing method and system, which can implement unified measurement on interface traffic on different service boards.
  • a method for issuing tokens including:
  • Each of the token buckets is configured to be uniformly distributed to the token buckets on each of the service boards in a message ring manner.
  • a token issuing system comprising:
  • a main issuing module configured to be responsible for global token issuance
  • a plurality of token buckets are respectively disposed on a plurality of service boards that need to perform traffic measurement uniformly.
  • the main issuing module is configured to uniformly issue tokens to token buckets on each service board in a message ring manner.
  • a main issuing module responsible for global token issuance is set, and each token bucket is set on each service board that needs to perform unified traffic measurement, and the main issuing module In the manner of the message ring, the tokens are uniformly issued to the token buckets on each of the service boards, so that the interface traffic on different service boards can be uniformly measured.
  • FIG. 1 is a schematic diagram of a token issuing method according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a token issuing system according to an embodiment of the present invention; A specific example of this. detailed description
  • a method for issuing a token includes:
  • the main issuing module can be selected by the token issuing module on the service board with the smallest slot, or by a dedicated service board. 512.
  • the token buckets are set independently on each service board that needs to perform unified traffic measurement. However, the token buckets of each service board do not issue tokens independently.
  • the main issuing module uniformly issues a token to a token bucket on each service board in a message ring manner.
  • FIG. 2 is a schematic diagram of a token issuing system according to an embodiment of the present invention.
  • the manner of the message ring may be: the main issuing module sends a token issuing message, and the token issuing message is sequentially forwarded to the token bucket of each service board in a logical ring order, and When the token issuance message returns to the main issuance module, the token issuance is terminated.
  • the main issuance module then issues a new round of token issuance message to start a new round of token issuance.
  • the token issuance message carries: an address of the main issuing module, an address of a token bucket of a next service board to be sent, a number of old tokens, and a number of new tokens.
  • a certain number of old tokens or new tokens may be respectively represented by a numerical value, and how many tokens are received from the token issuing message by the token bucket on the service board, and the token is issued in the old message. The total value of the token and the new token is subtracted from the corresponding number. If the token bucket picks up 3 tokens, the total value of the old and new tokens is subtracted by 3. .
  • the main issuing module can forward the token issuing message in the order of the slot number of the service board, and return to the lowest or highest slot when the highest (ascending) or lowest slot (descending order) is reached, until finally returning to the main issuing.
  • the service board where the module is located returns to the main release module to form a ring.
  • the above message ring is a logical ring, and each node on the ring needs to maintain the address of its downlink node.
  • the actual physical structure of the message ring can be either a ring structure, a bus structure, a full interconnect structure, or a switch fabric.
  • the token buckets on each service board are received from the received token issuing message.
  • the required number of tokens, and the number of old tokens and/or new tokens in the token issuance message and the address of the token bucket of the next service board to be sent are updated, the updated token
  • the total number is the total number of original tokens (the sum of the number of new and old tokens) minus the number of tokens remaining after the number of tokens received, and then according to the next token to be sent in the updated token issuing message
  • the address of the token bucket forwards the updated token issuing message to the token bucket of the next service board in the logical ring sequence.
  • tokens are included in the token issuance message, one is a new token allocated in the current round, and the other is the remaining old token in the previous round. For the remaining old tokens in the previous round, keep up to one lap. When a new round of token issuance message forwarding, the remaining tokens in the previous round become old tokens, and the new token of this round is issued. .
  • any token bucket can be picked up without restrictions, and the old token is given priority, and the new token is received after the old token is received.
  • the token issuance is terminated.
  • the advantage of this is that you can flexibly control the number of tokens that the token buckets on different service boards receive from the token issuance message. For example, if the number of old tokens in the token issuance message is sufficient, The token's token bucket can receive the required number of tokens without restriction.
  • the token bucket that finally receives the token directly sends a token issuance completion message to the main issuing module according to the address of the main issuing module in the token issuing message.
  • the new round of token issuance message sent by the main issuing module directly starts from the service board, and returns a new round of token issuing message to the token bucket of the service board, in the new round of token issuing message.
  • There is a newly assigned token the tokens carried in the new round of token issuance messages are all new tokens).
  • the program can guarantee the final collar
  • the token bucket of the token is retrieved in time to obtain the required number of tokens, but the time for issuing tokens per round cannot be fixed.
  • each round of the token issuance message is uniformly and cyclically forwarded, and even if the token is issued, it arrives at the service board where the main distribution module is located, and a new round is issued by the main distribution module.
  • the token issuance message is then looped back to the token bucket that finally received the token before the token is allocated.
  • the specific implementation is that the token bucket that receives the token is forwarded to the next one of the logical ring sequence according to the address of the token bucket of the next service board to be sent in the token issuing message.
  • the token bucket of the service board is forwarded to the main issuing module in a logical ring order until the token issuance completion message, and the main issuing module issues a new round of token issuing message and then forwards to the logical ring sequence in sequence. After the last token token is received, a new round of token issuance begins.
  • This scheme can fix each round of token issuance time.
  • Both of the above schemes start a new round of token issuance from the last board that receives the token.
  • the purpose is to ensure that the token bucket of each service board can receive the token equally.
  • the token issuing method of the embodiment of the present invention sets a master issuing module responsible for global token issuance, and sets a respective token bucket on each service board that needs to perform unified traffic measurement, and then the main issuing module A token is uniformly issued to the token buckets on each of the service boards in a message ring manner, so that unified measurement can be performed on interface traffic on different service boards.
  • the token issuing method in the embodiment of the present invention is specifically described below by using an example of limiting the total bandwidth of a VPN (Virtual Private Network).
  • FIG. 3 is a specific example of a token issuing method according to an embodiment of the present invention.
  • the bandwidth of the user VPN and the carrier is 5 ⁇ bytes/second, and the maximum burst size is 2 ⁇ bytes.
  • the packets of the five access points correspond to the five service boards of the access device, and that the service boards are on five service boards.
  • a token bucket with a committed rate of 5 ⁇ bytes/sec and a burst size of 2 ⁇ is configured respectively, and it is assumed that the main issuing module issues tokens at a rate of 5 ⁇ bytes per millisecond, each The maximum number of tokens that can be obtained by the token bucket is 2K bytes.
  • the token issuance message arrives at the token bucket, the number of issued tokens is 5K bytes, the token bucket of the A receives the token of 2K bytes, and the remaining token of the 3K bytes is forwarded to the token bucket.
  • the B token bucket also receives 2K bytes, and the remaining tokens are 1K bytes, which are forwarded to the C token bucket;
  • the C token bucket can only receive 1K byte tokens, and the message is returned to the main issuing module. In the next millisecond, the main issuing module sends a new token issuing message to the C token bucket, and the C token bucket receives the 1.5K token. (assuming that a 0.5K token has been consumed), and the remaining 3.5K token is forwarded to the D token bucket;
  • the D token bucket receives the 2K byte token, and the remaining 1.5K token is forwarded to the E token bucket.
  • the E token bucket After the E token bucket receives the 1.5K byte token, it forwards it to the main issuing module.
  • the main issuing module sends a new token issuing message to the E token bucket, the E token bucket receives the 1K token (assuming that 0.5K token has been consumed), and the remaining 4K token is forwarded to the main issuing module. ;
  • the main issuing module starts a new round of token issuance, at which time the token issues a message, the remaining old token 4K, the new token 5K;
  • a token bucket consumes a 1.5K token at this time, receives the old token of 1.5K, the remaining old token 2.5k, the new token 5K, and forwards it to the B token bucket;
  • the B token bucket consumes 1K token, receives 1K old token, and the remaining old token is 1.5K, and the new token is 5K, which is forwarded to the C token bucket.
  • the C token bucket consumes the token 2K, receives the 1.5K old token and the 0.5K new token, and the remaining 4.5K new token is forwarded to the D token bucket;
  • the D token bucket consumes the token 2K, receives the 2K new token, and the remaining 2.5K new token is forwarded to the E token bucket;
  • the E token bucket also consumes 2K tokens, receives 2K new tokens, and has the remaining 0.5K new tokens, which are forwarded to the main distribution module; In the next millisecond, the main issuing module starts a new round of token issuance, when the old token is 0.5K and the new token is 5K:.
  • the token issuing time of each round may or may not be fixed.
  • the main issuing module has a fixed number of newly assigned tokens in each round of token issuing messages; when each round of issuing time is not fixed, the main issuing module presses according to the interval at which the message is sent to return.
  • the rate of transmission calculates the number of tokens that can be allocated in the next round.
  • the delay of the message can be required to be smaller than the time interval of the token issuance.
  • a token issuing system includes: a main issuing module, configured to be responsible for global token issuance;
  • a plurality of token buckets are respectively disposed on a plurality of service boards that need to perform traffic measurement uniformly.
  • the main issuing module is configured to uniformly issue tokens to token buckets on each service board in a message ring manner.
  • the main issuing module may be specifically configured to: issue a token issuing message, and forward the token issuing message to the token bucket of each service board in a logical ring order, and in the order When the card issuance message is returned to the main issuing module, the token issuance is terminated; then a new round of token issuance message is sent to start a new round of token issuance; wherein the token issuance message carries: The address of the main issuing module, the address of the token bucket of the next service board to be sent, a number of old tokens, and a number of new tokens; and, the token buckets on each of the service boards are Receiving the token issuing message, collecting the required number of tokens from the token issuing message, and issuing the old token in the token issuing message After the quantity and/or the number of new tokens and the address of the token bucket of the next service board to be sent are updated, according to the address of the token bucket of the next service board to be sent in the updated token issuing message And forwarding the updated token issuing message to
  • any token bucket can be unrestricted, and the old token is given priority, and the new token is received after the old token is received.
  • the token issuance is terminated.
  • the address of the main issuing module in the token issuing message directly sends a token issuance completion message to the main issuing module, and the new issuing module sends a new round of token issuing message directly to the After the token bucket of the token is finally received, a new round of token issuance begins.
  • the main issuing module is further configured to: receive a token issuing completed message directly sent by the token bucket that finally receives the token, and directly return a new round of tokens to the token bucket that finally receives the token. After the message is issued, a new round of token issuance begins.
  • the token bucket that finally receives the token is based on the address of the token bucket of the next service board to be sent in the token issuing message to the token of the next service board in the logical ring sequence.
  • the bucket sends a token issuance completion message, and the token issuance completion message is forwarded to the main issuance module in a logical ring order, and a new round of token issuance message sent by the main issuance module is followed by a logical ring sequence. After forwarding to the token bucket that last received the token, a new round of token issuance begins.
  • the main issuing module is further configured to: receive the token issuing completion message forwarded by the token bucket in which the last token is received, and forward the new round of token issuing message in a logical ring order. After the last token token bucket, A new round of token issuance.
  • the token issuing device of the embodiment of the present invention is configured to set a token bucket on each service board that needs to perform unified traffic measurement, and the main issuing module is responsible for global token issuance, in the form of a message ring.
  • the token buckets on the service board uniformly issue tokens, which enables unified measurement of interface traffic on different service boards.
  • the token issuing method and system provided by the embodiments of the present invention can be applied to a switch or router product in the field of data communication, and can also be applied to a data gateway product in the wireless field.

Landscapes

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

Description

一种令牌发放方法和系统 本申请要求于 2011年 2月 28 日提交中国专利局、 申请号为
201110048493.2、 发明名称为 "一种令牌发放方法和系统" 的中国专利 申请的优先权, 其全部内容通过引用结合在本申请中。
技术领域
本发明属于通信技术领域, 具体涉及一种令牌发放方法和系统。 背景技术
令牌桶 ( Token Bucket ) 是一种常见的流量测量技术, 常用于对业 务板的流量进行限制和整形, 还能够对流量的速率进行测量。 其工作原 理是, 令牌桶按用户设定的速度向桶中放置令牌, 当桶中令牌的数量超 出桶的容量的时候, 令牌的数量不再增加。 当报文到来时, 如果令牌桶 中有足够的令牌可以用来发送报文, 则报文直接通过并继续发送, 同时 令牌桶中的令牌量按报文的长度做相应的减少; 如果令牌桶中的令牌数 量不足或为空, 则无法得到足够转发令牌的报文将被丟弃或进行标记, 此时令牌桶中的令牌数量不发生变化。
在实现本发明的过程中发明人发现, 目前令牌桶只能够对单个业务 板上的接口流量进行测量, 无法对分布在不同业务板上的一组接口流量 进行统一测量。
发明内容
本发明实施例提供了一种令牌发放方法和系统, 能够对不同业务板 上的接口流量实现统一测量。
本发明实施例釆用如下技术方案:
一种令牌发放方法, 包括:
设置一个负责全局令牌发放的主发放模块; 在每个需要统一进行流量测量的业务板上设置各自的令牌桶; 所述主发放模块以消息环的方式向每个所述业务板上的令牌桶统 一发放令牌。
一种令牌发放系统, 包括:
主发放模块, 用于负责全局令牌发放;
多个令牌桶, 分别设置于多个需要统一进行流量测量的业务板; 所述主发放模块用于以消息环的方式向每个所述业务板上的令牌 桶统一发放令牌。
由本发明实施例的上述技术方案可知, 通过设置一个负责全局令牌 发放的主发放模块, 并在每个需要统一进行流量测量的业务板上设置各 自的令牌桶, 由所述主发放模块以消息环的方式对每个所述业务板上的 令牌桶统一发放令牌, 从而可以对不同业务板上的接口流量实现统一测 量。
附图说明
下面对本发明描述中所需要使用的附图作一简单地介绍。
图 1为本发明实施例提供的一种令牌发放方法的示意图; 图 2为本发明实施例提供的一种令牌发放系统的示意图; 图 3为应用本发明实施例提供的令牌发放方法的一个具体示例。 具体实施方式
下面结合附图及实施例, 对本发明的技术方案进行清楚、 完整地描 述。
参见图 1 , 本发明实施例提供的一种令牌发放方法, 包括:
S 11 , 设置一个负责全局令牌发放的主发放模块。
其中, 主发放模块可以选择槽位最小的业务板上的令牌发放模块承 担, 也可以由专门的业务板承担。 512 ,在每个需要统一进行流量测量的业务板上设置各自的令牌桶。 在每个需要统一进行流量测量的业务板上都独立设置各自的令牌 桶, 但每个业务板的令牌桶不独立发放令牌。
513 , 所述主发放模块以消息环的方式向每个所述业务板上的令牌 桶统一发放令牌。
参见图 2 ,图 2为本发明实施例提供的一种令牌发放系统的示意图。 所述消息环的方式具体可以是: 所述主发放模块发出令牌发放消息, 将 所述令牌发放消息按逻辑环顺序依次向每个所述业务板上的令牌桶进 行转发, 并在所述令牌发放消息回到所述主发放模块时结束本轮的令牌 发放; 然后所述主发放模块发出新一轮的令牌发放消息, 开始新一轮的 令牌发放。 其中, 所述令牌发放消息携带有: 所述主发放模块的地址、 要发送的下一个业务板的令牌桶的地址、 若干数量的旧令牌和若干数量 的新令牌。 在具体实现时, 若干数量的旧令牌或新令牌可以分别用一个 数值表示, 业务板上的令牌桶从令牌发放消息中领取多少数量的令牌, 就将令牌发放消息中旧令牌与新令牌的总数值减去相应的数量, 如令牌 桶领取了 3个令牌, 则将新旧令牌的总数值减去 3。。
主发放模块可以将令牌发放消息简单地按业务板的槽位号的顺序 进行转发, 达到最高 (升序) 或最低槽位 (降序) 时返回到最低或最高 槽位, 直到最后回到主发放模块所在的业务板, 回到主发放模块, 形成 一个环。
需要说明的是, 上述消息环为逻辑上的环, 环上每个节点需要维护 其下行节点的地址。 消息环的实际物理结构既可以是环型结构、 总线结 构、 全互连结构还可以是交换结构。
下面对令牌发放消息转发过程进行具体说明:
当令牌发放消息按逻辑环顺序依次向每个所述业务板上的令牌桶 进行转发时, 每个所述业务板上的令牌桶从收到的令牌发放消息中领取 所需数量的令牌, 并将所述令牌发放消息中的旧令牌数量和 /或新令牌 数量以及要发送的下一个业务板的令牌桶的地址进行更新, 更新后的令 牌总数为原有令牌总数(新旧令牌的数量之和)减去领取的令牌数量后 剩余的令牌数量, 然后依据更新后的所述令牌发放消息中的要发送的下 一个业务板的令牌桶的地址, 将更新后的所述令牌发放消息转发给逻辑 环顺序中的下一个业务板的令牌桶。
需要说明的是, 在令牌发放消息中包括两种令牌, 一种是本轮分配 的新令牌, 一种是上一轮剩余的旧令牌。 对于上一轮剩余的旧令牌, 最 多保留一圈, 在进行新一轮的令牌发放消息转发时, 上一轮剩余的令牌 都变为旧令牌, 同时发放本轮的新令牌。
对于旧令牌, 任何令牌桶都可以不受限制地领取, 而且优先领取旧 令牌, 并在旧令牌领取完后再领取新令牌。 当令牌发放消息中的新令牌 数量被领取完毕时, 则结束本轮的令牌发放。 这样做的好处是, 可以较 灵活地控制不同业务板上的令牌桶从令牌发放消息中领取的令牌数量, 例如在令牌发放消息中的旧令牌数量充足的情况下, 先领取令牌的令牌 桶可以不受限制地领取到所需要数量的令牌。
另外, 为了防止令牌长期被第一次领取令牌的令牌桶占用, 有必要 规定第一次从令牌发放消息中一次领取的新令牌的数量, 例如规定不能 超过每一轮分配新令牌数量的一半, 当然也可以设置为其它比例。
在令牌发放消息中的新旧令牌被领取完毕时,有两种方案开始新一 轮的令牌发放。 一种方案是, 如图 2所示, 最后领取令牌的令牌桶依据 所述令牌发放消息中的所述主发放模块的地址直接向所述主发放模块 发送令牌发放完毕消息, 此时主发放模块发出的新一轮令牌发放消息, 则直接从该业务板开始, 向该业务板的令牌桶返回新一轮的令牌发放消 息, 在该新一轮的令牌发放消息中携带有新分配的令牌(此时该新一轮 的令牌发放消息中携带的令牌全部为新令牌)。 该方案可以保证最后领 取令牌的令牌桶及时领取到所需数量的令牌, 但每一轮令牌发放的时间 无法固定。
另一种方案是, 每一轮的令牌发放消息都统一绕环转发, 即使令牌 发放完毕也绕环一周到达所述主发放模块所在的业务板, 此时主发放模 块发出的新一轮的令牌发放消息再绕环转发到最后领取令牌的令牌桶 后才开始分配令牌。 具体实现是, 最后领取令牌的令牌桶依据所述令牌 发放消息中的要发送的下一个业务板的令牌桶的地址, 将令牌发放完毕 消息转发给逻辑环顺序中的下一个业务板的令牌桶, 直至所述令牌发放 完毕消息按逻辑环顺序转发到所述主发放模块, 并所述主发放模块发出 新一轮的令牌发放消息再按逻辑环顺序转发到所述最后领取令牌的令 牌桶后, 开始新一轮的令牌发放。 该方案可以将每一轮令牌发放时间固 定。
上述两种方案都是从最后领取令牌的业务板才开始新一轮的令牌 发放, 其目的是保证每个业务板的令牌桶都能够平等地领取到令牌。
本发明实施例的令牌发放方法, 通过设置一个负责全局令牌发放的 主发放模块, 并在每个需要统一进行流量测量的业务板上设置各自的令 牌桶, 然后由所述主发放模块以消息环的方式对每个所述业务板上的令 牌桶统一发放令牌, 从而可以对不同业务板上的接口流量实现统一测 量。
下面釆用一个限制 VPN ( Virtual Private Network , 虚拟专用网络) 总带宽的例子对本发明实施例的令牌发放方法进行具体说明。
参见图 3 , 图 3为应用本发明实施例提供的令牌发放方法的一个具 体示例。 假设用户 VPN与运营商签约的带宽为 5Μ字节 /秒, 最大突发 尺寸为 2Κ字节, 假设 5个接入点的报文对应接入设备 5块业务板上, 在 5块业务板上分别配置有承诺速率为 5Μ字节 /秒、 突发尺寸为 2Κ的 令牌桶, 并且假设主发放模块按每毫秒 5Κ字节的速度发放令牌, 每个 令牌桶最大能够获取的令牌数为 2K字节, 贝 'J :
令牌发放消息到达 Α令牌桶, 发放令牌数为 5K字节, A令牌桶最 大领取 2K字节的令牌, 剩余 3K字节令牌转发给 B令牌桶;
B令牌桶同样领取 2K字节, 剩余令牌数为 1K字节, 转发给 C令 牌桶;
C令牌桶只能领取 1K字节令牌, 消息返回给主发放模块; 下一个毫秒, 主发放模块将新的令牌发放消息发往 C令牌桶, C令 牌桶领取 1.5K令牌(假设已经消耗了 0.5K令牌), 剩余 3.5K令牌, 转 发给 D令牌桶;
D令牌桶领取 2K字节令牌, 剩余 1.5K 令牌, 转发给 E令牌桶;
E令牌桶领取 1.5K 字节令牌后, 转发给主发放模块;
下一个毫秒, 主发放模块将新的令牌发放消息发往 E令牌桶, E令 牌桶领取 1K令牌 (假设已经消耗了 0.5K令牌), 剩余 4K令牌, 转发 给主发放模块;
下一个毫秒,主发放模块开始新一轮令牌发放,这时令牌发放消息, 剩余旧令牌 4K, 新令牌 5K;
A令牌桶这时消耗了 1.5K令牌, 领取 1.5K的旧令牌, 剩余旧令牌 2.5k, 新令牌 5K, 转发给 B令牌桶;
B令牌桶消耗了 1K令牌, 领取 1K旧令牌, 剩余旧令牌 1.5K, 新 令牌 5K, 转发给 C令牌桶;
C令牌桶消耗了令牌 2K, 领取 1.5K旧令牌和 0.5K新令牌, 剩余 4.5K新令牌转发给 D令牌桶;
D令牌桶消耗了令牌 2K, 领取 2K新令牌, 剩余 2.5K新令牌, 转 发给 E令牌桶;
E令牌桶也消耗了 2K令牌, 领取 2K新令牌, 剩余 0.5K新令牌, 转发给主发放模块; 下一毫秒, 主发放模块开始新一轮令牌发放, 这时旧令牌为 0.5K, 新令牌为 5K:。
需要说明的是, 为实现总带宽的限制功能, 主发放模块按配置的速 率向各业务板上的令牌桶发放令牌时, 每轮的令牌发放时间可以固定, 也可以不固定。 在每轮发放时间固定时, 主发放模块在每一轮令牌发放 消息中新分配的令牌数量固定; 在每轮发放时间不固定时, 主发放模块 根据消息发送到返回的时间间隔按下发速率计算出下一轮可以分配的 令牌数量。 例如, 上述对于 5M字节 /秒的限速应用, 如果在某一轮令牌 发放中, 从令牌发放消息发送到返回到主发放模块的时间由原来的 1ms 变为 0.5ms , 即该轮的令牌发放时间缩短了一半, 则下一轮令牌发放数 量不再是 5K, 而是 10K, 这样就可以克服消息环传递时延的影响。 可 以理解的是, 上述消息环传递的时延越小控制的精度越高, 因此在设计 消息环时可以要求消息转一圈的时延小于令牌发放的时间间隔。
仍参见图 2 , 本发明实施例提供的一种令牌发放系统, 包括: 主发放模块, 用于负责全局令牌发放;
多个令牌桶, 分别设置于多个需要统一进行流量测量的业务板; 所述主发放模块用于以消息环的方式向每个所述业务板上的令牌 桶统一发放令牌。
其中, 所述主发放模块具体可以用于: 发出令牌发放消息, 将所述 令牌发放消息按逻辑环顺序依次向每个所述业务板上的令牌桶进行转 发, 并在所述令牌发放消息回到所述主发放模块时结束本轮的令牌发 放; 然后发出新一轮的令牌发放消息, 开始新一轮的令牌发放; 其中, 所述令牌发放消息携带有: 所述主发放模块的地址、 要发送的下一个业 务板的令牌桶的地址、 若干数量的旧令牌和若干数量的新令牌; 以及, 每个所述业务板上的令牌桶在收到所述令牌发放消息时, 从所述令 牌发放消息中领取所需数量的令牌, 并将所述令牌发放消息中的旧令牌 数量和 /或新令牌数量以及要发送的下一个业务板的令牌桶的地址更新 后,依据更新后的所述令牌发放消息中的要发送的下一个业务板的令牌 桶的地址, 将更新后的所述令牌发放消息转发给逻辑环顺序中的下一个 业务板的令牌桶。
需要说明的是, 对于旧令牌, 任何令牌桶都可以不受限制地领取, 而且优先领取旧令牌, 并在旧令牌领取完后再领取新令牌。 当令牌发放 消息中的新令牌被领取完毕时, 则结束本轮的令牌发放。 这样做的好处 是, 可以较灵活地控制不同业务板上的令牌桶从令牌发放消息中领取的 令牌数量, 例如在令牌发放消息中的旧令牌数量充足的情况下, 先领取 令牌的令牌桶可以不受限制地领取到所需要数量的令牌。
在所述令牌发放消息中的新旧令牌被领取完毕时, 为保证每个业务 板的令牌桶都能够平等地领取到令牌, 一种方案是, 最后领取令牌的令 牌桶依据所述令牌发放消息中的所述主发放模块的地址直接向所述主 发放模块发送令牌发放完毕消息, 并在所述主发放模块将新一轮的令牌 发放消息直接发送到所述最后领取令牌的令牌桶后, 开始新一轮的令牌 发放。 此时所述主发放模块还具体用于: 接收最后领取令牌的令牌桶直 接发送的令牌发放完毕消息, 并向所述最后领取令牌的令牌桶直接返回 新一轮的令牌发放消息后, 开始新一轮的令牌发放。
另一种方案是, 最后领取令牌的令牌桶依据所述令牌发放消息中的 要发送的下一个业务板的令牌桶的地址向给逻辑环顺序中的下一个业 务板的令牌桶发送令牌发放完毕消息, 并在所述令牌发放完毕消息按逻 辑环顺序转发到所述主发放模块, 由所述主发放模块发出的新一轮的令 牌发放消息再按逻辑环顺序转发到所述最后领取令牌的令牌桶后, 开始 新一轮的令牌发放。 此时所述主发放模块还具体用于: 接收最后领取令 牌的令牌桶按逻辑环顺序转发的令牌发放完毕消息, 并将发出的新一轮 的令牌发放消息按逻辑环顺序转发到所述最后领取令牌的令牌桶后, 开 始新一轮的令牌发放。
本发明实施例的令牌发放装置, 通过在每个需要统一进行流量测量 的业务板上设置各自的令牌桶, 由主发放模块负责全局令牌发放, 以消 息环的方式对每个所述业务板上的令牌桶统一发放令牌, 从而可以对不 同业务板上的接口流量实现统一测量。
本发明实施例提供的令牌发放方法和系统可以应用到数据通信领 域的交换机或路由器产品, 也可应用到无线领域的数据网关产品中。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不 局限于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围 内, 可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。 因此, 本发明的保护范围应该以权利要求的保护范围为准。

Claims

权利 要求 书
1、 一种令牌发放方法, 其特征在于, 包括:
设置一个负责全局令牌发放的主发放模块;
在每个需要统一进行流量测量的业务板上设置各自的令牌桶;
所述主发放模块以消息环的方式向每个所述业务板上的令牌桶统一发放令 牌。
2、 根据权利要求 1所述的方法, 其特征在于, 所消息环的方式包括: 所述主发放模块发出令牌发放消息, 将所述令牌发放消息按逻辑环顺序依 次向每个所述业务板上的令牌桶进行转发, 并在所述令牌发放消息回到所述主 发放模块时结束本轮的令牌发放; 然后所述主发放模块发出新一轮的令牌发放 消息, 开始新一轮的令牌发放;
其中, 所述令牌发放消息携带有: 所述主发放模块的地址、 要发送的下一 个业务板的令牌桶的地址、 若干数量的旧令牌和若干数量的新令牌。
3、 根据权利要求 2所述的方法, 其特征在于, 所述主发放模块将令牌发放 消息按逻辑环顺序依次向每个所述业务板上的令牌桶进行转发包括:
每个所述业务板上的令牌桶在收到所述令牌发放消息时, 从所述令牌发放 消息中领取所需数量的令牌, 并将所述令牌发放消息中的旧令牌数量和 /或新令 牌数量以及要发送的下一个业务板的令牌桶的地址更新后, 依据更新后的所述 令牌发放消息中的要发送的下一个业务板的令牌桶的地址, 将更新后的所述令 牌发放消息转发给逻辑环顺序中的下一个业务板的令牌桶。
4、 根据权利要求 3所述的方法, 其特征在于, 所述每个所述业务板上的令 牌桶在收到所述令牌发放消息时, 从所述令牌发放消息中领取所需数量的令牌 包括:
每个所述业务板上的令牌桶不受限制地领取旧令牌, 并在旧令牌领取完后 再领取新令牌。
5、 根据权利要求 3或 4所述的方法, 其特征在于, 在所述令牌发放消息中 的新旧令牌被领取完毕时, 所述主发放模块将令牌发放消息按逻辑环顺序依次 向每个所述业务板上的令牌桶进行转发还包括:
最后领取令牌的令牌桶依据所述令牌发放消息中的所述主发放模块的地址 直接向所述主发放模块发送令牌发放完毕消息 , 并在所述主发放模块将新一轮 的令牌发放消息直接发送到所述最后领取令牌的令牌桶后, 开始新一轮的令牌 发放。
6、 根据权利要求 3或 4所述的方法, 其特征在于, 在所述令牌发放消息中 的新旧令牌被领取完毕时, 所述主发放模块将令牌发放消息按逻辑环顺序依次 向每个所述业务板上的令牌桶进行转发还包括:
最后领取令牌的令牌桶依据所述令牌发放消息中的要发送的下一个业务板 的令牌桶的地址向给逻辑环顺序中的下一个业务板的令牌桶发送令牌发放完毕 消息, 并在所述令牌发放完毕消息按逻辑环顺序转发到所述主发放模块, 由所 述主发放模块发出的新一轮的令牌发放消息再按逻辑环顺序转发到所述最后领 取令牌的令牌桶后, 开始新一轮的令牌发放。
7、 一种令牌发放系统, 其特征在于, 包括:
主发放模块, 用于负责全局令牌发放;
多个令牌桶, 分别设置于多个需要统一进行流量测量的业务板;
所述主发放模块, 用于以消息环的方式向每个所述业务板上的令牌桶统一 发放令牌。
8、 根据权利要求 7所述的系统, 其特征在于, 所述主发放模块, 具体用于 发出令牌发放消息, 将所述令牌发放消息按逻辑环顺序依次向每个所述业务板 上的令牌桶进行转发, 并在所述令牌发放消息回到所述主发放模块时结束本轮 的令牌发放; 然后发出新一轮的令牌发放消息, 开始新一轮的令牌发放;
其中, 所述令牌发放消息携带有: 所述主发放模块的地址、 要发送的下一 个业务板的令牌桶的地址、 若干数量的旧令牌和若干数量的新令牌。
9、 根据权利要求 8所述的系统, 其特征在于, 在所述令牌发放消息中的新 旧令牌被领取完毕时, 所述主发放模块, 还用于接收最后领取令牌的令牌桶直 接发送的令牌发放完毕消息, 并向所述最后领取令牌的令牌桶直接返回新一轮 的令牌发放消息后, 开始新一轮的令牌发放。
10、 根据权利要求 8 所述的系统, 其特征在于, 在所述令牌发放消息中的 新旧令牌被领取完毕时, 所述主发放模块, 还用于接收最后领取令牌的令牌桶 按逻辑环顺序转发的令牌发放完毕消息, 并将发出的新一轮的令牌发放消息按 逻辑环顺序转发到所述最后领取令牌的令牌桶后, 开始新一轮的令牌发放。
PCT/CN2011/078782 2011-02-28 2011-08-23 一种令牌发放方法和系统 WO2012116539A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2011100484932A CN102118269A (zh) 2011-02-28 2011-02-28 一种令牌发放方法和系统
CN201110048493.2 2011-02-28

Publications (1)

Publication Number Publication Date
WO2012116539A1 true WO2012116539A1 (zh) 2012-09-07

Family

ID=44216873

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/078782 WO2012116539A1 (zh) 2011-02-28 2011-08-23 一种令牌发放方法和系统

Country Status (2)

Country Link
CN (1) CN102118269A (zh)
WO (1) WO2012116539A1 (zh)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102118269A (zh) * 2011-02-28 2011-07-06 华为技术有限公司 一种令牌发放方法和系统
CN102647323B (zh) * 2012-03-28 2015-01-07 华为技术有限公司 流量控制方法、装置和集群系统
CN105991467B (zh) * 2015-04-15 2019-05-07 杭州迪普科技股份有限公司 一种报文转发方法及装置
CN105049370A (zh) * 2015-08-18 2015-11-11 北京汉柏科技有限公司 一种基于云计算操作系统的组件通信方法
CN109936511B (zh) * 2017-12-19 2020-12-25 北京金山云网络技术有限公司 一种令牌获取方法、装置、服务器、终端设备及介质
CN108399078B (zh) * 2018-03-19 2021-06-15 武汉斗鱼网络科技有限公司 一种消息频率限制方法、系统、服务器和存储介质
CN108848038B (zh) * 2018-08-30 2021-01-29 华为技术有限公司 基于令牌桶的流量管理方法和令牌桶节点
CN111835655B (zh) * 2020-07-13 2022-06-28 北京轻网科技有限公司 共享带宽限速方法、装置及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6801500B1 (en) * 2000-05-18 2004-10-05 Cisco Technology, Inc. Method and apparatus for providing reserved rates to multiple flows on a network interface
CN101282305A (zh) * 2008-05-22 2008-10-08 杭州华三通信技术有限公司 分布式系统中的带宽控制方法及业务板
CN101478527A (zh) * 2009-01-20 2009-07-08 华为技术有限公司 带宽分配方法和路由设备
CN101478491A (zh) * 2009-02-10 2009-07-08 中兴通讯股份有限公司 一种实现分组业务区分服务的方法及装置
CN102118269A (zh) * 2011-02-28 2011-07-06 华为技术有限公司 一种令牌发放方法和系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6801500B1 (en) * 2000-05-18 2004-10-05 Cisco Technology, Inc. Method and apparatus for providing reserved rates to multiple flows on a network interface
CN101282305A (zh) * 2008-05-22 2008-10-08 杭州华三通信技术有限公司 分布式系统中的带宽控制方法及业务板
CN101478527A (zh) * 2009-01-20 2009-07-08 华为技术有限公司 带宽分配方法和路由设备
CN101478491A (zh) * 2009-02-10 2009-07-08 中兴通讯股份有限公司 一种实现分组业务区分服务的方法及装置
CN102118269A (zh) * 2011-02-28 2011-07-06 华为技术有限公司 一种令牌发放方法和系统

Also Published As

Publication number Publication date
CN102118269A (zh) 2011-07-06

Similar Documents

Publication Publication Date Title
WO2012116539A1 (zh) 一种令牌发放方法和系统
CN108282415B (zh) 一种调度方法及设备
CN103823780B (zh) 一种实时现场总线控制调度方法
Vattikonda et al. Practical TDMA for datacenter Ethernet
CN1659833B (zh) 用于确定光纤信道结构中路由特征的方法和装置
US11272396B2 (en) Frame aggregation method, network setting frame sending method, and device
JP5817606B2 (ja) 負荷分散ポリシング機能を含むポリサ
WO2010083681A1 (zh) 带宽分配方法和路由设备
CN104125518A (zh) 一种利用无源光网络实现变电站内数据报文传输的方法
CN102811176B (zh) 一种数据流量控制方法和装置
CN102907058A (zh) 在没有中央控制的全网状网络中利用动态多路径路由的基于单元数据传输
JP2009524308A (ja) 動的リソース割当てのための方法及びシステム
CN103746878B (zh) 一种测定SpaceWire数据包的传输时间的仿真系统
CN107659456A (zh) 一种基于rs485通信的数据冲突传输方法
CN111092819B (zh) 一种收发组播业务报文的方法及设备
Han Simple and feasible dynamic bandwidth and polling allocation for XGPON
CN110492960A (zh) 基于以太网的同步通信方法
CN103618681B (zh) 一种弹性的网络带宽控制方法及其系统
CN108933717A (zh) 一种基于时间与事件交替触发的afdx端系统调度方法
CN116627891A (zh) 一种软件可控的片上网络动态信用管理装置、系统及方法
KR102073847B1 (ko) 제어 네트워크 시스템, 그 노드 장치
CN115643220A (zh) 基于抖动时延的确定性业务传输方法和装置
KR102016823B1 (ko) 하이브리드 네트워크들에서 볼륨-기반 온라인 과금
JP2017216548A (ja) 無線通信制御方法およびセンサ収容端末
CN110601996B (zh) 一种采用令牌保底分布式贪心算法的环网防饥饿流控方法

Legal Events

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

Ref document number: 11859947

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

Country of ref document: EP

Kind code of ref document: A1