Skip to content

Instantly share code, notes, and snippets.

@fnzv
Created April 7, 2018 10:51
Show Gist options
  • Save fnzv/ced4edaaa44cf12e1c34141b51555a51 to your computer and use it in GitHub Desktop.
Save fnzv/ced4edaaa44cf12e1c34141b51555a51 to your computer and use it in GitHub Desktop.
Automatically increase ulimit to 100k on Ubuntu 16
sudo echo 'fs.file-max = 100000' >> /etc/sysctl.conf
sudo sysctl -p
echo '* soft nproc 100000
* hard nproc 100000
* soft nofile 100000
* hard nofile 100000
root soft nproc 100000
root hard nproc 100000
root soft nofile 100000
root hard nofile 100000' >> /etc/security/limits.conf
echo 'session required pam_limits.so' >> /etc/pam.d/common-session
ulimit -n 100000
@fnzv
Copy link
Author

fnzv commented Apr 7, 2018

Related commands to increase maxconns:
sysctl net.core.somaxconn
sysctl -w net.core.somaxconn=2048
echo "net.core.somaxconn = 2048" >> /etc/sysctl.conf

@fnzv
Copy link
Author

fnzv commented Apr 7, 2018

Tuning Linux kernel for High Network traffic:
echo 'net.core.wmem_max=12582912' >> /etc/sysctl.conf
echo 'net.core.rmem_max=12582912' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_rmem= 10240 87380 12582912' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_wmem= 10240 87380 12582912' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_window_scaling = 1' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_timestamps = 1' >> /etc/sysctl.conf

echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
echo 10 > /proc/sys/net/ipv4/tcp_fin_timeout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment