Last active
June 16, 2023 11:49
-
-
Save adichad/2a347f6dcb8e662c8707cb741280246d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# fix for MacOS X users running out of ephemeral ports | |
# if network benchmark tools such as 'siege' or 'ab' freeze for several seconds: | |
# http://stackoverflow.com/questions/1216267/ab-program-freezes-after-lots-of-requests-why | |
# Enter sudo mode | |
sudo -i | |
# factory default as of Mac OS X 10.13.6; changing (lowering) this interferes with DNS resolution in most apps | |
sysctl -w net.inet.ip.portrange.first=49152 | |
echo "net.inet.ip.portrange.first=49152" >> /etc/sysctl.conf | |
# net.inet.tcp.msl: 15000 -> 1000; controls WAIT_TIMEOUT, makes unused connections available to tools like siege sooner | |
sysctl -w net.inet.tcp.msl=1000 | |
echo "net.inet.tcp.msl=1000" >> /etc/sysctl.conf | |
# kern.ipc.somaxconn: 128 -> 8192; because we can | |
sysctl -w kern.ipc.somaxconn=8192 | |
echo "kern.ipc.somaxconn=8192" >> /etc/sysctl.conf | |
# based on: https://gist.github.com/jpmx/4111000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment