lando / acquia

The Official Acquia Lando Plugin
https://docs.lando.dev/acquia
GNU General Public License v3.0
2 stars 6 forks source link

Acquia Recipe Performance Issues #10

Closed mikemadison13 closed 1 year ago

mikemadison13 commented 3 years ago

Tell us about your setup

What is your lando version and operating system? (note that the older your version the less likely we are to reply)

Tell us about your .lando.yml

See https://github.com/Drupal4Gov/Drupal-GovCon-2017/blob/develop/.lando.yml

Tell us about the command you were running

This project has been using the drupal9 recipe for quite some time and we recently swapped to the Acquia recipe to help test. While things "work" what I'm noticing is that after running the VM / running commands in the VM (like automated tests, code linting, etc.) the VM just starts to crawl and becomes unresponsive. Pages won't load, commands seemingly silently fail (they just hang forever). If I destroy the VM and swap back to the drupal9 recipe I don't experience this. Nothing else changes other than the recipe (and the settings for the database, of course).

I've tried a fair bit of troubleshooting when this happens.... restart Lando, restart Docker, restart the computer, destroy and rebuild the vm, etc. The behavior is consistent with the Acquia recipe (and consistently not a problem with the drupal9 recipe).

Please detail the steps we can take to replicate this bug. Be as detailed as possible.

  1. Clone the govcon repository
  2. composer install
  3. lando start
  4. install all the things (lando blt setup)
  5. run / log into the site and browse around AND/OR run a command like lando blt validate. i typically start to see the issue within a few clicks in the UI or a minute or two into the validate run.

This bug is preventing me from using the acquia recipe.

poindexterous commented 3 years ago

I'm having a similar experience to @mikemadison13. We're in the middle of upgrading from d8 to d9 and decided to try out the Acquia recipe (since we have to revise our .lando.yml either way) but it's incredibly slow right from the start. Page load time is several minutes, cim sync and other drush commands are equally slow, and there seem to be some other oddities where "lando pull" doesn't seem to behave as expected when specifying an environment database even when using the --on-demand flag; it seems to be copying an old DB backup instead of copying the current active DB for the specified environment. I was previously testing the d9 recipe and it seemed to have much better performance. I wonder if it's the settings I have in the landofile? I have memcache turned off but I didn't think it would make a huge difference. This is still an experiment in progress for us.

I'm using: Windows pro Intel(R) Core(TM) i9-9900 CPU @ 3.10GHz 3.10 GHz, 32GB ram Lando version 3.1.4 Docker desktop 3.3.0

here's the lando file that I'm playing with:


name: {mysite}
recipe: acquia
config:
  acli_version: latest
  ah_application_uuid: {mysite uuid}
  ah_site_group: {mysite}
  php: '7.4'
  xdebug: true
  # Disable local mailhog by default.
  inbox: false
  # Disable local memcache by default.
  cache: false
  composer_version: '1.8.6'

services:
  phpmyadmin:
    type: phpmyadmin
    hosts:
      - database

proxy:
  phpmyadmin:
    - phpmyadmin.lndo.site
reynoldsalec commented 2 years ago

@mikemadison13 to be clear, are you switching over that linked Landofile to be the acquia recipe? Looks like it's a drupal9 recipe in that example. Would be helpful to know how you've tested this in exact steps so we can say with confidence that a stock recipe: drupal9 is, in fact, faster than a recipe: acquia.

Both of you seem savvy so you probably already know this, but make sure you've read through the Lando performance tips: https://docs.lando.dev/config/performance.html#performance

mikemadison13 commented 2 years ago

i've basically:

rubenvarela commented 2 years ago

I noticed a slow down as well and tracked it down to memcache.

On the memcache conditional, I had to add an and clause and exclude the “LANDO” environment.

mikemadison13 commented 2 years ago

I don't have any memcache config in my .lando file, so I guess if Acquia is standing up a memcache container and I need something, that could be it?

rubenvarela commented 2 years ago

The Acquia recipe has a memcache container.

This is the most recent Acquia documentation for memcache, https://docs.acquia.com/cloud-platform/performance/memcached/enable/

And on settings.php, the if will be valid,

if (file_exists('/var/www/site-php')) {
   require('/var/www/site-php/mysite/mysite-settings.inc');

   // Memcached settings for Acquia Hosting
   if (file_exists(DRUPAL_ROOT . '/sites/default/cloud-memcache-d8+.php')) {
      require(DRUPAL_ROOT . '/sites/default/cloud-memcache-d8+.php');
   }
}

The file, the first thing it has is,

if (getenv('AH_SITE_ENVIRONMENT') &&
  array_key_exists('memcache', $settings) &&
  array_key_exists('servers', $settings['memcache']) &&
  !empty($settings['memcache']['servers'])
) {

What I've had to do to regain performance is modify it to add && $_ENV['AH_SITE_ENVIRONMENT'] != 'LANDO'


The link to cloud-memcache-d8+.php is https://docs.acquia.com/_downloads/cloud-memcache-d8+.php

labboy0276 commented 2 years ago

The memcache service in /var/www/site-php/mysite/mysite-settings.inc is wrong. This setting $settings['memcache']['servers'] = ['memcached:11211' => 'default']; should be $settings['memcache']['servers'] = ['cache:11211' => 'default'];.

If you install the memcache modules that come with the acquia recipe and go to /admin/reports/memcache you will see that memcache is not working due to the incorrect settings.

wrong

With the settings adjusted, the memcache service is working:

right

Adjusting this cut my page load times in half.

This has been addressed in this PR: https://github.com/lando/acquia/pull/25

We will merge and cut a new release soon.

rubenvarela commented 2 years ago

@labboy0276 thank you for the fix!

I hadn’t dug that deep. Just had tracked it down to ‘memcache’ and had a workaround.

reynoldsalec commented 2 years ago

@rubenvarela your insight combined with @cdubz's PR was the key to figuring it out, so thanks for the work tracking it down...this is how open source is supposed to work!

maskedjellybean commented 7 months ago

What @rubenvarela pointed out here is very very problematic for anyone that doesn't want memcache enabled.

Since Lando sets $_ENV['AH_SITE_ENVIRONMENT'] to "LANDO", and cloud-memcache-d8.php is tracked in Git and can't be modified, and anything you add to local.settings.php runs AFTER cloud-memcache-d8.php, there is no way to prevent the "Use memcache as cache backend" code in cloud-memcache-d8.php from running (which runs on every page load).

The only way I can think is to unset AH_SITE_ENVIRONMENT in .lando.yml:

services:
  appserver:
    overrides:
      environment:
        AH_SITE_ENVIRONMENT:

I'm still testing to see if there are side affects to this.

maskedjellybean commented 7 months ago

I'll open a separate issue.

EDIT: Created: https://github.com/lando/acquia/issues/84