Network Speed on Linux NAS underperforming, how to debug (it's not the cables)

2

before posting this I read many threads/pages/blogs about networks speeds underperforming the specs. So I bought new CAT6 UTP cables and tested between every device on my network.

I now get consistent speeds at around 110mb/s between all devices except my self-build linux NAS. It consistently copies files only at 40mb/s. I tested this with short cables, long cables, a dedicated 1gbit switch (instead of my gigabit router doing the routing), always the same result. I tested copying over the network from SSD to SSD, SSD to HDD, no difference (NAS has both SSD and HDD). I tried SFTP, SMB, FTP, also made no difference. In all tests the NAS' load stayed very small.

By now my suspicion is the NAS hardware and/or linux drivers, configuration. How can I debug this?

[update]

1 core maxes out during file copy over network. the load seemed small at 0,6 in munin but thats just the average over 5min. So CPU is the bottleneck?

[update 2]

so in my case the driver helped a bit but at the end my bottleneck is the combination of protocol+cpu. only HTTP manages to max out the connection whereas sftp and smb are limited by the cpu, maybe some tweaking can reduce cpu-usage for either for them.

The Specs:

OS: Debian 8
Board: ASRock N3150B-ITX Intel N3150 mITX
CPU: Intel(R) Celeron(R) CPU  N3150  @ 1.60GHz
RAM: 8 GB
HDD: 2 x WD Red WD40EFRX 4TB
SSD: 1 x Kingston SSDNow V300 120GB MLC

Detailed Specs

lscpu

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 76
Model name:            Intel(R) Celeron(R) CPU  N3150  @ 1.60GHz
Stepping:              3
CPU MHz:               481.933
CPU max MHz:           2080,0000
CPU min MHz:           480,0000
BogoMIPS:              3202.01
Virtualization:        VT-x
L1d cache:             24K
L1i cache:             32K
L2 cache:              1024K
NUMA node0 CPU(s):     0-3

lshw

    description: Computer
    width: 64 bits
    capabilities: smbios-2.8 vsyscall32
  *-core
       description: Motherboard
       physical id: 0
     *-memory
          description: System memory
          physical id: 0
          size: 7472MiB
     *-cpu
          product: Intel(R) Celeron(R) CPU  N3150  @ 1.60GHz
          vendor: Intel Corp.
          physical id: 1
          bus info: cpu@0
          size: 479MHz
          capacity: 2080MHz
          width: 64 bits
          capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp x86-64 constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch epb tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms dtherm ida arat cpufreq
     *-pci
          description: Host bridge
          product: Intel Corporation
          vendor: Intel Corporation
          physical id: 100
          bus info: pci@0000:00:00.0
          version: 21
          width: 32 bits
          clock: 33MHz
          configuration: driver=iosf_mbi_pci
          resources: irq:0
        *-display
             description: VGA compatible controller
             product: Intel Corporation
             vendor: Intel Corporation
             physical id: 2
             bus info: pci@0000:00:02.0
             version: 21
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi vga_controller bus_master cap_list rom
             configuration: driver=i915 latency=0
             resources: irq:121 memory:90000000-90ffffff memory:80000000-8fffffff ioport:f000(size=64) memory:c0000-dffff
        *-storage
             description: SATA controller
             product: Intel Corporation
             vendor: Intel Corporation
             physical id: 13
             bus info: pci@0000:00:13.0
             version: 21
             width: 32 bits
             clock: 66MHz
             capabilities: storage msi pm ahci_1.0 bus_master cap_list
             configuration: driver=ahci latency=0
             resources: irq:118 ioport:f060(size=32) memory:91415000-914157ff
        *-usb
             description: USB controller
             product: Intel Corporation
             vendor: Intel Corporation
             physical id: 14
             bus info: pci@0000:00:14.0
             version: 21
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi xhci bus_master cap_list
             configuration: driver=xhci_hcd latency=0
             resources: irq:117 memory:91400000-9140ffff
           *-usbhost:0
                product: xHCI Host Controller
                vendor: Linux 4.8.0-0.bpo.2-amd64 xhci-hcd
                physical id: 0
                bus info: usb@1
                logical name: usb1
                version: 4.08
                capabilities: usb-2.00
                configuration: driver=hub slots=7 speed=480Mbit/s
              *-usb
                   description: USB hub
                   product: USB2.0 Hub
                   vendor: Genesys Logic, Inc.
                   physical id: 5
                   bus info: usb@1:5
                   version: 88.31
                   capabilities: usb-2.00
                   configuration: driver=hub maxpower=100mA slots=4 speed=480Mbit/s
           *-usbhost:1
                product: xHCI Host Controller
                vendor: Linux 4.8.0-0.bpo.2-amd64 xhci-hcd
                physical id: 1
                bus info: usb@2
                logical name: usb2
                version: 4.08
                capabilities: usb-3.00
                configuration: driver=hub slots=6 speed=5000Mbit/s
        *-generic UNCLAIMED
             description: Encryption controller
             product: Intel Corporation
             vendor: Intel Corporation
             physical id: 1a
             bus info: pci@0000:00:1a.0
             version: 21
             width: 32 bits
             clock: 33MHz
             capabilities: pm msi bus_master cap_list
             configuration: latency=0
             resources: memory:91100000-911fffff memory:91000000-910fffff
        *-multimedia
             description: Audio device
             product: Intel Corporation
             vendor: Intel Corporation
             physical id: 1b
             bus info: pci@0000:00:1b.0
             version: 21
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi bus_master cap_list
             configuration: driver=snd_hda_intel latency=0
             resources: irq:122 memory:91410000-91413fff
        *-pci:0
             description: PCI bridge
             product: Intel Corporation
             vendor: Intel Corporation
             physical id: 1c
             bus info: pci@0000:00:1c.0
             version: 21
             width: 32 bits
             clock: 33MHz
             capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
             configuration: driver=pcieport
             resources: irq:115 ioport:e000(size=4096) memory:91300000-913fffff
           *-storage
                description: SATA controller
                product: 88SE9128 PCIe SATA 6 Gb/s RAID controller
                vendor: Marvell Technology Group Ltd.
                physical id: 0
                bus info: pci@0000:01:00.0
                version: 20
                width: 32 bits
                clock: 33MHz
                capabilities: storage pm msi pciexpress ahci_1.0 bus_master cap_list rom
                configuration: driver=ahci latency=0
                resources: irq:120 ioport:e050(size=8) ioport:e040(size=4) ioport:e030(size=8) ioport:e020(size=4) ioport:e000(size=32) memory:91310000-913107ff memory:91300000-9130ffff
        *-pci:1
             description: PCI bridge
             product: Intel Corporation
             vendor: Intel Corporation
             physical id: 1c.1
             bus info: pci@0000:00:1c.1
             version: 21
             width: 32 bits
             clock: 33MHz
             capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
             configuration: driver=pcieport
             resources: irq:116 ioport:d000(size=4096) memory:91200000-912fffff
           *-network
                description: Ethernet interface
                product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
                vendor: Realtek Semiconductor Co., Ltd.
                physical id: 0
                bus info: pci@0000:02:00.0
                logical name: eth0
                version: 11
                serial: d0:50:99:78:03:d2
                size: 1Gbit/s
                capacity: 1Gbit/s
                width: 64 bits
                clock: 33MHz
                capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
                configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 ip=192.168.0.100 latency=0 link=yes multicast=yes port=MII speed=1Gbit/s
                resources: irq:119 ioport:d000(size=256) memory:91204000-91204fff memory:91200000-91203fff
        *-isa
             description: ISA bridge
             product: Intel Corporation
             vendor: Intel Corporation
             physical id: 1f
             bus info: pci@0000:00:1f.0
             version: 21
             width: 32 bits
             clock: 33MHz
             capabilities: isa bus_master cap_list
             configuration: driver=lpc_ich latency=0
             resources: irq:0
        *-serial
             description: SMBus
             product: Intel Corporation
             vendor: Intel Corporation
             physical id: 1f.3
             bus info: pci@0000:00:1f.3
             version: 21
             width: 32 bits
             clock: 33MHz
             capabilities: pm cap_list
             configuration: driver=i801_smbus latency=0
             resources: irq:18 memory:91414000-9141401f ioport:f040(size=32)
     *-scsi:0
          physical id: 2
          logical name: scsi0
          capabilities: emulated
        *-disk
             description: ATA Disk
             product: KINGSTON SV300S3
             physical id: 0.0.0
             bus info: scsi@0:0.0.0
             logical name: /dev/sda
             version: BBF0
             serial: 50026B7854011055
             size: 111GiB (120GB)
             capabilities: gpt-1.00 partitioned partitioned:gpt
             configuration: ansiversion=5 guid=bd0d92d8-3872-4af8-bd37-6e144769d696 logicalsectorsize=512 sectorsize=512
           *-volume:0
                description: Windows FAT volume
                vendor: mkfs.fat
                physical id: 1
                bus info: scsi@0:0.0.0,1
                logical name: /dev/sda1
                logical name: /boot/efi
                version: FAT32
                serial: a00b-19c0
                size: 510MiB
                capacity: 511MiB
                capabilities: boot fat initialized
                configuration: FATs=2 filesystem=fat mount.fstype=vfat mount.options=rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro state=mounted
           *-volume:1
                description: EXT4 volume
                vendor: Linux
                physical id: 2
                bus info: scsi@0:0.0.0,2
                logical name: /dev/sda2
                logical name: /
                version: 1.0
                serial: 3c53dc3f-51e0-4967-810a-46642c6dba53
                size: 103GiB
                capabilities: journaled extended_attributes large_files huge_files dir_nlink recover extents ext4 ext2 initialized
                configuration: created=2017-01-03 17:06:08 filesystem=ext4 lastmountpoint=/ modified=2017-02-08 22:31:35 mount.fstype=ext4 mount.options=rw,relatime,errors=remount-ro,data=ordered mounted=2017-02-08 22:31:36 state=mounted
           *-volume:2
                description: Linux swap volume
                vendor: Linux
                physical id: 3
                bus info: scsi@0:0.0.0,3
                logical name: /dev/sda3
                version: 1
                serial: 3e37cb96-5f81-48d1-be5b-ca47292b232f
                size: 7665MiB
                capacity: 7666MiB
                capabilities: nofs swap initialized
                configuration: filesystem=swap pagesize=4095
     *-scsi:1
          physical id: 3
          logical name: scsi2
          capabilities: emulated
        *-disk
             description: ATA Disk
             product: WDC WD40EFRX-68N
             vendor: Western Digital
             physical id: 0.0.0
             bus info: scsi@2:0.0.0
             logical name: /dev/sdb
             version: 0A82
             serial: WD-WCC7K7HFN3K7
             size: 3726GiB (4TB)
             configuration: ansiversion=5 logicalsectorsize=512 sectorsize=4096
     *-scsi:2
          physical id: 4
          logical name: scsi3
          capabilities: emulated
        *-disk
             description: ATA Disk
             product: WDC WD40EFRX-68N
             vendor: Western Digital
             physical id: 0.0.0
             bus info: scsi@3:0.0.0
             logical name: /dev/sdc
             version: 0A82
             serial: WD-WCC7K1XSZYZ6
             size: 3726GiB (4TB)
             configuration: ansiversion=5 logicalsectorsize=512 sectorsize=4096
     *-scsi:3
          physical id: 5
          logical name: scsi9
          capabilities: emulated
        *-processor UNCLAIMED
             description: SCSI Processor
             physical id: 0.0.0
             bus info: scsi@9:0.0.0
  *-network:0
       description: Ethernet interface
       physical id: 1
       logical name: vethBC83V0
       serial: fe:72:5a:77:15:f2
       size: 10Gbit/s
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=veth driverversion=1.0 duplex=full link=yes multicast=yes port=twisted pair speed=10Gbit/s
  *-network:1
       description: Ethernet interface
       physical id: 2
       logical name: veth4IKF6U
       serial: fe:a4:7f:d9:88:e8
       size: 10Gbit/s
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=veth driverversion=1.0 duplex=full link=yes multicast=yes port=twisted pair speed=10Gbit/s
  *-network:2
       description: Ethernet interface
       physical id: 3
       logical name: veth6FWFI5
       serial: fe:26:a4:3e:ec:22
       size: 10Gbit/s
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=veth driverversion=1.0 duplex=full link=yes multicast=yes port=twisted pair speed=10Gbit/s
  *-network:3 DISABLED
       description: Ethernet interface
       physical id: 4
       logical name: lxc-nic
       serial: 52:54:00:c6:f0:23
       size: 10Mbit/s
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=tun driverversion=1.6 duplex=full link=no multicast=yes port=twisted pair speed=10Mbit/s

hwinfo --short

cpu:                                                            
                       Intel(R) Celeron(R) CPU  N3150  @ 1.60GHz, 480 MHz
                       Intel(R) Celeron(R) CPU  N3150  @ 1.60GHz, 480 MHz
                       Intel(R) Celeron(R) CPU  N3150  @ 1.60GHz, 480 MHz
                       Intel(R) Celeron(R) CPU  N3150  @ 1.60GHz, 480 MHz
graphics card:
                       Intel VGA compatible controller
sound:
                       Intel Audio device
storage:
                       Intel SATA controller
                       Marvell 88SE9128 PCIe SATA 6 Gb/s RAID controller
network:
  eth0                 Realtek RTL8111/8168 PCI Express Gigabit Ethernet controller
network interface:
  veth6FWFI5           Ethernet network interface
  lxc                  Ethernet network interface
  eth0                 Ethernet network interface
  vethBC83V0           Ethernet network interface
  lxc-nic              Ethernet network interface
  lo                   Loopback network interface
  veth4IKF6U           Ethernet network interface
disk:
  /dev/sdb             WDC WD40EFRX-68N
  /dev/sdc             WDC WD40EFRX-68N
  /dev/sda             KINGSTON SV300S3
partition:
  /dev/sda1            Partition
  /dev/sda2            Partition
  /dev/sda3            Partition
usb controller:
                       Intel USB Controller
bios:
                       BIOS
bridge:
                       Intel Host bridge
                       Intel PCI bridge
                       Intel PCI bridge
                       Intel ISA bridge
hub:
                       Linux 4.8.0-0.bpo.2-amd64 xhci-hcd xHCI Host Controller
                       Genesys Logic USB2.0 Hub
                       Linux 4.8.0-0.bpo.2-amd64 xhci-hcd xHCI Host Controller
memory:
                       Main Memory
unknown:
                       FPU
                       DMA controller
                       PIC
                       Keyboard controller
  /dev/lp0             Parallel controller
                       PS/2 Controller
                       Intel SMBus
                       Intel Encryption controller
  /dev/ttyS0           16550A
  /dev/ttyS1           16550A
  /dev/sg3             Marvell 91xx Config

lspci

00:00.0 Host bridge: Intel Corporation Device 2280 (rev 21)
00:02.0 VGA compatible controller: Intel Corporation Device 22b1 (rev 21)
00:13.0 SATA controller: Intel Corporation Device 22a3 (rev 21)
00:14.0 USB controller: Intel Corporation Device 22b5 (rev 21)
00:1a.0 Encryption controller: Intel Corporation Device 2298 (rev 21)
00:1b.0 Audio device: Intel Corporation Device 2284 (rev 21)
00:1c.0 PCI bridge: Intel Corporation Device 22c8 (rev 21)
00:1c.1 PCI bridge: Intel Corporation Device 22ca (rev 21)
00:1f.0 ISA bridge: Intel Corporation Device 229c (rev 21)
00:1f.3 SMBus: Intel Corporation Device 2292 (rev 21)
01:00.0 SATA controller: Marvell Technology Group Ltd. 88SE9128 PCIe SATA 6 Gb/s RAID controller (rev 20)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 11)

ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d0:50:99:78:03:d2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.100/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
5: lxc: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:c6:f0:23 brd ff:ff:ff:ff:ff:ff
    inet 10.11.0.1/24 brd 10.11.0.255 scope global lxc
       valid_lft forever preferred_lft forever
6: lxc-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master lxc state DOWN group default qlen 1000
    link/ether 52:54:00:c6:f0:23 brd ff:ff:ff:ff:ff:ff
12: veth6FWFI5@if11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxc state UP group default qlen 1000
    link/ether fe:26:a4:3e:ec:22 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc26:a4ff:fe3e:ec22/64 scope link 
       valid_lft forever preferred_lft forever
16: veth4IKF6U@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxc state UP group default qlen 1000
    link/ether fe:a4:7f:d9:88:e8 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fca4:7fff:fed9:88e8/64 scope link 
       valid_lft forever preferred_lft forever
38: vethBC83V0@if37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxc state UP group default qlen 1000
    link/ether fe:72:5a:77:15:f2 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc72:5aff:fe77:15f2/64 scope link 
       valid_lft forever preferred_lft forever

ethtool eth0

Settings for eth0:
    Supported ports: [ TP MII ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Half 1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: Symmetric Receive-only
    Advertised auto-negotiation: Yes
    Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                         100baseT/Half 100baseT/Full 
                                         1000baseT/Full 
    Link partner advertised pause frame use: Symmetric
    Link partner advertised auto-negotiation: Yes
    Speed: 1000Mb/s
    Duplex: Full
    Port: MII
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    Supports Wake-on: pumbg
    Wake-on: g
    Current message level: 0x00000033 (51)
                   drv probe ifdown ifup
    Link detected: yes

iptables

iptables -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1    1280K   89M fail2ban-ssh  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            multiport dports 22
2        0     0 ACCEPT     udp  --  lxc    *       0.0.0.0/0            0.0.0.0/0            udp dpt:53
3        0     0 ACCEPT     tcp  --  lxc    *       0.0.0.0/0            0.0.0.0/0            tcp dpt:53
4        0     0 ACCEPT     udp  --  lxc    *       0.0.0.0/0            0.0.0.0/0            udp dpt:67
5        0     0 ACCEPT     tcp  --  lxc    *       0.0.0.0/0            0.0.0.0/0            tcp dpt:67
6     615K  107M ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
7        0     0 REJECT     all  --  !lo    *       0.0.0.0/0            127.0.0.0/8          reject-with icmp-port-unreachable
8    7065K 1431M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
9       40  2560 ACCEPT     tcp  --  *      *       0.0.0.0/0            192.168.0.100        state NEW tcp dpt:22
10      27  1724 ACCEPT     tcp  --  *      *       0.0.0.0/0            192.168.0.100        state NEW tcp dpt:80
11   15377  923K ACCEPT     tcp  --  *      *       10.11.0.10           10.11.0.1            state NEW tcp dpt:4949
12    340K   65M ACCEPT     udp  --  *      *       192.168.0.0/24       0.0.0.0/0            state NEW udp dpt:5353
13       0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            192.168.0.100        state NEW tcp dpt:3689
14       0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            192.168.0.100        state NEW tcp dpt:6600
15       5   412 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmptype 8
16    309K   77M LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            limit: avg 5/min burst 5 LOG flags 0 level 7 prefix "iptables denied: "
17    441K   97M DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1      429 38624 ACCEPT     tcp  --  *      *       0.0.0.0/0            10.11.0.20           state NEW tcp dpt:445
2        7   444 ACCEPT     tcp  --  *      *       0.0.0.0/0            10.11.0.20           state NEW tcp dpt:139
3        0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            10.11.0.20           state NEW udp dpt:138
4        2   156 ACCEPT     udp  --  *      *       0.0.0.0/0            10.11.0.20           state NEW udp dpt:137
5     243M  228G ACCEPT     all  --  *      lxc     0.0.0.0/0            10.11.0.0/24         ctstate RELATED,ESTABLISHED
6      84M  341G ACCEPT     all  --  lxc    *       10.11.0.0/24         0.0.0.0/0           
7        0     0 ACCEPT     all  --  lxc    lxc     0.0.0.0/0            0.0.0.0/0           
8        0     0 REJECT     all  --  *      lxc     0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable
9        0     0 REJECT     all  --  lxc    *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable
10       0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1        0     0 ACCEPT     udp  --  *      lxc     0.0.0.0/0            0.0.0.0/0            udp dpt:68
2      12M 9842M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain fail2ban-ssh (1 references)
num   pkts bytes target     prot opt in     out     source               destination         
1    1280K   89M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0
debian-jessie
gigabit-ethernet
asked on Super User Apr 3, 2017 by greenone83 • edited Apr 3, 2017 by greenone83

1 Answer

3

update

It seems my hypothesis, below, had merit: here you will find a recent guide on how to correct the 8168 behaviour by installing the appropriate drivers, and how to make them stick after a kernel upgrade/reboot.

protocols

Using a protocol such as SFTP implies adding encryption and compression. Compressing a file means that you hit the CPU, but increase the network bandwidth. Which is itself, on a slow CPU, influenced by CPU load. So you need to strike a balance between the two.

The relevant settings are the same as SSH and SCP. You want to experiment with different ciphers, because each implementation is machine dependant.

Also, network configuration for short-latency, large-bandwidth connections is different than the reverse. Linux has auto-tuning, but still your situation might fall outside its limits; here you'll find some more information (and where to tweak). I remember seeing a script that claimed to do auto-tuning by transferring a large file between two hosts (one in server mode, one in client mode), but to do this you need two Linux hosts. And also, importantly, the best settings for talking to a Linux SFTP host might be very bad for a Samba connection to Windows 7, and so on.

In all likelihood, you will have to find a compromise between the various needs.


original answer

network:
 eth0                 Realtek RTL8111/8168 PCI Express Gigabit Ethernet controller
...
driver=r8169 

You're probably using an underperforming driver, that does not take advantage of the Realtek features (such as checksum offloading), resulting in excessive CPU load.

Here there are instructions on how to shoehorn the r8168 driver in:

You can install a dkms package with r8168 driver from official Ubuntu repositories.

You will need to uninstall the driver you have installed manually, then run in terminal:

sudo apt-get install r8168-dkms

The dkms package will rebuild the kernel module (driver) each time you upgrade a kernel.

The repository for Ubuntu 14.04 contains a dkms r8168 version 8.037.00-1.

It may work OK. But if you really need the latest driver, you can install it by:

wget http://mirrors.kernel.org/ubuntu/pool/universe/r/r8168/r8168-dkms_8.040.00-1_all.deb
sudo dpkg -i r8168-dkms_8.040.00-1_all.deb

That will install the same version that you are using now but with dkms support.

Another thing you might do is activate Large Frame support (you now have the standard MTU of 1500). For large file transfers, a MTU of up to 9000 may yield better results, provided that the driver and all involved parties support it likewise.

answered on Super User Apr 3, 2017 by LSerni • edited Apr 13, 2017 by Community

User contributions licensed under CC BY-SA 3.0