When I run php “composer” in an Ubuntu 18.04 container on a ZFS backend, it takes about 12-15 minutes to install a project or a module (such as Drupal 8). In other backends (btrfs, lvm) or directly on the host it takes about 2.5 minutes (still slow, but tolerable).
I tried reproducing this problem with ZFS outside of LXD, but could not. Specifically, on an Ubuntu 18.04 system, I setup a zfs filesystem and created a user with a home directory on ZFS. Then I ran “composer” as that user on a project directory in the same ZFS filesystem and it ran normally. Composer accesses the project directory and also $HOME/.cache/composer. I don’t know if it accesses the root filesystem. I looked at /tmp while it was running and didn’t see anything.
This is why I’m bringing this to LXD first. Should I enter this as an issue on github?
When I run strace on the command, I see that it pauses for several seconds after calls like this:
madvise(0x7f989e000000, 2097152, MADV_HUGEPAGE) = 0
Here’s how to reproduce:
On a brand new Ubuntu 18.04 container on ZFS backend:
apt-get install -y php
apt-get install -y php-mysql
apt-get install -y php-zip
apt-get install -y php-gd
apt-get install -y php-xml
apt-get install -y php-mbstring
apt-get install -y zip unzip php-curl
these may not all be needed, but this is what I tested with
sudo su ubuntu
php installer --quiet
time ./composer.phar create-project drupal-composer/drupal-project:8.x-dev --no-dev --stability dev --no-interaction $HOME/drupal
come back 15 minutes later to see how long it took.
When running this on a VPS with 2GB ram, I needed to add a 1GB swapfile first.