Re: Failed to set ProxyReceiveBufferSize

1999-12-08 Thread Bill Moseley

At 05:43 PM 11/28/99 -0500, Robin Berjon wrote:
>>This message is for every proxied request.
>>Does anybody knows what does it means ?
>>In proxy config I have 
>>ProxyReceiveBufferSize 1048576

Is the ProxyReceiveBufferSize buffer part of each child's processes memory
allocation?

I'm wondering how ProxyReceiveBufferSize might effect the benefits of using
two servers (light and heavy) on a single machine.  That is, does using a
larger ProxyReceiveBufferSize take away from the memory savings realized
from changing from one mod_perl server to a lightweight server and a
mod_perl server?

Thanks,


Bill Moseley
mailto:[EMAIL PROTECTED]



Re: Failed to set ProxyReceiveBufferSize

1999-12-04 Thread Stas Bekman

> > > "OB" == Oleg Bartunov <[EMAIL PROTECTED]> writes:
> > 
> > OB> This message is for every proxied request.
> > OB> Does anybody knows what does it means ?
> > OB> In proxy config I have 
> > OB> ProxyReceiveBufferSize 1048576
> > 
> > OB> Restarting proxy server doesn't helps.
> > 
> > OB> btw, anybody know what is an optimal size of ProxyReceiveBufferSize
> > OB> and does it really works.
> > 
> > As a followup to Vivek's email, I've digged up in the linux kernel
> > sources, the 2 relevant snippets are:
> > 
> > /usr/src/linux/net/core/sock.c:
> > 
> > /* Run time adjustable parameters. */
> > __u32 sysctl_wmem_max = SK_WMEM_MAX;
> > __u32 sysctl_rmem_max = SK_RMEM_MAX;
> > __u32 sysctl_wmem_default = SK_WMEM_MAX;
> > __u32 sysctl_rmem_default = SK_RMEM_MAX;
> > [snip]
> > case SO_RCVBUF:
> >   /* Don't error on this BSD doesn't and if you think
> >  about it this is right. Otherwise apps have to
> >  play 'guess the biggest size' games. RCVBUF/SNDBUF
> >  are treated in BSD as hints */
> >  
> >  if (val > sysctl_rmem_max)
> >val = sysctl_rmem_max;
> > 
> >  /* FIXME: is this lower bound the right one? */
> >  sk->rcvbuf = max(val*2,256);
> >  break; 
> > 
> > 
> > 
> > 
> > 
> > /usr/src/linux/include/linux/skbuff.h:
> > /* These are just the default values. This is run time configurable.
> >  * FIXME: Probably the config option should go away. -- erics
> >  */
> > 
> > # ifdef CONFIG_SKB_LARGE
> > #define SK_WMEM_MAX 65535
> > #define SK_RMEM_MAX 65535
> > #else
> > #define SK_WMEM_MAX 32767
> > #define SK_RMEM_MAX 32767
> > #endif
> > 
> > 
> > So the limit is either 32k or 64k, depending on CONFIG_SKB_LARGE...
> > If you set it bigger it silently uses the default value as you see in the
> > first code snippet
> > 
> > I used to write a 1Mb example in the guide. Have removed the rewishful
> > setting :)
> 
> No, don't remove it. Under FreeBSD it's possible to
> configure kernel to have more buffers for socket:
> 
> sysctl -w kern.ipc.maxsockbuf=2621440
> 
> I did this and errors are gone now ! I still use 1Mb value.
> Probably it's worth to comment this in your guide.

Of course! Thanks Oleg!

Someone wants to include a similar infobits regarding other OS?

___
Stas Bekman  mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheavenhttp://www.singlesheaven.com



Re: Failed to set ProxyReceiveBufferSize

1999-12-04 Thread Oleg Bartunov

On Sat, 4 Dec 1999, Stas Bekman wrote:

