ODROID-XU4 tune network and USB speed

It’s time for another small blog about the ODROID-XU4.
This is just a quick tip to improve your network and USB performance even more. It will optimize your hardware interrupts (IRQ) affinity on your ODROID-XU4.
This guide is for the 3.10.y kernel and debian 8. For other kernel versions the interrupts may have different numbers.

Description

Whenever a piece of hardware, such as disk controller or ethernet card, needs attention from the CPU, it throws an interrupt. The interrupt tells the CPU that something has happened and that the CPU should drop what it’s doing to handle the event. In order to prevent multiple devices from sending the same interrupts, the IRQ system was established where each device in a computer system is assigned its own special IRQ so that its interrupts are unique.
Starting with the 2.4 kernel, Linux has gained the ability to assign certain IRQs to specific processors (or groups of processors). This is known as SMP IRQ affinity, and it allows you control how your system will respond to various hardware events. It allows you to restrict or repartition the workload that you server must do so that it can more efficiently do it’s job.
Source

It’s always a good idea to spread your interrupts evenly across all CPUs. In my case I want to achieve the best performance possible. Therefore I want to use the faster A15 CPU cluster for all important interrupt handling.

There are basically 3 different interrupts on a headless ODROID-XU4 server you should take into consideration:

  • the USB2 port
  • the first USB3 port
  • the second USB3 port (the 1 Gigabit ethernet adapter is connected to this one)

Per default all 3 interrupts for these devices are handled by CPU0, which is a A7 core as you can see in the output below:

IRQ Tuning

First of all make sure that automatic IRQ balancing is disabled:

For debian add the following to your /etc/rc.local  file to pin the interrupt handling to A15 cores 4-6 (CPU4-6):

After a reboot and some file transfer you should see something like this:

Note the numbers for CPU4 and CPU5. CPU0 handled some initial interrupts during the boot, because rc.local isn’t executed immediately.

Benchmarks

Tuning without measuring performance before and afterwards is useless. So, here are some iperf results:

Up to 100 Mbit/s faster. Not bad for such an easy fix 🙂

Read my post in the ODROID forum to get some more information and tuning tips.

10 thoughts on “ODROID-XU4 tune network and USB speed”

  1. great update, i was hitting 870 and after the update hitting 940!
    ive been having massive issues with my Probox getting dropped from the XU4 (EXT4 – copying files/streaming/etc and it just randomly disconnects) so I upgraded the kernel (3.10.96 -> 3.10.103) having had one drop, but now,

    C:\ip>iperf.exe -c 192.168.2.1 -r
    ————————————————————
    Server listening on TCP port 5001
    TCP window size: 208 KByte (default)
    ————————————————————
    ————————————————————
    Client connecting to 192.168.2.1, TCP port 5001
    TCP window size: 208 KByte (default)
    ————————————————————
    [ 4] local 192.168.2.52 port 12145 connected with 192.168.2.1 port 5001
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0-10.0 sec 751 MBytes 630 Mbits/sec
    [ 4] local 192.168.2.52 port 5001 connected with 192.168.2.1 port 60215
    [ 4] 0.0-10.0 sec 1.06 GBytes 914 Mbits/sec

    (not sure which ones up/down) one way only maxes out at around 630-640)

    any ideas?

      1. It was already on performance 🙁
        I just noticed that 104 is now the latest kernel, so I ran your script and now its even worse haha.

        root@odroid:~# uname -a
        Linux odroid 3.10.104+ #1 SMP PREEMPT Fri Jan 13 22:56:35 CET 2017 armv7l GNU/Linux
        root@odroid:~#

        ————————————————————————————————–

        C:\ip>iperf.exe -c 192.168.2.1 -r
        ————————————————————
        Server listening on TCP port 5001
        TCP window size: 208 KByte (default)
        ————————————————————
        ————————————————————
        Client connecting to 192.168.2.1, TCP port 5001
        TCP window size: 208 KByte (default)
        ————————————————————
        [ 4] local 192.168.2.52 port 35581 connected with 192.168.2.1 port 5001
        [ ID] Interval Transfer Bandwidth
        [ 4] 0.0-10.0 sec 301 MBytes 253 Mbits/sec
        [ 4] local 192.168.2.52 port 5001 connected with 192.168.2.1 port 38749
        [ 4] 0.0-10.0 sec 204 MBytes 171 Mbits/sec

  2. Thanks update works perfectly, you could consider moving the infos out of the comment to a real article to make them more visible. My search yesterday was probably to specific but I did not find a official statement for the update path or a good HowTo like yours.

  3. Hi it appears to me that you changed from the OpenMediaVault Image that you used in 2015 to something else or did you successfully upgraded the debian 7 omv Image to debian 8 with omv 3 ?

    1. Hi,

      yes I upgraded to OMV 3 and Debian 8.
      It’s not too difficult.
      Just uninstall all plugins and the omv-extras package. Then run omv-release-upgrade. Afterwards install omv-extras package for OMV v3 and your plugins again.

      Edit: Before you upgrade you should change your boot.ini and /etc/fstab.
      Mount your boot partition like this:

      Then edit your /media/boot/boot.ini and change the ro to rw in the setenv line like this:

      Record the rootfs UUID!

      Afterwards edit your /etc/fstab and add the following as the beginning above the openmediavault volumes

Leave a Reply

Your email address will not be published. Required fields are marked *