```bash echo " updating kernel settings" cat << EOF >> /etc/sysctl.conf # SWAP settings vm.swappiness=0 vm.panic_on_oom=0 vm.overcommit_memory=1 kernel.panic=10 kernel.panic_on_oops=1 vm.max_map_count = 262144 # Have a larger connection range available net.ipv4.ip_local_port_range=1024 65000 # Increase max connection net.core.somaxconn=10000 # 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 # 16MB 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 # 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 # ip_forward and tcp keepalive for iptables net.ipv4.tcp_keepalive_time=600 net.ipv4.ip_forward=1 # monitor file system events fs.inotify.max_user_instances=8192 fs.inotify.max_user_watches=1048576 EOF sysctl -p > /dev/null 2>&1 ```