tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: Tomcat Concurrency
Date Mon, 15 Jul 2013 22:38:56 GMT
2013/7/16 Mark Haroldson <MarkHaroldson@msn.com>:
> Hello;
>
>
>
> I am running a tomcat 6 webapp using Jersey and I am running into a
> concurrency issue. When there are multiple concurrent connections to tomcat
> only one or two are processed concurrently. I have increased the maxThreads
> on the connector and now can see the requests being processed  by different
> threads however I still on observe one or two threads running concurrently.
>
>
>
> 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?
>

Looking at a crystal ball I would guess that your client is a web
browser. A well-behaving browser creates no more than 2 simultaneous
connections to the same host (a limitation recommended by the HTTP
specification).

A Tomcat can certainly serve more than 2 clients simultaneously. It is
possible to mis-configure it or create a servlet that serves no more
than 1 client, but you must be creative (in a newbie way) to do so.

Without seeing your actual configuration and your actual code it is
impossible to provide any review.

If congestion were at Tomcat side, as when several threads are waiting
for the same resource, it would be easy to spot the place by taking a
pair of thread dumps (see wiki -> FAQ -> Troubleshooting).


Best regards,
Konstantin Kolinko

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


Mime
View raw message