-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Konstantin,

On 7/15/13 6:38 PM, Konstantin Kolinko wrote:
> 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).

No longer true. Firefox and Chrome default to 6 per server:
http://kb.mozillazine.org/Network.http.max-connections-per-server
http://code.google.com/p/chromium/issues/detail?id=12066

> 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).

Mark, you should probably print the thread id when doing your
printlns. That will help you see what is going on. Also, you might
want to try making more than 4 connections. What client are you using?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJR5XhVAAoJEBzwKT+lPKRY00wP/3tOIEuEsw+4wdtZhnGYg+aI
nQj82y7wakuLBYHKDstl/EoEAqKtLoV/hM2nWyctpylkRlZs5oj8fPVEb6xINf4r
sqqJIwAFGomMod7H+TrQsXa4Tf6v1579iGGAPg4HgVw9MebzYz1y9eFeJ6BeODNw
/eapZyCeQFFP3CmFQIyyvYk060EqQnaefo8wTMYVc+UZ59zPvq9NwaigerCUezYG
nwq/GqcqRjdI+xUNkiCraldPVt7amBrUSeZsh2pvYzHvaAuzokaqHMo2kcpixyDf
kuTwCOdZHUaMsMsHyfh5b6jGNR06DV1djRNJF46jArL4DMCh9NS/H4UgACA1PgAb
OcW+YOn4lBzzR0lHfx3opitzn7d1i7s6NMwA7djwHRma+XusuMiZLUPahsq3/tXk
+zwGPiAKyxMb9U68hSZSzSbrEVjdeuyfUo8RKxFvX6RGIK8PcPpkZwOYyzMjuk6u
rVyxuSB5Ody4slGOAR/3jo6egTe6TXzqeXkL+Zlq7M5SVFVjUZlzmhc7jnb7wqBl
ZAXIV6hJmDPek+cgsaKi990KRYeWSqtU8W33WR21hgVZBsavJ0uz7wDNaEoPo4Zs
smA2rMVLA6yWFfOM7oaCJs0UwIfY/N2PNYmVmO8RjUzFT8533GHMKlR/oCAVsnrJ
u8UNSi9fglS5pelSMX4Z
=Punl
-----END PGP SIGNATURE-----

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

Reply via email to