8

How to get maximum TCP Receive/Send window in MAC OS X?

There are two ctl in Linux. /proc/sys/net/core/rmem_max - Maximum TCP Receive Window (NET_CORE_RMEM_MAX) /proc/sys/net/core/wmem_max - Maximum TCP Send Window (NET_CORE_WMEM_MAX)

but i couldn't find how to get these parameters in mac os.

Does anybody know?

I have found the following ctls in MAC OS X: net.inet.tcp.recvspace, net.inet.tcp.sendspace, kern.ipc.maxsockbuf

It seems that recvspace+sendspace can't be greater than maxsockbuf. I have read about it here: http://www.macgeekery.com/tips/configuration/mac_os_x_network_tuning_guide_revisited

Vlad
  • 2,090
  • 3
  • 21
  • 37

2 Answers2

2

I'm not 100% sure whether these are the correct ones, but try sysctl -n net.inet.tcp.recvspace and sysctl -n net.inet.tcp.sendspace. You can set them with sysctl -w (see man sysctl).

DarkDust
  • 90,870
  • 19
  • 190
  • 224
  • 1
    These ctls (net.inet.tcp.recvspace, net.inet.tcp.sendspace) gave me current tcp buffers sizes for send and receive. I need to know maximum value to recvspace and sendspace. The only idea is: kern.ipc.maxsockbuf – Vlad Dec 22 '10 at 12:35
  • IPC is shorthand for InterProcessCommunication, so I doubt this is it. – DarkDust Dec 22 '10 at 12:51
  • Actually socket api is one of the ipc tool. I am not sure about kern.ipc.maxsockbuf. I have read it in the article mentioned above. I should run some tests. – Vlad Dec 22 '10 at 12:53
1

As OP mentioned: recvspace+sendspace < maxsockbuf

maxsockbuf is limited by kern.ipc.nmbclusters, nmbclusters*2KB/16=maxsockbuf

sysctl -a | egrep nmbcl\|maxsockb
kern.ipc.maxsockbuf: 8388608
kern.ipc.nmbclusters: 65536

To increase maxsockbuf, tell the system to use more than the default mbufclusters via the ncl boot arg: (you need to disable SIP before edit boot-args)

nvram boot-args="ncl=131072"
shutdown -r now

quote from here

Hunger
  • 5,186
  • 5
  • 23
  • 29