8844
|
1 |
Queues
|
|
2 |
------
|
|
3 |
|
|
4 |
.. heading hierarchy:
|
|
5 |
------------- Chapter
|
|
6 |
************* Section (#.#)
|
|
7 |
============= Subsection (#.#.#)
|
|
8 |
############# Paragraph (no number)
|
|
9 |
|
|
10 |
This section documents a few queue objects, typically associated with
|
|
11 |
NetDevice models, that are maintained as part of the ``network`` module:
|
|
12 |
|
|
13 |
* DropTail
|
|
14 |
* Random Early Detection
|
|
15 |
|
|
16 |
Model Description
|
|
17 |
*****************
|
|
18 |
|
|
19 |
The source code for the new module lives in the directory ``src/network/utils``.
|
|
20 |
|
|
21 |
ns-3 provides a couple of classic queue models and the ability to
|
|
22 |
trace certain queue operations such as enqueuing, dequeuing, and dropping.
|
|
23 |
These may be added to certain NetDevice objects that take a Ptr<Queue>
|
|
24 |
pointer.
|
|
25 |
|
|
26 |
Note that not all device models use these queue models.
|
|
27 |
In particular, WiFi, WiMax, and LTE use specialized device queues.
|
|
28 |
The queue models described here are more often used with simpler ns-3
|
|
29 |
device models such as PointToPoint and Csma.
|
|
30 |
|
|
31 |
Design
|
|
32 |
======
|
|
33 |
|
|
34 |
An abstract base class, class Queue, is typically used and subclassed
|
|
35 |
for specific scheduling and drop policies. Common operations
|
|
36 |
include:
|
|
37 |
|
|
38 |
* ``bool Enqueue (Ptr<Packet> p)``: Enqueue a packet
|
|
39 |
* ``Ptr<Packet> Dequeue (void)``: Dequeue a packet
|
|
40 |
* ``uint32_t GetNPackets (void)``: Get the queue depth, in packets
|
|
41 |
* ``uint32_t GetNBytes (void)``: Get the queue depth, in packets
|
|
42 |
|
|
43 |
as well as tracking some statistics on queue operations.
|
|
44 |
|
|
45 |
There are three trace sources that may be hooked:
|
|
46 |
|
|
47 |
* ``Enqueue``
|
|
48 |
* ``Dequeue``
|
|
49 |
* ``Drop``
|
|
50 |
|
|
51 |
DropTail
|
|
52 |
########
|
|
53 |
|
|
54 |
This is a basic first-in-first-out (FIFO) queue that performs a tail drop
|
|
55 |
when the queue is full.
|
|
56 |
|
|
57 |
Random Early Detection
|
|
58 |
######################
|
|
59 |
|
|
60 |
Random Early Detection (RED) is a queue variant that aims to provide
|
|
61 |
early signals to transport protocol congestion control (e.g. TCP) that
|
|
62 |
congestion is imminent, so that they back off their rate gracefully
|
|
63 |
rather than with a bunch of tail-drop losses (possibly incurring
|
|
64 |
TCP timeout). The model in ns-3 is a port of Sally Floyd's ns-2
|
|
65 |
RED model.
|
|
66 |
|
|
67 |
Scope and Limitations
|
|
68 |
=====================
|
|
69 |
|
|
70 |
The RED model just supports default RED. Adaptive RED is not supported.
|
|
71 |
|
|
72 |
References
|
|
73 |
==========
|
|
74 |
|
|
75 |
The RED queue aims to be close to the results cited in:
|
|
76 |
S.Floyd, K.Fall http://icir.org/floyd/papers/redsims.ps
|
|
77 |
|
|
78 |
Usage
|
|
79 |
*****
|
|
80 |
|
|
81 |
Helpers
|
|
82 |
=======
|
|
83 |
|
|
84 |
A typical usage pattern is to create a device helper and to configure
|
|
85 |
the queue type and attributes from the helper, such as this example
|
|
86 |
from ``src/network/examples/red-tests.cc``:
|
|
87 |
|
|
88 |
::
|
|
89 |
|
|
90 |
PointToPointHelper p2p;
|
|
91 |
|
|
92 |
p2p.SetQueue ("ns3::DropTailQueue");
|
|
93 |
p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
|
|
94 |
p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
|
|
95 |
NetDeviceContainer devn0n2 = p2p.Install (n0n2);
|
|
96 |
|
|
97 |
p2p.SetQueue ("ns3::DropTailQueue");
|
|
98 |
p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
|
|
99 |
p2p.SetChannelAttribute ("Delay", StringValue ("3ms"));
|
|
100 |
NetDeviceContainer devn1n2 = p2p.Install (n1n2);
|
|
101 |
|
|
102 |
p2p.SetQueue ("ns3::RedQueue", // only backbone link has RED queue
|
|
103 |
"LinkBandwidth", StringValue (redLinkDataRate),
|
|
104 |
"LinkDelay", StringValue (redLinkDelay));
|
|
105 |
p2p.SetDeviceAttribute ("DataRate", StringValue (redLinkDataRate));
|
|
106 |
p2p.SetChannelAttribute ("Delay", StringValue (redLinkDelay));
|
|
107 |
NetDeviceContainer devn2n3 = p2p.Install (n2n3);
|
|
108 |
|
|
109 |
|
|
110 |
Attributes
|
|
111 |
==========
|
|
112 |
|
|
113 |
The RED queue contains a number of attributes that control the RED
|
|
114 |
policies:
|
|
115 |
|
|
116 |
* Mode (bytes or packets)
|
|
117 |
* MeanPktSize
|
|
118 |
* IdlePktSize
|
|
119 |
* Wait (time)
|
|
120 |
* Gentle mode
|
|
121 |
* MinTh, MaxTh
|
|
122 |
* QueueLimit
|
|
123 |
* Queue weight
|
|
124 |
* LInterm
|
|
125 |
* LinkBandwidth
|
|
126 |
* LinkDelay
|
|
127 |
|
|
128 |
Consult the ns-3 documentation for explanation of these attributes.
|
|
129 |
|
|
130 |
Output
|
|
131 |
======
|
|
132 |
|
|
133 |
The ns-3 ascii trace helpers used by many of the NetDevices will hook
|
|
134 |
the Enqueue, Dequeue, and Drop traces of these queues and print out
|
|
135 |
trace statements, such as the following from ``examples/udp/udp-echo.cc``:
|
|
136 |
|
|
137 |
::
|
|
138 |
|
|
139 |
+ 2 /NodeList/0/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader
|
|
140 |
( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff)
|
|
141 |
ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1
|
|
142 |
dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0)
|
|
143 |
- 2 /NodeList/0/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader
|
|
144 |
( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff)
|
|
145 |
ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1
|
|
146 |
dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0)
|
|
147 |
|
|
148 |
which shows an enqueue "+" and dequeue "-" event at time 2 seconds.
|
|
149 |
|
|
150 |
Users are, of course, free to define and hook their own trace sinks to
|
|
151 |
these trace sources.
|
|
152 |
|
|
153 |
Examples
|
|
154 |
========
|
|
155 |
|
|
156 |
The drop-tail queue is used in several examples, such as
|
|
157 |
``examples/udp/udp-echo.cc``. The RED queue example is found at
|
|
158 |
``src/network/examples/red-tests.cc``.
|
|
159 |
|
|
160 |
Validation
|
|
161 |
**********
|
|
162 |
|
|
163 |
The RED model has been validated and the report is currently stored
|
|
164 |
at: https://github.com/downloads/talau/ns-3-tcp-red/report-red-ns3.pdf
|
|
165 |
|