infos on bing: mailing list
This document is a complement to the Readme file. The intent is to provide a more detailed analysis of the mathematics behind bing and the algorithms that are used.
This document may sometimes sound a bit authoritative but in its current state it really is not. This is an early version which is still quite incoplete and chances are that it contains errors so if you think you have found one send an email to me, fgouget@multimania.com, or to the bing mailing list.
Here is the plan as to what I will try to dewvelop next. Of course if someone contributes code on some other aspect it will be integrated even if I planned to work on it much later.
Bing makes a number of assumptions to compute a link's raw bandwidth. If any of these is broken then bing will return erroneous results. How much the results will be affected ? It depends on the link, the assumption that has been broken,...
where to find them, how do they compare
Consider a string of hosts and links h0 - l1 - h2 - l2 - ... - ln - hn
If the probablility that each host hi delays the transmission of a packet, what is the probability that the packet be delayed by the time in its round-trip ?
The probability for the packet not to be delayed by host hi is 1-pi, and the only way for the packet not to be delayed at all is that it is not delayed by any host. That is this probability is (1-p0)*(1-p1)*...*(1-pn). In all other cases the packet is delayed. Thus the probability Cn that the packet is not delayed at all is:
If that probability is the same for all intermediate hosts (or can be bounded between a min and a max) we get:
What this tells us is that the probability that the packet is not delayed decreases exponentially with the number of hosts. But note that this does not necessarily mean that we cannot measure far away links. You will probably be able to measure a modem link which is many hops away because the delays will probably be small compared to the rtt difference at the two ends of this modem link. But it does put a limit on our chances to get a good measurement of relatively fast and far away links.
aggregated pipes: shotgun modems ?, modem aggregation, aggregated fast-ethernet to a switch
determining half-duplex/full duplex
fixed bandwidth may be wrong for modems
fixed latency may be wrong for satellite links
This section describes how Bing computes the link characteristics such as the bandwidth. It first describes how we modelize the network (the phiysics), then the algorithms (the maths) and then gives a word of caution about how to interpret the results and why the assumptions we have made may be wrong.
Bing attempts to determine the characterics of the the links that connect TCP/IP hosts. That these links be point to point links or buses does not matter. What is important is that each network link forms a direct connection between the two (or more) hosts, i.e. the TCP/IP packets are not stored and forwarded at any point between the two hosts.
So for instance the in the figure below A-B is a network link but not A-C. This is because a hub does not store and forward IP packets, it starts retransmitting IP packets from the segment 1 to the segment 2 as soon as the first byte is received (in fact it operates at the physical level and does not even know what a byte is). So between A and B a TCP/IP packet is never stored and then forwarded. In contrast the router has to first receive the full TCP/IP packet from segment 2 before it can before it can retransmit it on the segment 3. So by the definition above A-C and B-C are not network links.
Ethernet Ethernet Ethernet Segment 1 Segment 2 Segment 3 A ----------- Hub -----+----- Router ----------- C | B
When we attempt to characterize a network link we will be at one end of it. We will then say that packets leaving our computer are going "up" while packets comming to our computer are going "down" (which keeps with the tradition of uploads and downloads). Each network link can then be split in two: an "uplink" and a "downlink".
Of course in some cases the uplink and downlink are in fact exactly the same link, this is the case in particular of ethernet over a coaxial cable. In other cases they may have the same characteristics, this is the case for instance of ethernet over an RJ45 conenction. But there are also a number of situations where the uplink and the downlink have different characteristics, examples are given in a later section.
Then we characterize each half of the link by the following properties:
It follows that the time t
it takes to send s bytes (in s we include all the protocal overhead) from one host on the link to the other is:
t = s / b + l
Determining the characteristics of such a network link is then equivalent to determining the values of b
and l
.
(!!)From there is is trivial to generalize the foNow generalizing the formula above from just one network link to a chain of n+1 hosts (h0..hn) connected via n
network linksthe round-trip-time will be of the form:
rtt = (1/bu,1+1/bu,2+...+1/bu,n+1/bd,n+1/bd,n-1+...+1/bd,1)*s+lu,1+lu,2+...+lu,n+ld,n+ld,n-1+...+ld,1
where bu,i and lu,i are respectively the bandwidth and the latency of the uplink connecting the host i-1 to the host i and bd,i and ld,i are respectively the bandwidth and the latency of the downlink connecting the host i to the host i-1.
Finally we can derive from expression (2) that the round-trip-time is an affine function of the packet size, that is, it is of the form:
rtt=a*s+b
where a
and b
are constants determined by the bandwidth and latency of the intervening network links.
Before we go on to see how we are going to measure the network link's bandwidth let's review the assumptions made by the network link modelisation.
We assume the bandwidth is constant in time. This is not always the case. For instance modems using protocols like V34 or V90 constantly monitor the line quality and adjust their bit rate accordingly. Comes a storm and the bandwidth falls ! The same may happen if your neighbor picks up the phone and the cross-over phenomenon starts perturbing your communication (when two cables are parallel and close to each over for some distance part of the signal on one cable can "cross-over" and appear as a weak perturbation on the over cable). This is the only case I know where the bandwidth is not necessarily constant in time. Even then the bandwidth is not very likely to change during the typical duration of a bing measurement.
We also assume that the bandwidth is independent from the nature of the data sent. Again, modems usually compress the data before sending it which then violates this assumption. The workaround is to send random data which is then incompressible. But this only a partial solution because we can only randomize the packet payload, not its TCP/IP header. So for small packets, where the ratio header size / payload size is high, the bandwidth will be slightly different than for big packets.
We assume that the bandwidth does not depend on the amount of packets sent. This is incorrect if the network link is an aggregate of multiple links. Take for instance a server with four fast ethernet network cards will all the same IP address. Such a server is usually connected to a fast ethernet switch which does load balancing of the traffic on the four server's network cards. In such a situation packets individually "travel" at 100Mbps but we can have four of them travelling at once which makes the aggregate bandwidth 400Mbps. Since the server has a single IP address we see this type of link as a single network link with a 400Mbps bandwidth.
As another example consider the case of a linux box configured as a gateway to the internet by aggregating the bandwidth of two or more modems. In this case too the resulting aggregate link is capable of sending more than one packet simultaneously which results in an aggregate bandwidth which is higher than the rate at which each packet is being transmitted. And in this case all links may not have the same speed. One may be a 19.2kpbs modem while the other may be a 56kbps modem resulting, in addition, in changes in the rate at which a packet is being sent depending on which modem it goes through. (!!) do the boxes have the same IP address on both modems in such a case ?
Finally we can contrast the cases above with that of "shotgun" modems.As far as I understand, these modems aggregate two phone lines together but do so at the bit level which means that a TCP/IP packet is being sent on both lines simultaneously. So in this case the assumption that the bandwidth does not depend on the number of packets is valid.
The assumption that the latency does not depend on time must be true in all but the most extreme cases. A non negligible component of the latency is the length of the network link. The data travels approximately at the speed of light so the longer the distance the higher the latency. One sample case where it may change over time is if the network link actually goes through a low orbit satellite. In such a case the distance sender-satellite-receiver may change a lot as the satellite orbits around the earth. But such network links are currently very rare.
First we must notice that we cannot measure the round-trip-time as defined above and even less the time it takes for a network packet to go from one host to another. In both cases we would need hardware network probe.
What we can do though is measure the time it elapsed between when our software called the method to send the packet and when our software received the packet on the other side. But even this is not practical since we would have to install our software on all the hosts.
So instead we measure the rtt.
It is quite likely that there will be devices and intermediaries between two hosts. Some are internal to the computer and others are network devices which are usually used to extend the reach of a network. All these intermediaries can be split into three categories.
This kind of device starts retransmitting a network frame as soon as a fixed amount of data has been received. One such kind of device are devices that don't even know what a frame is. Modems are one such kind of device. They only know about bytes and start retransmitting those bytes as soon as they have filled they transmit buffer. Another kind of device that follows this kind of rule is the network hub like ethernet repeaters. As soon as they have received the start of an ethernet frame they start retransmitting it on the other ports. Since this works both ways if a collision occurs the frame will be dropped the and the initiator will retransmit.
How does this kind of device affect the bing measures?
Let's call d the number of bytes the device must receive before it starts retransmitting the frame on the other side of the link. The device will have to wait until it has received d bytes before it can start retransmitting data. Then the time it takes to retransmit the data is overlapped with the time it takes to receive it. So the one-way trip time is:
So such a device is not going to affect our measure of the bandwidth. The only thing we will notice is a slightly increased link latency.
This kind of device bridges two links of different bandwidths. We further assume that it is bridging a slow link to a faster link. The reverse case is in fact equivalent to the previous type of device. What this device does is that it first waits until it has bufferized enough data to start transmitting to the faster link without running out. Should the frame on the slow link turnout to be invalid, due to a collision or a link failure, it would reproduce a similar condition on the other link so that the data is ignored anyway.
How does this kind of device affect the bing measures?
Let's call respectively bs and bf the bandwidth of the slow and fast links. The device can start retransmitting data only once the time it takes to transmit all the data on the fast link plus some buffer delay of d bytes is the same as the time it takes to receive the remainder of the data from the slow link.
So the total transmission time will be the same as the time it takes to receive all of the data at the slow link speed plus the time to build the buffer and the time to retransmit it on the fast link.
So we essentially have the same result as in the previous case except that the latency is slightly lower.
This kind of device, by far the most common, waits until it has received all the data from the first link and then retransmits it on the other link. This is what any router and probably most switches do. But this is also how your network card works. It waits until it has received all the data via the PCI/ISA bus and then retransmits it on the second link, the ethernet or fast ethernet link.
How does this kind of device affect the bing measures?
Let's call b1 and b2 the bandwidth of the two links. The device will also introduce some delay but this time it is better described in terms of time rather than in terms of bytes, so let's call it l. There is absolutely no overlap between the receive phase and the transmit phase so the one-way trip time is:
This means that the bandwidth measured by bing is going to be:
In other words, bing is going to measure the geometric mean of the links bandwidths.
Some examples:
Are these results significant?
It depends on the combined ability of the hardware and your application to overlap
data transfers.
In the first example it is very unlikely that the network card will let you tranfer a
packet to its buffer while it is sending the content of another buffer to the network.
This means the hardware prevents you from overlapping transfers from memory to the card
and from the card to the network. This means you will not be able to send data faster than
what big tells you.
In the example involving the network switch you can in fact transfer data on the first
network segment while the previous packet is being transfered on the second segment. But
this depends on your application. An RPC based client/server application that has to wait
until it gets the result of an RPC before it can do more work and issue the next one will
be limited by the presence of the switch because the switch doubles the latency. Not only
is the 'b' factor of the linear regression probably the double of what it would be with a
direct connection but the bandwidth as measured by bing too is just half of what it would
be without the switch. So the performance of RPC based applications should closely match
the results of bing.
On the other hand the performance of applications like ftp will not be accurately predicted
by bing's results because they can overlap multiple data transfers. Modern fast ethernet
PCI cards are very likely able to transfer data to or from memory while sending or receiving
data to or from the network. So in the switch example above we could have up to four
packets in flight at any time. In such cases the bandwidth is limited by the slowest link,
the fast ethernet link, ad the ability of the networking protocol implementation to
efficiently use it (and that is not a given).
Other bandwidth measuring related links:
Ping tools:
You can find a more complete and very good taxonomy of network measurement tools at the following URL: http://www.caida.org/Tools/taxonomy.html.
Libpcap is a library which provides a system-independent interface for packet capture.
ftp://ee.lbl.gov/libpcap-0.4.tar.Z
Found this in the Wine list (by gerard patel