"Herman Schultz" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>
> My understanding is tomcat will spawn a thread for each request to my
> servlet.
> How can I limit the number of thread that tomcat spawn for my servlet
> simultaneously?
>
> And let say if I limit the simulateous thread for my servlet to 10, what
> happens to the 11th request? Will it get dropped? Or Will it get queued?
>

TC 6 has the SemaphoreValve 
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/valves/SemaphoreValve.html)
 
that you could sub-class to do mostly what you want (or for TC 5 under Java 
5, grab the source and modify it).  It doesn't prevent the number of theads 
that Tomcat spawns, but it limits the number that are executing through it 
at any given time (out-of-the-box, it would be the number of threads 
accessing the Context, but you can sub-class it and override the 
controlConcurrency method to make it finer grained).  You could also look 
at the code, and do the same thing in a Filter.  In this case, the 11th 
request will get queued, at least until the browser gets tired of waiting 
for it :).

As Chris has already said, you can only limit the number of threads spawned 
at the <Connector> level.

> Thank you.
> 




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to