I created a basic TCP server that reads incoming binary data in protocol buffer format, and writes a binary msg as response. I would like to benchmark the the roundtrip time.
I tried iperf, but could not make it send the same input file multiple times. Is there another benchmark tool than can send a binary input file repeatedly?
If you have access to a linux or unix machine1, you should use tcptrace. All you need to do is loop through your binary traffic test while capturing with wireshark or tcpdump file.
After you have that
.pcap
file2, analyze withtcptrace -xtraffic <pcap_filename>
3. This will generate two text files, and the average RTT stats for all connections in that pcap are shown at the bottom of the one calledtraffic_stats.dat
.The
.pcap
file used in this example was a capture I generated when I looped through anexpect
script that pulled data from one of my servers. This was how I generated the loop...You can adjust the sleep time between loops based on your server's
accept()
performance and the duration of your tests.END NOTES:
tcptrace
is capable of very detailed per-socket stats if you use other options...As a very simple highlevel tool netcat comes to mind ... so something like
time (nc hostname 1234 < input.binary | head -c 100)
assuming the response is 100 bytes long.You will need to measure the time in the client application for a roundtrip time, or monitor the network traffic going from, and coming to, the client to get the complete time interval. Measuring the time at the server will exclude any kernel level delays in the server and all the network transmission times.
You can always stick a shell loop around a program like iperf. Also, assuming iperf can read from a file (thus stdin) or programs like ttcp, could allow a shell loop catting a file N times into iperf/ttcp.
If you want a program which sends a file, waits for your binary response, and then sends another copy of the file, you probably are going to need to code that yourself.
Note that TCP performance will go down as the load goes up. If you're going to test under heavy load, you need professional tools that can scale to thousands (or even millions in some cases) of new connection/second or concurrent established TCP connections.
I wrote an article about this on my blog (feel free to remove if this is considered advertisement, but I think it's relevant to this thread): http://synsynack.wordpress.com/2012/04/09/realistic-latency-measurement-in-the-application-layers