Nextcloud plugin uses a lot of memory

Foergy

Cadet
Joined
Jan 5, 2024
Messages
1
After a long search why my TrueNAS instance takes so much memory for services, I found out that the Nextcloud plugin takes a huge amount of memory for spawning a lot of php-fm instances (using top -o res). The instance took in total about 6 of my 8 GB RAM on my home server and about 20 of 64 GB RAM on the company server.

After some more research I found out that the default php settings of the plugin are obviously chosen for really large Nextcloud instances with hundreds or thousands of parallel requests. This is is far away from the scenario at home or in a small company.

The default settings in /usr/local/etc/php-fpm.d/nextcloud.conf are:

Code:
pm = dynamic
pm.max_children = 100
pm.start_servers = 25


which means at least 25 php-fm server instances (!) without any traffic and up to 100 instances.

Changing the settings to (installing and using nano inside the jail):

Code:
pm = ondemand
pm.max_children = 50


the server opens new php-fp server instances only if required and my memory is now nicely tidied up and available for the ZFS cache again.

The TrueNAS version is TrueNAS-13.0-U6.1 on both systems, one is a HP MicroServer, the other a SuperMicro Storage server.
 

somethingweird

Contributor
Joined
Jan 27, 2022
Messages
183
Just to added

Code:
 ; Choose how the process manager will control the number of child processes.
; Possible Values:
;   static  - a fixed number (pm.max_children) of child processes;
;   dynamic - the number of child processes are set dynamically based on the
;             following directives. With this process management, there will be
;             always at least 1 children.
;             pm.max_children      - the maximum number of children that can
;                                    be alive at the same time.
;             pm.start_servers     - the number of children created on startup.
;             pm.min_spare_servers - the minimum number of children in 'idle'
;                                    state (waiting to process). If the number
;                                    of 'idle' processes is less than this
;                                    number then some children will be created.
;             pm.max_spare_servers - the maximum number of children in 'idle'
;                                    state (waiting to process). If the number
;                                    of 'idle' processes is greater than this
;                                    number then some children will be killed.
;  ondemand - no children are created at startup. Children will be forked when
;             new requests will connect. The following parameter are used:
;             pm.max_children           - the maximum number of children that
;                                         can be alive at the same time.
;             pm.process_idle_timeout   - The number of seconds after which
;                                         an idle process will be killed.
; Note: This value is mandatory.
 
Top