Sysctl

From Leo's Notes
Revision as of 21:34, 25 February 2020 by Leo (talk | contribs) (Created page with " == Quick Usage == * {{code|sysctl -a}} to see all set values. * {{code|1=sysctl -w key=value}} to write a value. * {{code|sysctl -p /etc/sysctl.conf}} to apply what's in the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This page was last edited on 25 February 2020, at 21:34.


Quick Usage

  • sysctl -a to see all set values.
  • sysctl -w key=value to write a value.
  • sysctl -p /etc/sysctl.conf to apply what's in the /etc/sysctl.conf file.


Examples

TCP Tuning

# Provide adequate buffer memory.
# rmem_max and wmem_max are TCP max buffer size
# settable with setsockopt(), in bytes
# tcp_rmem and tcp_wmem are per socket in bytes.
# tcp_mem is for all TCP streams, in 4096-byte pages.
# The following are suggested on IBM's
# High Performance Computing page
# net.core.rmem_max = 524288000
# net.core.wmem_max = 524288000
net.core.rmem_default = 462144000
net.core.wmem_default = 462144000

net.ipv4.tcp_rmem = 4096 46214400 262144000
net.ipv4.tcp_wmem = 4096 46214400 262144000

# This server might have 200 clients simultaneously, so:
#   max(tcp_wmem) * 2 * 200 / 4096
net.ipv4.tcp_mem = 46214400 46214400 46214400
 
# Disable TCP SACK (TCP Selective Acknowledgement),
# DSACK (duplicate TCP SACK), and FACK (Forward Acknowledgement)
net.ipv4.tcp_sack = 0
net.ipv4.tcp_dsack = 0
net.ipv4.tcp_fack = 0
 
# Disable the gradual speed increase that's useful
# on variable-speed WANs but not for us
net.ipv4.tcp_slow_start_after_idle = 0

# recommended default congestion control is htcp
net.ipv4.tcp_congestion_control=htcp

# recommended for hosts with jumbo frames enabled
net.ipv4.tcp_mtu_probing=1

# recommended for CentOS7+/Debian8+ hosts
net.core.default_qdisc = fq

net.ipv4.tcp_low_latency=1