Weighted round robin
From Wikipedia, the free encyclopedia
Weighted round robin (WRR) is a best-effort connection scheduling discipline. It is the simplest emulation of generalized processor sharing (GPS) discipline. While GPS serves infinitesimal amount of data from each nonempty connection, WRR serves a number of packets for each nonempty connection (number = normalized(weight / mean packet size) ).
To obtain normalized set of weights a mean packet size must be known. Only then WRR correctly emulates GPS. It is best to know this parameter in advance. But that's really uncommon in IP networks so it has to be estimated which may be in practice quite hard (in terms of good GPS approximation). Another problem with WRR is that in a scale of one round WRR doesn't provide fair link sharing.
WRR mechanism (pseudo-code):
//calculate number of packets to be served each round by connections for (each connection) connection[i].normalized_weight = connection[i].weight / connection[i].mean_packet_size; min = findSmallestNormalizedWeight(); for (each connection) connection[i].packets_to_be_served = connection[i].normalized_weight / min; // main loop while (true) { for (each non-empty connection) for (j=0; j< min(connection[i].packets_to_be_served, connection[i].packets_waiting); j++) servePacket (connection[i].getPacket()); }
There's a modified version of WRR called deficit round robin (DRR) which is able to properly handle packets of different size without knowing their mean size of each connection in advance.
There are more effective scheduling disciplines which handles both of these problems mentioned above (e.g. weighted fair queuing (WFQ)).