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

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
Ceshy
Posts: 5
Joined: Thu Jul 15, 2021 8:40 am

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

Post by Ceshy »

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!
User avatar
Joulinar
Posts: 5147
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

Hi,

we could have helped with the issues on MariaDB that time ;)

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.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Ceshy
Posts: 5
Joined: Thu Jul 15, 2021 8:40 am

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

Post by Ceshy »

Update:
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?
Ceshy
Posts: 5
Joined: Thu Jul 15, 2021 8:40 am

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

Post by Ceshy »

I probably found the issue
https://help.nextcloud.com/t/nextcloud- ... ss/70719/5
https://docs.nextcloud.com/server/20/ad ... cloud-side

But
sudo -u www-data php occ config:app:set files max_chunk_size --value 0
is not working "could not open input file: occ".
User avatar
Joulinar
Posts: 5147
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

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

Code: Select all

sudo -u www-data php /var/www/nextcloud/occ
Anyway, on DietPi you can use short cut ncc instead like this

Code: Select all

root@DietPi4:~# ncc config:app:set files max_chunk_size --value 0
Config value max_chunk_size for app files set to 0
root@DietPi4:~#
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
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Ceshy
Posts: 5
Joined: Thu Jul 15, 2021 8:40 am

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

Post by Ceshy »

Joulinar wrote: Thu Jul 15, 2021 11:37 pm you would need to specify the location of occ command as follow

Code: Select all

sudo -u www-data php /var/www/nextcloud/occ
Anyway, on DietPi you can use short cut ncc instead like this

Code: Select all

root@DietPi4:~# ncc config:app:set files max_chunk_size --value 0
Config value max_chunk_size for app files set to 0
root@DietPi4:~#
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.
User avatar
Joulinar
Posts: 5147
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

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
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Ceshy
Posts: 5
Joined: Thu Jul 15, 2021 8:40 am

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

Post by Ceshy »

Could this be solved by switching to nginx / Apache?
User avatar
Joulinar
Posts: 5147
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

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.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply