Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem?
This was initially reported in discord: https://discord.com/channels/664580571770388500/1337106988563169280
DDEV seems to be using PHP-fpm + apache mpm_prefork at the moment which can make a single page with lots of assets (js/css/fonts/images) very slow to load.
It seems mpm_event is more common and can handle a lot more concurrent requests.
To reproduce:
mkdir my-drupal-site && cd my-drupal-site
ddev config --webserver-type=apache-fpm --project-type=drupal11 --docroot=web
ddev start
ddev composer create drupal/recommended-project:^11
ddev composer require drush/drush
ddev drush si -y
ddev drush cset system.performance js.preprocess 0 -y
ddev drush cset system.performance css.preprocess 0 -y
ddev launch $(ddev drush uli)
Now go to https://my-drupal-site.ddev.site/node/add/article
Open the inspector network tab, disable cache and sort on Time or Response time
Refresh a few times, we can see that lots of assets take 1-6 seconds to load! This makes the overall page (first contentful paint) really slow to load.
Switch to mpm_event within the web container (ddev exec bash):
a2dismod mpm_prefork
a2enmod mpm_event
sleep 3
service apache2 restart
And compare the response times (now around 200ms at most in my case).
Describe your solution
It seems there is no reason to use mpm_prefork with PHP-fpm.
Switching to mpm_event makes a huge difference.
Either:
- switch to mpm_event unconditionally
- or provide a config option for users to choose the apache MPM (mpm_event|mpm_prefork|mpm_worker) ?
Describe alternatives
No response
Additional context
No response