Skip to content

Instantly share code, notes, and snippets.

@hatchetation
Last active December 21, 2015 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hatchetation/6233286 to your computer and use it in GitHub Desktop.
Save hatchetation/6233286 to your computer and use it in GitHub Desktop.
Kernel tuning for long fat networks
#!/bin/bash
# lfn-tcp-cfg.sh - tune kernel params for better throughput in high-latency situations.
#
# note that these settings don't persist past a reboot
# SEA <-> ORD has 55-60ms RTT. Assume nominal 65ms and 500mbps available bandwidth
# BDP = B/s * RTT(s)
# = 500mbps * 65ms
# = 3.6MB (3,611,111 B) : w/ 1475B MTU, ~2450 packets
# ^^^^ need to ensure that the kernel can keep this much data in flight
# increase global socket buffer size limits
sudo sysctl -w net.core.rmem_max=16777216
sudo sysctl -w net.core.wmem_max=16777216
# expand TCP socket (R/W) buffer sizes. ("minBytes defaultBytes maxBytes")
sudo sysctl -w net.ipv4.tcp_wmem="16384 4194304 16777216"
sudo sysctl -w net.ipv4.tcp_rmem="16384 4194304 16777216"
# increase max queue length, affects traffic IN. (eg, received by NIC prior to kernel)
echo 4000 | sudo tee /proc/sys/net/core/netdev_max_backlog
# increase transmit queue size.
sudo ifconfig eth0 txqueuelen 8000
# flush cached path-discovery settings so these tweaks take effect reliably.
echo 1 | sudo tee /proc/sys/net/ipv4/route/flush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment