2013/7/16 Mark Haroldson <markharold...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to