TCP is the protocol that gets the most attention, and that makes some sense as it’s the one that carries your email and web pages, the two most popular applications on the net. There are times, though, when TCP is not appropriate, like when you want to multicast data to several machines at once.
Multicasting takes advantage of the fact that LANs, such as Ethernet, are broadcast media, in which all hosts can, if they choose, see all the packets as they go by.
In order to use multicast you have to use a datagram protocol, such as
UDP, for reasons that I will not get into in this posting.
One of the more important qualities to test for when building a multicast network is latency. Many people know about testing for bandwidth, i.e. how many bytes/bits per second can we shove down this pipe, but latency tests are rarer. Since such tests are rare I have written one which is now included in FreeBSD. It can be found in the
src/tools/tools/mctest directory of CURRENT (8.0). An example is shown below:
mctest -i em0 -s 1024 -n 100 -t 1
mctest -i em0 -s 1024 -n 100 -r
Send 100 packets of 1024 bytes, with an inter-packet gap of 1 nanosecond.
mctest program includes both the source and the sink code, and the
-r command line argument is what tells the program to be a sink (i.e. to receive packets).
The way that
mctest tests for latency is that the source sends out a multicast packet and then the sink(s) send the packet right back. The sinks report statistics like the size of the gap between packets, which shows network jitter, and if any packets were lost. The source reports if packets were lost as well as the round trip latency of the packets.
Results from the test look like this on the source:
Results from client #0
sec: 0 usecs: 73
sec: 0 usecs: 44
sec: 0 usecs: 48
sec: 0 usecs: 39
which shows partial results. The results for all clients are actually output. There is also a convenient shell script
mctest_run.sh which can be used to start sinks on multiple hosts. All of this is documented in the manual page as well.