Hey I been encountering an issue and wonder if I am the only one.
I installed a working nextcloud multiple times now and always had the same issue.
As seen in the image my WSL 2 Ubuntu takes all RAM it wants and after that CPU usage goes crazy. Nextcloud / Ubuntu is not responding in this stage. If I clear the ram with the command “sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches***”
it seems not to happen.
I’m very familiar with this issue, as I struggled with it for over two years on my Nextcloud Snap and Nextcloud AIO servers (both running on Ubuntu Server).
Just like in your case, my server kept crashing, especially when uploading larger files. I tried to address the problem by clearing the memory every minute via cron, but this didn’t help much.
To minimize crashes, I started uploading larger files via SSH and then rescanned the files on the server.
Since I don’t know what platform you’re running on, I can’t say whether my approach is directly applicable to your setup, but I recommend giving it a try if possible.
Feel free to reach out if you have any questions.
Mine is not directly crashing but as you said when uploading many files or big files. Big files are the bigger problem. I am still running a Windows 10 machine with WSL 2 for Ubuntu as my server but maybe I will use a dedicaded Linux in future. So thank you already for that guide. I think it will be useful in future
WSL2 is basically a VM runs with Hyper-V as it’s hypervisors but much tightly integrated with Windows than a conventional Hyper-V VM. However, underneath, it is a VM layer with Hyper-V as it’s backend.
I have been a long term user of Nextcloud running via Hyper-V and dynamic memory management with Linux or anything apart from Windows VMs are a common problem of Hyper-V.
In theory, Hyper-V is supposed to increase or decrease the RAM allocation based on the RAM requirement of the Guest OS but due to Linux memory caching, it never works out as it is suppose to. Once some amount of RAM is allocated to the Linux Guest, Hyper-V can’t reclaim that back.
However, with Windows as Guest OS on Hyper-V, this feature works flawlessly.
This Dynamic RAM management works flawlessly with QEMU as hypervisor. Where Linux Guest runs on Linux Host.
Coming to the issue now, since WSL2 is just basically a Hyper-V VM, consider running Ubuntu as a standalone Hyper-V VM then deploy Nextcloud snap in that Ubuntu VM. WSL2 wont give you the ability to limit RAM usage but standalone Hyper-V will.