where to set pm.max_children
When searching on my site, friendica gets unresponsive. I see in the logs that it asks to raise the value of pm.max_children.
However, on the docker image I can't find those settings.
Could you help me?
Just mount your own php config file into the container like described here:
https://serverfault.com/questions/884256/how-and-where-to-configure-pm-max-children-for-php-fpm-with-docker
Does this help?
Sure, thanks! But it would be nice to have it configured by env variables like some of the other preferences, no?
Best, Francis
On 31 Jan 2025, at 11:59, ne20002 @.***> wrote:
Just mount your own php config file into the container like described here:
https://serverfault.com/questions/884256/how-and-where-to-configure-pm-max-children-for-php-fpm-with-docker
Does this help?
β Reply to this email directly, view it on GitHub https://github.com/friendica/docker/issues/275#issuecomment-2626931010, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT2F44CGJSYS6FAPV47D3L2NNJS7AVCNFSM6AAAAABVDTS5E6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRWHEZTCMBRGA. You are receiving this because you authored the thread.
It's always difficult to decide what configuration values shall be available as env variables for a docker image. There are many. As you're the first asking for this I'd rather go with the 'mounting your own config file' approach.
Fair enough. But the issue here is that Friendica is almost unusable with the default configs. pm.macx_children leads quickly to errors with the default values.
On 31 Jan 2025, at 12:13, ne20002 @.***> wrote:
It's always difficult to decide what configuration values shall be available as env variables for a docker image. There are many. As you're the first asking for this I'd rather go with mounting your own config file approach.
β Reply to this email directly, view it on GitHub https://github.com/friendica/docker/issues/275#issuecomment-2626955838, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT2F45L3YUDLTSSGLK5B7T2NNLENAVCNFSM6AAAAABVDTS5E6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRWHE2TKOBTHA. You are receiving this because you authored the thread.
As said, it's the first time I hear this but I'm willing to take a deeper look on the issue. Which version of friendica and which docker image are you using? How many users do ou have on the system?
@nupplaphil, @annando, @MrPetovan maybe you can help? Is pm.max_children ever been an issue?
The last version, 2024.12-fpm. I have around a dozen users, I think. But I notic4ed this since the start.
On 31 Jan 2025, at 13:39, ne20002 @.***> wrote:
As said, it's the first time I hear this but I'm willing to take a deeper look on the issue. Which version of friendica and which docker image are you using? How many users do ou have on the system?
@nupplaphil https://github.com/nupplaphil, @annando https://github.com/annando, @MrPetovan https://github.com/MrPetovan maybe you can help? Is pm.max_children ever been an issue?
β Reply to this email directly, view it on GitHub https://github.com/friendica/docker/issues/275#issuecomment-2627187567, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT2F46B4SAXB6MRRPLJGEL2NNVHRAVCNFSM6AAAAABVDTS5E6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRXGE4DONJWG4. You are receiving this because you authored the thread.
I'm still using the Apache2 PHP module over here, so I'd be hard-pressed to give advice on php-fpm. π
Fair enough. But the issue here is that Friendica is almost unusable with the default configs. pm.macx_children leads quickly to errors with the default values.
@oculos, as these kind of warnings often don't point the problem and as you are the first to ask I don't want to put too much effort into adding this as an env variable. I also don't have the setup to test it. But a dozen users shouldn't give friendica any problems, not even on a raspberry pi.
I suggest you try to fix this by mounting your own config file into the container and check if you can resolve the issue by modifying values. If this is successful we will hopefully get more information to decide how to handle this. Is this ok?
I saw today that I got these with the default docker:
PHP Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 8388616 bytes) in /var/www/html/src/Protocol β
β
There is the Site / administration / workers pannel in the admin console webui where you can set Maximum number of parallel workers
It may be
- the good place to add pm.* parameters one day
- an inspiration so keep
pm.max_childrenin sync withMaximum number of parallel workers
This details of process handling in php are beyond my knowledge (tended to write paygrade ;)
But looking at @m33m33 's answer about syncing pm.max_children and Number of parallel workers I'm not sure we can modifiy a php config file from the Friendica web app. Also, is it required to keep them in sync? What is the impact?
Parallel workers are spawned using PHP CLI, nothing to do with PHP-FPM, so there's no reason to link them together. Also Friendica indeed can't change fpm's configuration.
Does this also apply to fpm images ?
It seems that pm.max_children and related settings are usually calculated based on the available memory and the average/max memory used per process. For the docker images I would default to 1GB of memory. But what is the average/max memory usage of processes by Friendica? Any suggestions?
I have a 512Mb max memory per script execution on my Apache install, not sure if it's relevant.
This is one source I found (others are similar). I think when we collect the info from different systems we may get a pretty good number to use.
My concern is scalability. It would be nice to increase/decrease these things as one sees fit in case thereβs need for that.
On 27 Feb 2025, at 21:12, ne20002 @.***> wrote:
ne20002 left a comment (friendica/docker#275) This is one source I found (others are similar). I think when we collect the info from different systems we may get a pretty good number to use.
β Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
https://chrismoore.ca/2018/10/finding-the-correct-pm-max-children-settings-for-php-fpm/ https://github.com/friendica/docker/issues/275#issuecomment-2689013034 https://github.com/notifications/unsubscribe-auth/ABT2F42RGAEGVHB2MU4ASD32R5WUFAVCNFSM6AAAAABVDTS5E6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBZGAYTGMBTGQ
ne20002 left a comment (friendica/docker#275) https://github.com/friendica/docker/issues/275#issuecomment-2689013034 This https://chrismoore.ca/2018/10/finding-the-correct-pm-max-children-settings-for-php-fpm/ is one source I found (others are similar). I think when we collect the info from different systems we may get a pretty good number to use.
β Reply to this email directly, view it on GitHub https://github.com/friendica/docker/issues/275#issuecomment-2689013034, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT2F42RGAEGVHB2MU4ASD32R5WUFAVCNFSM6AAAAABVDTS5E6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBZGAYTGMBTGQ. You are receiving this because you were mentioned.
We must find a good starting point at first. One good for most and hobby users. Friendica is running on a small machine with only 1GB RAM, e.g. Raspi or VPS. When raising these values we need to ensure that those instances don't get into trouble.
Configuration is a good thing. The easiest way is always to mount your own config file into the container. As those configuration require knowledge (or try and error or both) I assume people needing tweaking these values know how to do this and how to work with dockerized applications.
Maxing these configuration values need info about the machine and can not easily be collected (e.g. memory on a machine running multiple applications with docker 'sharing' its memory).
Let's see where we land with a new default.
To get a bit more insight I added the following to my configuration:
- enable the fpm status page as described here. For this I mounted a config file including
pi@dmz1:/mnt/pods/friendica/etc$ cat docker-fpm.conf
pm.status_path = /status
as /usr/local/etc/php-fpm.d/zz-docker-fpm.conf into the container.
- add the correspondig location to my nginx.conf
location /status {
access_log off;
allow 10.0.0.0/8;
allow 127.0.0.0/8;
allow 192.168.0.0/16;
allow fc00::/7;
deny all;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php-handler;
}
The result gives some more insight on the current configuration and is worth watching it:
pi@dmz1:/mnt/pods/friendica/etc$ curl -4 dmz1:8012/status
pool: www
process manager: dynamic
start time: 02/Mar/2025:09:41:04 +0100
start since: 1624
accepted conn: 122
listen queue: 0
max listen queue: 0
listen queue len: 4096
idle processes: 1
active processes: 1
total processes: 2
max active processes: 2
max children reached: 0
slow requests: 0
The current values for the pm in the docker file are:
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3