Supporting LZ4 as initramfs compressor

Balint Reczey balint.reczey at canonical.com
Wed Jun 5 13:39:31 UTC 2019


Hi Dimitri,

Thanks for keeping this thread alive.

On Wed, Jun 5, 2019 at 2:16 PM Dimitri John Ledkov <xnox at ubuntu.com> wrote:
>
> On Fri, 31 May 2019 at 09:13, Seth Arnold <seth.arnold at canonical.com> wrote:
> >
> > On Thu, May 30, 2019 at 11:46:57AM +0100, Dimitri John Ledkov wrote:
> > > As if lz4 kernel & xz initrd would yield the fastest boot time? That
> >
> > I'm lacking some context here, but I think building the initrds is already
> > too slow and I'm afraid xz on initrd rebuilds would be significantly
> > worse than lz4 or zstd or even low-compression levels of zlib.
> >
> > Boot times are important but every now and then people do run apt upgrade
> > by hand and waiting forever to rebuild an initrd that may or may not be
> > used is pretty tedious. xz is great if the really slow compress times will
> > be made up for by better transfers or disk savings or similar.
> >
>
> I've tried to dig up past benchmarks in private discussions, public
> discussions and kernel mailing list.
>
> Zstd patches have not made it into the upstream kernel yet.
>
> As used by mkinitramfs:
> - lz4 is faster to compress than gzip
> - lz4 is blazingly fast to decompress
> - lzma is dog slow to compress and decompress, but is tiny
> - lz4 size weight over gzip is marginal (14%) but imho worth the
> improved boot time & initrd creation time
> - xz is potentially even slower and even smaller than lzma
>
> In places where size is an absolute premium (tiny embedded iot
> devices) and performance is irrelevant, xz or lzma should be used.
>
> In all other places, our performance profile is in favor of lz4.
>
> Imho that includes the kernel image itself, thus we should consider switching:
> - initramfs tools to default to lz4
> - livecd-rootfs to default to lz4
> - kernels to compress kernel image with lz4
> - grub to include lz4 support

Please also note that it is not just the compressor that should be
tweaked but the parameters, too.
Initramfs-tools uses lz -9 because it provided the best space - speed
tradeoff, but comparisons testing the kernel compressors were using
the defaults which were not -9.
IMO lz4 (-9) would be the best choice for kernels, too, but to see
more accurate measurements it may be a good idea to run tests again
with setting compression level.

Cheers,
Balint

>
> I shall proceed with changing the defaults on the above to improve our
> responsiveness experience on installer, cloud, core and classic
> devices.
> If our firstboot & subsequent boot speed degrades or disk space
> becomes a concern, we can look into tweaking these changes further.
>
> --
> Regards,
>
> Dimitri.
>
> --
> ubuntu-devel mailing list
> ubuntu-devel at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel


--
Balint Reczey
Ubuntu & Debian Developer



More information about the ubuntu-devel mailing list