Nextcloud performance is really bad

Hello,

I don’t know what I can do anymore to solve my big performance problems on nextcloud.
I have a installation on a Raspberry Pi 4 with 8GB RAM. Ubuntu Server LTS is running with all updates installed. Using Apache & MariaDB.
3x8 TB HDD data is connected and 1x2TB SSD data.
Nextcloud is installed on the sdcard and the nextcloud data folder installed on the SSD. The 3 HDD are just added as External Storage.

When I try to call Nextcloud in the browser, the websites needs up to 10seconds to be displayed.
You can try yourself: https://cloud.konzeptgeil.com

The Login page is a little bit faster than the other pages/apps when logged in, but still very slow.

I always update and I’m currently on Nextcloud Hub II (23.0.3).
The check for performance and security is green: everything is right.
The Protocoll under “Admin” does not have any entries.

htop does not show anything strange. RAM usage is mostly under 50% and CPU mostly under 30%.

I’m not a linux crack, and I don’t really know how to go on.

I compared mine to yours so we can have tangible numbers.

Mine loaded in 1.3s and yours in 4.56s.

I’ll skip the obvious one being the SD card.

I also had some problems here, so I elbow-greased with this a little bit.

The next thing: you can enable HTTP/2 which had a little bit of improvement for me.

Another thing: update to PHP8. Didn’t see an improvement, but the promises back in the day were high.

Apart from that, you can properly configure APCu and Redis

Lastly, make sure your client machine and connection is fast. In my case, turns out my 10-year-old notebook on wifi loads the page at double the time compared to my wife’s two-year desktop connected through ethernet.

This is just an overview. Let us now if you have any difficulty configuring these thing I said

APCu and Redis are installed and configured.
The server is via lan direct to my router with 100mbit internet connection - but I’m currently on lan with my local machine and the loading time is really long - doesn’t matter which device from which network.
It also seems, that the server “reacts” really fast, but the start of pager loading seems delayed.
Update to php8 and use http/2 are currently not possible for me due to other applications dependencies.

Is there perhaps any log file or config I should share here?

wolf@frida:/var/www/html/nextcloud/config$ cat config.php 
<?php
$CONFIG = array (
  'instanceid' => 'XXXX',
  'passwordsalt' => 'XXXX',
  'secret' => 'XXXX',
  'trusted_domains' => 
  array (
    0 => 'cloud.konzeptgeil.com',
    1 => '192.168.101.101',
  ),
  'datadirectory' => '/home/wolf/hd_cloud/nextcloud',
  'overwrite.cli.url' => 'https://cloud.konzeptgeil.com',
  'dbtype' => 'mysql',
  'version' => '23.0.3.2',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'XXX',
  'logtimezone' => 'UTC',
  'default_phone_region' => 'DE',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_smtphost' => 'XXX.XXX.com',
  'mail_smtpport' => '465',
  'mail_domain' => 'konzeptgeil.com',
  'mail_from_address' => 'cloud',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'XXX@konzeptgeil.com',
  'mail_smtppassword' => 'XXX',
  'mail_smtpauthtype' => 'LOGIN',
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'maintenance' => false,
  'htaccess.RewriteBase' => '/',
  'loglevel' => 0,
  'theme' => '',
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    2 => 'OC\\Preview\\OpenDocument',
    3 => 'OC\\Preview\\PDF',
    4 => 'OC\\Preview\\MSOffice2003',
    5 => 'OC\\Preview\\MSOfficeDoc',
    6 => 'OC\\Preview\\Image',
    7 => 'OC\\Preview\\Photoshop',
    8 => 'OC\\Preview\\TIFF',
    9 => 'OC\\Preview\\SVG',
    10 => 'OC\\Preview\\Font',
    11 => 'OC\\Preview\\MP3',
    12 => 'OC\\Preview\\Movie',
    13 => 'OC\\Preview\\MKV',
    14 => 'OC\\Preview\\MP4',
    15 => 'OC\\Preview\\AVI',
  ),
  'app_install_overwrite' => 
  array (
    0 => 'contacts',
    1 => 'admin_notifications',
    2 => 'dashboard',
    3 => 'calendar',
  ),
  'mysql.utf8mb4' => true,
  'data-fingerprint' => 'XXX',
);

I don’t know if it makes a difference for home use, but you can try changing how Redis communicate to nextcloud. I won’t remember the details so you should google it. But mine I configured to use a socket, so here I have it like this:

  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/run/redis/redis-server.sock',
    'port' => 0,
    'password' => 'XXXXXXXXXXXXXXXXXXXXX',
    'timeout' => 1.5,
  ),

Otherwise, your config.php seems to be very similar to mine, and everything seems well in place as you have A+ on nextcloud scan.

Please consider that you can have both PHP7.X and PHP8 at the same time.

1 Like

Okay, I was able to check and have finally activated http/2.0. I also switched redis to work with sockets.
Still same bad performance I think. Last thing would be update to php8, but I cannot believe this will be the big boost.
There must be somewhere a “real” problem …

Opening the dashboard after login takes 52 seconds.

I deactivated some apps like
Accessibility , Talk, Deck, Collaborative tags, Federation, Social share Facebook/Twitter/Diaspora, Usage survey and Nextcloud announcements. It’s now much faster. One of these apps was the problem.
I don’t use any of them really, so better to have not that much apps running.

Wasn’t aware about apps reducing performance that much.

Thank you so much for helping!

I found your solution impressive, and I think this thread is of general interest.

So I decided to test mine:

Nextcloud 23.03
PHP8.0.17
MySQL 10.3.34
Core I5 7th generation 2.50GHz, 8GB RAM
Running on an SSD

I repeatedly opened and measured the time it takes to open my dashboard (before, I was just opening the login page). It originally had:

Upcoming events
Upcoming tasks
Recommended files
Talk mentions

I made three scenarios: before any modifications, removed only the talk mentions, and disabled the Talk app.

I made 15 samples from each, alternating while collecting the data.

Results as mean (standard deviation):
Before: 11.0s (SD: 0.8s)
Removed Talk mentions: 10.2s (SD: 1.0s)
Removed Talk app: 8.0s (0.9s)

Image1

I thought the time reduction was quite impressive: from 8% from just removing the Talk mentions to 28% when removing the app. Also, note that my system isn’t much faster than yours, even though I am running on a notebook (compared to raspberry pi). So the number of apps seems to matter more.

I would be glad if someone reading this thread could contribute to the discussion.

1 Like

Hello,

I have multiple apps, from Talk to Collabora Office running in a Raspberry PI 4 4GB RAM and mine is working pretty good. I checked how much time it takes to load the dashboard and it takes around 4 to 5 seconds.

When I first installed Nextcloud few years ago in a Raspberry 3, the biggest challenges I found were:

  • The SD card, even if I bought the recommended one, it was too slow; it got much (very much!) better when I changed to a Samsung EVO one. After that I did some write and read performance tests and even if theoretically both had same specifications the reality was a different story. I guess this is too obvious but I recommend you give it a try a check the perfomance you get on yours; in my environment the difference was from taking up to near 10 minutes to upload a picture to upload 3 or 4 pictures in a minute.

  • MySQL and SD card was not a good idea. Some time after that, I moved the MariaDB data directory into a hard drive instead of running in the default location. The difference was huge again. Depending on the usage of your instance, you could also tune the time for the logs being written in the disk, but it most probably would not be needed if you move the database into a SSD.

After that I also added the tunning recommendations from Nextcloud for the caching and so on.

I can help with any of these actions if you want to give it a try to any of them.

By the way, is there any reason for using Ubuntu instead of the Raspberry OS? Nowadays it is 64bits so I think it might be worthy give it a try as well.

Hello to all,

on my nextcloud 23 it is DECK !!! If Deck isused with attachments, links and integreation in calender, simultanly used by many Users it powers down everything. Redis is spooling only:1650605524.600231 [0 unix:/var/run/redis/redis.sock] “GET” “cbd68a0ce27f6b13a3577cae0f74fb11/deck-cardMapperfindBoardId:1209”
1650605524.600460 [0 unix:/var/run/redis/redis.sock] “GET” “cbd68a0ce27f6b13a3577cae0f74fb11/deck-cardMapperfindBoardId:1209”.
PHP-fpm rises to 100 %CPU and redis to about 50%, mysql now and then over 100%.
After a lot of try and error with everything I disabled Deck and everything was working great again.

1 Like

I mean, i deactivated the apps and the performance got better. But it’s still a nightmare.
I moved my nextcloud data directory from a hdd to a ssd. And the performance DEcreased. wtf.

Moving de DB from the sdcard to the ssd: I will try soon.

Why not RaspberryOS? I don’t set up a new server, just because RaspberryOS is available since some weeks in 64bit. they needed so long to release it, too long for me.
If the performance is better on the 64bit RaspberryOS than on Ubuntu Server 64 LTS I would give it a try someday. But I need at least one week to setup the server new that everything is running again. This is nothing I “just do”.