TTCP recommendations for large-delay, large-bandwidth networks ------------------------------------------------------------------------------- This recommendation identifies one "bug" and one implementation recommendation regarding the ttcp in large-delay, large-bandwidth networks, also known as long fat networks (LFN). Wrap-Around Bug ----------------------- The identified "bug" only occurs for transfers greater that 2^32 bytes (4,294,967,296 bytes). At this point, the variable, nbytes, must be classified as a 64 bit integer or there will be an integer wrap-around problem and ttcp will report an incorrect throughput. Most users of ttcp will never see this problem. However, for those experimenting with wide area network with links at 622 Mbits/sec or greater, the problem may surface. Bug fix for integer wrap-around problem: Original code: unsigned long nbytes; Fix: unsigned long long nbytes; Implementation Recommendation ----------------------------------------- The implementation recommendation concerns the reporting of ttcp throughput measurement. Currently, most, if not all, versions of ttcp report throughput in kilobits, kilobytes, megabits or megabytes per second in which kilo is defined as 1024 instead of 1000 and mega is defined as 1000*1024 instead of 1,000,000 or 1024*1024. This causes a 2.4% mismatch between actual throughput readings on telecommunication instrumentation such as ATM test equipment and the measurements reported via ttcp. Table 1 illustrates this example. A Hewlett Packard ATM tester was used to capture ATM PDUs (protocol data units) as was tcpdump and ttcp. All methods provided roughly the same calculated throughput in megabits per second - here a megabit is defined as 1,000,000 bits. However, ttcp reported a throughput of 125 megabits per second. The difference is 2.4 percent and is a result of the use of 1000 * 1024 instead of 1,000,000 when defining a megabit. TABLE 1 ******************************************************************************* Data Data Sent Calc Report Correct Time per PDU in Time Tput Tput Tput Tput #PDU's (Sec) (bytes) (MB/s) (MB/s) (Mb/s) (Mb/s) (Mb/s) HP BSTS 639 0.3640385 9140 5840460 16.0435 128.3482 TCPDUMP 639 0.3641900 9140 5840460 16.0368 128.2948 TTCP 640 0.3655740 9140 5849600 16.0011 128.0091 125 128 ******************************************************************************* The following source code excerpt is typical of ttcp and was from nttcp available at ftp://ftp.arl.mil/pub/ttcp/nttcp.c. Note that KB (kilobytes) is defined as 1024 bytes not 1000 bytes and Mb (megabits) is defined as 1000 kilobytes where kilobytes is defined as 1024 bytes. In order to have ttcp results match those of telecommunication instrumentation equipment, the following changes should be made: 1024 should be changed to 1000 for the KB/sec and KB/cpu calculations and the 128000 should be changed to 125000 for the Mb/sec calculation. Otherwise, an adjustment of 128/125 should be multiplied to the ttcp reported throughput measurement in order for them to match actual measurement. Example: throughput = [nbytes(bytes) / realt(sec)] * 8(bits/byte) * [1 (Mbit) / 1,000,000 (bits)] = [nbytes(bytes) / realt(sec) / 125000(bytes/Mbit) /* * T T C P . C * * Test TCP connection. Makes a connection on port 5001 * and transfers fabricated buffers or data copied from stdin. * * Usable on 4.2, 4.3, and 4.1a systems by defining one of * BSD42 BSD43 (BSD41a) * Machines using System V with BSD sockets should define SYSV. * * Modified for operation under 4.2BSD, 18 Dec 84 * T.C. Slattery, USNA * Minor improvements, Mike Muuss and Terry Slattery, 16-Oct-85. * * Distribution Status - * Public Domain. Distribution Unlimited. */ "ttcp%s: %ld bytes in %.2f real seconds = %.2f KB/sec = %.4f Mb/s\n", trans?"-t":"-r", nbytes, realt, ((double)nbytes)/realt/1024, ((double)nbytes)/realt/128000 ); if (verbose) { fprintf(stdout, "ttcp%s: %ld bytes in %.2f CPU seconds = %.2f KB/cpu sec\n", trans?"-t":"-r", nbytes, cput, ((double)nbytes)/cput/1024 ); -------------------------------------------------------------------------------