> Date: Sat, 4 Dec 1999 19:52:07 +0200 (IST)
> From: Stas Bekman <[EMAIL PROTECTED]>
> To: Oleg Bartunov <[EMAIL PROTECTED]>
> Cc: mod_perl list <[EMAIL PROTECTED]>
> Subject: Re: Failed to set ProxyReceiveBufferSize
> 
> >>>>> "OB" == Oleg Bartunov <[EMAIL PROTECTED]> writes:
> 
> OB> This message is for every proxied request.
> OB> Does anybody knows what does it means ?
> OB> In proxy config I have 
> OB> ProxyReceiveBufferSize 1048576
> 
> OB> Restarting proxy server doesn't helps.
> 
> OB> btw, anybody know what is an optimal size of ProxyReceiveBufferSize
> OB> and does it really works.
> 
> As a followup to Vivek's email, I've digged up in the linux kernel
> sources, the 2 relevant snippets are:
> 
> /usr/src/linux/net/core/sock.c:
> 
> /* Run time adjustable parameters. */
> __u32 sysctl_wmem_max = SK_WMEM_MAX;
> __u32 sysctl_rmem_max = SK_RMEM_MAX;
> __u32 sysctl_wmem_default = SK_WMEM_MAX;
> __u32 sysctl_rmem_default = SK_RMEM_MAX;
> [snip]
> case SO_RCVBUF:
>   /* Don't error on this BSD doesn't and if you think
>  about it this is right. Otherwise apps have to
>  play 'guess the biggest size' games. RCVBUF/SNDBUF
>  are treated in BSD as hints */
>  
>  if (val > sysctl_rmem_max)
>val = sysctl_rmem_max;
> 
>  /* FIXME: is this lower bound the right one? */
>  sk->rcvbuf = max(val*2,256);
>  break; 
> 
> 
> 
> 
> 
> /usr/src/linux/include/linux/skbuff.h:
> /* These are just the default values. This is run time configurable.
>  * FIXME: Probably the config option should go away. -- erics
>  */
> 
> # ifdef CONFIG_SKB_LARGE
> #define SK_WMEM_MAX 65535
> #define SK_RMEM_MAX 65535
> #else
> #define SK_WMEM_MAX 32767
> #define SK_RMEM_MAX 32767
> #endif
> 
> 
> So the limit is either 32k or 64k, depending on CONFIG_SKB_LARGE...
> If you set it bigger it silently uses the default value as you see in the
> first code snippet
> 
> I used to write a 1Mb example in the guide. Have removed the rewishful
> setting :)

No, don't remove it. Under FreeBSD it's possible to
configure kernel to have more buffers for socket:

sysctl -w kern.ipc.maxsockbuf=2621440

I did this and errors are gone now ! I still use 1Mb value.
Probably it's worth to comment this in your guide.

Regards,

Oleg

> 
> 
> ___
> Stas Bekman  mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas  
> Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
> www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
> single o-> + single o-+ = singlesheavenhttp://www.singlesheaven.com
> 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



Re: Failed to set ProxyReceiveBufferSize

1999-12-04 Thread Stas Bekman

> "OB" == Oleg Bartunov <[EMAIL PROTECTED]> writes:

OB> This message is for every proxied request.
OB> Does anybody knows what does it means ?
OB> In proxy config I have 
OB> ProxyReceiveBufferSize 1048576

OB> Restarting proxy server doesn't helps.

OB> btw, anybody know what is an optimal size of ProxyReceiveBufferSize
OB> and does it really works.

As a followup to Vivek's email, I've digged up in the linux kernel
sources, the 2 relevant snippets are:

/usr/src/linux/net/core/sock.c:

/* Run time adjustable parameters. */
__u32 sysctl_wmem_max = SK_WMEM_MAX;
__u32 sysctl_rmem_max = SK_RMEM_MAX;
__u32 sysctl_wmem_default = SK_WMEM_MAX;
__u32 sysctl_rmem_default = SK_RMEM_MAX;
[snip]
case SO_RCVBUF:
  /* Don't error on this BSD doesn't and if you think
 about it this is right. Otherwise apps have to
 play 'guess the biggest size' games. RCVBUF/SNDBUF
 are treated in BSD as hints */
 
 if (val > sysctl_rmem_max)
   val = sysctl_rmem_max;

 /* FIXME: is this lower bound the right one? */
 sk->rcvbuf = max(val*2,256);
 break; 





/usr/src/linux/include/linux/skbuff.h:
/* These are just the default values. This is run time configurable.
 * FIXME: Probably the config option should go away. -- erics
 */

# ifdef CONFIG_SKB_LARGE
#define SK_WMEM_MAX 65535
#define SK_RMEM_MAX 65535
#else
#define SK_WMEM_MAX 32767
#define SK_RMEM_MAX 32767
#endif


So the limit is either 32k or 64k, depending on CONFIG_SKB_LARGE...
If you set it bigger it silently uses the default value as you see in the
first code snippet

I used to write a 1Mb example in the guide. Have removed the rewishful
setting :)


___
Stas Bekman  mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheavenhttp://www.singlesheaven.com



Re: Failed to set ProxyReceiveBufferSize

1999-11-29 Thread Vivek Khera

>>>>> "OB" == Oleg Bartunov <[EMAIL PROTECTED]> writes:

