## Kernel Optimizations for few very high bandwidth connections.

# Quickly with this:
# curl -fsSL https://updates.safing.io/internal/sysctl.conf > /etc/sysctl.d/9999-spn-network-optimizing.conf
# cat /etc/sysctl.d/9999-spn-network-optimizing.conf
# sysctl -p /etc/sysctl.d/9999-spn-network-optimizing.conf

# Provide adequate buffer memory.
# net.ipv4.tcp_mem is in 4096-byte pages.
net.core.rmem_max = 1073741824
net.core.wmem_max = 1073741824
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.ipv4.tcp_rmem = 4096 16777216 1073741824
net.ipv4.tcp_wmem = 4096 16777216 1073741824
net.ipv4.tcp_mem = 4194304 8388608 16777216
net.ipv4.udp_rmem_min = 16777216
net.ipv4.udp_wmem_min = 16777216

# Enable TCP window scaling.
net.ipv4.tcp_window_scaling = 1

# Increase the length of the processor input queue
net.core.netdev_max_backlog = 100000
net.core.netdev_budget = 1000
net.core.netdev_budget_usecs = 10000

# Set better congestion control.
net.ipv4.tcp_congestion_control = htcp

# Turn off fancy stuff for more stability.
net.ipv4.tcp_sack = 0
net.ipv4.tcp_dsack = 0
net.ipv4.tcp_fack = 0
net.ipv4.tcp_timestamps = 0

# Max reorders before slow start.
net.ipv4.tcp_reordering = 3

# Prefer low latency to higher throughput.
# Disables IPv4 TCP prequeue processing.
net.ipv4.tcp_low_latency = 1

# Don't start slow.
net.ipv4.tcp_slow_start_after_idle = 0 
