Sam’s Network Simulation Cradle Blog

27 Jan 2006

Last day in WAND in University

Filed under: Network Simulation Cradle — sammydre @ 3:15 pm

I’m out of the country on Sunday, on my way to the sunny United Kingdom to stay.

So I have cleaned my desk up this week, just got a few things to take home with me tonight as I leave.

Today I hacked up my massif replacement a bit more. Got it to output useful stuff every second, then wrote a python script to parse the very verbose output and create a .csv file. I imported that into openoffice and made a graph: check it out.

sam2.jpg

Isn’t it very massif-like? Legend not the best you say? Well, boo hoo. I think it’s pretty snazzy myself.

26 Jan 2006

More performance stuff

Filed under: Network Simulation Cradle — sammydre @ 11:30 pm

I’ve hacked away more and more on SSS, and finally come away with a little prog that is like a massif replacement, but much quicker. And doesn’t make a graph. But the backend functionality is basically, there, it measures things as it should.

I had to set the environment variable MALLOC_CHECK_ to something to make SSS or anything like that work. Otherwise things just break horribly. No idea why. The default malloc/free implementation in libc must be doing some sort of magic thatI am breaking, but I don’t see how. I was just doing nothing and calling the original malloc/free routine and it would make apps segfault! Anyway, it all works now. My hacked up SSS seems to work a charm. Yay.

Just running it with the same scenario as measured in the last post now. This will take at least 45 minutes, but will give some idea of the overheads introduced by my prog. Is it on the scale of massif or not… I don’t think so, but I’m just checking!

Update: Yep, it ran in 48 minutes, compared to 45 minutes. Seems fine!

Performance stuff

Filed under: Network Simulation Cradle — sammydre @ 10:31 am

So I used the performance script I wrote at some point on the laptop with a simulation I know normally takes some time. It has roughly 150 flows in it, many of which are Linux 2.6 ones. It takes about 45 minutes to run, the output of timing it 10 times is as follows:

usr     sys   real

2817.96 38.81 3065.35
2709.93 18.03 2788.06
2751.56 14.75 2820.44
2768.43 9.52 2818.47
2755.66 14.32 2827.81
2777.69 14.76 2848.27
2735.63 6.52 2773.58
2714.32 12.34 2780.31
2698.15 9.24 2754.04
2738.63 9.23 2792.17

Which is roughly 45 minutes. The memory output is like so:

vmsize rss  data  lib

78712 60796 27828 27372
78720 60804 27828 27372
78720 60800 27828 27372
78716 60800 27828 27372
78720 60800 27828 27372
78720 60804 27828 27372
78716 60800 27828 27372
78716 60800 27828 27372
78716 60800 27828 27372
78712 60796 27828 27372

Then I ran it with valgrind --tool=massif. I came back the next day, it has used almost 10 hours of CPU time and still had not finished. I’m not sure why massif is so slow, but it looks like it is going to be unacceptable for large simulations. It still gave me a graph, but I have no idea how far through the simulation was. Really need statistics for the whole run.

So I thought to myself, “I’ll write my own, simplified, massif, with an LD_PRELOAD“. I have written a memory debugger before, so it can’t be too bad. I searched out the code for SSS, and tried it with ns-2. No-go. Problem with realloc. So I made a realloc implementation in SSS, and tried that. Floating point exception in libc when freeing memory. Huh. Not sure what is up there!

24 Jan 2006

simd stuff

Filed under: Network Simulation Cradle — sammydre @ 11:10 pm

I spent some time on simd, fixed up daemonising, wrote a small amount of documentation, removed some old redundant code, fixed a bug or two.

Released it on my software page.

23 Jan 2006

Analysing emulation network traffic wasn’t going so well, so…

Filed under: Network Simulation Cradle — sammydre @ 8:23 am

So I’ve decided to build up a good body of categorised trace data. So the idea today is to run a lot of emulations and have a big set of trace data at the end of it. I can then analyse it at my leisure and perform simulations and such. All without the need of the emulation network.

Hopefully this can be finished today with time to spare. We’ll see.

19 Jan 2006

Hmm…

Filed under: Network Simulation Cradle — sammydre @ 2:04 pm

