Issues with NC Docker (apache2/mariadb)


i’ve run into a problem with my Nextcloud instance. I am using Nextcloud within docker containers the setup looks like this:

Name Image
nc_app nextcloud:24
nc_collabora collabora/code:latest
nc_db mariadb:latest
nc_redis redis:alpine
nc_cron nextcloud:latest

After some time the instance stops working. Sometimes the website just dosen’t load anymore, or are extremly slow.
Other times the mariadb and apache2 report the following errors:

mariadb log:

2022-07-13 11:28:23 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections)

app log:

[Wed Jul 13 10:48:19.590369 2022] [mpm_prefork:error] [pid 1] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

The storage in this case is a NFS Share, but that seems fine as it is working flawless for many other services.
However almost every user uses the files from this nexcloud instance via WebDav, if that makes any difference at all, and the connections run through traefik (maybe thats a bottleneck?)

I thought about raising the max_connections limit for mariadb and restart the apache2 service with a cron job, but i don’t know if this is a good way to solve the issues.

Any ideas, what i can check in this case? If raising the max_connections and using a cron job for restarts does anyone know how to do this through ENV variables?

1 Like