simulate asymetric delays in the network

219 views
Skip to first unread message

Matt

unread,
Sep 11, 2014, 1:13:51 PM9/11/14
to ns-3-...@googlegroups.com
Hi,

I would like to create network with asymetric delay between a client C
and a Server S, even under low traffic.
I see that p2pchannel can have a delay attribute:
p2phelper.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (20)));

I guess to achieve that I should play with routing tables so that
packets don't follow the same forward & reverse paths.

something like (dots are here to keep formatting)
...........____
........../........\
C ----R1----R2---S

I want for instance a delay C->S of 40ms and S->C of 100ms
Is there any example I could use ?

Cheers
Matt

Konstantinos

unread,
Sep 11, 2014, 1:44:56 PM9/11/14
to ns-3-...@googlegroups.com
You can follow the way you suggested, ie having two p2p links between R1 and R2 with different delays.
There is an example of static routing in /examples/routing/static-routing-slash32.cc
You just need to be careful with the IP addressing and #interfaces. Every p2p link should be a new subnet and the two routers would have in total 3 interfaces.

Matt Anonyme

unread,
Sep 13, 2014, 10:02:35 AM9/13/14
to ns-3-...@googlegroups.com
It was a bit tedious to write the routes but this works thanks :)

Tommaso Pecorella

unread,
Sep 13, 2014, 12:25:32 PM9/13/14
to ns-3-...@googlegroups.com
Yo,

the "problem" is where this delay comes from.
Asymmetric delays can be caused by two distinct things:
1) Asymmetric bandwidth.
2) Different path.

First let's define the "delay". It has two components: the delay between the 1st byte Tx and Rx (it depends only the physical medium) and the delay between the 1st byte Rx and the last byte Rx (it depends on the channel bandwidth).
The first component is usually symmetric, the second is often asymmetric.
This, of course, is valid for one hop and assuming the hop is using the same technology (e.g., wireless, fiber optic, etc.). If the hop is performed by using completely different physical medium... bong.

How to do have a channel with asymmetric delays in ns-3. Simple: you develop one.
Just have a delay matrix (may be also non-symmetric) storing the delay between each node. Then use that one.
The difficulty may be to calculate the delays of scenarios with more than 2 nodes and to define what is a "channel busy". Mind that both csma and p2p use some assumptions that makes them questionable for delays much greater than the effective packet duration.

Hope this helps

T.

Matt

unread,
Sep 20, 2014, 6:46:21 PM9/20/14
to ns-3-...@googlegroups.com
Hi tommaso,

Thanks for taking the time to do some pedagogy over the networking
concepts and not limit yourself to the technical aspect.

Ideally I would like to consider both cases (asymmetric routing &
asymmetric BW) but due to time/codebase constraints, I limit myself in
a first time to asymetric routing delays.

