Question: More and more [`tar`](http://www.gnu.org/software/tar/manual/tar.html) archives use the [`xz`](http://en.wikipedia.org/wiki/Xz) format based on LZMA2 for compression instead of the traditional [`bzip2(bz2)`](http://en.wikipedia.org/wiki/Bz2) compression. In fact *kernel.org* made a late "*Good-bye bzip2*" [announcement, 27th Dec. 2013](https://www.kernel.org/happy-new-year-and-good-bye-bzip2.html), indicating kernel sources would from this point on be released in both tar.gz and tar.xz format - and on the main page of the [website](https://www.kernel.org/) what's directly offered is in `tar.xz`.

Are there any specific reasons explaining why this is happening and what is the relevance of [`gzip`](http://en.wikipedia.org/wiki/Gzip) in this context?

Answer: 
First of all, this question is not directly related to `tar`. Tar just creates an uncompressed archive, the compression is then applied later on.

Gzip is known to be relatively fast when compared to LZMA2 and bzip2. If speed matters, `gzip` (especially the multithreaded implementation [`pigz`](http://zlib.net/pigz/)) is often a good compromise between compression speed and compression ratio. Although there are alternatives if speed is an issue (e.g. LZ4).

However, if a high compression ratio is desired LZMA2 beats `bzip2` in almost every aspect. The compression speed is often slower, but it decompresses much faster and provides a much better compression ratio at the cost of higher memory usage.

There is not much reason to use `bzip2` any more, except of backwards compatibility. Furthermore, LZMA2 was desiged with multithreading in mind and many implementations by default make use of multicore CPUs (unfortunately `xz` on Linux does not do this, yet). This makes sense since the clock speeds won't increase any more but the number of cores will.

There are multithreaded `bzip2` implementations (e.g. [`pbzip`](http://compression.ca/pbzip2/)), but they are often not installed by default. Also note that multithreaded `bzip2` only really pay off while *compressing* whereas decompression uses a single thread if the file was compress using a single threaded `bzip2`, in contrast to LZMA2. Parallel `bzip2` variants can only leverage multicore CPUs if the file was compressed using a parallel `bzip2` version, which is often not the case.
LZMA2 is a block compression system whereas gzip is not. This means that LZMA2 lends itself to multi-threading. Also, if corruption occurs in an archive, you can generally recover data from subsequent blocks with LZMA2 but you cannot do this with gzip. In practice, you lose the entire archive with gzip subsequent to the corrupted block. With an LZMA2 archive, you only lose the file(s) affected by the corrupted block(s). This can be important in larger archives with multiple files.