12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 22DelayBox: Per-Flow Delay <strong>and</strong> LossDelayBox is an <strong>ns</strong> node th<strong>at</strong> should be placed in between the source <strong>and</strong> destin<strong>at</strong>ion nodes. With Delaybox, packets froma TCP flow can be delayed, dropped, <strong>and</strong>/or forced through a bottleneck link before being passed on to the next node. Adistribution can be used to specify delay, loss, <strong>and</strong>/or bottleneck link speed for a source - destin<strong>at</strong>ion pair. Each flow betweenth<strong>at</strong> source - destin<strong>at</strong>ion pair draws from the distribution to determine its characteristics. Delays in DelayBox are per-flow,r<strong>at</strong>her than per-packet. Since DelayBox distinguishes between flows, the fid_ variable (flow identifier) should be set foreach flow in the simul<strong>at</strong>ion. DelayBox can be used with both Tcp <strong>and</strong> FullTcp agents.22.1 Implement<strong>at</strong>ion DetailsDelayBox maintai<strong>ns</strong> two tables: a rule table <strong>and</strong> a flow table. Entries in the rule table are added by the user in the OTclsimul<strong>at</strong>ion script <strong>and</strong> give an outline of how flows from a source to a destin<strong>at</strong>ion should be tre<strong>at</strong>ed. <strong>The</strong> fields are source,destin<strong>at</strong>ion, delay R<strong>and</strong>om Variable (in ms), loss r<strong>at</strong>e R<strong>and</strong>om Variable (in fraction of packets dropped), <strong>and</strong> bottleneck linkspeed R<strong>and</strong>om Variable (in Mbps). <strong>The</strong> bottleneck link speed field is optional. Entries in the flow table are cre<strong>at</strong>ed internally<strong>and</strong> specify exactly how each flow should be h<strong>and</strong>led. Its values are obtained by sampling from the distributio<strong>ns</strong> given in therule table. <strong>The</strong> fields are source, destin<strong>at</strong>ion, flow ID, delay, loss, <strong>and</strong> bottleneck link speed (if applicable). Full-TCP flowsare defined as beginning <strong>at</strong> the receipt of the first SYN of a new flow ID <strong>and</strong> ending after the sending of the first FIN. Packetsafter the first FIN are forwarded immedi<strong>at</strong>ely (i.e., they are neither delayed nor dropped by DelayBox). For TcpAgent,flows are defined as beginning <strong>at</strong> the receipt of the first 40 byte packet of a new flow ID. Since there are no FIN packets inTcpAgent, TcpAgent flows are never co<strong>ns</strong>idered finished nor are they removed from the flow table.DelayBox also maintai<strong>ns</strong> a set of queues to h<strong>and</strong>le delaying packets. <strong>The</strong>re is one queue per entry in the flow table. <strong>The</strong>sequeues are implemented as delta queues, in th<strong>at</strong> the time to tra<strong>ns</strong>fer the packet is kept only for the head packet. All otherpackets are stored with the difference between the time they should be tra<strong>ns</strong>ferred <strong>and</strong> the time the previous packet shouldbe tra<strong>ns</strong>ferred. <strong>The</strong> actual time the previous packet should be tra<strong>ns</strong>ferred is stored in the variable deltasum_, named sobecause it is the sum of all delta values in the queue (including the head packet’s tra<strong>ns</strong>fer time). If the bottleneck link speedhas been specified for the flow, a processing delay is computed for each packet by dividing the size of the packet by the flow’sbottleneck link speed.When a packet is received, its tra<strong>ns</strong>fer time (current time + delay) is calcul<strong>at</strong>ed. (This tra<strong>ns</strong>fer time is the time th<strong>at</strong> the first bitof the packet will begin tra<strong>ns</strong>fer. Packets th<strong>at</strong> wait in the queue behind this packet must be delayed by the amount of time totra<strong>ns</strong>fer all bits of the packet over the bottleneck link.) <strong>The</strong>re are two scenarios to co<strong>ns</strong>ider in deciding how to set the packet’sdelta:208

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!