I am not sure that I used the correct commands for setting the RPS for a 32 cores machine. This is what I used: echo 1f > /sys/class/net/eth0/queues/rx-0/rps_cpus
Should it be "echo 1f..." or "echo f..." or anything else?
Receive Packet Steering (RPS) creates a hash from the IP addresses and port. numbers, which it then uses to determine to which CPU to enqueue the packet. The use of the hash ensures that packets for the same stream of data are sent. to the same CPU, which helps to increase performance.
Receive Packet Steering (RPS) is similar to RSS in that it is used to direct packets to specific CPUs for processing. However, RPS is implemented at the software level, and helps to prevent the hardware queue of a single network interface card from becoming a bottleneck in network traffic.
Pinterest engineers just say:
echo f > /sys/class/net/eth0/queues/rx-0/rps_cpus
But there are another their talk:
echo ffff > /sys/class/net/eth0/queues/rx-0/rps_cpus
Can't see the actual difference from kernel point of view but you can try both
Reproducing from the Performance Tuning Guide for Red Hat Enterprise Linux 7:
The rps_cpus files use comma-delimited CPU bitmaps. Therefore, to allow a CPU to handle interrupts for the receive queue on an interface, set the value of their positions in the bitmap to 1. For example, to handle interrupts with CPUs 0, 1, 2, and 3, set the value of rps_cpus to 00001111 (1+2+4+8), or f (the hexadecimal value for 15).
So for quad-core cpus...
echo f > /sys/class/net/eth0/queues/rx-0/rps_cpus
and for cpus with >4 cores...
echo ff+ > /sys/class/net/eth0/queues/rx-0/rps_cpus
where ff+ is a regex for appending extra f(s) for each set of additional 4 cores
You might want to try using binary calculator and nproc:
echo "obase=16;2^$(nproc)-1" | bc > /sys/class/net/eth0/queues/rx-0/rps_cpus
That formula will configure RPS for any number of cores.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With