			Bing 1.0.5

1. What is bing ?

Bing is a point-to-point bandwidth measurement tool (hence the
'b'), based on ping.

Bing determines the real (raw, as opposed to available or average)
throughput on a link by measuring ICMP echo requests roundtrip times
for different packet sizes for each end of the link.

Suppose we are on host A and want to know the throughput between
L1 and L2, two extremities of a point-to-point link.

	A ----( the Internet )--- L1 --- L2

If we know the rtt (roundtrip time) between A and L1, and the rtt
between A and L2, we can deduce the rtt between L1 and L2.

If we do that for two different packet sizes, we can compute the
raw capacity (bps) of the link.

Note that bing can also be used to have an idea of ethernet cards
performance.

Many thanks to the following people for their help, hints, support,
and real beers :

	Marc Baudoin		<babafou@babafou.eu.org>
	François Berjon
	Julien Boissinot	<jb@spia.freenix.org>
	Stéphane Bortzmeyer	<bortzmeyer@pasteur.fr>
	Jacques Caron		<jcaron@pressimage.net>
	Laurent Chemla		<laurent@brainstorm.fr>
	René Cougnenc
	Nat Makarevitch		<nat@nataa.frmug.org>
	Jean-Philippe Nicaise	<nicky@fdn.fr>
	Christian Perrier	<perrier@onera.fr>
	Bertrand Petit		<elrond@phoe.frmug.org>
	Philippe Regnauld	<regnauld@ftf.net>
	Ollivier Robert		<roberto@keltia.freenix.org>
	Justin Seger		<jseger@freebsd.org>
	Hervé Schauer		<herve@hsc.fr>
	Christophe Wolfhugel	<wolf@oleane.net>

Send virtual beers, bug reports, enhancements and flames to :

	Pierre Beyssac		<pb@fasterix.freenix.org>

2. Infos on bing

You can subscribe to the "bing-users" mailing list by sending a
mail containing :

	subscribe bing-users

to <majordomo@freenix.org>.

The posting address is <bing-users@freenix.org>

New releases can be found on http://www.freenix.org/reseau/outils.html

3. Installing bing

The provided source should compile and run out of the box on :

	FreeBSD 1.1.5.1
	FreeBSD 2.0.5
	Linux
	NetBSD 1.0
	SunOS 4.1.3
	AIX
	HP-UX 9
	Solaris 2
	BSDI 1.0
	Ultrix (DECstation)

On Solaris 2, you should only need to uncomment the CLIBS line
in the Makefile.

Then (on all systems) :
	$ make
	$ su root
	# make install

bing, like ping, needs to be installed setuid root to be able to
make its own ICMP packets.

Note that, to format the man page (bing.8), you'll need the 'mandoc'
macros package. If you don't have it, a preformatted cat page
(bing.0) and postscript page (bing.ps) are provided.

4. How to use bing

	1) using 'traceroute', find the IP adresses of the endpoints
	   of the link you want to measure.

	2) try :

		bing -v point1 point2

	   where 'point1' is the nearest endpoint.
	   Option '-v' is useful to be warned of any routing problems.

	3) wait a little for the measure to stabilize.

	4) if after a while, the measurement looks weird (typically,
	   negative or amazing throughputs) have a look at the indicated
	   roundtrip times. If they are too small (below a few milliseconds),
	   try to rerun bing with a bigger packet size :

		bing -S 1000 -v point1 point2

	   CAUTION : do not increase packet size too much, because this
		     could trigger IP fragmentation/reassembly on
		     the link to measure *or* on intermediate links,
		     which messes up the measures completely.

		     If you stay below 1400 bytes, you should be safe
		     (except on SLIP links where you should not go over
		     1000). This depends on the MTU (maximum transmit unit)
		     of the link.

	5) if, after increasing packet size, you still can't get stable
	   results, try to use the -z option. This option fills packets
	   will random data, defeating compressed links.

	6) if you still can't get anything reasonnable, the link you're
	   trying to measure is probably a high-throughput link too far
	   away (network- and throughput-wise) from you, or some weird
	   animal (IP over X25, Frame Relay, ATM, satellite...).

	   You can try to run bing from a better connected machine
	   (with respect to the target link). If you can't, you
	   can always try to think of a way (I'm sure there are)
	   of improving bing to make it work anyway :-).

	   Probably the best solution is to find something else to
	   do (I leave it to your choice entirely, suggestions are :
	   go for a walk, eat, drink, be elected).

5. Measurement problems

There are many cases in which the measurements may not be accurate
(read:  "plain wrong") :

	- links attained through a link of much lower throughput
	  (typically, don't expect to measure a 34Mbps backbone
	  link through your V32bis dialup account). You can
	  expect to measure links about 15 to 30 times faster than
	  the slower link in your path to them, i.e. up to 512kbps
	  through a V32bis modem, up to 2Mbps through a 64kbps
	  link, and so on.

	- saturated links. bing works by measuring the minimal rtts.
	  The more saturated links there are in the measure path,
	  the more time it takes to get a packet through all of
	  them with minimal delay.

	- IP/X25 connections. Due to encapsulation in small packets,
	  it is very difficult to know the "raw" bit capacity
	  because the overhead by IP packet is not fixed and varies
	  with the packet size. However, a clever bing could be
	  able to find out about the encapsulating size by slowly
	  increasing the strobe packet size and detecting steps in
	  the rtt increase.  Maybe one day ;-)

	- more generally, what you might call "hidden multi-hop" links can
	  give strange results. This includes IP over X25, Frame Relay,
	  as well as probably any IP encapsulation over a switched
	  packet network.

	- padding. On many links, the smallest packet size is bigger than
	  the smallest possible IP packet size and padding occurs. For
	  example it happens on ethernet. It tends to give optimistic
	  results.

	- non symmetrical routing : 

		     -----------------<---
		     |			 |
		     |			( somewhere )
		     |			 ^
		     |			 |
	A ---( the Internet )--> L1 ---> L2

	  If the routings are set in such a way that the ICMP echo
	  replies from L2 don't cross the L1-L2 link, bing can't
	  reliably compute the link capacity.

	  It generally happens, at least in France, on links crossing
	  ASs (autonomous systems) between different providers.
	  Sadly, these links happen to be the most interesting to
	  measure, to be able to check providers claims regarding
	  their connection with the rest of the world...

	  I don't think there's an easy way around (this is the
	  same problem as traceroute not being able to report
	  network return paths).

I have been objected that high-bandwidth links with dedicated
routers might be impossible to measure, due to the way these devices
work.

Fast routers are designed in such a way that, when receiving a
packet, they decode the header as soon as possible, even before
the packet is completely received. They can thus decide on an
outgoing route for the packet and might even (I'm not sure about
that) begin resending it before receiving it completely.

This should not directly interfere with ICMP ECHO_REQUEST packets
because these packets must be locally processed and this is generally
done entirely by software at a lower priority when the packet has
been completely received.

Moreover, since bing only considers minimal round-trip times in
its throughput calculations, you only have to expect that some ICMP
ECHO_REQUESTs will be processed by the router as soon as they are
received, which should happen often enough if the router is not
saturated.

5. Packet loss evaluation

Knowing the packet losses on A-L1 and on A-L2, it should be possible
to compute the loss between L1 and L2 :

	A --- L1 --- L2
	   a      b

	A-L1 packet loss = a
	A-L2 packet loss = ab
	L1-L2 packet loss = ab / a

Bing attempts to calculate it, but the results are generally not significant.

6. Ethernet devices measurement

This might sound surprising, since ethernet throughput is known to
be 10Mbps !

By running bing between two machines on an ethernet, you can evaluate
the CPU overhead induced by memory copies and polled I/O.

For example, between two Sparc 2 running SunOS 4.1.3, I generally
get around 9Mbps. Between two PCs running FreeBSD with NE2000
clones, expect around 4 or 5Mbps (or a little more depending on
processor speed). Between two PCs with 3C509 cards, I get about
7Mbps.

7. Possible NTP influence

Though I never got any evidence of it, it is possible that running
bing on a NTP-synchronized machine introduces a bias in the
measurements, when the NTP daemon makes a small correction while
bing is waiting for an echo reply packet (almost all the time).

I suppose this should mainly have an effect when measuring fast
and far away links, which are difficult or impossible to measure
anyway.

8. Possible enhancements

It should be possible to measure mono-directional throughput by
varying the packet size only for one of the packets, the sent packet or
the received packet.

For example, sending variable-sized ICMP ECHO_REPLY packets with a small TTL
should elicit fixed-size "ttl exceeded" replies.

Another interesting extension would be a mechanism trying to
determine the optimal big packet size in such a way that the
measurement is accurate enough yet fast.

$Id: README,v 1.6.2.2 2001/01/19 18:44:37 pb Exp $
