** Description changed: - This is a companion to https://bugs.launchpad.net/snapd/+bug/2165972. - However it does not seem to be fixed by PR#17626. + [Impact] + + * + + [Test Plan] + + * + + [Where problems could occur] + + * + + [Other Info] + + * + + ---original--- + This is a companion to https://bugs.launchpad.net/snapd/+bug/2165972. However it does not seem to be fixed by PR#17626. I've been working on improving Workshop VM launch times, see this draft: https://github.com/canonical/workshop/pull/1042. I found that (at least sometimes) a significant amount of the boot is spent waiting for snapd to refresh the catalog. In my draft I simply create an empty file at /var/cache/snapd/names using cloud-init; this saves about 2s on average (with my NZ internet). Here is a quick reproducer: ``` #!/usr/bin/env bash set -e trap 'lxc delete -f v1 v2' EXIT workaround='#cloud-config bootcmd: - install -D --mode=0644 /dev/null /var/cache/snapd/names ' for vm in v1 v2; do lxc init --vm ubuntu:24.04 "$vm" if [ "$vm" = v2 ]; then lxc config set v2 cloud-init.user-data="$workaround" fi lxc start "$vm" until lxc exec "$vm" -- true &>/dev/null; do sleep 1; done lxc exec "$vm" -- systemctl is-system-running --quiet --wait lxc exec "$vm" -- systemd-analyze --no-pager blame lxc exec "$vm" -- systemd-analyze --no-pager critical-chain done ``` In one run, the workaround took snapd.seeded.service from 3.615s to 2.098s. I'm using an Ubuntu 24.04 host with LXD 6.9 and a ZFS storage pool backed by a fast SSD. YMMV. I don't really want to use this workaround, because I think it probably misleads snapd into thinking the catalog was refreshed recently. I just want to move the catalog refresh off the critical path. I think a lot of workshops don't really use snaps, since they can use the equivalent SDK instead, so it's not worth paying the cost of refreshing a catalog that might never be used. I slopped together a couple of patches here: https://github.com/jonathan-conder/snapd/commits/fast12/ which might help with that. I have a more involved reproducer which validates these patches against a baseline of PR#17626 rebased on 2.77.1; see attached. Both patches give roughly similar speed improvements and combining them doesn't seem to have a big impact over just one of them. But I've been running my benchmarks in a noisy environment. I'll leave it to your judgement as to whether either of them is actually a good idea; maybe you can come up with something more suitable.
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2167816 Title: snapd network requests slow down LXD VM boot To manage notifications about this bug go to: https://bugs.launchpad.net/snapd/+bug/2167816/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
