docker-leantime icon indicating copy to clipboard operation
docker-leantime copied to clipboard

Optimizing the pm.max_children setting

Open johncadengo opened this issue 1 year ago • 1 comments

I'm getting this warning on a vanilla Leantime docker installation:

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

How do I update this setting within docker compose?

Related issue: https://github.com/Leantime/leantime/issues/2355

johncadengo avatar Apr 05 '24 01:04 johncadengo

I didn't find any way to configure it with docker-compose.yaml

You can configure it using Dockerfile

# Use leantime/leantime:latest as the base image
FROM leantime/leantime:latest

# Specify the working directory
WORKDIR /usr/local/etc/php/conf.d

# Update memory_limit in custom.ini
RUN sed -i 's/memory_limit = 1G/memory_limit = 5G/' custom.ini

# Add additional settings to custom.ini
RUN echo 'pm = dynamic' >> custom.ini \
    && echo 'pm.max_children = 50' >> custom.ini \
    && echo 'pm.start_servers = 10' >> custom.ini \
    && echo 'pm.min_spare_servers = 10' >> custom.ini \
    && echo 'pm.max_spare_servers = 20' >> custom.ini \
    && echo 'post_max_size = 50M' >> custom.ini \
    && echo 'upload_max_filesize = 50M' >> custom.ini

# The above settings in custom.ini does not seem to work. change php-fpm settings directly
RUN sed -i 's/^pm = .*/pm = dynamic/' /usr/local/etc/php-fpm.d/www.conf \
    && sed -i 's/^pm.max_children = .*/pm.max_children = 50/' /usr/local/etc/php-fpm.d/www.conf \
    && sed -i 's/^pm.start_servers = .*/pm.start_servers = 10/' /usr/local/etc/php-fpm.d/www.conf \
    && sed -i 's/^pm.min_spare_servers = .*/pm.min_spare_servers = 10/' /usr/local/etc/php-fpm.d/www.conf \
    && sed -i 's/^pm.max_spare_servers = .*/pm.max_spare_servers = 20/' /usr/local/etc/php-fpm.d/www.conf \
    && sed -i 's/^pm.max_requests = .*/pm.max_requests = 2000/' /usr/local/etc/php-fpm.d/www.conf

# Expose any necessary ports and define the entrypoint if needed

rqi14 avatar Jun 12 '24 03:06 rqi14

I'm getting this warning on a vanilla Leantime docker installation:

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

How do I update this setting within docker compose?

Related issue: Leantime/leantime#2355

First you must determine if you really need to update this value. When you see this warning, this means that the current pool cannot serve every request in realtime and requests are put in a queue. It is perfectly ok if you see this once in a while. It is not realistic to think that any server always has slots waiting to serve new requests. A lot of the time you are in a queue for a few ms.

The real question is: do you experience slowdowns? Do you get complaints about the performance?

Also remember that settings values too high can have the opposite effect. It depends on your machine and use-case.

phulstaert avatar Aug 08 '24 22:08 phulstaert

The new docker image increases these values and also uses nginx. Closing this for now if there are still issues with the system please add them to https://github.com/Leantime/leantime

marcelfolaron avatar Feb 18 '25 12:02 marcelfolaron