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

Improve: configuring php-fpm params #98

Open
nermalcat69 opened this issue Nov 26, 2024 · 0 comments
Open

Improve: configuring php-fpm params #98

nermalcat69 opened this issue Nov 26, 2024 · 0 comments
Assignees

Comments

@nermalcat69
Copy link
Contributor

PHP related change. Possibly add as a new page to a PHP runtime service section. Below is a description of what it does,

Configuring php-fpm Parameters in zerops.yml

1. Introduction

In zerops.yml, you can customize the configuration of php-fpm processes using environment variables. This allows you to optimize your application’s performance without modifying the server's core configuration.

2. Default Mode: dynamic

The dynamic mode is the default process management strategy for php-fpm. In this mode, the system automatically adjusts the number of processes based on current load.

  • Environment variables and their default values:
    • PHP_FPM_PM = dynamic
    • PHP_FPM_PM_MAX_CHILDREN = 20
    • PHP_FPM_PM_START_SERVERS = 2
    • PHP_FPM_PM_MIN_SPARE_SERVERS = 1
    • PHP_FPM_PM_MAX_SPARE_SERVERS = 3
    • PHP_FPM_PM_MAX_SPAWN_RATE = 32
    • PHP_FPM_PM_MAX_REQUESTS = 500

These values can be adjusted according to your requirements directly in zerops.yml.

3. Optional Mode: ondemand

The ondemand mode can be enabled by setting the PHP_FPM_PM variable to ondemand. This mode is ideal for applications with lower traffic, where processes are created only upon incoming requests.

  • Additional parameters:
    • PHP_FPM_PM_PROCESS_IDLE_TIMEOUT = 60s (time after which idle processes are terminated)

Other parameters (e.g., PHP_FPM_PM_MAX_CHILDREN) behave similarly to the dynamic mode.

4. Applying Changes

To update the configuration:

  1. Add or modify the environment variables in your zerops.yml file.
  2. Restart or reload the service for the changes to take effect.

For a detailed explanation of php-fpm parameters and modes, refer to the official php-fpm documentation.

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