As far as I can tell, I never initialised ticks on FreeBSD to 1 (or non-zero, anyway, which is the important bit). I think I’ve done so, or similar, for the other stacks I have. 0 is often a special value, for tcp timestamps, it can be interpreted different and so on. Fixing this now.

Emulation/simulation comparisons of FreeBSD are not as good as I’d like them to be really. I’ve ressurrected my old program MDAV, which is pretty ugly and the code isn’t the nicest ever, but it is handy when comparing emulation and simulation traces. It requires tcpnorm to be useful, which once I updated, seemed to work fine.

18 Jan 2006

Further differences

Filed under: Network Simulation Cradle — sammydre @ 11:42 am

I noted that the HZ value used in simulation and emulation did not match. FreeBSD defaults to HZ=100 (at least for 5.3), and I wanted to use this default for endhosts. So I made an image with a kernel compiled for that HZ value.

When I have the bandwidth window enabled (the default), there are differences between simulation and emulation (the previous test had this disabled, and things were very close). At first I thought this was because of the different value of HZ, resulting in different timer granularities.

That does not seem to be the problem. There is a useful sysctl net.inet.tcp.inflight.debug, which I set to 5. It outputs information like the following (from emulation):

0xc15c6a98 bw 1 rttbest 200 srtt 160 bwnd 2896
0xc15c6a98 bw 25527 rttbest 185 srtt 183 bwnd 4363
0xc15c6a98 bw 46600 rttbest 185 srtt 225 bwnd 5881
0xc15c6a98 bw 82067 rttbest 185 srtt 222 bwnd 8102
0xc15c6a98 bw 120928 rttbest 185 srtt 209 bwnd 10340
0xc15c6a98 bw 108998 rttbest 185 srtt 230 bwnd 9946
0xc15c6a98 bw 129268 rttbest 185 srtt 239 bwnd 11460
0xc15c6a98 bw 113034 rttbest 185 srtt 275 bwnd 11020
0xc15c6a98 bw 111531 rttbest 185 srtt 262 bwnd 10668
0xc15c6a98 bw 104050 rttbest 185 srtt 258 bwnd 10081
0xc15c6a98 bw 112422 rttbest 185 srtt 242 bwnd 10379
0xc15c6a98 bw 102807 rttbest 185 srtt 257 bwnd 9996
0xc15c6a98 bw 111089 rttbest 185 srtt 251 bwnd 10463
0xc15c6a98 bw 111494 rttbest 185 srtt 220 bwnd 9934

And from simulation:

0x868285c bw 12783 rttbest 179 srtt 184 bwnd 3619
0x868285c bw 51060 rttbest 179 srtt 218 bwnd 6055
0x868285c bw 80704 rttbest 179 srtt 219 bwnd 7914
0x868285c bw 122507 rttbest 179 srtt 187 bwnd 9901
0x868285c bw 155768 rttbest 179 srtt 186 bwnd 11755
0x868285c bw 204162 rttbest 179 srtt 177 bwnd 14252
0x868285c bw 231483 rttbest 179 srtt 197 bwnd 16495
0x868285c bw 199080 rttbest 179 srtt 183 bwnd 14156
0x868285c bw 209239 rttbest 179 srtt 197 bwnd 15188
0x868285c bw 275490 rttbest 179 srtt 185 bwnd 18564
0x868285c bw 214277 rttbest 179 srtt 206 bwnd 15752
0x868285c bw 191283 rttbest 179 srtt 181 bwnd 13655
0x868285c bw 209415 rttbest 179 srtt 184 bwnd 14741
0x868285c bw 231281 rttbest 179 srtt 195 bwnd 16411

Let us concentrate on the first variable, bw, first. This is the simplest to analyse. The code to figure this out is below:

save_ticks = ticks;
if ((u_int)(save_ticks - tp->t_bw_rtttime) < 1)
return;

bw = (int64_t)(ack_seq - tp->t_bw_rtseq) * hz /
(save_ticks - tp->t_bw_rtttime);
tp->t_bw_rtttime = save_ticks;
tp->t_bw_rtseq = ack_seq;
if (tp->t_bw_rtttime == 0 || (int)bw < 0)
return;
bw = ((int64_t)tp->snd_bandwidth * 15 + bw) >> 4;
tp->snd_bandwidth = bw;

