Really Slow Nextcloud on Raspberry Pi 4 4GB RAM with external SSD

Hi everyone,

I am facing some issues with Nextcloud on DietPi at a Raspberry Pi 4 with 4 GB RAM.
I am using an extern USB M2 SDD, so usually it should ran fast. Raspberry PI and my Computer is connected over 1 GBits Ethernet.

Site loading in Nextcloud takes 2-5 s, which is a kind of annoying when you are browsing through the folders or just want to add a task/date in the calendar. Uploading pictures works with max. 10 MB/s, upload and a 2-3 GB ISO Image also only uploads with around 10 MB/s. But not constantly. The upload drops to 0 or a few kB every second and then briefly jumps back to 10 MB/s. I am not an expert but this looks like a caching problem.

I also tried to move everything on my SSD, but when I moved the user_data folder to my SSD everything messed up and I had no access to Nextcloud anymore and there were a lot of errors with MariaDB. Even when I moved the folder back, nothing worked, so I reflashed the Dietpi image.

I installed Dietpi 32 bit, then installed Nextcloud with the Dietpi Software Manager and mounted my M.2. USB SSD with the Drive Manager. In Nextcloud I added my SSD as external storage and copied my files on it.

I am a beginner so I don’t know yet where to make relevant settings and where to find the config files.

What could be the problem?
Thanks for your help!


we could have helped with the issues on MariaDB that time :wink:

Anyway I would recommend to flash DietPi directly and your SSD and boot the system from SSD without SD Card plugged in. This way your entire system is located on SSD. It should improve general system performance and you don’t need to deal with external storage in NextCloud.

Ok I have now test installed the 64 bit version on my SSD and directly booted from it. Everything worked perfectly and wow everything runs fast like a rocket and also Nextcloud can be operated smoothly. Pages load very fast but the problem with the upload speed remains. Maximum upload speed is 11 MB/s and every second the speed drops to 0 and then goes back to 11 MB/s for 1 second…

Are there any other settings that can optimize the speed?

I probably found the issue

sudo -u www-data php occ config:app:set files max_chunk_size --value 0
is not working “could not open input file: occ”.

you would need to specify the location of occ command as follow

sudo -u www-data php /var/www/nextcloud/occ

Anyway, on DietPi you can use short cut ncc instead like this

root@DietPi4:~# ncc config:app:set files max_chunk_size --value 0
Config value max_chunk_size for app files set to 0

However, using the SSD for the entire system would be recommended anyway
Not sure what web server you are using, but on Lighttpd files are cached on /var/cache/lighttpd/uploads

Thank you so much for your help.
So adjusting the chunk size worked… But unfortunately did not solve the problem… even after several restarts.

I just ran a iperf test and it transfers 10 Mbytes packeges with a resulting bandwidth of 90 Mbits.
This is strange, since I already reach higher speeds with Raspbian on my Raspi 3 B+ (and there iperfs transfered 100 MBytes pakages not only 10 MBytes)
According to Config and my router the Raspi 4 with Dietpi is connected over 1 Gbit.

Oh and yes I use Lighttpd.
And I have now installed the whole system on my SSD. I have removed the SD card.

hmm using your setting to reduce max_chunk_size dossn’t seems to be efficient. Cache files are still stored by Lighttpd in smaller chunks and once upload completed these chunks need to be assembled together again. Quite a time consuming activity. For larger files it might be faster to upload files via SCP, FTP or SAMBA and check on new files for Nextcloud afterwards using ncc files:scan --all

Could this be solved by switching to nginx / Apache?

honestly I don’t know. I never did such comparison. Maybe you could ask this on Nextcloud help forum. Probably these guys will have some experience.