Good speed on LAN but poor in WAN with docker NC and traefik

Nextcloud version : 24.0.5
Operating system and version : UBUNTU MATE 22.04
Docker installation (see YAML files in post)
NC installation is available at : cloud.labasenantes.org

I’m facing download and upload performance issues since the installation of NC on docker with traefik as proxy on a server I host at home. I have a good connection and tested speed on the server (180Mbps download and 45Mbps upload) but when I try to download files from outside my home the download is really bad (you can test at my public folder : Cloud). When I use NC whith any computer at home download and upload performance is good. The router of my home is a simple box, there is no restrictions on ports, no firewall.

Steps to replicate it:

  1. Try to upload a file to Cloud
  2. Try to download it
  3. Is it 180 Mbps upload and 45Mbps download ?

I searched on different topics on this forum but I couldn’t find any improvements…

Here are my YAML files. For NC :

version: '3.8'

services:
  app:
    image: nextcloud:${NEXTCLOUD_VERSION}
    container_name: ${COMPOSE_PROJECT_NAME}-app
    restart: unless-stopped
    depends_on:
      - db
      - cache
    environment:
      - MYSQL_HOST=${COMPOSE_PROJECT_NAME}-db
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=${NEXTCLOUD_DB_USER_NAME}
      - MYSQL_PASSWORD_FILE=/run/secrets/db_password
      - REDIS_HOST=nextcloud-cache
      - NEXTCLOUD_ADMIN_USER=${ADMIN_USERNAME}
      - NEXTCLOUD_ADMIN_PASSWORD_FILE=/run/secrets/app_admin_password
      - NEXTCLOUD_TRUSTED_DOMAINS=${NEXTCLOUD_HOST}
      - OVERWRITEPROTOCOL=https
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nextcloud.rule=Host(`${NEXTCLOUD_HOST}`)"
      - "traefik.http.routers.nextcloud.tls=true"
      - "traefik.http.routers.nextcloud.tls.certresolver=letsencrypt"
      - "traefik.http.services.nextcloud.loadbalancer.server.port=80"
      - "traefik.docker.network=labase"
      - "traefik.http.routers.nextcloud.entrypoints=web,websecure"
      - "traefik.http.routers.nextcloud.middlewares=nextcloudHeader"
    volumes:
      - nextcloud:/var/www/html
      - /media/ssd120go:/var/www/html/data
      - ./volumes/skeleton:/skeleton      
      - /media/hdd500go:/media/hdd500go
      - /media/hdd1500go:/media/hdd1500go
      - /media/hdd2000go:/media/hdd2000go
    networks:
      - labase
    secrets:
      - db_password
      - app_admin_password

  db:
    image: mariadb:${NEXTCLOUD_MARIADB_VERSION}
    container_name: ${COMPOSE_PROJECT_NAME}-db
    restart: unless-stopped
    environment:
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=${NEXTCLOUD_DB_USER_NAME}
      - MYSQL_PASSWORD_FILE=/run/secrets/db_password
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
      - MYSQL_INITDB_SKIP_TZINFO=1
    volumes:
      - db:/var/lib/mysql
    networks:
      - labase
    secrets:
      - db_password

  cache:
    image: redis
    container_name: ${COMPOSE_PROJECT_NAME}-cache
    restart: unless-stopped
    volumes:
      - cache:/data
    networks:
      - labase
        
volumes:
  db:
    name: ${NEXTCLOUD_VOLUME_DB_NAME}
  cache:
    name: ${NEXTCLOUD_VOLUME_CACHE_NAME}
  nextcloud:
    name: ${NEXTCLOUD_VOLUME_APP_NAME}
      
networks:
  labase:
    name: labase
    external: true

secrets:
  db_password:
    file: secrets/nextcloud_db_password
  app_admin_password:
    file: secrets/nextcloud_admin_password

For traefik :

version: '3.8'

services:
  traefik:
    image: "traefik"
    container_name: ${COMPOSE_PROJECT_NAME}-traefik
    restart: unless-stopped
    command:
      - "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entryPoints.websecure.address=:443"
      - "--certificatesresolvers.letsencrypt.acme.tlschallenge=true"
      - "--certificatesResolvers.letsencrypt.acme.email=${LETS_ENCRYPT_EMAIL}"
      - "--certificatesResolvers.letsencrypt.acme.storage=/acme.json"
    environment:
      TZ: Europe/Paris
    labels:
      - "traefik.enable=true" 
      - "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
      - "traefik.http.routers.http-catchall.entrypoints=web"
      - "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
      
      # middleware redirect
      - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"

      #hsts
      - "traefik.http.middlewares.nextcloudHeader.headers.stsSeconds=15552000"
      - "traefik.http.middlewares.nextcloudHeader.headers.stsIncludeSubdomains=true"
      - "traefik.http.middlewares.nextcloudHeader.headers.stsPreload=true"
      - "traefik.http.middlewares.nextcloudHeader.headers.forceSTSHeader=true"
    ports:
      - "80:80"
      - "443:443"
      # - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./acme.json:/acme.json"
    networks:
      - labase
    logging:
      driver: "json-file"
      options:
        max-size: "4m"
        max-file: "1"

networks:
  labase:
    name: labase

The output of my config.php file in /path/to/nextcloud :

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'nextcloud-cache',
    'password' => '',
    'port' => 6379,
  ),
  'overwriteprotocol' => 'https',
  'passwordsalt' => '*********',
  'secret' => '*********',
  'trusted_domains' =>
  array (
    0 => 'cloud.labasenantes.org',
  ),
  'datadirectory' => '/var/www/html/data',
  'skeletondirectory' => '/skeleton',
  'dbtype' => 'mysql',
  'version' => '24.0.5.1',
  'overwrite.cli.url' => 'https://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'nextcloud-db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'instanceid' => 'octy88ds4umh',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '*******)',
  'installed' => true,
  'allow_local_remote_servers' => true,
  'maintenance' => false,
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'mail.infomaniak.com',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'contact',
  'mail_domain' => 'labasenantes.org',
  'mail_smtpauth' => 1,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpname' => 'contact@labasenantes.org',
  'mail_smtppassword' => '*******',
  'mail_smtpsecure' => 'tls',
  'loglevel' => 2,
  'trusted_proxies' =>
  array (
    1 => '127.0.0.1',
  ),
  'overwritehost' => 'cloud.labasenantes.org',
);

Do you have any ideas I can test or things that I forgot ?
Thanks !
Thomas.

If you are accessing the cloud in the same way (always using same components - and not bypass any device) there is no good reason for different speed.

I tried uploading 300MB ISO file to your cloud - the speed a was 20-30 MBit/s which is about 30% of my possible upload and 15% of your DL…

but I have to admit I have bad connection to you… tracert time out after 13 hops but the last hops already had >30ms response time…looks like *.sfr.net is the most bad part of the connection…

from such bad response times I would say transfer speed is not such bad…

your docker-compose looks good, the only thing I’m wondering - you mount multiple volumes into container do you happen to user “external storage” app? this is known to cause system slowdown in some situations

but if this would be a reason it should be bad from internal network as well… :thinking:

Oh waw thanks for your complete answer !
The fact that SFR is the main part of the problem looks plausible for me because I do have some times latency on my connection at home…
I also do use external storgae, I will lokk the linked post but I think it won’t help to solve the externatl latency (as you said it’s not that bad in local).
It’s been a while that i’m on this, thanks for your explanations.

Perhaps I will try to move my server to another place with a good connection…

Thanks’ !