Skip to content

Variables or at least better defaults for PHP pm.* settings #1982

Closed

Description

@t3easy

The default values for

pm.max_children
pm.start_servers
pm.min_spare_servers
pm.max_spare_servers

are not usable in production in most Nextcloud installations.

In the new docs, there is a part that these settings should be changed depending on the available resources:
https://docs.nextcloud.com/server/26/admin_manual/installation/server_tuning.html#tune-php-fpm

Older docs had some example values:
https://docs.nextcloud.com/server/21/admin_manual/installation/server_tuning.html#tune-php-fpm

If these settings are not changed, the Nextcloud no longer responds when the load increases.

[pool www] server reached pm.max_children setting (5), consider raising it

The docker image should provide better defaults for PHP pm.* settings and environment variables to change them without building the image.

Activity

  1. J0WI commented on May 25, 2023

    @J0WI
    Contributor

    Duplicate of #1969

  2. rugk commented on May 25, 2023

    @rugk
    Contributor

    I think this issue is not actually a real duplicate IMHO. Could not you e.g.:

    • configure these settings to at least somewhat higher number?
    • at the first start of the container automatically calculate a value that is considered to be "good" (e.g. based on the ram or whatever) likely in a shell script
    • or, maybe in addition, include, if possible, a check for a good value in the Nextcloud "health/system check" admin page (would be am issue for the Nextcloud php project itself of course, however)?
  3. J0WI commented on May 25, 2023

    @J0WI
    Contributor

    There is some attempt in #1766 and #1964. We can't make any assumption about the host system. This may range from a tiny SOC board to a large root server and from single purpose hosts to one that shares it's resources with many other services. There is no "good" default or at least I'm not aware of a "good" way to calculate it.

  4. t3easy commented on May 26, 2023

    @t3easy
    ContributorAuthor

    @J0WI I would assume that a docker host has at least 4 GB RAM and is dedicated for the Nextcloud stack. If this parameters can be changed for larger or smaller hosts by environment variables like the PHP memory and upload limit https://github.com/nextcloud/docker/blob/master/26/fpm-alpine/Dockerfile#L81 this should be a good solution.
    Otherwise you force the users to build an own image extending Nextcloud or mount a config into the container.

  5. t3easy commented on Jun 28, 2023

    @t3easy
    ContributorAuthor

    This is what I did:

    FROM nextcloud:${NEXTCLOUD_VERSION}-fpm-alpine
    
    # ...
    
    ENV PHP_PM_MAX_CHILDREN=5
    ENV PHP_PM_START_SERVERS=2
    ENV PHP_PM_MIN_SPARE_SERVERS=1
    ENV PHP_PM_MAX_SPARE_SERVERS=3
    
    RUN set -eux; \
        { \
            echo '[www]'; \
            echo 'pm.max_children = ${PHP_PM_MAX_CHILDREN}'; \
            echo 'pm.start_servers = ${PHP_PM_START_SERVERS}'; \
            echo 'pm.min_spare_servers = ${PHP_PM_MIN_SPARE_SERVERS}'; \
            echo 'pm.max_spare_servers = ${PHP_PM_MAX_SPARE_SERVERS}'; \
        } | tee "/usr/local/etc/php-fpm.d/zz-pm.conf"

    The defaults are those from /usr/local/etc/php-fpm.d/www.conf so there is no change for existing installations. I cloud provide a PR if you like.

  6. skl256 commented on Oct 19, 2023

    @skl256

    @t3easy Thank you very mush! My problem (freeze when rewinding video) solved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions