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

ddev-drupal9-solr makes ddev start take longer #26

Closed
gitressa opened this issue Jun 11, 2023 · 4 comments
Closed

ddev-drupal9-solr makes ddev start take longer #26

gitressa opened this issue Jun 11, 2023 · 4 comments

Comments

@gitressa
Copy link
Contributor

Problem

Normally, a Drupal 10 DDEV project takes 8-10 seconds to start, which is great. But if you install Solr with ddev get ddev/ddev-drupal9-solr (https://github.com/ddev/ddev-drupal9-solr) it slows down and ddev start takes about 35 seconds.

Here's the output after export DDEV_DEBUG=true && export DDEV_VERBOSE=true when starting a plain Drupal 10, and a Drupal 10 with Solr. I removed the first 40 lines, since they're identical:

Drupal 10

$ time ddev start
[...]
Pulling image for drud/ddev-dbserver-mariadb-10.4:v1.21.5 
Pulling image for phpmyadmin:5 
Pulling image for drud/ddev-webserver:v1.21.5 
Pulling image for drud/ddev-router:v1.21.5 
Pulling image for drud/ddev-ssh-agent:v1.21.5 
Executing docker-compose -f /home/user/dev/drupal10/.ddev/.ddev-docker-compose-full.yaml up --build -d 
Network ddev-drupal10_default  Created 
Container ddev-drupal10-web  Started 
Container ddev-drupal10-db  Started 
Container ddev-drupal10-dba  Started 
Testing to see if /mnt/ddev_config is properly mounted 
INFO[0007] starting app.Exec &{  ls -l /mnt/ddev_config/nginx_full/nginx-site.conf >/dev/null [] false false <nil> <nil>} at 20:29:36.161027021 
INFO[0007] PERF: app.Exec &{  ls -l /mnt/ddev_config/nginx_full/nginx-site.conf >/dev/null [] false false <nil> <nil>} took 0.21s 
Container ddev-router  Running 
Ensuring write permissions for drupal10 
Existing settings.php file includes settings.ddev.php 
INFO[0008] starting app.Exec &{db  mysql -e "SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;" 2>/dev/null [] false false <nil> <nil>} at 20:29:37.553466319 
INFO[0009] PERF: app.Exec &{db  mysql -e "SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;" 2>/dev/null [] false false <nil> <nil>} took 0.13s 
Ensuring write permissions for drupal10 
Successfully started drupal10 
Project can be reached at https://drupal10.ddev.site https://127.0.0.1:33009 
INFO[0009] PERF: main() took 9.04s                      

real  0m9,104s
user  0m0,415s
sys 0m0,145s

Drupal 10 with Solr

$ time ddev start
[...]
Pulling image for drud/ddev-dbserver-mariadb-10.4:v1.21.5 
Pulling image for phpmyadmin:5 
Pulling image for solr:8 
Pulling image for drud/ddev-webserver:v1.21.5 
Pulling image for drud/ddev-router:v1.21.5 
Pulling image for drud/ddev-ssh-agent:v1.21.5 
Executing docker-compose -f /home/user/dev/d10solr/.ddev/.ddev-docker-compose-full.yaml up --build -d 
Network ddev-d10solr_default  Created 
Container ddev-d10solr-web  Started 
Container ddev-d10solr-db  Started 
Container ddev-d10solr-solr  Started 
Container ddev-d10solr-dba  Started 
INFO[0003] starting CopyIntoVolume /home/user/dev/.local/share/mkcert ddev-global-cache at 20:27:34.528600635 
Copied /home/user/dev/.local/share/mkcert:CopyIntoVolume_ntmekywxlxhy into /mnt/v/mkcert in 104.923129ms 
Exec chown -R 1000 /mnt/v/mkcert stdout=, stderr=, err=<nil> 
INFO[0004] PERF: CopyIntoVolume /home/user/dev/.local/share/mkcert ddev-global-cache took 0.55s 
Pushed mkcert rootca certs to ddev-global-cache/mkcert 
Testing to see if /mnt/ddev_config is properly mounted 
INFO[0007] starting app.Exec &{  ls -l /mnt/ddev_config/nginx_full/nginx-site.conf >/dev/null [] false false <nil> <nil>} at 20:27:38.393838787 
INFO[0007] PERF: app.Exec &{  ls -l /mnt/ddev_config/nginx_full/nginx-site.conf >/dev/null [] false false <nil> <nil>} took 0.19s 
Container ddev-router  Started 
Ensuring write permissions for d10solr 
Existing settings.php file includes settings.ddev.php 
INFO[0034] starting app.Exec &{db  mysql -e "SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;" 2>/dev/null [] false false <nil> <nil>} at 20:28:05.057264093 
INFO[0034] PERF: app.Exec &{db  mysql -e "SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;" 2>/dev/null [] false false <nil> <nil>} took 0.13s 
Ensuring write permissions for d10solr 
Successfully started d10solr 
Project can be reached at https://d10solr.ddev.site https://127.0.0.1:32985 
INFO[0034] PERF: main() took 34.26s                     

real  0m34,314s
user  0m0,599s
sys 0m0,162s
@rfay
Copy link
Member

rfay commented Jun 11, 2023

I assume you created this in ddev-contrib but wanted it to be in ddev-drupal9-solr?

The reason it takes longer to start up is that DDEV waits for the solr container to be ready to serve; ddev start does this for any additional service, waiting for all services to be ready before you use them.

The healthcheck is at https://github.com/ddev/ddev-drupal9-solr/blob/799e69a85726244c60d72f24143c2f10af76383c/docker-compose.solr.yaml#L77-L78

Apache solr is written in java; it's a very heavyweight daemon, and it takes some time for it to come up.

You could remove the healthcheck if you wanted, but then if you started using ddev immediately after it said it was ready you might get errors or unpredictable behavior from solr.

@gitressa
Copy link
Contributor Author

gitressa commented Jun 12, 2023

Ah yes, perhaps you can move the issue to ddev-drupal9-solr?

Thanks for the explanation. But isn't it interesting that Solr Cloud DDEV integration starts up faster?

$ time ddev start
Starting d10solr... 
Network ddev-d10solr_default  Created 
Container ddev-d10solr-dba  Started 
Container ddev-d10solr-db  Started 
Container ddev-d10solr-zoo  Started 
Container ddev-d10solr-solr1  Started 
Container ddev-d10solr-solr3  Started 
Container ddev-d10solr-web  Started 
Container ddev-d10solr-solr2  Started 
Container ddev-router  Started 
Successfully started d10solr 
Project can be reached at https://d10solr.ddev.site https://127.0.0.1:32913 

real	0m12,717s
user	0m0,399s
sys	0m0,201s

Could it be because there is no health check for the Solr Cloud DDEV solution?

How can I disable the healthcheck for ddev/ddev-drupal9-solr?

PS. Tip to get the Docker and security file placed with one-liners :)

wget -P .ddev https://raw.githubusercontent.com/ddev/ddev-contrib/master/docker-compose-services/solr/docker-compose.solr.yaml
curl https://raw.githubusercontent.com/ddev/ddev-contrib/master/docker-compose-services/solr/solr/security.json --create-dirs -o .ddev/solr/security.json && chmod 755 .ddev/solr

@rfay
Copy link
Member

rfay commented Jun 12, 2023

As you suggest, I imagine that the Solr Cloud recipe does not have a healthcheck, so DDEV doesn't know that the solr daemon hasn't finished starting up, so you'll see errors if you try to use it too soon.

To disable the ddev-drupal9-solr healthcheck you could

  1. Edit the docker-compose.solr.yaml to remove the healthcheck and remove #ddev-generated
  2. Add a docker-compose.solr-nohealthcheck.yaml with something like:
services:
  solr:
    healthcheck:
      test: [true]

But as explained above, this may or not mess up your use-case. If you don't often use search before the solr daemon is ready, it won't be a problem.

Note that you can also just ctrl-c the ddev start after you've seen the services come up and it will all work fine.

@rfay rfay changed the title Solr slows down start up ddev-drupal9-solr makes ddev start take longer Jun 12, 2023
@rfay rfay transferred this issue from ddev/ddev-contrib Jun 12, 2023
@gitressa
Copy link
Contributor Author

Thanks for moving and updating the issue.

I imagine that the Solr Cloud recipe does not have a healthcheck, so DDEV doesn't know that the solr daemon hasn't finished starting up, so you'll see errors if you try to use it too soon.

That would also explain some odd errors I saw right after starting DDEV, when I was still experimenting with Solr Cloud. Apart from the errors, things seemed all right.

Thanks for the tips about skipping health check. I can't make the Docker file solution work, but Ctrl + C works very well, so I'll use that when I feel impatient.

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