Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Oct 2008 13:02:53 -0700
From:      Jeremy Chadwick <koitsu@FreeBSD.org>
To:        Chuck Swiger <cswiger@mac.com>
Cc:        FreeBSD <freebsd@optiksecurite.com>, freebsd-questions@freebsd.org
Subject:   Re: collecting pv entries -- suggest increasing PMAP_SHPGPERPROC
Message-ID:  <20081027200253.GA29814@icarus.home.lan>
In-Reply-To: <6DE465B2-C9D2-4A97-994F-D08CD7FE6211@mac.com>
References:  <49060AE0.3000301@optiksecurite.com> <E0956D53-6EA3-4E70-91B2-6606EA48869A@mac.com> <49061898.60903@optiksecurite.com> <6DE465B2-C9D2-4A97-994F-D08CD7FE6211@mac.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Oct 27, 2008 at 12:56:30PM -0700, Chuck Swiger wrote:
> On Oct 27, 2008, at 12:38 PM, FreeBSD wrote:
>>> You need to keep your MaxClients setting limited to what your system 
>>> can run under high load; generally the amount of system memory is the 
>>> governing factor. [1]  If you set your MaxClients higher than that, 
>>> your system will start swapping under the load and once you start 
>>> hitting VM, it's game over: your throughput will plummet and clients 
>>> will start getting lots of broken connections, just as you describe.
>>
>> According to top, we have about 2G of Inactive RAM with 1,5G Active  
>> (4G total RAM with amd64). Swapping is not a problem in this case.
>
> With 4GB of RAM, you're less likely to run into issues, but the most  
> relevant numbers would be the Swap: line in top under high load, or the 
> output of "vmstat 1" / "vmstat -s".
>
> It would also be helpful to know what your httpd's are looking like in  
> terms of size, and what your content is like.  For Apache serving mostly 
> static content and not including mod_perl, mod_php, etc, you tend to have 
> 5-10MB processes and much of that is shared, so you might well be able to 
> run 400+ httpd children.  On the other hand, as soon as you pull in the 
> dynamic language modules like perl or PHP, you end up with much larger 
> process sizes (20 - 40 MB) and much more of their memory usage is 
> per-process rather than shared, so even with 4GB you probably won't be 
> able to run more than 100-150 children before swapping.
>
>> After checking multiple things (MySQL, networks, CPU, RAM) when a drop 
>> occurs, we determined that everytimes there is drop, the number is 
>> Apache's process is MaxClients (ps aux | grep httpd | wc -l) and the 
>> new http request doesn't get answer from Apache (the TCP hanshakes 
>> completes but Apache never push the data).
>
> Yes, that aspect is going to be the same pretty much no matter what the 
> bottleneck is or how large you set MaxClients to.  You will end up with 
> significantly better results (fewer drops, higher aggregate throughput) 
> if you tune appropriately than if you try to ramp MaxClients up further 
> than the available hardware can support.
>
> You might find that checking out the URLs being most commonly listed in 
> http://yourdomain.com/server-status when you run into high load problems 
> will point towards a particular script or dynamic content which is 
> causing a bottleneck.

One of the problems here is that the individual reporting the problem is
basing all of his conclusions on the first couple lines of top(1)
output, and is not bothering to look at per-process RSS or SZ.  "I have
lots of Inactive RAM, so what's the problem!??!"

We should probably take the time to explain to the user the fact that
shared pages per process != amount of RAM that's been touched/used at
one point but is currently unused.  Without someone explaining how the
VM works in this regard, he's going to continue to be confused and
correlate things which aren't necessarily related.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |




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