Skip to content

Improve: configuring php-fpm params #98

@nermalcat69

Description

@nermalcat69

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions