Networking

Receive Side Scaling on Linux: RSS, RPS, RFS and Multi-Queue NICs

By NileVPS Team · Published · 5 min read

اقرأ المقال بالعربي

On a busy server, receiving packets is real CPU work: the network interface raises an interrupt, the kernel runs a softirq to pull packets off the ring, and the TCP/IP stack processes each one before the application sees it. If all of that lands on a single CPU core, that core can hit 100 percent while the others sit idle, and network throughput stalls even though the machine has spare capacity. Receive Side Scaling (RSS) and its software relatives RPS, RFS and XPS exist to spread this work across cores. This guide explains each one and shows how to inspect and configure them on a Linux VPS.

Spotting a single-core bottleneck

Before tuning anything, confirm that packet processing is the problem:

mpstat -P ALL 1

Watch the %soft column. If one CPU shows high softirq time under network load and the rest are near zero, packet processing is concentrated on that core. You can also compare the per-CPU counters:

watch -d 'grep -E "NET_RX|NET_TX" /proc/softirqs'
grep -iE "virtio|eth|ens|enp" /proc/interrupts

mpstat comes from the sysstat package. Find your interface name with ip link; it may be eth0, ens3, enp1s0 or similar.

RSS: hardware multi-queue

RSS is done by the network card, or by the virtual NIC on a VPS. The NIC has several receive queues, each with its own interrupt. For each incoming packet it computes a hash over fields such as source and destination IP and port, then uses an indirection table to map the hash to a queue. Packets of the same flow always land on the same queue, which preserves ordering, while different flows spread across queues and therefore across CPUs.

Check how many queues your interface supports and uses:

ethtool -l eth0

The output shows Pre-set maximums and Current hardware settings, usually as Combined channels (one RX and one TX queue together). If the current value is lower than the maximum, raise it:

sudo ethtool -L eth0 combined 4

View the hash indirection table and hash key:

ethtool -x eth0

On virtual machines that use virtio-net, multi-queue support depends on how the host configured the virtual NIC, and the number of queues is often tied to the number of vCPUs. Some VPS plans expose only one queue; in that case RPS is the tool to use.

IRQ distribution

Multiple queues only help if their interrupts run on different cores. The irqbalance service distributes them automatically and is installed by default on many distributions:

systemctl status irqbalance

To pin a queue manually, write a CPU list to its IRQ entry, where NN is the IRQ number from /proc/interrupts:

echo 2 | sudo tee /proc/irq/NN/smp_affinity_list

If you pin IRQs by hand, stop irqbalance or configure it to ignore those IRQs, or it may move them back.

RPS: software receive steering

Receive Packet Steering (RPS) does in software what RSS does in hardware. After the interrupt arrives on one core, the kernel hashes the packet and hands further processing to another core chosen from a CPU mask. This is useful when the NIC has fewer queues than you have cores.

RPS is configured per receive queue with a hexadecimal CPU bitmask. For a 4 vCPU VPS, f means CPUs 0 to 3:

cat /sys/class/net/eth0/queues/rx-0/rps_cpus
echo f | sudo tee /sys/class/net/eth0/queues/rx-0/rps_cpus

A value of 0 means RPS is disabled for that queue.

RFS: steering toward the application

Receive Flow Steering (RFS) improves on RPS by sending packets to the core where the application that reads the socket is running, which improves cache locality. It needs a global flow table plus a per-queue count:

sudo sysctl -w net.core.rps_sock_flow_entries=32768
echo 32768 | sudo tee /sys/class/net/eth0/queues/rx-0/rps_flow_cnt

With several queues, divide the global value between them, for example 8192 each for four queues.

XPS: transmit side

Transmit Packet Steering (XPS) maps CPUs to transmit queues, so a core sends through its own queue and avoids lock contention:

echo 1 | sudo tee /sys/class/net/eth0/queues/tx-0/xps_cpus
echo 2 | sudo tee /sys/class/net/eth0/queues/tx-1/xps_cpus

Many drivers set up XPS automatically when multi-queue is enabled.

Quick reference

FeatureWhere it runsConfigured with
RSSNIC hardware or virtual NICethtool -l, -L, -x
IRQ affinityInterrupt deliveryirqbalance, /proc/irq/*/smp_affinity_list
RPSKernel, receive path/sys/class/net/<if>/queues/rx-*/rps_cpus
RFSKernel, receive pathrps_sock_flow_entries, rps_flow_cnt
XPSKernel, transmit path/sys/class/net/<if>/queues/tx-*/xps_cpus

Making settings persistent

ethtool and /sys changes reset at reboot. A simple approach is a oneshot systemd unit, for example /etc/systemd/system/net-steering.service, with Type=oneshot, After=network-online.target, and ExecStart= lines that run your ethtool -L and sh -c 'echo f > /sys/class/net/eth0/queues/rx-0/rps_cpus' commands. Put the sysctl value in /etc/sysctl.d/. Enable the unit with systemctl enable net-steering.service and verify after a reboot.

When it matters

On a small VPS with one or two vCPUs and modest traffic, defaults are fine. These features matter for reverse proxies, VPN gateways, DNS resolvers, game servers and anything handling many packets per second. Combine them with IRQ affinity tuning and properly sized socket buffers. If you need more cores for packet-heavy workloads, compare plans on our pricing page.

FAQ

What is the difference between RSS and RPS?

RSS is done by the network card, which places packets into several hardware queues with separate interrupts. RPS does the same distribution in software after the packet arrives, so it works even when the NIC exposes only one queue, at the cost of some extra CPU work.

Should I enable RPS if my NIC already supports RSS?

Usually not, if the number of hardware queues matches the number of cores and IRQs are spread well. RPS is most useful when there are fewer queues than cores, or when one queue is still overloaded.

Why does ethtool -L fail on my VPS?

The virtual NIC may expose a single queue, or the driver may not support changing channels. Check the maximum in ethtool -l. If it is 1, use RPS and RFS instead to spread processing across vCPUs.

Related guides