Basically, we first set bw to (amount of data received / time) then merge it with tp->snd_bandwidth, making it into a long term average. So if you are receiving more quickly, the bw will go up to reflect this and tp->snd_bandwidth will move slowly upwards. It’s just a bandwidth estimator. Pretty simple stuff.

Unfortunately printing the debug info out (since I was connected via serial console!) slows emulation down and biases the result heavily. We can see that emulation has lower numbers that simulation, which matches up when the debug output is enabled. Normally emulation goes faster than simulation.

RTTs are a bit lower in simulation, due to ideal conditions I guess. I’m not sure, there is still something different in the simulation and emulation test. More analysis required.

17 Jan 2006

FreeBSD looking good

Filed under: Network Simulation Cradle — sammydre @ 3:11 pm

After updating FreeBSD, simulation and emulation tcptrace graphs look very similar for some time. Not perfect, but very very good.

Emulation network measurements

Filed under: Network Simulation Cradle — sammydre @ 2:04 pm

Comparing emulation and simulation, in the case where the buffer is overshot.

First of all: applications make a difference. tcpperf vs. iperf – both write data as quickly as they can, but the traces they produce are somewhat different. Simulation is setup to work like tcpperf.

Seconf of all: the reason I was finding it hard to make FreeBSD overshoot the router buffer is that it has a “bandwidth” window. This means TCP sending data is limited by the send window, receive window, congestion window AND this additional window, which uses a Vegas-like algorithm. It is likely other stacks have similar mechanisms. See tcp_xmit_bandwidth_limit in the FreeBSD source code. I think I’ve encountered this before. Setting the sysctl net.inet.tcp.inflight.enable=0 disables this, and makes TCP look a bit more like traditional exponential increase – overflow buffer – handle loss – etc. The bandwidth window aims to not get any loss but utilise the link as much as possible.

Third of all: the reason FreeBSD in simulation and emulation had slight differences is because the simulation version is a slightly newer version including various fixes to TCP SACK. I’m now building a new kernel for the emulation machines that will hopefully put them in like with simulation. Would ideally update both to the latest FreeBSD 5.4 (even 6.0!), but I am not willing to invest the time at the moment.

I also used Emacs for debugging. It even worked.

16 Jan 2006

Running emulations

Filed under: Network Simulation Cradle — sammydre @ 6:12 pm

Ran a few simulations to figure out some parameters I would like to actually measure on the emulation network.

Then used my current Python emulation network stuff to quickly setup the router, then I set it about running the tests. Hopefully that will work and I’ll have some results to compare to simulation soon.

uma_zalloc_arg and memleaks

Filed under: Network Simulation Cradle — sammydre @ 5:28 pm

I fixed the memory leak I was having in my FreeBSD code. After some intense debugging with gdb, valgrind (memcheck and massif) and a little python scripting and debug output, I tracked it all down. After looking at the original code (using grep mainly) I found the solution was trivial enough.

I had forgotten to add the fini and dtor callbacks to uma_zfree_arg. This seems to fix everything.

Emulation network: OpenBSD sorted, Python

Filed under: Network Simulation Cradle — sammydre @ 12:34 pm

Sorted out my OpenBSD problems. The execDaemon wasn’t quite coded right. We needed a fcntl(currSock, F_SETFD, FD_CLOEXEC); before the popen() so that the connection would terminate properly. Once that was fixed openbsd configuration worked a charm.

Continued writing bash scripts to control emulation network machines then gave up and re-wrote in Python. Now seems to work nicely, starting to get together a decent interface to control the machines and easily run tests. Just now got it to a point where it run without a hitch and measured a simple test properly. I’m probably now at a point where writing further tests is trivial and running them will “just work”.

13 Jan 2006

OpenBSD config stuff

Filed under: Network Simulation Cradle — sammydre @ 9:37 am

My eventual /etc/rc.conf for the openbsd machine:

