Tuesday, February 18, 2014

Raspberry Pi Journal #50


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?


  1. time tar -c VID0000*.AVI >vid.tar
  2. real 0m1.903s
  3. user 0m0.040s
  4. sys 0m1.590s



  1. time tar -cz VID0000*.AVI >vid.tgz
  2. real 1m8.890s
  3. user 1m4.000s
  4. 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.


  1. time tar -c VID0000*.AVI | gzip - >vid.tar.gz
  2. real 1m19.526s
  3. user 1m9.580s
  4. 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.


  1. time tar -c VID0000*.AVI | ssh pi@remotepi gzip - >video.tgz
  2. pi@cloudypi's password: enter password
  3. real 12m54.990s
  4. user 0m16.460s
  5. 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.

No comments:

Post a Comment