Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 2004 13:50:21 -0300
From:      fabulous <fabulous@t7ds.com.br>
To:        freebsd-performance@freebsd.org
Subject:   Re: net.inet.tcp.sendspace
Message-ID:  <40E2EF4D.3050508@t7ds.com.br>
In-Reply-To: <DFEBD5EB-C9F2-11D8-B73A-000A95C705DC@chittenden.org>
References:  <40E1A47D.6020709@t7ds.com.br> <DFEBD5EB-C9F2-11D8-B73A-000A95C705DC@chittenden.org>

next in thread | previous in thread | raw e-mail | index | archive | help


Thank you very very much.. but sysctl sendspace/recvspace will be the 
limits then? can I set SO_SNDBUF to something higher than tcp.sendspace?

I'm thinking of setting tcp.sendspace to 64k and using setsockopt on 
ircd to set it to 2k (why an irc connection would need more than that?), 
so apache will use 64k and ircd 2k.. am I right? :P

[]'s

Sean Chittenden wrote:

>> Is there any way to change its value according to the connection's uid 
>> or port?
> 
> 
> Not with sysctl(8).  You can by hacking the application and adding a few 
> setsockopt(2) calls, specifically the SO_RCVBUF and SO_SNDBUF options.  
> Here's a sample snippit you could follow:
> 
> /* Add these #includes if they aren't already there */
> #include <err.h>
> #include <sysexits.h>
> 
> /* Add this to the top of the function that calls listen(2) */
> int rcvbuf = 4096;
> int sndbuf = 4096;
> 
> /* And add these calls before the application makes its listen(2) call. 
>  You may find that some applications are already setting their send and 
> receive buffer sizes. */
> if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf)) != 0)
>   err(EX_OSERR, "setsockopt(2) for SO_RCVBUF failed");
> 
> if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf)) != 0)
>   err(EX_OSERR, "setsockopt(2) for SO_SNDBUF failed");
> 
>> I need small sendspaces to ircd and bigger ones to apache..
> 
> 
> Add the above to each of the applications before they make their 
> listen(2) calls.  It's a shame more applications don't let you tweak 
> this value via a config file.
> 
> -sc
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40E2EF4D.3050508>