Last active
December 26, 2018 08:55
-
-
Save chrolis/049e18ddb66df415f23a0c6468c03af5 to your computer and use it in GitHub Desktop.
RFS/RPS/XPS 自動設定する君
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# references: | |
# - https://blog.yuuk.io/entry/linux-networkstack-tuning-rfs | |
# - https://qiita.com/saitara/items/aabb9c8869079ceb96a2 | |
# - https://www.greptips.com/posts/1119/ | |
set -ue | |
rps_sock_flow_entries=32768 | |
for interface in /sys/class/net/eth*; do | |
# RFS/RPS | |
rxs=$(find "${interface}/queues" -maxdepth 1 -name 'rx-*' | wc -l) | |
rps_flow_cnt=$(( rps_sock_flow_entries / rxs )) | |
for qrx in "${interface}"/queues/rx-*; do | |
echo "echo 'FFFF' > ${qrx}/rps_cpus" | |
echo 'FFFF' > "${qrx}/rps_cpus" | |
echo "echo $rps_flow_cnt > ${qrx}/rps_flow_cnt" | |
echo $rps_flow_cnt > "${qrx}/rps_flow_cnt" | |
done | |
# XPS | |
i=0 | |
for qtx in "${interface}"/queues/tx-*; do | |
echo "echo 2^${i} | bc > ${qtx}/xps_cpus" | |
echo 2^${i} | bc > "${qtx}/xps_cpus" | |
i=$(( i + 1 )) | |
done | |
done | |
echo 32768 > /proc/sys/net/core/rps_sock_flow_entries |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment