Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test and benchmark other local development environments #18

Closed
geerlingguy opened this issue Mar 10, 2020 · 12 comments
Closed

Test and benchmark other local development environments #18

geerlingguy opened this issue Mar 10, 2020 · 12 comments

Comments

@geerlingguy
Copy link
Owner

geerlingguy commented Mar 10, 2020

After episode 6, Oliver Davies mentioned the Symfony Local Server, and I thought it might be time—especially since the live stream software eats my little MacBook Pro's CPU for lunch—to try out a faster local dev environment.

Because I'm one for data, I'd rather test things out with some 'official' timings, like how long it takes to install Drupal, to run a cache rebuild, and to migrate things.

So here's a table with some data:

Dev Environment Drupal install (drush) 1st / page load (curl) Cache rebuild (drush)
Current / custom Docker 71.16s 6.36s 7.25s
Current / with NFS (#22) 30.92s 2.80s 5.09s
Current / with bg-sync (#22) 35.54s 1.20s 3.50s
Current / with docker-sync (#22) 35.84s 1.58s 3.51s
Symfony Local Server 71.33s 2.78s 4.25s
DDEV Local 63.24s 4.16s 9.20s
Drupal VM 23.45s 2.83s 2.56s

Commands run:

# Drupal install (drush)
time drush site:install minimal --db-url="mysql://drupal:$DRUPAL_DATABASE_PASSWORD@$DRUPAL_DATABASE_HOST/drupal" --site-name="Jeff Geerling" --existing-config -y

# Home page load (curl)
time curl http://localhost/

# Cache rebuild (drush)
time drush cr
@geerlingguy
Copy link
Owner Author

For Drupal VM I'm adding it as a composer dev dependency: http://docs.drupalvm.com/en/latest/deployment/composer-dependency/

@geerlingguy
Copy link
Owner Author

It's strange, I would've thought the Symfony Local server would be a lot faster, but it seems it was as slow as the custom Docker environment! I made sure to test with opcache enabled and disabled. With it disabled the UI is very slow. With it enabled the UI is faster. CLI speed seemed to not be impacted even if I turned everything off and set it enabled on cli (and confirmed via drush php-ev).

Drupal VM is the winner—once it's up and running. But it takes a minute or two to get started (versus only a few seconds for the others).

So I'm kind of at a crossroads here. I think I'll end up sticking with the custom docker setup, mostly because that doesn't require me to have a fully-tweaked and operational local PHP 7.3 environment running (which could make it more annoying to work on in different environments, especially if I want to work from a PC running Linux or Windows here and there).

@geerlingguy
Copy link
Owner Author

I filed some PRs for the other environments (DDEV, Drupal VM, Symfony Local) and closed them so that I have the reference point if I should choose to use one of them in the future.

Honestly, Drupal VM felt the fastest (by a good margin—especially for installation), but it also feels very heavyweight... and means that I can't have the exact same setup in CI (and eventually in production, if I use Docker) as I have locally... which I don't particularly enjoy.

@geerlingguy
Copy link
Owner Author

So closing this issue and I might have some good material for a blog post at some point, otherwise I'll leave this as-is.

Also note: https://github.com/geerlingguy/drupal-the-fastest

@geerlingguy
Copy link
Owner Author

While working on #22, I decided to test things out with NFS. Might also try docker-sync or one of the other sync methods too.

@geerlingguy
Copy link
Owner Author

TIL, you can add a docker-compose.override.yml file and it will be merged into the structure of the main docker-compose.yml file. You an also specify multiple compose files with -f and they'll be merged. That's how I'll get things going for CI and local with different volume mounts.

@geerlingguy
Copy link
Owner Author

Heh, I also attempted a Drupal install without cached/delegated on the volume mount, and not only did it consume 5% of my battery (and 200% of my CPU), it took a whopping 5 minutes!

@geerlingguy
Copy link
Owner Author

Well, pretty happy now. I'll be summing this stuff up in a blog post.

@geerlingguy geerlingguy changed the title Test other local development environments Test and benchmark other local development environments Mar 12, 2020
@gitressa
Copy link

Thanks for the thorough bench-marking. I compared plain vanilla installs of Drupal 8 between ddev and Lando. They seem to perform almost at the same speed, except for Lando start, which takes 60 seconds, compared to ddev's 15 seconds.

System

  • Ubuntu 18.04
  • Composer 1.10.0
  • Docker 19.03.8
  • Lando v3.0.0-rc.23
  • ddev v1.13.1

Get the Drupal 8 code with Composer

$ time composer create-project drupal/recommended-project drupalddev
real  0m6,357s

Lando

$ time lando init --source cwd --recipe drupal8 --webroot web --name drupallando
real  0m0,334s

$ time lando start
real  1m1,861s

$ time drush site:install --db-url=mysql://drupal8:drupal8@database/drupal8 -y
real  0m16,639s

$ time curl http://drupallando.lndo.site
real  0m1,452s

$ time drush cache:rebuild
real  0m2,719s

ddev

$ time ddev config --project-type drupal8
real  0m0,040s

$ time ddev start
real  0m14,813s

$ time ddev exec drush site:install -y
real  0m15,121s

$ time curl http://drupalddev.ddev.site
real  0m1,325s

$ time ddev exec drush cache:rebuild
real  0m4,177s

@gitressa
Copy link

I just upgraded to the latest Lando v3.0.0-aft.2, and the first lando start of a new instance is 50% faster, down to half a minute. Just to clarify, I haven't timed the very first start after installing Lando itself, where PHP, MySQL and the rest of the software is downloaded. Here are the values for easier comparison, all times are in seconds:

Tool First start Start site:install 1st / page load (curl) cache:rebuild
ddev 1.13.1 11.3 11.2 15.1 1.3 4.2
Lando v3.0.0-rc.23 61.9 7.6 16.6 1.5 2.7
Lando v3.0.0-aft.2 28.6 9.3 16.5 1.5 2.7

@geerlingguy
Copy link
Owner Author

geerlingguy commented Mar 21, 2020

@gitressa - Thanks so much for adding these details here! It may be time to revisit my project https://github.com/geerlingguy/drupal-the-fastest and update things again for 2020.

@gitressa
Copy link

You're welcome @geerlingguy :-) Revisiting and updating the bench-marking project would certainly be of great interest to me, and surely many others.

I noticed that the Lando script also downloads Drush 10, which will take around 20 seconds longer, compared to for example ddev:

# Install Drush, then install Drupal inside Lando.
lando composer require drush/drush

https://github.com/geerlingguy/drupal-the-fastest/blob/master/methods/lando.sh
https://github.com/geerlingguy/drupal-the-fastest/blob/master/methods/ddev-local.sh

Lando does come with Drush 8.3.2 out of the box, but perhaps Drush wasn't included, when the lando.sh script was initially created?

I have created a PR which updates Lando and removes Drush installation geerlingguy/drupal-the-fastest#9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants