From 586fa0f2058dda60f4e57f865b57a566e8b60445 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Tue, 31 Jul 2012 11:07:01 -0400 Subject: [PATCH] new scripts for tinkering with tcp buffer sizes on linux. --- scripts/networking/set_tcp_config.sh | 24 ++++++++++++++++++++++++ scripts/networking/show_tcp_memory.sh | 17 +++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 scripts/networking/set_tcp_config.sh create mode 100644 scripts/networking/show_tcp_memory.sh diff --git a/scripts/networking/set_tcp_config.sh b/scripts/networking/set_tcp_config.sh new file mode 100644 index 00000000..7fc3d76e --- /dev/null +++ b/scripts/networking/set_tcp_config.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# this script modifies the linux kernel for maximum tcp buffer size, which can +# improve long-haul transfers over a wan. + +# new maximum buffer size to set. +new_max=4194304 + +echo "net.core.wmem_max=$new_max" >> /etc/sysctl.conf +echo "net.core.rmem_max=$new_max" >> /etc/sysctl.conf + +echo "net.ipv4.tcp_rmem= 10240 87380 $new_max" >> /etc/sysctl.conf +echo "net.ipv4.tcp_wmem= 10240 87380 $new_max" >> /etc/sysctl.conf + +echo "net.ipv4.tcp_window_scaling = 1" >> /etc/sysctl.conf + +echo "net.ipv4.tcp_timestamps = 1" >> /etc/sysctl.conf + +echo "net.ipv4.tcp_sack = 1" >> /etc/sysctl.conf + +echo "net.ipv4.tcp_no_metrics_save = 1" >> /etc/sysctl.conf + +echo "net.core.netdev_max_backlog = 5000" >> /etc/sysctl.conf + diff --git a/scripts/networking/show_tcp_memory.sh b/scripts/networking/show_tcp_memory.sh new file mode 100644 index 00000000..7e81e94d --- /dev/null +++ b/scripts/networking/show_tcp_memory.sh @@ -0,0 +1,17 @@ + +function show_proc() +{ + echo ---------------------------------------------- + echo $* + $* +} + +show_proc cat /proc/sys/net/ipv4/tcp_mem +show_proc cat /proc/sys/net/core/rmem_default +show_proc cat /proc/sys/net/core/rmem_max +show_proc cat /proc/sys/net/core/wmem_default +show_proc cat /proc/sys/net/core/wmem_max +show_proc cat /proc/sys/net/core/optmem_max +show_proc cat /proc/net/sockstat +show_proc cat /proc/sys/net/ipv4/tcp_max_orphans + -- 2.34.1