Use libeatmydata during nspawn cache prep

The nspawn cache prep is timing out regularly so use eatmydata to minimise
pressure on the filesystem during package installation.

dpkg calls fsync for each file installed from each package which can
result in very poor performance on some filesystems. This patch gives
around a 4x improvement in "slow" gate runs, and 2x on esxi hdd storage.

Change-Id: I80efd3f8044f377a497492f09689c459c6094742
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
Co-authored-by: Jonathan Rosser <jonathan.rosser@rd.bbc.co.uk>
This commit is contained in:
Kevin Carter 2018-12-30 09:10:45 -06:00
parent fce12838ba
commit 26221a267d
2 changed files with 3 additions and 7 deletions

View File

@ -93,9 +93,3 @@
with_items: "{{ (nspawn_copy_from_host | union(nspawn_container_cache_files_from_host)) | list }}"
when:
- nspawn_image_cache_refresh | bool
- name: Create static MACs in the container
copy:
src: "/etc/systemd/network/99-default.link"
dest: "/var/lib/machines/{{ nspawn_container_base_name }}/etc/systemd/network/99-default.link"
remote_src: true

View File

@ -28,8 +28,10 @@ export DEBIAN_FRONTEND=noninteractive
apt-get remove -y --purge snap* nspawn* lxd* resolvconf || true
apt-get update
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes {{ nspawn_container_distro_required_packages | join(' ') }}
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes eatmydata
export LD_PRELOAD=/usr/lib/{{ ansible_architecture }}-linux-gnu/libeatmydata.so
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes {{ nspawn_container_distro_required_packages | join(' ') }}
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes {{ nspawn_container_distro_packages | join(' ') }}
apt-get upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes
apt-get clean