Slow download speed on Wan

Hi,

(Sorry for my mistakes, I’m doing my best :slight_smile: )

Long Story Short :

Nextcloud really slow with PHP7 and Apache2 when outside of the LAN, but other services are working fine.

I just installed a Nextckoud server on an ARM device (Odroid XU4) with a Plex server. It’s like a Raspberry Pi 3 but almost 3 times faster, with 1G ethernet, 2G Ram et 8 cores 2Ghz.

I disabled the Plex server for my tests, so it has nothing to do with it.

When I stream a video with Plex, I can watch a FullHd video easily.
In LAN, I can also download files on my Nextcloud server, with the Web page, at almost 12Mo/s
But as soon as I use another connection, than I can’t download anything (sometimes 200k/s for 3s than nothing for 10s). I asked some friends and they have the same troubles.

The CPU is really fine (5%) and I have plenty of storage and Ram.

The cloud is working fine when I use it on LAN, download and upload rates are great and I dont have any troubles.

My upload speed is not awesome, but I can stream some Plex so I don’t think this is the bottleneck.

For my configuration :
Php7
Apache2

Nextcloud conf file

$CONFIG = array (
‘trusted_domains’ =>
array (
0 => ‘192.168.0.17’,
1 => ‘xx.xx.xx.xx’,
2 => ‘xx.xx.xx.xx’,
),
‘datadirectory’ => ‘/home/odroid/Nextcloud’,
‘overwrite.cli.url’ => ‘http://192.168.0.17/nextcloud’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘12.0.3.3’,
‘dbname’ => ‘xxx’,
‘dbhost’ => ‘xxxx’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘xxx’,
‘dbpassword’ => ‘xxx’,
‘installed’ => true,
‘auth.bruteforce.protection.enabled’ => false,
‘memcache.local’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
);

Php.ini

I just enabled the opcache and I added some memory for the upload

I have another instance of a nextcloud server that runs well (on php5 with nginx) for my work, and I wanted to try that configuration.

It runs on HTTP, I will enable HTTPS later.

I did some tweaking but nothing change for now, any idea ? I don’t use Apache2 a lot so that can be the problem, but I don’t know where to start :disappointed_relieved:

Hi,

can you please re-phrase your question? I can’t seem to grasp, what issue it is, that you are facing. You also seem to confuse upload and download, when referecing streaming a video from Plex.

When you say “use another connection”, can you please state what excatly the circumstances are?

Why is my nextcloud so slow when I’m using it outside of my house ? When I use it at my place (192.168.0.17), then it’s fast enough, but when I’m outside (93.xx.xx.xx) it’s slow (like 25k/s).

I don’t know where to start to understand why

Ahh… ok… now we’re talking… :wink: What kind of internet access do you have at home? Could it be, that you’re on some asymmetric internet connection? First off, you could start by measuring your home internet connection by utilizing some of the speedtests available.

(Coaxial connection)

Download Speed in theory : 400mb/s
Upload speed in theory : 40mb/s

Download with speedof.me : 80mb/s
Upload with speeof.me : 35mb/s

With other things like Plex, I can get a 6mb/s stream, so I think this is more about some mistakes I made in a conf file :slight_smile:

Maybe… to be able to diagnose that more thoroughfully, you would need to perform some speedtests to server from the internet. There are a couple of apps to do that on Linux based systems like iperf. Install that on your NC box and the same on a client outside of your network and try it out. These tools should give you a good view of what your connection and server is capable of.
Especially, try the http and https ports, to rule out, that your ISP is throttling those outbound. If these tests are unobtrusive, then the next step woule be to sniff the http traffic of your external connections using wireshark, to see whether there’s something bad going on between your NC box and your router.

Hum, I just did some test with iperf

I can’t use my 80 port (it is binded), do you think there could be some troubles only with this port ?

I will try wireshark at the end of the day, thank you :slight_smile:

What IP is what host in that example? Assueming that 192.168.0.17 is your local NC box, you seem to get approx. 16Mbit/s upload to the internet, right?

I tested it with online.net server, and 192.168.0.17 is, in fact, my local box. So yeah, this was internet upload (sometimes it’s 17M/s but it can be better. I never got below 15M/s)

Nothing much to say about wireshark, there is no strange things going on.

I’m looking into some apache configuration or using another port than HTTP (80)

Well, I don’t know why but now it’s quicker (350k/s). I installed a cache solution not so long ago, so maybe that did the trick ?

But now I’m getting 150k/s upload and 350k/s download. I’ll try to optimise my cloud to get 1M/s upload and 5M/s download.

If you have any idea i’m open !

It’s good now, I’m getting 14M/s. I think three things helped :

It’s good now, thanks :smiley:

@caminin
I learned some more about the PHP settings in between. As you have full server control (other than hosting provider users), I recommend to directly add the values to /etc/php/7.0/mods-available/opcache.ini respectively /etc/php/7.0/mods-available/apcu.ini, there without the leading php_admin_value.
Leave out the mysql settings completely, they do not have any effect.

And remove the Satisfy Any line!! It is a bid misleading places at admin manual, that it might be necessary and no sign that it might harm. But it indeed can totally expose your data: https://github.com/nextcloud/server/issues/6449