You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Marinko, Jeff" <Je...@intuit.com> on 2002/08/27 22:45:05 UTC

Processor Availability

Greetings!

Tomcat uses processors to service requests, as processors free up, they then
move on and process other requests.  My question is this:  Is there any way
to "lock" up all the processors?  Is there a maximum time before a processor
becomes available again, assuming it is taking to long to process a request?
Any way to check how many processors are active/in use?

Jeff


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Processor Availability

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 27 Aug 2002, Marinko, Jeff wrote:

> Date: Tue, 27 Aug 2002 13:45:05 -0700
> From: "Marinko, Jeff" <Je...@intuit.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Processor Availability
>
> Greetings!
>
> Tomcat uses processors to service requests, as processors free up, they then
> move on and process other requests.

Each processor also possesses a thread, so you can think of the set of
available processors as a "thread pool".

>  My question is this:  Is there any way
> to "lock" up all the processors?

Sure ... if you send "n+1" simultaneous requests when you've only got "n"
available processors, you're going to run out (assuming that each request
takes enough time for all of them to get submitted before the first ones
start completing.

Such things happen occasionally when you get spkies of request activity,
but it's usually a transient condition.  The analog in plain old web sites
is when a site gets Slashdotted :-).

>  Is there a maximum time before a processor
> becomes available again, assuming it is taking to long to process a request?

The amount of time your app takes to process a request is totally up to
your app.  There's nothing Tomcat can do if you decide to execute a
database query that takes 5 minutes because you're selecting through a
million rows without using an index.

The time it takes Tomcat to return the processor to the pool when a
request is completed is as small as we can make it (a few milliseconds on
a typical configuration).  There's no motivation (or code in Tomcat) for
keeping a processor unavailable any longer than it has to be.

Besides processors, there might be contention for available threads and/or
TCP/IP socket resources in your operating system.  There are also VERY
wide variations in the maximum number of threads a particular OS+JVM
combination can support -- the Volano Report <http://www.volano.com> makes
interesting reading in this regard.

> Any way to check how many processors are active/in use?
>

There's nothing built in, but it would be straightforward to create a
Valve that was stuck on the Engine (so it could see all requests to all
webapps).  Because this Valve will be executed by multiple threads at the
same time, maintaining a simple counter that is incremented at the start
of a request and decremented at the end would give you an active count.

For the requests being processed by a particular webapp, you could do the
same thing (and portably to boot) using a Filter mapped to "/*".

> Jeff
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>