Skip to content

Instantly share code, notes, and snippets.

@duong1989
Created January 17, 2024 03:25
Show Gist options
  • Save duong1989/c4dba44ccafbf9d7abc90eed0266c1b0 to your computer and use it in GitHub Desktop.
Save duong1989/c4dba44ccafbf9d7abc90eed0266c1b0 to your computer and use it in GitHub Desktop.
sysctl.conf
# Elasticsearch optimization
vm.max_map_count=262144
# Redis optimization
vm.overcommit_memory=1
net.core.somaxconn=65535
# Have a larger connection range available
net.ipv4.ip_local_port_range=1024 65000
# Reuse closed sockets faster
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_fin_timeout=15
# The maximum number of "backlogged sockets". Default is 128.
# net.core.somaxconn=4096
net.core.netdev_max_backlog=4096
# 16 MB per socket - which sounds like a lot, but will virtually never consume that much.
net.core.rmem_max=16777216
net.core.wmem_max=16777216
# Various network tunables
net.ipv4.tcp_max_syn_backlog=20480
net.ipv4.tcp_max_tw_buckets=400000
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_syn_retries=2
net.ipv4.tcp_synack_retries=2
net.ipv4.tcp_wmem=4096 65536 16777216
#vm.min_free_kbytes=65536
# Connection tracking to prevent dropped connections (usually issue on LBs)
net.netfilter.nf_conntrack_max=262144
# Error by setting the following: cannot stat /proc/sys/net/ipv4/netfilter/ip_conntrack_generic_timeout: No such file or directory
net.ipv4.netfilter.ip_conntrack_generic_timeout=120
net.netfilter.nf_conntrack_tcp_timeout_established=86400
# ARP cache settings for a highly loaded Docker Swarm
net.ipv4.neigh.default.gc_thresh1=8096
net.ipv4.neigh.default.gc_thresh2=12288
net.ipv4.neigh.default.gc_thresh3=16384
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment