4. Mpong

The mpong commad can be used to get a very rough idea of the round-trip latency between two machines. However, be aware that this tool does not contain optimizations which could further decrease latencies; for example, it does not set CPU affinity or modify thread priority. It also does not contain logic to detect lost packets and retransmit them. Nor does it provide topic-based PUB/SUB model of usage.

However, the tool can still be useful in reproducing latency problems with a simple tool which can be provided in source form to support organizations for diagnosis. For example:

MACHINE 1: mpong 224.1.3.5 12000

MACHINE 2: mpong -iv -ompong.raw 224.1.3.5 12000
Machine 2, the initiator (-i) will start the test by sending a packet to Machine 1, the reflector, over group 224.1.3.5 port 12001. The packet will contain the sending timestamp. Machine 1 will receive it and send it back (reflect) over the same group but with port 12000. This is one round-trip cycle. The first 20 cycles are for "warm-up", followed by the measurement phase, consisting of 65536 (default) cycles. The initiator prints the results and exits. The reflector does not exit and must be killed.

Notice that both commands are provided port number 12000; the code takes care of incrementing it appropriately. The -v option forces verbose output, resulting in a large dataset being written to file plot.raw.

Warning: Since this tool's multicast traffic is UDP, it is possible to lose a packet during the test. This will result in a hang of the test since no timeouts are programmed. If several tries continue to result in loss, there is something seriously wrong with your multicast connectivity, and that needs to be diagnosed and resolved before meaningful latency measurements are possible. You should use the initial 5 tests to verify adequate connectivity before using mpong.

A quick and easy plot of the data can produced with gnuplot. Here is a simple unix shell script:

#!/bin/sh
# remove text lines (select lines starting with numerics)
grep "^[0-9]" mpong.raw >mpong.dat
gnuplot <<__EOF__
## IF TYPE eq ps   set terminal postscript landscape color
## IF TYPE eq eps  set terminal postscript eps color
set terminal jpeg
## IF TYPE eq png  set terminal png
## IF TYPE eq pbm  set terminal pbm
set output "mpong.jpg"
set xlabel "time (sec)" 
set ylabel "RTT (usec)" 
set multiplot
set autoscale
set data style lines
set border 3
set xtics border nomirror
set ytics border nomirror
set origin 0.0,0.0
set title "mpong results" 
set style line 10 lt 1 lw 1 pt 5 ps 0.65
plot 'mpong.dat' using 1:2 title 'mpong.dat' with linespoints linestyle 10
__EOF__
This should produce mpong.jpg

Copyright 2005 - 2011 Informatica, Inc.