Token Bucket

download Token Bucket

of 15

Transcript of Token Bucket

  • 7/31/2019 Token Bucket

    1/15

    1

  • 7/31/2019 Token Bucket

    2/15

    When one part of the subnet (e.g. one or morerouters in an area) becomes overloaded,congestion results.

    Because routers are receiving packets fasterthan they can forward them, one of two thingsmust happen: The subnet must prevent additional packets from

    entering the congested region until those alreadypresent can be processed.

    The congested routers can discard queued packets tomake room for those that are arriving.

    2

  • 7/31/2019 Token Bucket

    3/15

    Packet arrival rate exceeds the outgoing link capacity.

    Insufficient memory to store arriving packets

    Bursty traffic Slow processor

    3

  • 7/31/2019 Token Bucket

    4/15

    Traffic Shaping

    Anothermethod of congestion control is to shapethe traffic before it enters the network.

    At connection set-up time, the sender and carrier

    negotiate a traffic pattern (shape). Traffic shaping controls the rate at which packets

    are sent (not just how many). Used in ATM andIntegrated Services networks.

    Two traffic shaping algorithms are: Leaky Bucket

    Token Bucket

    4

  • 7/31/2019 Token Bucket

    5/15

    Token Bucket Token Bucket with Leaky Bucket Rate Control

    5

  • 7/31/2019 Token Bucket

    6/15

    In contrast to the LB, the Token BucketAlgorithm, allows the output rate to vary,depending on the size of the burst.

    In the TB algorithm, the bucket holds tokens.To transmit a packet, the host must capture anddestroy one token.

    Tokens are generated by a clock at the rate ofone token everyt sec.

    Idle hosts can capture and save up tokens (up tothe max. size of the bucket) in order to sendlarger bursts later.

    6

  • 7/31/2019 Token Bucket

    7/15

    A token is added to the bucket every 1/r sec.

    The bucket can hold at the most b tokens.

    If a token arrives when the bucket is full, it isdiscarded.

    When a packet of n bytes arrives, n tokens are removedfrom the bucket, and the packet is sent to the network.

    7

  • 7/31/2019 Token Bucket

    8/15(a) Before. (b) After. 8

    5-34

  • 7/31/2019 Token Bucket

    9/15

    Implementers of this algo. on platforms lacking theclock resolution necessary to add a single token to thebucket every 1/r sec. may want to consider analternative formulation.

    No. of tokens to add every S ms

    = (r*s)/1000

    9

  • 7/31/2019 Token Bucket

    10/15

    Average Rate

    Over the long run the output of conformant

    packets is limited by the token rate r.

    Burst Size

    Let M be the max. possible transmission rate inbytes/sec.

    10

  • 7/31/2019 Token Bucket

    11/15

    The max burst size is Lmax=Tmax*M

    Tmax =

    11

  • 7/31/2019 Token Bucket

    12/15

    LB discards packets; TB does not. TB discards tokens.

    With TB, a packet can only be transmitted if there areenough tokens to cover its length in bytes.

    LB sends packets at an average rate. TB allows for largebursts to be sent faster by speeding up the output.

    TB allows saving up tokens (permissions) to send largebursts. LB does not allow saving.

    12

  • 7/31/2019 Token Bucket

    13/15

    More accurate description of flows rate help networkto effectively manage its resources

    Simplest shaping - leaky bucket - for fixed data rates token bucket (with leaky bucket) -> more diverse

    traffic patterns

    13

  • 7/31/2019 Token Bucket

    14/15

    14

  • 7/31/2019 Token Bucket

    15/15

    15