OB> This message is for every proxied request.
OB> Does anybody knows what does it means ?
OB> In proxy config I have 
OB> ProxyReceiveBufferSize 1048576

OB> Restarting proxy server doesn't helps.

OB> btw, anybody know what is an optimal size of ProxyReceiveBufferSize
OB> and does it really works.

ProxyReceiveBufferSize is the size of the receive buffer for the
socket using setsockopt on SO_RCVBUF thusly (from proxy_http.c):

if (conf->recv_buffer_size) {
if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
   (const char *) &conf->recv_buffer_size, sizeof(int))
== -1) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
     "setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, 
using default");
}
}

Check your OS manual to see what the limits on that parameter for
sockets is.



RE: Failed to set ProxyReceiveBufferSize

1999-11-29 Thread Eric Cholet

> >This message is for every proxied request.
> >Does anybody knows what does it means ?
> >In proxy config I have 
> >ProxyReceiveBufferSize 1048576
> >
> >Restarting proxy server doesn't helps.
> 
> Are you sure you are getting this message on absolutely every proxy request ? 
> 
> Maybe 1048576 is a bit too high, are you really buffering that much ? I
> have set mine to 10240 but I suspect it might still be too high because
> what I am proying is pretty small. I don't get that error though. Have you
> tried setting it to a smaller value to see if you still get that error ?
> The example in the docs sets a buffer of 2048.
> 
> 
> >btw, anybody know what is an optimal size of ProxyReceiveBufferSize
> >and does it really works.


ProxyReceiveBufferSize is used to set the size of the proxy socket's
receive buffer; in proxy_http.c the value is used to set the SO_RCVBUF option.
Check your system's manpage for setsockopt, mine says:

 SO_SNDBUF and SO_RCVBUF are options to adjust
 the normal buffer sizes allocated for output and input buffers, respec-
 tively.  The buffer size may be increased for high-volume connections, or
 may be decreased to limit the possible backlog of incoming data.  The
 system places an absolute maximum on these values, which is accessible
 through the sysctl(3) MIB variable ``kern.maxsockbuf''.


> No, I'm unsure of how that buffer works, especially I don't know if it
> accumulates until it is full or there is nothing more to come, or if it is
> using the same kind of scheme as the new mod_cgi which is supposed to use a
> more efficient scheme. Knowing more about that would likely be useful for
> those of us that are using an Apache proxy to mod_perl.

mod_proxy then goes on to read data from the back end server in a 8k buffer
(HUGE_STRING_LEN = 8k), using a loop:

if (ap_should_client_block(r)) {
while ((i = ap_get_client_block(r, buffer, sizeof buffer)) > 0)
ap_bwrite(f, buffer, i);
}
ap_bflush(f);


--
Eric



Re: Failed to set ProxyReceiveBufferSize

1999-11-28 Thread Robin Berjon

>This message is for every proxied request.
>Does anybody knows what does it means ?
>In proxy config I have 
>ProxyReceiveBufferSize 1048576
>
>Restarting proxy server doesn't helps.

Are you sure you are getting this message on absolutely every proxy request ? 

Maybe 1048576 is a bit too high, are you really buffering that much ? I
have set mine to 10240 but I suspect it might still be too high because
what I am proying is pretty small. I don't get that error though. Have you
tried setting it to a smaller value to see if you still get that error ?
The example in the docs sets a buffer of 2048.


>btw, anybody know what is an optimal size of ProxyReceiveBufferSize
>and does it really works.

No, I'm unsure of how that buffer works, especially I don't know if it
accumulates until it is full or there is nothing more to come, or if it is
using the same kind of scheme as the new mod_cgi which is supposed to use a
more efficient scheme. Knowing more about that would likely be useful for
those of us that are using an Apache proxy to mod_perl.



.Robin
You can tune a piano, but you can't tuna fish.



Failed to set ProxyReceiveBufferSize

1999-11-28 Thread Oleg Bartunov

Hi,

I have 2 server setup - proxy and mod_perl enabled backend,
system is FreeBSD 3.1 release, apache 1.3.9, mod_perl 1.21-dev

Everything works fine but today I noticed strange messages in
proxy-error log:
[Sun Nov 28 19:12:44 1999] [error] [client 195.133.129.98] (55)No buffer space a
vailable: setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using def
ault

This message is for every proxied request.
Does anybody knows what does it means ?
In proxy config I have 
ProxyReceiveBufferSize 1048576

Restarting proxy server doesn't helps.

btw, anybody know what is an optimal size of ProxyReceiveBufferSize
and does it really works.


Regards,

Oleg
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83