You could check it apache threads are the problem by using something like:

ps -feH | grep httpd | wc
(or something else instead httpd to hit only apache processes)

If the line number gets close to 150 (Apache (prefork) MaxClients)
then that is the problem.


On Tue, Apr 12, 2011 at 2:18 PM, André Warnier <a...@ice-sa.com> wrote:
> Borut Hadžialić wrote:
>>
>> I'm gonna try to make a guess here :)
>>
>>> top - 08:20:02 up 72 days,  9:39,  4 users,  load average: 6.83, 5.63,
>>> 3.16
>>> Tasks: 265 total,   1 running, 264 sleeping,   0 stopped,   0 zombie
>>> Cpu(s):  0.2%us,  0.1%sy,  0.0%ni, 99.2%id,  0.5%wa,  0.0%hi,  0.0%si,
>>>  0.0%st
>>> Mem:  12328624k total, 11382976k used,   945648k free,   123400k buffers
>>> Swap:  4882424k total,      860k used,  4881564k free,  7565012k cached
>>
>> - somewhat large load average (6.83)
>> - but no io waiting (0.5%wa),
>> - app is heavily used
>> - tomcat requests take long time (sometimes takes few seconds to
>> produce the answer).
>>
>> Could it be a lack of threads at apache or tomcat?
>
> Spot on for the observation.
>
> That is one of the things that puzzle me : overall CPU usage is very low,
> and there is no i/o wait.  Yet the load average is high (which should mean
> that a number of processes are constantly waiting for something), and Tomcat
> is using 333% of CPU time (which may be very little time in an absolute
> sense, but is puzzling anyway).
> And the clients are waiting.
> So where are the time/resources being spent ?
>
> About threads :
> - Apache (prefork) MaxClients is set to 150
> - Tomcat AJP Connector does not specify any thread parameters, so defaults
> apply, which should be :
> maxThreads : 200
> maxSpareThreads : 50
> minSpareThreads : 4
>
> Considering that Apache handles most requests for static contents, I think
> that the numbers should be about right.
> But not having so far done any real monitoring, that may be wrong.  Which is
> one of the things I'd like to check.
>
> I think I'll start by making the Tomcat AJP Connector parameters explicit,
> and raise the minSpareThreads a bit.  And also its Heap size.
> But I don't like to start changing things left and right, without knowing
> exactly why I'm doing it.
>
> Is there for example any parameter or command-line switch that I can use for
> the JVM or Tomcat, which would tell me a bit more (in the logs) about when
> Tomcat is starting a new thread, how many are alive on average etc.. ?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>



-- 
Why?
Because YES!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to