Re: Max udp buffer size
Re: Max udp buffer size
- Subject: Re: Max udp buffer size
- From: Andrew Gallatin <email@hidden>
- Date: Mon, 30 Apr 2012 08:49:43 -0400
On 04/29/12 20:53, Matthew Wallace wrote:
Hoping this is the right forum for this question - I've noticed a
peculiar limit when setting net.inet.udp.recvspace using sysctl. This
value cannot be any larger than 5591040 bytes - any value larger than
that gives the error message "Result too large". This is on a MacPro
running OS X 10.7.3. Can anybody give me any clue as to where this
limitation comes from and if there's any way around it?
A while back (10.6?) Apple made socket buffer sizes conditional
on the amount of number of mbuf clusters. The value you're trying
to adjust is limited by sb_max. That, in turn, is set by
kern.ipc.maxsockbuf. That is limited to 1/16 of the amount of memory
allocated to network buffers. I think the goal was to prevent
one or two connections from being able to starve the entire machine.
The easiest fix is to increase the number of mbuf clusters using the
ncl=??? argument.
The default mbuf cluster pool size is 64MB (32768 2KB clusters),
and the maxsockbuf limit is indeed 1/16 of that:
root@macpro03:~# sysctl -a | egrep nmbcl\|maxsockb
kern.ipc.maxsockbuf: 4194304
kern.ipc.nmbclusters: 32768
To fix this, tell the system to use more than the
default 32768 mbufclusters via the ncl boot arg:
root@macpro02:~# nvram boot-args="ncl=131072"
root@macpro02:~# shutdown -r now
When the machine comes back up, it has more mbuf clusters,
and will allow you to raise kern.ipc.maxsockbuf:
root@macpro02:~# sysctl -w kern.ipc.maxsockbuf=16777216
kern.ipc.maxsockbuf: 8388608 -> 16777216
root@macpro02:~# sysctl -a | egrep nmbcl\|maxsockb
kern.ipc.maxsockbuf: 16777216
kern.ipc.nmbclusters: 131072
Now you can finally increase udp recvspace:
root@macpro02:~# sysctl -w net.inet.udp.recvspace=8388608
net.inet.udp.recvspace: 42080 -> 8388608
Drew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden