cpipe: Determine the throughput of a pipe
December 23rd, 2007 edited by paulgearArticle submitted by Todd Troxell. Please help DPOTD by submitting good articles about software you like!
A package I find useful is cpipe. It is simple tool you can use to determine the throughput of a pipe. Potential uses of cpipe might include determining the speed of:
- backups that use tar and dd
- your system’s pseudo-random number generator (see below)
- an OpenSSH tunnel or OpenVPN between two systems on the Internet
For example, to determine the speed at which you can read from /dev/urandom
and write to /dev/null
, run:
$ cpipe -vt < /dev/urandom > /dev/null
This will produce output like the following:
thru: 56.045ms at 2.2MB/s ( 1.3MB/s avg) 1.1MB thru: 74.936ms at 1.7MB/s ( 1.3MB/s avg) 1.2MB thru: 21.748ms at 5.7MB/s ( 1.4MB/s avg) 1.4MB thru: 90.131ms at 1.4MB/s ( 1.4MB/s avg) 1.5MB
You can also use it to measure read times, write times and to limit throughput:
$ cat /dev/zero | cpipe -s 100 -vt > /dev/null thru: 1256.079ms at 101.9kB/s ( 101.9kB/s avg) 128.0kB thru: 1259.942ms at 101.6kB/s ( 101.7kB/s avg) 256.0kB thru: 1260.469ms at 101.5kB/s ( 101.7kB/s avg) 384.0kB
Cpipe’s upstream homepage is http://cpipe.berlios.de/. It is written by Harald Kirsch. It has been available in Debian since (at least) sarge, and Ubuntu since (at least) dapper.
December 23rd, 2007 at 2:23 pm
A very similar tool is pv, also available in Debian (and Ubuntu I suppose). One nice feature it seems to have over cpipe is that it can also display a progress bar.
December 23rd, 2007 at 2:26 pm
dd can do this:
- check it’s man page for a signal to send to it to print out it’s status. more cumbersome than this app but it’s everywhere.
- also useful for a pipe’s flow-control w/rate limiting
December 24th, 2007 at 9:40 am
FreeBSD (and probably other BSDs) send a signal on Ctrl-T that most programs interpret as a request to print status.
December 24th, 2007 at 6:40 pm
pipebench is also useful for measuring pipe throughput.