Tape Archive Compression
There's a built-in program to provide back up, or archive. It's called TAR or Tape ARchive. You can read more about it in the man pages. I'm interested at this point, in the execution time. As you know, tar does not provide compression by default. You can activate the compression feature by including option -z. There is no question that it works. The question is, how fast is it?
- time tar -c VID0000*.AVI >vid.tar
- real 0m1.903s
- user 0m0.040s
- sys 0m1.590s
- time tar -cz VID0000*.AVI >vid.tgz
- real 1m8.890s
- user 1m4.000s
- sys 0m2.890s
As you can see, the original operation is just a couple seconds long. The compressed option, however, took over 1 minute long. That's an enormous difference! Let's do a pipe with gzip command.
- time tar -c VID0000*.AVI | gzip - >vid.tar.gz
- real 1m19.526s
- user 1m9.580s
- sys 0m3.320s
The process takes even longer to process. So, let's see if we can improve it so that the time it takes will be between uncompressed and the original compressed.
- time tar -c VID0000*.AVI | ssh pi@remotepi gzip - >video.tgz
- pi@cloudypi's password: enter password
- real 12m54.990s
- user 0m16.460s
- sys 0m9.620s
So, there's a trick to it. I'm using the pipe command to send the data to a remote pi on the network. Then the remote pi compresses the data and then send it back to my local pi. As you can see, the time went through the roof. Obviously, the network bandwidth is the bottleneck. After all, my CPU utilization rate is near zero. Which is nice since I can watch anime while it's compressing. But that's besides the point since I can use the "nice" command to put it into the background.
Oh, well. Some things just aren't worth it.