Improving Drupal site performance
We have a single server Drupal 9 site (yes, old and we are upgrading) we would like to maximize the performance on. It's a VM with 6 CPU, 12GB RAM, running Apache 2.4 and PHP 8.4. We are currently running the prefork MPM but are testing the following changes:
- Event MPM
- PHP8-FPM
- Opcache
Memory isn't an issue as "free -h" shows no swap being used with 10GB free. The server does require a login via the Drupal simpleSAMLphp module. We are not doing any front-end (i.e. Varnish) or backend (e.g. Redis) caching. We are currently load testing using a script that spawns browser instances from Selenium Grid though we plan to look into k5/locust which would require less testing overhead.
A few questions in terms of setting parameters for the above:
- This server is dedicated to serving web pages with Drupal. Should we lean towards pm=static vs pm=ondemand/dynamic? We are currently using
pm=dynamic. - Each php-fpm process seems to consume no more than 100MB. Should we simply divide available memory/100MB to determine the value for
pm.max_children? - We are looking at the Opcache status from https://github.com/rlerdorf/opcache-status and the numbers look good. Anything we should pay attention to for the opcache settings in PHP-FPM?
- Any MariaDB settings we should look into?
When load testing the server with 40-50 users, top and mpstat show the following with:
pm.max_children = 30pm.start_servers = 9pm.min_spare_servers = 6pm.max_spare_servers = 12pm.max_requests = 100
top - 20:05:00 up 1:10, 15 users, load average: 4.85, 2.17, 1.82 Tasks: 373 total, 5 running, 368 sleeping, 0 stopped, 0 zombie %Cpu(s): 74.8 us, 8.9 sy, 0.0 ni, 14.3 id, 1.5 wa, 0.0 hi, 0.4 si, 0.0 st MiB Mem : 15691.45+total, 11877.61+free, 2856.645 used, 1348.715 buff/cache MiB Swap: 32767.99+total, 32767.99+free, 0.000 used. 12834.80+avail Mem 20:05:01 CPU %usr %nice %sys %idle 20:05:02 all 87.65 0.00 11.69 0.00 20:05:02 0 89.00 0.00 10.00 0.00 20:05:02 1 88.89 0.00 10.10 0.00 20:05:02 2 86.00 0.00 14.00 0.00 20:05:02 3 88.00 0.00 11.00 0.00 20:05:02 4 86.00 0.00 14.00 0.00 20:05:02 5 88.00 0.00 11.00 0.00 According to /fpm-status, active process=30. The performance seems to indicate the site performance at 40-50 users is under load as response is <3s. 40-50 users seems low but it seems we are running into CPU issues so unless we can get CPU usage down, I don't see the number of users increasing.
[link] [comments]