Help setting up nextcloud correctly

Hi,

I have my nextcloud server running to save some photos on it.
So far its a simple setup with docker-compose.
I have all my containers running behing Traefik2 reverse proxy and the Nextcloud image with apache2 and I have the following code for that container:

  Nextcloud:
    container_name: Nextcloud
    image: nextcloud
    restart: unless-stopped
    network_mode: bridge
    environment:
      - PUID=99
      - PGID=100
    ports: 
      - 9001:80
    volumes:
      - "${SETTINGS}/Nextcloud/config:/var/www/html/config"
      - "${SETTINGS}/Nextcloud/www:/var/www/html/"
      - "/mnt/user/Nextcloud:/var/www/html/data"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nextcloud-http.entrypoints=http"
      - "traefik.http.routers.nextcloud-http.rule=Host(`cloud.${DOMAIN}`)"
      - "traefik.http.routers.nextcloud-http.middlewares=https-redirect@file"

      - "traefik.http.routers.nextcloud-https.entrypoints=https"
      - "traefik.http.routers.nextcloud-https.tls=true"

      - "traefik.http.routers.nextcloud-https.rule=Host(`cloud.${DOMAIN}`)"
      - "traefik.http.routers.nextcloud-https=nextcloud"
      - "traefik.http.routers.nextcloud-https.service=nextcloud"

      - "traefik.http.services.nextcloud.loadbalancer.server.port=80"

It is working and I can save things on it, but I ended up having some problems while using the online client.

For example, when I uploaded multiple files at once (for example 200), since there were multiple concurrent requests, some would fail.

But the worst is when I enter in a folder and it tries to generate all the thumbnails. When that happens, depending on the folder, the apache2 service ramps up to 100% CPU and 100% memory and all containers fail, getting with all my resources at 100%.

The server has unraid with a Ryzen 3700x (8 cores) and 32GB RAM, so I don’t think this is normal.

Can anyone lead me on what I’m doing wrong on the setup?

Thank you in advance!

Do do have configured all tuning option?
https://docs.nextcloud.com/server/19/admin_manual/installation/server_tuning.html

I also get sometimes problems. Today i deleted 100 files in a folder and three files were not deleted. So i had to delete them again.