I have a few other questions:
-what is the best way to divide a Time ? Right now I do:
Time t = MilliSeconds(40);
t = MilliSeconds(t.GetMilliSeconds()/4);
-is it possible to use a RandomPropagationDelayModel on a P2P device ?
I don't want to generate traffic to change the RTT but I still would
like to see some changes in my RTT (can be thought of as a hack).
-I don't think there is the possibility to set a per-node clock. Would
it be possible to upstream a patch that would allow to set a per node
clock. The motive is that clock synchronization should allow
performance improvements in network as some papers show but that it is
hardly the case in practice (there are different OSs time resolution,
GPS takes time to converge and NTP precision can be ~10ms magnitude
depending on where are the servers. Having such a mechanism in ns3
could help reproducing these behaviors.

Regards
Matt
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "ns-3-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ns-3-users/Te55Tn5yqf4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ns-3-users+...@googlegroups.com.
> To post to this group, send email to ns-3-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ns-3-users.
> For more options, visit https://groups.google.com/d/optout.

Tommaso Pecorella

unread,
Sep 21, 2014, 2:37:59 AM9/21/14
to ns-3-...@googlegroups.com
Hi Matt, replies are in-line


On Sunday, September 21, 2014 12:46:21 AM UTC+2, Matt Anonyme wrote:
Hi tommaso,

Thanks for taking the time to do some pedagogy over the networking
concepts and not limit yourself to the technical aspect.

YW. Consider that usually I'm pedantic to clarify my own ideas to myself and because the thread may be relevant for other people even after quite a long time.
 
Ideally I would like to consider both cases (asymmetric routing &
asymmetric BW) but due to time/codebase constraints, I limit myself in
a first time to asymetric routing delays.

I have a few other questions:
-what is the best way to divide a Time ? Right now I do:
 Time t = MilliSeconds(40);
t = MilliSeconds(t.GetMilliSeconds()/4);

The Time class has some operators already defined:
  friend Time operator + (const Time & lhs, const Time & rhs);
 
friend Time operator - (const Time & lhs, const Time & rhs);
 
friend Time operator * (const Time & lhs, const int64_t & rhs);
 
friend Time operator * (const int64_t & lhs, const Time & rhs);
 
friend int64_t operator / (const Time & lhs, const Time & rhs);
 
friend Time operator / (const Time & lhs, const int64_t & rhs);
 
friend Time & operator += (Time & lhs, const Time & rhs);
 
friend Time & operator -= (Time & lhs, const Time & rhs);

As you see, they are mostly Time Vs unsigned int. If you want to divide your time by 2.5, you're in trouble.

By going through Milliseconds, you are at risk of rounding errors (the function returns an unsigned int). I'd rather use Seconds, it's a double and you're less at risk.
If precision is your concern, and you want to be ultra-secure, you can use lower resolutions, but you'll have to handle the rounding cases.

 
-is it possible to use a RandomPropagationDelayModel on a P2P device ?
I don't want to generate traffic to change the RTT but I still would
like to see some changes in my RTT (can be thought of as a hack).

It's a perfectly legit hack. But it will not work :P
The problem is that the channel is sending stuff, and it will not buffer them. Consider the case of two packets, one sent with a 3 Seconds delay and the successive one with 2 seconds delay. The second will arrive before the first.
Ideally the delay can change, but only when the channel is not busy, and this is quite an issue.
What you can use is a DelayBox, i.e., a "fake" node responsible for introducing delays and provide the required buffering.
There was a mdule being developer (a port of the ns2 DelayBox), but I'm not sure how far the authors went.
 
-I don't think there is the possibility to set a per-node clock.

You're right, it isn't.
 
Would
it be possible to upstream a patch that would allow to set a per node
clock. The motive is that clock synchronization should allow
performance improvements in network as some papers show but that it is
hardly the case in practice (there are different OSs time resolution,
GPS takes time to converge and NTP precision can be ~10ms magnitude
depending on where are the servers. Having such a mechanism in ns3
could help reproducing these behaviors.

It's an interesting idea, but it should be better analyzed.
The point often not well understood is that the "time" in a simulator is the time of the Scheduler.
How the various protocols in each node are using that info is the effect of various elements, and many protocols already include some randomization.
It could be interesting to have a Node::Now() function, taking the Simulator::Now() value and applying a skew/drift. However the use-case should be clearly documented, along with the pros and cons.

I guess that the node-time discussion is worth to be moved to ns-devs mailing list...

Cheers,

T.

pdbarnes

unread,
Oct 8, 2014, 7:59:37 PM10/8/14
to ns-3-...@googlegroups.com
Hello Matt,


On Saturday, September 20, 2014 3:46:21 PM UTC-7, Matt Anonyme wrote:
I have a few other questions:
-what is the best way to divide a Time ? Right now I do:
 Time t = MilliSeconds(40);
t = MilliSeconds(t.GetMilliSeconds()/4);

A better way to do this preserving full 64-bit precision is

t = Time (t.GetInteger () /4);

This can handle any numerical type for the divisor, including float/double.

Using t.GetSecond () as Tommaso suggests only gets you the 56 bits of a double :)

At some point I'll implement floating arithmetic operators for Time; just haven't gotten around to it.

Peter

Reply all
Reply to author
Forward
0 new messages