Forwarded with Roger's permission ;) Roger is also looking for feedbacks from BSD fans, since so far he had feedbacks only from those world dominating linux junkies :) ---------- Forwarded message ---------- Date: Wed, 7 Mar 2001 17:06:41 +0100 From: Roger Espel Llima <[EMAIL PROTECTED]> To: Stas Bekman <[EMAIL PROTECTED]> Cc: Eric Kolve <[EMAIL PROTECTED]> Subject: Re: mod_perl guide corrections. On Wed, Mar 07, 2001 at 09:28:15AM +0800, Stas Bekman wrote: > On Tue, 6 Mar 2001, Eric Kolve wrote: > > > I wanted to make a suggestion as well as ask a question about > > buffering. In the mod_perl > > guide(http://perl.apache.org/guide/scenario.html#Buffering_Feature) you > > mention that linux needs to have a RECV buffer size high enough such > > mod_perl can write the entire output to the buffer. While reading the > > tuning guide for lingerd, I noticed another setting, the SEND buffer > > size limit wmem_max. What I am wondering is, could you tell me if I am > > wrong that both (rmem_max and wmem_max) need to be the same. It seems > > to make sense that you would want the send buffer size as large as the > > receive. I apologize if this is crossing to much into a help session, > > but I did ask this of the mailing list and got no response. No, they don't need to be the same; the kernel's receive buffers and send buffers are used for different things: the receive buffers are for TCP data that hasn't been read by the application yet, and the send buffers are for application data that hasn't been sent over the network yet. If you're using a front-end proxy (Apache/mod_proxy, squid, or soemthing else), then the chain goes like this: Apache/mod_perl -> [kernel sendbuf] --tcp/ip--> [kernel recvbuf] ---(...) (...)--> Apache/mod_proxy -> [kernel sendbuf] --tcp/ip--> Client. you don't want Apache/mod_perl to block, so you want the page to fit in the sum of all the local (fast) buffers. the total amount of buffer space is 2*(kernel_sendbuf) + (kernel_rcvbuf) + (mod_proxy's userspace bufsize). this total should be more than the size of the webpages. (but also note that the kernel buffers are actually smaller than what you enter in wmem_max and rmem_max; these 'max' amounts seem to correspond to the total of allocated kernel memory per socket, but not all of this goes to actual tcp/ip data bytes. if your wmem_max is 64k, you might be able to write 55k or so without blocking). one final remark about this setup: increasing the kernel's rcvbuf too much seems like a bad idea, because you could just as easily increase mod_proxy's userspace bufsize, and get the same effect in terms of buffering capacity. kernel memory is 'pinned' (not swappable), so it's harder on the system to use a lot of it. the userspace buffer size for mod_proxy seems to be fixed to 8k, but changing it is just a matter of replacing HUGE_STRING_LEN with somethign else in proxy/proxy_http.c. with a lingerd setup, you don't have the proxy, so the chain is just: Apache/mod_perl -> [kernel sendbuf] --tcp/ip--> client. so here it becomes more important to have a big enough kernel sendbuf. > So, may be Roger will kind enough to help you out here, and I'll make the > necessary corrections to the guide and at the same time add the lingerd > technique while I'm on it. Thanks, Roger! Thanks to you too :) -- Roger Espel Llima, [EMAIL PROTECTED] http://www.iagora.com/~espel/index.html