tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "verlag.preisser@t-online.de" <verlag.preis...@t-online.de>
Subject Re: Tomcat Concurrency
Date Mon, 15 Jul 2013 22:48:18 GMT
Hi,

-----Original-Nachricht-----
> Von: Mark Haroldson <MarkHaroldson@msn.com>
> An: <users@tomcat.apache.org>

> Example:
> 
> Given the following servlet;
> 
> 
> 
> Servlet()
> 
> {
> 
> Output("Start thread");
> 
> Thread.sleep(20000);
> 
> Output("End thread")
> 
> }
> 
> 
> 
> I would expect the following output
> 
> 
> 
> Start Thread
> 
> Start Thread
> 
> Start Thread
> 
> Start Thread
> 
> End Thread
> 
> End Thread
> 
> End Thread
> 
> End Thread
> 
> 
> 
> Instead I see
> 
> Start Thread
> 
> Start Thread
> 
> End Thread
> 
> End Thread
> 
> Start Thread
> 
> End Thread
> 
> Start Thread
> 
> End Thread
> 
> 
> 
> What are the factors that control thread concurrency in Tomcat? Has
> anyone seen behavior like this before? Should I expect a high number
> of concurrent threads or does java/tomcat gate access to the servlet?

Are you testing this with a Browser? If so, then I would guess the browser only uses 1 TCP
connection to send all requests. For example, Firefox and Chrome open only one TCP connection
and send the requests sequentially if I open multiple tabs with the same URL (they wait for
the 1st request to finish before they send the second request). In this case I see an output
like this:
Start Thread
End Thread
Start Thread
End Thread
Start Thread
End Thread

However, If I use IE10 on Win8, it will open multiple TCP connections and send the requests
concurrently. The output will look like this:
Start Thread
Start Thread
Start Thread
End Thread
End Thread
End Thread


Regards,
Konstantin Prei├čer



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


Mime
View raw message