Priority Buffer¶
The PriorityBuffer module extends PacketBuffer by configuring a packet drop strategy. By default, when the buffer is full, packets belonging to the last queue are dropped first. This is the behavior that can be changed by the packet drop strategy.
In this example network, packets are produced at random intervals by two active packet sources (ActivePacketSource). The packet packet sources push packets into two queues (PacketQueue). The queues share a PriorityBuffer with a packet capacity of 2. Packets are popped from the queues at random intervals by two active packet sinks (ActivePacketSink). When the buffer becomes full, it drops packets from the second queue first.
network PriorityBufferTutorialStep
{
submodules:
buffer: PriorityBuffer {
@display("p=125,350");
}
producer1: ActivePacketSource {
@display("p=125,100");
}
producer2: ActivePacketSource {
@display("p=125,225");
}
queue1: PacketQueue {
@display("p=325,100");
bufferModule = "^.buffer";
}
queue2: PacketQueue {
@display("p=325,225");
bufferModule = "^.buffer";
}
collector1: ActivePacketSink {
@display("p=525,100");
}
collector2: ActivePacketSink {
@display("p=525,225");
}
connections:
producer1.out --> queue1.in;
queue1.out --> collector1.in;
producer2.out --> queue2.in;
queue2.out --> collector2.in;
}
[Config PriorityBuffer]
network = PriorityBufferTutorialStep
sim-time-limit = 10s
*.producer*.packetLength = 1B
*.producer*.productionInterval = uniform(0s, 1s)
*.collector*.collectionInterval = uniform(0s, 2s)
*.buffer.packetCapacity = 2