This version is the base version of the OCaml simulation. This explains some of the parts of the code. I anticipated exploiting some OCaml features but I have not yet. This could well be written in C. The code simulates sending 29 packets each of 216 bytes thru of a sequence of 20 nodes. There is a 10Gb/s link following each node. Buffering for the circuit is limited to 1 buffer. Here is the output. Note that a 0 latency 10Gb/s link can move a 216 byte packet in 52 μs. The network with single buffer nodes moves the data at half that rate. The last packet arrives at 0.004 sec.

If we change “bw = 1e10” to “bw = if j=10 then 1e6 else 1e10” then link 10 has a 1Mb/s bandwidth making a severe bottleneck. We get this where we are done at 15.2 sec. The transit times of a packet account for the rate at which the net accepts new packets until the first packet reaches the bottleneck whereafter the input rate is throttled.

Before the bottleneck is reached packets enter the net at about half the bandwidth of the links. Setting the packet buffer quota in each node to 2 results in nearly the full link bandwidth. (Go back to original and change “quota = 1” to “quota = 2”.) We get this and almost twice the thru put. We are done at 0.0025 sec. Each node is able to invite packet j+1 even while it holds packet j until it is acknowledged by the downstream node.

Now we introduce a 1000 km link after node 10 with a 5 ms latency by changing
delay = 0.” to “delay = if j=10 then 0.005 else 0.”. Quota per node is 1 again. Also the snapshot time was changed from “0.0005” to “0.0003”. We finish at 0.289 sec.

We further change this by allowing 2 packet buffers on either side of the long link by changing
quota = 1” to “quota = if j=10 or j=11 then 2 else 1”. This results and we finish at 0.090 sec. At this point our program compares with the original thus:

< let sch = let times = [| 0.; 0.0005; 0.04; 1.; 10.5; 1e6 |] and j=ref 0 in
> let sch = let times = [| 0.; 0.0003; 0.04; 1.; 10.5; 1e6 |] and j=ref 0 in
<            delay = 0.;
<            quota = 1;
>            delay = if j=10 then 0.005 else 0.;
>            quota = if j=10 or j=11 then 2 else 1;
Renting three buffers at either end of the long link gets you done by 0.107 sec and four buffers gets 0.077 sec. There are about 96 packets in the 1000 km link.

We should note at this point that renting more buffers on either side of the long link saves packet rental as we rent the other buffers for a shorter time in order to transmit our 29*216 (≃ 2 MB) file. I won’t try to minimize the cost here but we should note that this supports the simple idea that a long link should allocate buffers at either end whose size is the number of bits in the link, at least if we do any sort of backwards error control on the links. The current simulation privatizes these buffers but the principle is the same.