ftp command

You can use the ftp command to send a very large file by using /dev/zero as input and /dev/null as output. This allows you to transfer a large file without involving disks (which might be a bottleneck) and without having to cache the entire file in memory.

Use the following ftp subcommands (change count to increase or decrease the number of blocks read by the dd command):
> bin
> put "|dd if=/dev/zero bs=32k count=10000" /dev/null

The above command transfers 10000 blocks of data and each block is 32 KB in size. To increase or decrease the size of the file transferred, change the count of blocks read by the dd command, which is the count parameter, or by changing the block size, which is the bs parameter. Note that the default file type for the ftp command is ASCII, which is slower since all bytes have to be scanned. The binary mode, or bin should be used for transfers whenever possible.

Make sure that tcp_sendspace and tcp_recvspace are at least 65535 for the Gigabit Ethernet "jumbo frames" and for the ATM with MTU 9180 or larger to get good performance due to larger MTU size. A size of 131072 bytes (128 KB) is recommended for optimal performance. If you configure your Gigabit Ethernet adapters with the SMIT tool, the ISNO system default values should be properly set. The ISNO options do not get properly set if you use the ifconfig command to bring up the network interfaces.

An example to set the parameters is as follows:
# no -o tcp_sendspace=65535
# no -o tcp_recvspace=65535
The ftp subcommands are as follows:
ftp> bin
200 Type set to I.
ftp> put "|dd if=/dev/zero bs=32k count=10000" /dev/null
200 PORT command successful.
150 Opening data connection for /dev/null.
10000+0 records in
10000+0 records out
226 Transfer complete.
327680000 bytes sent in 2.789 seconds (1.147e+05 Kbytes/s)
local: |dd if=/dev/zero bs=32k count=10000 remote: /dev/null
ftp> quit
221 Goodbye.
The above data transfer was executed between two Gigabit Ethernet adapters using 1500 bytes MTU and the throughput was reported to be : 114700 KB/sec which is the equivalent of 112 MB/sec or 940 Mbps.
When the sender and receiver used Jumbo Frames, with a MTU size of 9000, the throughput reported was 120700 KB/sec or 117.87 MB/sec or 989 Mbps, as you can see in the following example:
ftp> bin
200 Type set to I.
ftp> put "|dd if=/dev/zero bs=32k count=10000" /dev/null
200 PORT command successful.
150 Opening data connection for /dev/null.
10000+0 records in
10000+0 records out
226 Transfer complete.
327680000 bytes sent in 2.652 seconds (1.207e+05 Kbytes/s)
local: |dd if=/dev/zero bs=32k count=10000 remote: /dev/null
The following is an example of an ftp data transfer between two 10/100 Mbps Ethernet interfaces:
ftp> bin
200 Type set to I.
ftp> put "|dd if=/dev/zero bs=32k count=10000" /dev/null
200 PORT command successful.
150 Opening data connection for /dev/null.
10000+0 records in
10000+0 records out
226 Transfer complete.
327680000 bytes sent in 27.65 seconds (1.157e+04 Kbytes/s)
local: |dd if=/dev/zero bs=32k count=10000 remote: /dev/null
The throughput of the above data transfer is 11570 KB/sec which is the equivalent of 11.3 MB/sec or 94.7 Mbps.