Page of 410

 

part one, performance. here is a comparison of two separate workflows and what t
hey do. you have a file on disk blah.tar.gz which is, say, one gb of gzip compre
ssed data which, when uncompressed, occupies two gb, so a compression ratio of f
ifty per cent. the way that you would create this, if you were to do archiving a
nd compression separately, would be tar cf blah.tar files ... this would result 
in blah.tar which is a mere aggregation of the files ... in uncompressed form. t
hen you would do gzip blah.tar. this would read the contents of blah.tar from di
sk, compress them through the gzip compression algorithm, write the contents to 
blah.tar.gz, then unlink, delete, the file blah.tar. now, lets decompress. way .
 you have blah.tar.gz, one way or another. you decide to run, gunzip blah.tar.gz
. this will read the one gb compressed data contents of blah.tar.gz. process the
 compressed data through the gzip decompressor in memory. as the memory buffer f
ills up with a block worth of data, write the uncompressed data into the file bl
ah.tar on disk and repeat until all the compressed data is read. unlink, delete,
 the file blah.tar.gz. now, you have blah.tar on disk, which is uncompressed but
 contains one or more files within it, with very low data structure overhead. th
e file size is probably a couple of bytes larger than the sum of all the file da
ta would be. you run, tar xvf blah.tar. this will read the two gb of uncompresse
d data contents of blah.tar and the tar file formats data structures, including 
information about file permissions, file names, directories, etc. write the two 
gb of data plus the metadata to disk. this involves translating the data structu
re and metadata information into creating new files and directories on disk as a
ppropriate, or rewriting existing files and directories with new data contents. 
the total data we read from disk in this process was one gb, for gunzip, plus tw
o gb, for tar, equals three gb. the total data we wrote to disk in this process 
was two gb, for gunzip, plus two gb, for tar, plus a few bytes for metadata equa
ls about four gb. way twoyou have blah.tar.gz, one way or another. you decide to
 run, tar xvzf blah.tar.gz. this will read the one gb compressed data contents o
f blah.tar.gz, a block at a time, into memory. process the compressed data throu
gh the gzip decompressor in memory. as the memory buffer fills up, it will pipe 
that data, in memory, through to the tar file format parser, which will read the
 information about metadata, etc. and the uncompressed file data. as the memory 
buffer fills up in the tar file parser, it will write the uncompressed data to d
isk, by creating files and directories and filling them up with the uncompressed
 contents. the total data we read from disk in this process was one gb of compre
ssed data, period. the total data we wrote to disk in this process was two gb of
 uncompressed data, plus a few bytes for metadata equals about two gb. if you no
tice, the amount of disk io in way two is identical to the disk io performed by,
 say, the zip or seven zip programs, adjusting for any differences in compressio
n ratio. and if compression ratio is your concern, use the xz compressor        

 

<< < Random Page > >>

 


Book Location: 3nztrw9zmhkgsy0u11a34ha8g04y4mpdwie2bv41a7...-w3-s5-v06

Single Page | Anglishize | Bookmarkable | Download | Home