Skip to content

Instantly share code, notes, and snippets.

@greentornado
Forked from tovbinm/Linux
Created September 10, 2019 03:57
Show Gist options
  • Save greentornado/d670431775fb3abc2578dcfe1b662ecb to your computer and use it in GitHub Desktop.
Save greentornado/d670431775fb3abc2578dcfe1b662ecb to your computer and use it in GitHub Desktop.
Increase ulimit
1.
# vim /etc/sysctl.conf
fs.file-max = 999999
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216
net.ipv4.ip_local_port_range = 1024 65535
2.
# vim /etc/security/limits.conf
root - nofile 999999
root soft nofile 999999
root hard nofile 999999
#(on a regular linux: * - nofile 999999)
3.
# vim /etc/pam.d/common-session
session required pam_limits.so
Reboot & Verify your settings:
# sysctl -p && cat /proc/sys/fs/file-max && ulimit -n
Consider increasing the following:
net.ipv4.tcp_max_syn_backlog
net.core.somaxconn
And decreasing 'vm.swappiness' to 5
echo "fs.file-max = 999999" >> /etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4096 4096 16777216" >> /etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 4096 4096 16777216" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65535" >> /etc/sysctl.conf
echo "net.ipv4.tcp_fin_timeout = 15" >> /etc/sysctl.conf
echo "root - nofile 999999" >> /etc/security/limits.conf
echo "root soft nofile 999999" >> /etc/security/limits.conf
echo "root hard nofile 999999" >> /etc/security/limits.conf
echo "session required pam_limits.so" >> /etc/pam.d/common-session
1. launchctl limit maxfiles 999999 999999
2. Restart you Mac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment