Hello. This is Komiya from OPS.
This is how to calculate the value to be put in RPS_cpus according to the number of CPU cores.
There is a request to distribute network interrupt processing across multiple cores. (especially cache servers)
I relied on people who could do it and asked them to do their best so far.
[shell]# core=1 # echo "obase=16; ibase=10; $(( 2 ** ${core})) -1" | bc | tr '[A-Z]' '[a-z]' 1 # core=2 # echo "obase=16; ibase=10; $(( 2 ** ${core})) -1" | bc | tr '[A-Z]' '[a-z]' 3 # core=4 # echo "obase=16; ibase=10; $(( 2 ** ${core})) -1" | bc | tr '[A-Z]' '[a-z]' f # core=5 # echo "obase=16; ibase=10; $(( 2 ** ${core})) -1" | bc | tr '[A-Z]' '[a-z]' 1f[/shell]
Chef's recipe based on it (sorry bash)
[shell]$ vim site-cookbooks/base_setting/recipes/rps_cpus.rb -------------- package "bc" do not_if "which bc" action :install end
package "irqbalance" do not_if "rpm -qa|grep irqbalance" action :install end
service "irqbalance" do supports :status => true, :restart => true, :reload => :true action [ :enable, :start ] end
rps_path="/sys/class/net/eth0/queues/rx-0/rps_cpus" rps_flow_path="/sys/class/net/eth0/queues/rx-0/rps_flow_cnt" rps_sock_path="/proc/sys/net/core/rps_sock_ flow_entries"
bash "set-rps_flow" do only_if "ls #{rps_flow_path}" code <-EOC echo="" 4096=""> #{rps_flow_path} cpucore=`cat /proc/cpuinfo|grep -c processor` sock_num=`echo "4096 * ${cpucore}"|bc -l` echo ${sock_num} > #{rps_sock_path} cpubitmap=`echo "obase=16; ibase=10; $(( 2 ** ${cpucore})) -1" | bc | tr '[A-Z]' '[a-z]'` echo ${cpubitmap} > #{rps_path} EOC end --------------[/shell]
< reference>
I tried using RPS/RFS in CentOS 6.2 to distribute network interrupt processing to multiple cores, but the interrupt processing is not distributed to multiple cores... Because irqbalance was not working, there is information on how to specify the value of rps_cpus in the RH document.
------------------------------
Example 1:
To use CPU 0, 1, 2, and 3 for the rx-0 queue on eth0, set the value of rps_cpus to f (1+2+4+8 = 15 in hexadecimal) as follows:
Example 2:
To use CPUs 4, 5, 6, and 7 for the tx-0 queue on eth0, set the value of rps_cpus to f0 (16+32+64+128 = 240 in hexadecimal) as follows:
------------------------------
In VIOPS06, I talked about the latest Linux kernel cases such as RPS and RFS.
1. For example, RPS&RFS was implemented to ensure efficient multi-core support for applications with non-RSS compatible NICs, but what about virtualized environments?
There was a patch called multi-queue support for virtio-net and vhost-net for KVM. It is unconfirmed whether it has been merged (it was not merged at LinuxCon 2011).
If it is virtual rather than physical, I didn't really understand it even if I checked /proc/intterupts.
http://tsuchinoko.dmmlabs.com/?p=519" target="_blank"> Multi-queue network interface (fixed) | Tsuchinoko Blog
For the time being, this is the place. Thank you for reading.
20140404 postscript: Apparently the settings disappear when the OS is restarted. It seems that it would be better to write it in rc.local or something.
[shell]vi /etc/rc.local ----------------- echo 'ffff' > /sys/class/net/eth0/queues/rx-0/rps_cpus echo 32768 > /sys/class/net/eth0/queues/rx-0/rps_flow_cnt echo 32768 > /proc/sys/net/core/rps_sock_flow_entries -----------------[/shell]
</-EOC>