Performance Tuning

From VyOS Wiki
Revision as of 20:33, 9 April 2014 by Rps (talk | contribs) (Created page with "For optimal network performance you should assign a dedicated CPU core to each network interface. You can manually see the IRQ for each interface in '''/proc/interrupts''',...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

For optimal network performance you should assign a dedicated CPU core to each network interface.

You can manually see the IRQ for each interface in /proc/interrupts, e.g.

vyos@vyos:~$ cat /proc/interrupts | grep eth 
  16:        930   IO-APIC-fasteoi   eth1
  19:       2445   IO-APIC-fasteoi   eth0

The smp_affinity value for an interface is a bitmask of available CPU cores in hexidecimal. Example for a 4-core system:

            Binary       Hex 
    CPU 0    0001         1 
    CPU 1    0010         2
    CPU 2    0100         4
    CPU 3    1000         8

The configuration would look something like:

set interfaces ethernet eth0 smp_affinity 1
set interfaces ethernet eth1 smp_affinity 2

Manually, this would be:

echo 1 > /proc/irq/16/smp_affinity
echo 2 > /proc/irq/19/smp_affinity

Note that newer systems may have multiple IRQs for each interface, e.g.

 30:    3176819    3181843   PCI-MSI-edge      eth0-rx-0
 31:        393        343   PCI-MSI-edge      eth0-tx-0
 32:          5          5   PCI-MSI-edge      eth0
 33: 3696151744 3709942356   PCI-MSI-edge      eth1-rx-0
 34: 3110055844 3108916060   PCI-MSI-edge      eth1-tx-0
 35:    1674002    1673645   PCI-MSI-edge      eth1
 36:  695750170  650735677   PCI-MSI-edge      eth2-rx-0
 37: 2838722531 2838813824   PCI-MSI-edge      eth2-tx-0
 38:     879793     879761   PCI-MSI-edge      eth2
 39:   51381461   50904827   PCI-MSI-edge      eth3-rx-0
 40:    9658376    9570304   PCI-MSI-edge      eth3-tx-0
 41:          5          7   PCI-MSI-edge      eth3

Here, for each interface seperate IRQs are used for RX, TX, and control. VyOS will assign the same affinity to each of the queues associated with a specific network interface.

If smp_affinity auto is configured, VyOS will try to distribute NICs across CPU cores automatically.