Walker News

How To Force Linux To Fix File Transfer Rate?

The question may sound weird to you, but not to John Walker who developed the valve program back in 2004. According to valve man page, the author regards this C program as the equivalent of the UNIX nice command for I/O.

The valve program allows one to copy or transfer files at a specified maximum transfer rate in bytes per second by pausing between data blocks. By doing so, you can perform bulk data transfers without locking up disc or network bandwidth to the detriment of other applications and/or users.

Is this still applicable in the 21st century? Well, I believe not everyone is living with modern, fast, and reliable computer network. If one day for some reason, this question cross your mind, and you can’t find a better way to restrict the transfer rate at the source or network device, remember there is this valve command to help you.

Download the valve source code and follow instruction of INSTALL file to compile the binary program. The sample usage of valve as follow (with reference to the official manual page):
tar cf - . | valve --rate 256K | ssh user@domain.com "(cd /tmp; tar xf -)"

The typical tar over ssh is as this without piping to valve program (i.e. dump the tar file content to standard output that is in turn piped to ssh program for transferring to remote host over the network and extract the tar file to specific folder in the remote system):
tar cf - . | ssh user@domain.com "(cd /tmp; tar xf -)"

Note: valve endeavour trying nanosleep, usleep, emulation of usleep with setitimer and signal, in order to pause between blocks of data during copying or transferring. If none of these functions are available in system, valve will not work accordingly.

Custom Search

2017  •  Privacy Policy