Nextcloud memory usage on a 4GB RPi4 with Ubuntu 20.04

Nextcloud version : 20.0.2
Operating system and version: Ubuntu 20.04 64bits
Nginx and mariaDB
PHP version: FPM 7.4.3
System: 4GB Raspberry pi
Note: There is also a PlexMedia Server on this instance which I use to stream the photos, musics and films from the nextcloud storage.

Hello, I have a strange ram usage on my raspberry pi.

I configured a pool for php-fpm with these parameters:

and here is my mysql conf file, my.conf

Using Nextcloud seems to create a lot of mysql connections that use about 1Gb or RAM. I expected them to be released after 60s since my wait-timeout in my.conf is 60.

But they are not released. Thus, it continues to create more and more connections (to the default mysql max values: 150) leading to using swap which slows down the performances.

Does any one have an idea? is there any trouble in my conf files?

Why should Nextcloud access the database so often? I think it might be possible that the file locking is done via your database. Make sure that you’ve configured e.g. Redis to be used for file locking instead of the database.

Hello, thanks.
Yes I’m using Redis with this conf

‘filelocking.enabled’ => true,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ => array(
‘host’ => ‘localhost’,
‘port’ => 6379,
‘timeout’ => 0.0,
),