2010年7月17日 星期六

Mac OSX tuning

For testing temporary improvements, you can directly use sysctl in a terminal window: (you have to be root to do that)
$ sudo sysctl -w kern.maxfiles=65536
kern.maxfiles: 12288 -> 65536

$ sudo sysctl -w net.inet.tcp.delayed_ack=0
net.inet.tcp.delayed_ack: 3 -> 0

$ sudo sysctl -w net.inet.tcp.win_scale_factor=8
net.inet.tcp.win_scale_factor: 3 -> 8

$ sudo sysctl -w net.inet.tcp.mssdflt=1440
net.inet.tcp.mssdflt: 512 -> 1440

$ sudo sysctl -w net.inet.udp.recvspace= 147456
net.inet.udp.recvspace: 42080 -> 147456

$ sudo sysctl -w net.inet.udp.maxdgram=57344
net.inet.udp.maxdgram: 9216 -> 57344

$ sudo sysctl -w net.inet.tcp.sendspace= 1048576
net.inet.tcp.sendspace: 65536 -> 1048576

$ sudo sysctl -w net.inet.tcp.recvspace= 1048576
net.inet.tcp.recvspace: 65536 -> 1048576

$ sudo sysctl -w net.local.stream.recvspace=65535
net.local.stream.recvspace: 8192 -> 65535

$ sudo sysctl -w net.local.stream.sendspace=65535
net.local.stream.sendspace: 8192 -> 65535

For permanent changes that last over a reboot, insert the appropriate configurations into Ltt>/etc/sysctl.conf. If this file does not exist must create it. So, for the above, just add the following lines to sysctl.conf:


kern.maxfiles=65536
net.inet.tcp.delayed_ack=0
net.inet.tcp.win_scale_factor=8
net.inet.tcp.mssdflt=1440
net.inet.udp.recvspace=147456
net.inet.udp.maxdgram=57344
net.inet.tcp.sendspace=1048576
net.inet.tcp.recvspace=1048576
net.local.stream.recvspace=65535
net.local.stream.sendspace=65535
Note This only works for OSX 10.3 or later! For earlier versions you need to use /etc/rc where you can enter whole sysctl commands.


參考:
http://kb.pert.geant.net/PERTKB/MacOSXOSSpecific

沒有留言:

wibiya widget