I have a local available image which is called DetectionSvc and has a size of 2,5 GB.
When i am doing lxc launch DetectionSvc containerDetection the command finishes at a mean time of about 40 secs. Is this time ok ? I believe it is ok due to the large image. Is there a way to reduce this time without changing the image size ?
You’ll need to figure out what keeps the image from launching faster. When you launch a new container, run lxc console on another terminal window so that you get a feel as to what takes up so much time.
40s start time is quite a lot, assuming all these are on SSD.
But if you do not attempt to delve deeper and try to figure out why this container image launches in so much time, then you are out of luck.
You can compare with the launch time of a pristine Ubuntu container. This will help you have a benchmark as to how fast you can make your container go.
My native Ubuntu installation is on my HDD. So i believe all of these are using my HDD not my SSD. Can anyone mention which are some good values for the launch time of containers ?
Both for an image of 189 MB ( plain ubuntu image ) and for a custom image of 2,5 GB.
Both images are available locally.
The 5.3s launch time for a container when you have a traditional disk look reasonable.
The lxc console output above show about 4s of output. The number at the start of the lines is the number of seconds since the boot of the kernel. Therefore, there are quite a few things going that we have not seen. Perhaps you can write a script to perform the launch and the run lxc console? The idea is to get an lxc console output that matches the 40s startup time that you are reporting. And you can visually observer the startup logs as to which services take so much time of the 40s startup time.
Anything other than dir would make the launch stage significantly faster by using copy-on-write rather than having to duplicate the entire data during creation.
When i did lxd init and choose zfs everything was ok but i forgot to do systemctl start snap.lxd.daemon so i unistall snap lxd and i i did again snap install lxd, lxd init
Would you like to use LXD clustering? (yes/no) [default=no]: no
Do you want to configure a new storage pool? (yes/no) [default=yes]: yes
Name of the new storage pool [default=default]: default
Name of the storage backend to use (btrfs, dir, lvm, zfs, ceph) [default=zfs]: zfs
Create a new ZFS pool? (yes/no) [default=yes]: yes
Would you like to use an existing empty block device (e.g. a disk or partition)? (yes/no) [default=no]: no
Size in GB of the new loop device (1GB minimum) [default=18GB]: 19GB
Would you like to connect to a MAAS server? (yes/no) [default=no]: no
Would you like to create a new local network bridge? (yes/no) [default=yes]: yes
What should the new bridge be called? [default=lxdbr0]: lxdbr0
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: auto
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: auto
Would you like LXD to be available over the network? (yes/no) [default=no]: yes
Address to bind LXD to (not including port) [default=all]: all
Port to bind LXD to [default=8443]: 8443
Trust password for new clients:
Again:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes] yes
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]: no
Error: Failed to create storage pool 'default': Failed to run: zpool create -f -m none -O compression=on default /var/snap/lxd/common/lxd/disks/default.img: cannot create 'default': pool already exists
DetectionSvc container launched siginifically faster. Especially the second time which i try the launch command. The first one took some time. Maybe because the used image was an image which had been imported from a tar.gz
If you’re only interested in startup time, rather than which steps are taking the time, then what you’re doing is fine. But in order to see which steps are taking the time you need to enable debug logging:
sudo snap set lxd daemon.debug=true
sudo systemctl reload snap.lxd.daemon
I’m not sure what you are trying to test, are you trying to test the launch time of a container on a dir or zfs pool, with or without the initial image being download first?