Table Of Contents
Table Of Contents

Leaky Bucket

The LeakyBucket compound module implements the leaky bucket algorithm. By default, the module contains a DropTailQueue, and a PacketServer. The queue capacity and the processing time of the server can be used to parameterize the leaky bucket algorithm.

In this example network, packets are produced by an active packet source (ActivePacketSource). The packet source pushes packets into a LeakyBucket module, which pushes them into a passive packet sink (PassivePacketSink). The leaky bucket is configured with a processing time of 1s, and a packet capacity of 1.

../../../_images/LeakyBucket.png
../../../_images/LeakyBucket_Bucket.png
network LeakyBucketTutorialStep
{
    submodules:
        producer: ActivePacketSource {
            @display("p=100,100");
        }
        bucket: LeakyBucket {
            @display("p=200,100");
        }
        consumer: PassivePacketSink {
            @display("p=300,100");
        }
    connections allowunconnected:
        producer.out --> bucket.in;
        bucket.out --> consumer.in;
}
[Config LeakyBucket]
network = LeakyBucketTutorialStep
sim-time-limit = 10s

*.producer.packetLength = 1B
*.producer.productionInterval = uniform(0s, 0.5s)
*.bucket.server.processingTime = 1s