Skip to content

Conversation

paulbrzeski
Copy link
Contributor

Sharing a couple of changes we've made to our Trellis so we can fine tune PHP settings for high traffic websites.

Changes include,

  • PHP-FPM crash prevention and optimisation
  • Small improvements to make things more semantic
  • Various configs to support above

This PR only provides the defaults, you can override these settings like any other using your group_vars configs.

PHP FPM for a server sharing environment with MariaDB.
New variables to add to group_vars/%ENV%/php.yml,

# Allow a max of 100 children, based on 16GB of ram and 164mb per child.
php_fpm_pm_max_children: 100
# Start and go up in small incremenets as we have the CPU to spare.
php_fpm_pm_start_servers: 5
php_fpm_pm_min_spare_servers: 5
php_fpm_pm_max_spare_servers: 35
# Allow lots of requests as we have the resources to spare.
php_fpm_pm_max_requests: 1000

# Emergency restart settings.
# Restart after 60 seconds if 10 PHP instances have not responded for 5 min

# Number of child processes not responding
php_fpm_set_emergency_restart_threshold: true
php_fpm_emergency_restart_threshold: 10

# Length of time children not responding.
php_fpm_set_emergency_restart_interval: true
php_fpm_emergency_restart_interval: 5m

# Time to wait before restarting after interval passes.
php_fpm_set_process_control_timeout: true
php_fpm_process_control_timeout: 60s

More info - https://geekflare.com/php-fpm-optimization/

(previously #1430)

Copy link
Member

@swalkinshaw swalkinshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Would you be able to rebase this to fix the conflict?

@@ -0,0 +1,151 @@
;;;;;;;;;;;;;;;;;;;;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add ; {{ ansible_managed }} here?

paulbrzeski and others added 17 commits March 3, 2023 13:07
`geerlingguy.mailhog` doesn't support arm64 (Apple Silicon) because the underlying binaries (`mailhog` and `mhsendmail`) don't have official `arm64` builds.

To support this by default, we need to override the url variables to point to forks that have these builds.

This adds a new "shim loader" `mailhog` role which simply loads the proper vars and then passes them to the included `geerlingguy.mailhog` role.
* chore(deps): add renovate.json

* Enable ansible-galaxy in renovate config

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Scott Walkinshaw <scott.walkinshaw@gmail.com>
`ubuntu-latest` recently changed to Ubuntu 22.04
Bugs/regressions in 2.13.6 have been fixed
This removes another place where `vagrant` is harcoded while still
ensuring its set to that value according to `dev.yml`'s `remote_user`
setting.
`ansible_user` can't be assumed to be defined during Ansible local
provisioning (the default mode in Vagrant if Ansible is not installed on
the host machine).
@paulbrzeski paulbrzeski force-pushed the php-tuning-settings branch from da0c2e2 to 80cfd97 Compare March 3, 2023 13:13
@paulbrzeski
Copy link
Contributor Author

This should be good to go now @swalkinshaw

@swalkinshaw
Copy link
Member

See #1496

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

Successfully merging this pull request may close these issues.

4 participants