Hi Till,
> we're using Kiwi and the boxed plugin...
> Before that we were using chroot builds on openSUSE Leap.
ok
> Going from chroot to boxed build increased ISO creation times by a factor of
> 4 to 5 on comparable hardware. Nested virtualization is supported.
So you are running on a VM with boxbuild as a nested KVM guest, correct ?
> From looking at the logs I'd summarize that we have two main pain points:
>
> - I/O in the box is slow (e.g. for calls to mksquashfs)
> - I/O when sharing files between box and host is slow (e.g. calls to rsync)
I can confirm that these two parts are the bottlenecks when
using boxbuild. If you build cross arch there is a third aspect which
on the architecture emulation
> Since nobody likes to wait ;-), we've tried to optimize ISO creation times
> with the boxed build plugin, but have come up empty so far.
To be honest I haven't done such a deep comparison as you did.
Thus there is not much I can add to your findings. However, I also
have experienced performance issues and you should be aware that
you will never be as fast as if you just build on the same host
in a chroot. Simply because there is no guest in between and you
never have to shuffle date from the the guest to the host.
I believe a factor of two will always persist.
Here is what I did to increase on the performance:
1. Make sure snapshot files gets written to a tmpfs. By default /tmp
is used for snapshots by qemu. You can change this via:
export TMPDIR=/some/tmpfs/dir
2. Operations like compression and also squashfs are multithreaded.
kiwi calls them such that the tools selects themselves how many
processes they spawn. This depends on the number of CPUs. The box
by default doesn't use smp. You can set the number of CPUs to use
via:
--box-smp-cpus=<number>
3. Use virtiofs for data transfer between guest and host.
You told me that --virtiofs-sharing has no effect on the performance
but in my tests this significantly improved the performance
compared to 9p
4. Increase guest memory. By default 8096M is used which should
be more than enough. But depending on how big your iso is it could
be that more main memory helps. You can influence this number via
--box-memory
Other than that it would be very useful to identify the calls
that suffered the most. So do you have a log file from a chroot
build and a log file of the same image build with boxbuild. Please
run with "kiwi-ng --debug ... system boxbuild ..." This increases
the verbosity of the log file and we can see the time each EXEC
call takes.
> Are we holding it wrong or are figures like this to be expected?
You are doing all correct. In my tests the build times usually
increases by a factor of two but not four or five. I'm not running
on a VM though and I'm mostly building disk images not iso's.
Thus as I said I have not really comparable data like you have.
> What (other) options do we have for reducing ISO creation times?
The ones I had in mind I shared with you. You could also consider
to use erofs instead of squashfs for building the ISOs. mkfs.erofs
is faster than mksquashfs. But you would be moving to another ro
filesystem
If nothing of the above helps, then I must say I have no more
ideas :) People like Alexander Graf who are deep into qemu and
virtualization might have more ideas what you can try. Running
an I/O centric guest on a guest is however not an ideal setup.
Regards,
Marcus
--
Public Key available via:
https://keybase.io/marcus_schaefer/key.asc
keybase search marcus_schaefer
-------------------------------------------------------
Marcus Schäfer Brunnenweg 18
Tel:
+49 7562 905437 D-88260 Argenbühl
Germany
-------------------------------------------------------