Re: Max udp buffer size
Re: Max udp buffer size
- Subject: Re: Max udp buffer size
- From: Matthew Wallace <email@hidden>
- Date: Mon, 30 Apr 2012 08:46:24 -0500
Worked like a champ - thanks so much for your help! As a curiousity, I still haven't been able to figure out where the value of 5591040 came from. If the value was really 1/16 of 64MB that would give 4MB as the max recv buffers - any ideas how they arrived at the seemingly random value of 5591040?
-Matt
On Mon, Apr 30, 2012 at 7:49 AM, Andrew Gallatin
<email@hidden> wrote:
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
------------------------
This message is for the named person(s) use only. It may contain confidential proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly use, disclose,distribute, print, or copy any part of this message if you are not the intended recipient. Allston Trading LLC and its subsidiaries and affiliates each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity.
------------------------
_______________________________________________
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