Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Receive Packet Steering (RPS) for 32 cores

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?

like image 390
Nativ Vered Avatar asked Jun 03 '15 11:06

Nativ Vered


People also ask

What is Receive Packet Steering?

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.

What is network RPS?

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.


3 Answers

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

like image 167
Anatoly Avatar answered Oct 21 '22 10:10

Anatoly


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

like image 20
neel Avatar answered Oct 21 '22 09:10

neel


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.

like image 34
user9499243 Avatar answered Oct 21 '22 09:10

user9499243