How is the speed when working locally?

Hello everyone,

Today I installed Nextcloud on my Raspberry Pi 3 (I’m waiting to receive my RP5 in order to make the actual setup). I was trying to make some tests about how to install it on a Raspberry Pi. I’ll very soon make a fresh install on a RP5 with NVMe installed.

So everything went smooth with clean Docker installation that I made on a Ubuntu Server distro for RP3.

I have a DDNS address that my Asus modem creates. When I setup Nextcloud on my Windows Desktop pc it asks me to enter the address that I connect and I enter the address that I got from the DDNS service. And once the installation is over, the Nextcloud folder appears in Windows Explorer.

My internet’s upload speed is not very fast. It’s around 15-20Mbps. So I understand it will be a little slow to download files but my desktop PC is in the same local network with the Raspberry Pi so I was hoping to have the speed of a local network file sharing. But it looks like even on my desktop it’s trying to download everything from the internet.

Is there a way to make it understand that my PC is connected in the same local network so that I could just use the Nextcloud faster when trying to reach my files from my desktop?

Should I have maybe setup the desktop nextcloud account with the local ip address instead of the domain name that I got with the DDNS? What is the best way to solve this speed issue?

Thank you.

This is a complex question with multiple parts that depends on your setup.

But it looks like even on my desktop it’s trying to download everything from the internet.

This is unlikely to be the case, most likely what you are experiencing is “hair pinning” where you attempt to connect to your external IP address but you router just redirects it to your internal resources. Otherwise it just wouldn’t work. It should be noted hair pinning could be causing some performance issue, networking can be a touchy thing after all.

Is there a way to make it understand that my PC is connected in the same local network so that I could just use the Nextcloud faster when trying to reach my files from my desktop?

Other than “Hair pinning” you would want a record in your routers DNS (or local Pi hole) that points to your local machines IP address rather than your WAN address.

Should I have maybe setup the desktop nextcloud account with the local ip address instead of the domain name that I got with the DDNS?

A quick and diry option is to edit your windows host file and forcably point the address to you internal IP address. Microsoft’s powertoys has a nice GUI editor for the HOST file to make it easier.

What is the best way to solve this speed issue?

Typically you will find Nextcloud to be slower than wire speed or even SAMBA share speed due to multiple factors. DB read write, the saturation of your servers CPU and Network interface and the latency and IO speeds of your storage device. Raspberry pi’s are quite low spec devices so you will always struggle to some extent, this especially is true on poorer performance storage setups that you see in the Pi 3.

My generic advice is always:

  1. Make sure you’ve followed the advice in the server tuning page.
    Redis, OPcache all that good stuff

  2. Setting up the notify_push backend can help

  3. Switch to syslog for Nextcloud
    You can disable Nextcloud’s file logging by switching to syslog and setting the loglevel to 3 (warning) either via OCC command or config.php edit this can take some load off your disk as the syslog facility is a touch smarter regarding performance. NOTE this will break the Web GUI log reader

php occ log:manage --level=error --backend=syslog

"log_type" => "syslog",
"logfile" => "",
"loglevel" => 3,
  1. Move your system Logs to RAM

Setup your raspberry pi to log to ram rather than disk e.g.: GitHub - azlux/log2ram: ramlog like for systemd (Put log into a ram folder)

Finally if all else fails look at this guy’s blog post: debugging nextcloud slowness He goes over using the profiler to identify where the bottle neck on his system was.

1 Like

Oh also A previous post had some performance issues due to DNS config problems in the docker container.

Above all, it is important that you use the same name including the same certificate on the inside and outside, otherwise you will have problems with Android and/or iOS on the inside, for example.

Incidentally, modern routers should have no problem with this. Search for NAT traversal and hairpinning.

Due to fast Internet speeds, the network to the Internet often no longer plays a role. It may be that your new Pi is not much faster than a Nextcloud hosted on the Internet. I recommend everyone to have a Nextcloud on the internet at least for testing purposes. You can store less important data there. You can get Internet Nextcloud accounts for free. Among other things, I have installed a Nextcloud on an internet web space with SQLite. Even the installation is probably faster than your old Pi.

Hi and good question.

All of your questions has been answered already. However in my own setup at home, I use custom firmware on my router, which happens to ship with dnsmasq, hence providing LAN adresses for all my local hosted services - including Nextcloud - is easy and fast. This works quite well. I do not use Raspberry though, and my infrastructure is consisting of more layers than yours, so I do have some bottlenecks, like reverse proxy, PostGreSql is on another host (I have a DB server which serves several services) and yet the speed and response time is significantly better using the LAN network. The reason is simple, as DNS is cached, so after first “lookup” the trafic will no longer go through the router (probably for most people as their router also acts as their only switch aswell, hence also affects the router CPU), but instead through my 10Gb coreswitch and only rarely reaches the router.

The speed question is - as already mentioned by others - a delicate subject. Many bottlenecks and potential factors to slo the overall experience:

  • Power of the host (Nextcloud box).
  • Memory capacity.
  • DB tuning.
  • Caching.
  • I/O of the data disk - including the maximum capacity of the interface of which the disk is attached.
  • Network speed (many people uses wireless on their devices, yet does not have proper wifi coverage other than the standard delivered by their ISP router)

So you will need to carefully analyse and mitigate all possible bottlenecks everywhere in your infrastructure and then also look at tuning of the various software components themselves, to truly optimize. However a good place to start is OPCache and aPcu. As this is a single instance install and a RPI, Redis is best for file locking only and aPcu will perform better. If you had more power and resources, Redis might provide a slight speed gain for also file and static page cache.

After this, try to read up on performance optimizing MariaDB. There can be a few things to gain here.

Avoid using full disk encryption or the default encryption app from nextcloud, as encrypting and decrypting takes up extra resources.

This has nothing to do with whether or not DNS is cached. If you have local DNS pointing to the local IP addresses of your services, traffic will only hit the switch, and it doesn’t really matter whether you’re using the built-in switch in the router or a separate upstream switch with the same speed, because even the switches in the cheapest consumer routers are capable of delivering their advertised line speeds.

Or if you don’t have local DNS, NAT loopback / Hairpin NAT comes into play, which can affect speed depending on the router model you’re using, but I agree with others here that this probably isn’t the issue.

Both the storage and the network interface on the Pi3 are connected to a single, shared USB 2.0 bus, which limits the maximum throughput to a theoretical 480Mbps / 60MB/s. In practice it is about half of that: Getting Gigabit Networking on a Raspberry Pi 2, 3 and B+ | Jeff Geerling

Another limiting factor are the SD-Cards. See here: https://www.jeffgeerling.com/blog/2018/raspberry-pi-3-b-review-and-performance-comparison

My conclusion:

According to the linked articles, you might be able to get another 5-10 MB/s with proper cooling, and/or overclocking, and/or buying a faster SD Card, and/or using an external SSD.

However, to get anywhere near gigabit speeds, you need at least a Pi4 and either a very fast SD card or, better, an external SSD.

1 Like

Thank you so much. All these answers are so valuable. I think before trying any of these, I should wait to receive my Raspberry Pi5 which is on the way and setup the same system with it with an NVMe attached to it and then compare. It looks like The Raspberry Pi3 was too old to expect better speeds. And even if I try to make some tweaks, maybe it’s not going to be worth or even noticable due to its small speeds with different reasons such as low processor speed, usb 2.0 standard, using the sd card etc…)

Oh, I’m not just going to have the new RP5 but also I’m going to have the new Asus GT-BE98 Router coming soon. I’m sure it’ll have more automatic and builtin solutions for NAT traversal and for hairpinning. Because I won’t really be using my Raspberry3 for this purpose. I was just trying to learn how to set it up before I receive my new devices and it was very simple to do with the tutorials.

After making a fresh install with RP5 and the new router, if I still think it’s slow than expected, I’ll refer my post here and try to overcome the issue. I’ll be doing all the tests towards the end of January :slight_smile: Thank you so much!

2 Likes