NS Helpful Hints

These are things that I wish I'd known 6 months ago. =) Please, please add to this page as you find out useful NS stuff.

Memory / Running Time

Check out Tips for Running Large Simulations in NS. In particular, if you put
remove-all-packet-headers
add-packet-header IP TCP
at the top of your simulation script (before the [new Simulator] line), you'll save lots o' memory and lots o' time. By default, NS includes every possible packet header in every packet in the simulation. Look in .../ns/tcl/lib/ns-packet.tcl for a list of packet header types. Add in only the ones you need. (In the example above, I only needed IP and TCP.)

If you're using ns-2.1b8 or ns-2.1b8a, you'll need to apply the patch found here first.

Running time of a HTTP simulation before: 772.78 s
Running time of a HTTP simulation after: 126.97 s

Running Time

Feb 8, 2003

If you're having problems with running time going exponential (as compared to simulation time), check out the Heap scheduler.

$ns use-scheduler Heap
With a large HTTP experiment at 100% load, I saved 6 hours of running time just by switching the scheduler. All of the other results (rsptime CDF, throughput, drops, etc) remained either exactly the same or very close.
Other DiRT documents
Author: Michele Weigle (mcweigle@cs.unc.edu)