latency - Taking 17.x seconds to send 10MB over a 10MB/s link through a switch in ns3 -
i working hang of ns3 , doing sanity check turned out wrong.
i want send 10mb on tcp through switch @ rate of 10mb/s , expect take 1.x seconds because of apparent buggery taking whopping 17.x seconds. can't seem figure out wrong after googling , checking users ns-3 group. if point me in right direction of how debug i'd take answer. btw, if set delay zero, works ten times faster couldn't make sense out of , takes 1.7x seconds.
here enough code reproduce behaviour:
#include <iostream> #include <fstream> #include "ns3/core-module.h" #include "ns3/network-module.h" #include "ns3/applications-module.h" #include "ns3/bridge-module.h" #include "ns3/csma-module.h" #include "ns3/internet-module.h" using namespace ns3; int main (int argc, char *argv[]) { uint32_t burstsize = 10000000; uint32_t packetsize = 1000; config::setdefault("ns3::tcpsocket::segmentsize", uintegervalue (packetsize)); // create topology's nodes. nodecontainer nodes; nodes.create (2); nodecontainer csmaswitch; csmaswitch.create (1); netdevicecontainer nodedevices; netdevicecontainer switchdevices; // setting csma attributes csmahelper csma; // setting node's channels csma.setchannelattribute ("datarate", dataratevalue (datarate ("10mb/s"))); csma.setchannelattribute ("delay", stringvalue ("10ms")); (int = 0; < 2; i++) { netdevicecontainer link = csma.install (nodecontainer (nodes.get (i), csmaswitch)); nodedevices.add (link.get (0)); switchdevices.add (link.get (1)); } // create bridge netdevice, packet switching ptr<node> switchnode = csmaswitch.get (0); bridgehelper bridge; bridge.install (switchnode, switchdevices); // add internet protocol stack nodes config::setdefault ("ns3::tcpl4protocol::sockettype", stringvalue ("ns3::tcpreno")); internetstackhelper internet; internet.install (nodes); internet.install (csmaswitch); // add ip addresses ipv4addresshelper ipv4; ipv4.setbase ("10.1.1.0", "255.255.255.0"); ipv4interfacecontainer nodeinterfaces; nodeinterfaces = ipv4.assign (nodedevices); uint16_t port = 10100; bulksendhelper source ("ns3::tcpsocketfactory", inetsocketaddress (nodeinterfaces.getaddress (0), port)); source.setattribute ("maxbytes", uintegervalue (burstsize)); source.setattribute ("sendsize", uintegervalue (packetsize)); applicationcontainer sourceapps = source.install (nodes.get (1)); sourceapps.start (seconds (0.0)); sourceapps.stop (seconds (1000.0)); // // create packetsinkapplication , install on node 0 // packetsinkhelper sink ("ns3::tcpsocketfactory", inetsocketaddress (ipv4address::getany (), port)); applicationcontainer sinkapps = sink.install (nodes.get (0)); sinkapps.start (seconds (0.0)); sinkapps.stop (seconds (1000.0)); csma.enablepcapall ("results/pcap/data", false); simulator::run (); simulator::destroy (); }
the implementation of csma bridge half duplex , that's why performance terrible.
Comments
Post a Comment