Browse Source

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>
Kevin Carter 3 months ago
parent
commit
26221a267d
2 changed files with 3 additions and 7 deletions
  1. 0
    6
      tasks/nspawn_cache.yml
  2. 3
    1
      templates/prep-scripts/nspawn_ubuntu_prep.sh.j2

+ 0
- 6
tasks/nspawn_cache.yml View File

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

+ 3
- 1
templates/prep-scripts/nspawn_ubuntu_prep.sh.j2 View File

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

Loading…
Cancel
Save