-
-
Notifications
You must be signed in to change notification settings - Fork 645
Drupal installation and update is extremely slow #1309
Comments
@Niklan I'd recommend running any composer commands on the host machine, this way it also can leverage the host cache. |
@thom8 but whats about drush commands? Above i posted example, simple upgrade from 8.3.0 to 8.3.1 took 90 minutes! Same update on DigitalOcean, which droplet is less pewerful took 10-20 seconds, not more. |
You should also be able to run drush commands on the host if you have it installed. Could also try running drush in debug mode to see what the hold up is -- |
Still would recommend using drupal composer then adding DrupalVM as a dependency.
All from the host machine. |
@Niklan - A few things:
Finally, does your computer have a hard drive or SSD? And how much RAM do you have on your computer? If it's less than a few GB, that could be an issue too. |
I have HDD, but I don't think this is the main problem. For example, on dockerized drupal, which also uses vagrant inside it, drupal 8 upgrades very fast, no more than a minute. It's hard to belive that on same computer, but using drupalvm this operation is 90 times slower. I mean, this slowing only appears on Drupal VM with Drupal update and installation processes. I have 8GB RAM, and VM has 2GB of RAM, also while working I always have around of free 1-2GB RAM. |
I tried rsync, Drupal updates from 8.3.0 to 8.3.1 in 2-5 seconds. I also trying to install and build Drupal with DrupalVM by Drush Make and Composer. Both works very fast now. But I have new problem now. I set:
drupal directory created as expected, system marks it as network folder as when i using NFS, but there is nothing here, folder just empty. Files only available by vagrant ssh for now. I think this is third about reverse-mounted folder, but how can I do it? And is it safe to change NFS to rsync on existed project? Which folder has proiority, local or in vagrant. Sying, i update same file in vagrant and local, but what happens, which will be using? |
@Niklan - Yeah, then it looks like it's definitely related to the shared folder mount. I wonder if it wasn't actually using NFS in the first place... even using native shared folders (which are horribly slow), a Drupal install takes < 5 minutes (< 1 minute if using rsync or NFS on my own computer), and something like updb / cr takes maybe ~1-2 minutes, depending on the site. There are many articles on the Internet talking about strategies for making Vagrant performance better (e.g. https://stefanwrobel.com/how-to-make-vagrant-performance-not-suck, and some articles on my own blog)—and most recommend rsync if you can use it (it's one-way only, as you've found out—no files inside the VM get put back on your drive), or NFS if not, since it's usually much faster than the alternatives. I haven't run a VM on a system with a spinning hard drive in a few years, so I don't know just how big a delta that would have vs an SSD, but judging by how a lot of other things are much faster on SSD, maybe there's something with your HDD that is causing the issue when using NFS or native shared folders. One final thing: I noticed you're running VirtualBox 5.0.x—that version is not guaranteed to work well with Drupal VM (You need 5.1.x if at all possible), and has been known to have weird issues. Maybe try upgrading and see if that helps? (First do a |
@geerlingguy
|
@oxyc thank you, thats helped me |
Now installs starts and crash on NGINX checking.
|
@Niklan - It looks like:
Can you run those commands to check the logged output? Maybe a setting is missing or incorrect? |
I just experienced the same issue and I could fix it with the help of this article. I executed this code inside the VM here before running
|
The problem with nginx was in new Drupal VM 4.4.3 version. I create ne project with 4.4.2 and same configs, but problems in not presented here. I upgraded VirtualBox to 5.1.20 and this is not helped me. NFS is still very slow and rsync very fast. If I stay with rsync, what the best way to work with core, connect via ssh? And how to upload files? FTP? It is not possible to set |
If i tried to install with thouse configs:
All installs, but when I SSH to /var/www/drupal, I haven't any permission
|
Another try All installs well, I copied my project to ./drupal and look how vagrant sync files. It was extremly fast, so this is not NFS problem i think. Maybe NFS is slow VM -> host, but host -> VM works without any delay. And also, Drupal VM 4.4.3 is realy broken. It's fails on NGINX, also even apache web server is set. Summarizing:
|
You are correct, the current release is broken but 4.4.4 will be released soon. For optimal performance, it's best to develop on the host like @thom8 suggested earlier. This is a slightly different setup and I think it works best with requiring Drupal VM as a composer dependency. You do this by setting up a new Drupal project, using eg drupal-composer/drupal-project as an example. Require your modules etc in the Now that you have Drupal VM as a dependency and all the files on your host machine you can set up - local_path: .
destination: /var/www/drupal
type: rsync
create: true
excluded_paths:
- private
- .git
- web/sites/default/files
- tmp
# Exclude the second synced folder.
- config/drupal
# Use a slower but two-way sync for configuration sync directory.
- local_path: config/drupal
destination: /var/www/drupal/config/drupal
type: "nfs"
create: true Now when you modify the codebase on your host, the files will be rsynced to the VM and read in native speed. When you export your configuration, they will be written to the NFS synced This issue sounds very odd to me though. It shouldn't be that slow. Maybe we can fix it somehow... Is it equally slow if you run |
I wonder if it's something you can tune in the NFS settings. I read a post that suggested using config.vm.synced_folder ".", "/vagrant",
nfs: true,
linux__nfs_options: ['rw','no_subtree_check','all_squash','async'] You can set that option for your vagrant_synced_folders:
- local_path: .
destination: /var/www/drupalvm
type: nfs
create: true
options_override:
linux__nfs_options: ['rw','no_subtree_check','all_squash','async']
|
I don't know what happening, but Drupal VM is completly broken for me now. I can't even start new project. Clean Drupal VM 4.4.4 folder. I just create this file config.yml with this content: vagrant_hostname: drupalvm.dev
vagrant_machine_name: drupalvm
vagrant_synced_folders:
- local_path: ./drupal
destination: /var/www/drupal
type: nfs
create: true
drupal_build_composer_project: false
drupal_install_site: false
drupal_core_path: /var/www/drupal Installtion and provision is always ending with error:
Files are not syncing, they are seems do not have permissions to do that.
If i trying to acces any of the pages, dashboard, adminer and other I got this: I checked sites-enabled and there seems all okay. What is going on? Honestly it's not first time I'm trying to use Drupal VM, year ago I have same issues on diffirent system. |
Drupal Console installation is currently broken and you'll need to remove it from
I haven't seen that error before. I wonder if your host NFS installation is broken somehow. What does the VM entries look like in your host machines Did you check the Linux docs? Specifically, I'm wondering if it could be a firewall issue.
|
Inside clean VM. Just installed.
I haven't any firewalls enabled at all, I handle such things on router. |
There are no entries at all? Do you have NFS installed? sudo apt-get install nfs-kernel-server |
If you do could you post the debug log from running vagrant up --debug &> vagrant.log |
|
|
Ah that exports was from within the VM, then yes it should be empty. What's the result of |
Files is now syncing, but I can't access any site. They return 404 not found. F.e. drupalvm.dev - 404, adminer.drupalvm.dev - 403, dashboard 404 and so on. |
@Niklan I would also recommend upgrading to Virtualbox 5.1.x before debugging much further, there's a number of bug fixes in the latest release. more info here -- #1276 (comment) |
@thom8, I'm already use latest version of virtualbox, I manually updated it. So all debug informations above from 5.1.20 version of it. |
@oxyc I did this, run vagran provision, and again try to update drupal from 8.3.0 to 8.3.1. There is result: https://pastebin.com/fzEPFhnk — nothing is changed. I looked at
Seems like |
@Niklan However, if there's any unlinked config in there you might need to these remove manually. When I've run into this before, I halt all my VMs then clear everything in |
This is more likely a vagrant issue so it might be a good idea to check the vagrant issue queue too -- https://github.com/mitchellh/vagrant/issues To check if it's isolated to DrupalVM, you could also try another project -- https://github.com/thom8/drupal8-vagrant If you can replicate it here it's more likely an upstream issue with vagrant / vbox. |
@thom8
All the same. I will check your vagrant envoirment later. |
I may be wrong but I'm pretty sure with NFS you can't mount a subdirectory of another mount, at least not on the same machine. |
Ahh I am wrong, looks like it works.. but in another project where I'm doing this it gets created as : Not sure if that would make a difference. Anyhow, the above doesn't mount the codebase twice so this might be the source of the performance issues. |
@Niklan - Another possibility — are you using a VPN, or are you behind a proxy server? Sometimes that can have an effect on NFS or other networking bits. |
@geerlingguy no, I don't using VPN at all. Files with drush download very fast, they extracting very slow via tmp folder, I don't know where is main bottleneck for this. Installation of new modules is also very fast, maybe because they have a little amount of files, but the core update or installation is always hang. It's not looks more as NFS problem, because files syncing very fast, at least host -> VM direction I can't see any delay, they syncing immediately, seems same for VM -> host syncing. It's slow down on extraction of files from archive with core inside VM, this operation doing file by file movent. |
@Niklan as a workaround would you consider doing any code changes directly on the host rather than inside the VM. I don't have this issue but always run drush/composer commands on the codebase from the host machine, it's generally lots faster + I can share my drush/composer cache between projects :) |
Hi everyone, I'm back to this issue. So this is not CPU, RAM problem. So for now I think only HDD or Vagrant (VB? NFS?) is the main problem. I sure SSD solve the problem (I will buy it later this summer, I don't see reasons for this now, all except update works extremly fast), but this is not solution for all. Anyway I don't think the hour or 1.5h for core update is normal even for HDD, extracting and copying core files done in seconds outside vagrant, sync is work momentally, but in vagrant this things work extremly slow. I will try @thom8 vagrant box later and will see if this problem is presented here too. |
Hi @Niklan, I really doubt SSD can help you much here... I have it and running any file operations from within the VM (guest) console is terribly slow for me. Would be good if @geerlingguy could confirm the shared folder are not suitable for any I/O initiated from the guest and put it as a disclaimer. It's just totally unusable in this particular scenario. My solution is to ignore any shared folders completely and go for "rsync via ssh". For example, some IDEs have this option to automatically deploy the code you edit on your host system to the VM box on any file change. This is duplication but for normal size repos you will not run out of disk space I'm sure. |
@lex0r - I frequently use the VM with NFS for the shares, and have PHP/Composer inside the VM building a Drupal codebase (using drupal-project). This usually takes < 5 minutes on my Mac at home (with a 100 Mbps internet connection), and disk IO is definitely the bottleneck—but it never feels very slow. The same operation directly on my own disk (using native host PHP/Composer), or within the VM on a VM disk (not in a shared folder) takes 3-4 minutes. So it's slower with NFS, but only 10-20%—so not really noticeable outside of huge file operations. With VirtualBox synced folders... that's an entirely different matter. Things are crazy slow there. Especially on hard disks (vs SSDs), it's usually 3-10x slower than running native. That's why for Windows, I often recommend people build the VM 'outside in', where the filesystem is inside the VM, and they share that out to the host if they need to work on the codebase (e.g. with PHPstorm in windows). See this post: https://www.jeffgeerling.com/blog/2017/drupal-vm-on-windows-fast-container-blt-project-development Additionally, I've spent a lot of time in the past 5 years working on performance issues with disk I/O, and have posted a lot of articles with benchmarks, graphs, notes, tips, etc.: https://www.jeffgeerling.com/search/vagrant%20performance |
But note that I have not used a Linux desktop as my main GUI—I use macOS and very occasionally Windows 10, and run everything for work inside VMs or Docker containers. |
Looks like I found the bottleneck. [261.4MB/524.26s] > post-package-update: Drupal\Core\Composer\Composer::vendorTestCodeCleanup
[261.4MB/524.31s] - Installing drupal/core (8.3.4): [261.4MB/529.14s] Reading /home/vagrant/.composer/cache/files/drupal/core/1d859caef96cf352e2e0007d845de27c30a5a3a2.zip from cache
[261.4MB/529.45s] Loading from cache[261.4MB/529.45s]
[261.4MB/529.45s] Extracting archive[261.4MB/529.46s] Executing command (CWD): unzip -qq 'core/9259d03ffced3fe2579b5c86f6947b6e' -d '/var/www/drupal/vendor/composer/62117c0f' && chmod -R u+w '/var/www/drupal/vendor/composer/62117c0f' Composer is using own folder for extracting, and then moving files, not the tmp. So every this command is syncing every time and every file. I think this is cause huge performance drop, accordingly to number of files in Drupal 8 core. I want to try vagrant_synced_folders:
- local_path: ./drupal
destination: /var/www/drupal
type: nfs
create: true
options_override:
nfs_udp: false
excluded_paths:
- vendor The only trick i found for this moment, it is disable vagrant machine, then user composer on host machine, after update run vagrant again. This is much faster way. Took 20 seconds to update core and all dependencies, but not great solution at all. |
@Niklan - I may be wrong, but I think As a quick test, can you try using |
@geerlingguy look the same. The one thing is embarrasses me. The docs clearly says: Rsync offers the best performance inside the VM, but sync is currently one-way-only (from host to VM), which can make certain development workflows burdensome. But I can see archives and extracted files on host, while I run vagrant_hostname: drupal8.dev
vagrant_machine_name: drupal8
vagrant_synced_folders:
- local_path: ./drupal
destination: /var/www/drupal
type: rsync
create: true
#options_override:
# nfs_udp: false
excluded_paths:
- vendor
drupal_build_composer_project: false
drupal_install_site: false
drupal_core_path: /var/www/drupal
installed_extras:
- adminer
# - drupalconsole
- drush
- mailhog
- pimpmylog
- varnish
- xdebug ofc I run |
@Niklan - Did you do a |
@geerlingguy no, I don't. So I reloaded it, composer works realyl fast, 20 seconds to all dependencies (vendor), the same time as NFS without core. But it's working strange. Alot of missing JS's and images. And core don't updated. I will test it more later. |
Just an aside—geerlingguy/ansible-role-drupal#51 upstream should hopefully get things to install a bit faster (well at least the initial project build). I'm going to close this issue for now (just because I think we've explored all the options so far, and there are some docs links that will hopefully help others who follow-up on it), but if you find any other specific issues, please feel free to open another follow-up! |
Thank you for your work. This looks like affect only installation Drupal via composer as drupal-project and don't handle installed Drupal as usual but managed by composer. It's possible to do the same alters for composer, so it store his temp files in /tmp folder, not inside /vendor/composer which the main bottleneck? |
One way would be to sync the vagrant_synced_folders:
- local_path: .
destination: /var/www/drupalvm
type: rsync
create: true
excluded_paths:
- drupal/web
- drupal/config
- local_path: ./drupal/web
destination: /var/www/drupalvm/drupal/web
type: nfs
create: true
- local_path: ./drupal/config
destination: /var/www/drupalvm/drupal/config
type: nfs
create: true This would require you to run all composer commands on your host though (including building the project). Not really ideal but a thought. |
Tryid this config, since I don't install drupal via composer. vagrant_synced_folders:
- local_path: ./drupal
destination: /var/www/drupal
type: rsync
create: true
excluded_paths:
- vendor
- local_path: ./drupal/core
destination: /var/www/drupal/core
type: nfs
create: true First try was very fast, maybe because core is extracted by previous try, but I will try more. Anyway this config is a bit confusing me. Can I do vice versa? Only "include" vendor via rsync and exclude it. |
Strange thing, but I can't reproduce this problem again, also on old DrupalVM configurations which was created 2 months ago. After closing this issue, I still has the problem, but after week it is gone. Thank you for you work, don't know how you fixes affected on old containers, but there is no problem. P.s. before problem is gone I installed some vagrant package to sync composer cache with host, maybe this was a solution. |
Issue Type
Your Environment
Your OS
Summary
When I try to
vagrant up
with drush make or compser build and installation, this process take a long time. Drush make is complete around 30-40 minutes, composer throw error about 1 hour working. This is very annying. But not so critical. If i disable build and installation Drupal by DrupalVM, I can copy and paste clean core and install site in 1-2 minutes.But
drush up -y
executes around 60 minutes on Drupal 8. Holy... why is it so long? I bet this is problem with folder syncing, I uses default settings almost at all, NFS for synced folders and so on.I noticed that when this commands (drush up, compser create-project) executes so long, they create (i think from archive which they download it) file by file very slow. So, it's looks like sync problem. I tried to increase memory limit and cpu's cores, but nothing changes. Everything else works very fast.
By the now it's again hanging on such operation:
My $10 DigitalOcean droplet with other projects on it do same operation for 10-20 seconds!
P.s. Example above finally finished in 90 minutes! And with error:
2006 MySQL server has gone away
The text was updated successfully, but these errors were encountered: