-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the network setting to match internal dev settings.
mend
- Loading branch information
1 parent
f528fb1
commit 61e0a83
Showing
10 changed files
with
73 additions
and
107 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,61 @@ | ||
echo "Running rto_setup.sh for GCE..." | ||
echo "Running rto_setup.sh" | ||
|
||
# Stop execution if any command exits with error | ||
set -e | ||
|
||
echo "Adjust RTO and apply non cache copy" | ||
first_line_res=$(ip route show | head -n 1) | ||
if [[ "$(echo "$first_line_res" | grep "rto_min lock 5ms" | wc -l)" -eq 0 ]]; then | ||
sudo ip route change "${first_line_res}" rto_min 5ms | ||
echo "Adjust Network settings and apply non cache copy" | ||
|
||
# Install ip. | ||
apt-get update | ||
yes | apt-get install net-tools | ||
yes | apt-get install iproute2 | ||
yes | apt-get install procps | ||
yes | apt-get install ethtool | ||
|
||
# Disable slow start after idle | ||
sysctl net.ipv4.tcp_slow_start_after_idle=0 | ||
|
||
# Disable metrics cache | ||
sysctl net.ipv4.tcp_no_metrics_save=1 | ||
|
||
# Address rto_min issue with two default routing entries: screen/7RGgkiXkGXSeYF2 | ||
route=$(ip route show | sed -n 1p) | ||
second_route=$(ip route show | sed -n 2p) | ||
if [[ "${second_route}" =~ ^default.* ]]; then | ||
modified_route=${route//" lock"/} | ||
ip route delete ${modified_route} | ||
fi | ||
route=$(ip route show | sed -n 1p) | ||
echo "route rto before change: $route" | ||
if [[ "${route}" =~ .*lock.*5ms.* ]]; then | ||
echo "${route}" | ||
else | ||
# shellcheck disable=SC2086 | ||
ip route change $route rto_min 5ms | ||
fi | ||
route=$(ip route show | sed -n 1p) | ||
echo "route rto after change: $route" | ||
|
||
# Disable Cubic Hystart Ack-Train | ||
echo 2 > /sys/module/tcp_cubic/parameters/hystart_detect | ||
|
||
# Improve handling SYN burst | ||
echo 4096 > /proc/sys/net/core/somaxconn | ||
echo 4096 > /proc/sys/net/ipv4/tcp_max_syn_backlog | ||
|
||
# Disable MTU Discovery | ||
echo 0 > /proc/sys/net/ipv4/tcp_mtu_probing | ||
|
||
# Increase TCP Zerocopy control memory | ||
sysctl -w net.core.optmem_max=131072 | ||
|
||
# Printing output of `ip route show` | ||
echo -e "\nPrinting output of 'ip route show':" | ||
ip route show | ||
|
||
first_line_res=$(ip route show | head -n 1) | ||
dev_name=$(echo "$first_line_res" | awk -F'[[:space:]]' '{ print $5 }') | ||
echo "dev_name=${dev_name}" | ||
sudo ethtool -K "${dev_name}" tx-nocache-copy on | ||
ethtool -K "${dev_name}" tx-nocache-copy on | ||
|
||
echo "rto_setup.sh finished" |