Last active
January 22, 2016 14:00
-
-
Save shionryuu/0ca6d0c8dbdcf2a99ef7 to your computer and use it in GitHub Desktop.
achieve lowlatency
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/bash | |
| # | |
| # achieve lowlatency | |
| # | |
| flow_entries=32768 | |
| intf=eth0 | |
| core=$(cat /proc/cpuinfo | grep -c processor) | |
| rxn=$(ls /sys/class/net/$intf/queues/ | grep rx | wc -l) | |
| # no need to enable rps/rfs | |
| if [[ $rxn > 1 ]]; then | |
| exit 1 | |
| fi | |
| # disable irqbalance | |
| if ps aux | grep irqbalance | grep -v grep; then | |
| killall irqbalance > /dev/null 2>&1 | |
| fi | |
| # enable rfs | |
| echo $flow_entries > /proc/sys/net/core/rps_sock_flow_entries | |
| queue=0 | |
| while [[ $queue < $rxn ]] | |
| do | |
| # enable rps | |
| printf "%x\n" $((2**core-1)) > /sys/class/net/$intf/queues/rx-$queue/rps_cpus | |
| echo $((flow_entries/rxn)) > /sys/class/net/$intf/queues/rx-$queue/rps_flow_cnt | |
| ((queue++)) | |
| done | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment