Skip to content

Commit

Permalink
Decrease default values for net.ipv4.tcp_rmem and net.ipv4.tcp_wmem
Browse files Browse the repository at this point in the history
  • Loading branch information
hakman committed Jun 25, 2021
1 parent 76b0b6a commit 72bcc4c
Show file tree
Hide file tree
Showing 119 changed files with 578 additions and 144 deletions.
4 changes: 2 additions & 2 deletions nodeup/pkg/model/sysctls.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ func (b *SysctlBuilder) Build(c *fi.ModelBuilderContext) error {
"",

"# Increase the maximum total buffer-space allocatable",
"net.ipv4.tcp_wmem = 4096 12582912 16777216",
"net.ipv4.tcp_rmem = 4096 12582912 16777216",
"net.ipv4.tcp_wmem = 4096 87380 16777216",
"net.ipv4.tcp_rmem = 4096 87380 16777216",
"",

"# Increase the number of outstanding syn requests allowed",
Expand Down
13 changes: 12 additions & 1 deletion pkg/model/bootstrapscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func (b *BootstrapScript) Run(c *fi.Context) error {
"SetSysctls": func() string {
// By setting some sysctls early, we avoid broken configurations that prevent nodeup download.
// See https://github.com/kubernetes/kops/issues/10206 for details.
return "sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true\n"
return setSysctls()
},
}

Expand Down Expand Up @@ -477,3 +477,14 @@ func gzipBase64(data string) (string, error) {

return base64.StdEncoding.EncodeToString(b.Bytes()), nil
}

func setSysctls() string {
var b bytes.Buffer

b.WriteString("sysctl -w net.core.rmem_max=16777216 || true\n")
b.WriteString("sysctl -w net.core.wmem_max=16777216 || true\n")
b.WriteString("sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true\n")
b.WriteString("sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true\n")

return b.String()
}
5 changes: 4 additions & 1 deletion pkg/model/tests/data/bootstrapscript_0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ systemctl daemon-reload
systemctl daemon-reexec


sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
5 changes: 4 additions & 1 deletion pkg/model/tests/data/bootstrapscript_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ systemctl daemon-reload
systemctl daemon-reexec


sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
5 changes: 4 additions & 1 deletion pkg/model/tests/data/bootstrapscript_2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ systemctl daemon-reload
systemctl daemon-reexec


sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
5 changes: 4 additions & 1 deletion pkg/model/tests/data/bootstrapscript_3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ systemctl daemon-reload
systemctl daemon-reexec


sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
5 changes: 4 additions & 1 deletion pkg/model/tests/data/bootstrapscript_4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ systemctl daemon-reload
systemctl daemon-reexec


sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
5 changes: 4 additions & 1 deletion pkg/model/tests/data/bootstrapscript_5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ systemctl daemon-reload
systemctl daemon-reexec


sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ Resources.AWSEC2LaunchTemplateapiserverapiserversminimalexamplecom.Properties.La
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down Expand Up @@ -257,7 +260,10 @@ Resources.AWSEC2LaunchTemplatemasterustest1amastersminimalexamplecom.Properties.
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down Expand Up @@ -595,7 +601,10 @@ Resources.AWSEC2LaunchTemplatenodesminimalexamplecom.Properties.LaunchTemplateDa
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ Resources.AWSEC2LaunchTemplatemasterustest1amasterscomplexexamplecom.Properties.
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down Expand Up @@ -386,7 +389,10 @@ Resources.AWSEC2LaunchTemplatenodescomplexexamplecom.Properties.LaunchTemplateDa
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ Resources.AWSEC2LaunchTemplatemasterustest1amasterscontainerdexamplecom.Properti
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down Expand Up @@ -369,7 +372,10 @@ Resources.AWSEC2LaunchTemplatenodescontainerdexamplecom.Properties.LaunchTemplat
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ Resources.AWSEC2LaunchTemplatemasterustest1amasterscontainerdexamplecom.Properti
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down Expand Up @@ -351,7 +354,10 @@ Resources.AWSEC2LaunchTemplatenodescontainerdexamplecom.Properties.LaunchTemplat
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ Resources.AWSEC2LaunchTemplatemasterustest1amastersdockerexamplecom.Properties.L
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down Expand Up @@ -354,7 +357,10 @@ Resources.AWSEC2LaunchTemplatenodesdockerexamplecom.Properties.LaunchTemplateDat
sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true
function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export AWS_REGION=us-test-1



sysctl -w net.ipv4.tcp_rmem='4096 12582912 16777216' || true
sysctl -w net.core.rmem_max=16777216 || true
sysctl -w net.core.wmem_max=16777216 || true
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216' || true
sysctl -w net.ipv4.tcp_wmem='4096 87380 16777216' || true


function ensure-install-dir() {
Expand Down
Loading

0 comments on commit 72bcc4c

Please sign in to comment.