Bash:
  1. # Turn firewalling off. This would disable all incoming traffic without
  2. # firewalling rules if it were turned on!
  3. pf="NO"
  4.  
  5. # Disable startup programs we dont want
  6. routed_flags="NO"
  7. httpd_flags="NO"
  8. apmd_flags="NO"
  9. sendmail_flags="NO"
  10. dhcpd_flags="NO"
  11. ftpd_flags="NO"
  12. spamd_flags="NO"
  13. named_flags="NO"
  14. rdate_flags="NO"
  15. timed_flags="NO"
  16. mrouted_flags="NO"
  17. rbootd_flags="NO"
  18. rtsold_flags="NO"
  19. xdm_flags="NO"
  20. wsmoused_flags="NO"
  21. identd_flags="NO"
  22.  
  23. # Add the server we which to connect to to get the time: ntpdate will ask for
  24. # the time from relic, which runs an ntpd server.
  25. ntpdate_flags="192.168.2.1"
  26.  
  27. # Disable multicast. Could be set up if someone wants it, this at least stops
  28. # /etc/netstart from complaining.
  29. multicast_host="NO"
  30. multicast_router="NO"
  31.  
  32. # Shut rc up, it complains if some of these aren‘t set?
  33. afs="NO"
  34. afs_mount_point="/"
  35. afs_device="/"
  36. amd="NO"
  37. amd_master="/"

Seems to work ok. We are only on OpenBSD 3.5 still, which is a bit dated now. Should really be using 3.8, but oh well.


Running /etc/netstart from the execDaemon config stuff seemed to create some bad interactions happening. My current solution is to have execDaemon run this file instead:

Bash:
  1. #!/bin/sh
  2.  
  3. # Wait a second. This allows the execDaemon to finish up and close its
  4. # connection.
  5. # Run netstart in the background with its output logged
  6. (sleep 1; sh /etc/netstart > /var/log/netstart.log 2>&1) &
  7.  
  8. # Exit right away
  9. exit 0

This needs to be integrated into the actual system to test it. Waiting on Brendon so we can compile his version of ns-2 for this.

12 Jan 2006

OpenBSD work

Filed under: Network Simulation Cradle — sammydre @ 5:00 pm

Spent some time working on getting OpenBSD configuration working on the emulation network.

There was some strange stuff going on.

During this process I disabled a lot of the daemons that were starting up that we didn’t want, ie. httpd, ftpd, sendmail, dhcpd, named, routed.

Hopefully made some progress and the config system and the image will be updated again and it will work. Hopefully. We’ll see.

9 Jan 2006

Back to work: Monday

Filed under: Network Simulation Cradle — sammydre @ 5:33 pm

Today I have:

  • Sent email asking about PhD progress meeting time

  • Started the quote process for a flight to the UK

  • Checked the SP&E journal

  • Added WNS-2 milestone into basecamp

  • Fixed libopenbsd3.so voodoo undefined reference problem (fixed the SConscript file)

  • Upgraded this blog to wordpress 2.

  • Got Jamie onto posters, maybe my poster will be on the wall oneday.

  • Found execDaemon bug. Buffer overflow. Fixed with Brendon. Made new images. FreeBSD had an imagezip problem. Recompile fixed.

  • Found another execDaemon bug which was much more subtle. Eventually fixed by re-writing some horrid code. Seems to work OK now. New images need to be made with this bugfixed version. That is a mission for tomorrow when Brendon gets in.

  • Worked on setting up emulation network tests again. Made a simple script that is now waiting on working emulation network machines.

Emulation network experiments

Filed under: Network Simulation Cradle — sammydre @ 12:17 pm

Rules on FreeBSD router for current experiments.

ipfw add 100 pipe 1 ip from { 10.0.12.0/24 or 10.0.11.0/24 } to { 10.0.13.0/24 or 10.0.14.0/24 } out
ipfw add 200 pipe 2 ip from { 10.0.13.0/24 or 10.0.14.0/24 } to { 10.0.12.0/24 or 10.0.11.0/24 } out
ipfw show
ipfw pipe 1 config bw 1500Kbit/sec delay 50ms queue 10
ipfw pipe 2 config bw 1500Kbit/sec delay 50ms queue 10

SP and E revisted

Filed under: Network Simulation Cradle — sammydre @ 9:02 am

Looks good. “Software – Practice and Experience is an internationally respected and rigorously refereed vehicle for the dissemination and discussion of practical experience with new and established software for both systems and applications.”

Seems to be roughly monthly. Should look into writing something for this.

Powered by WordPress