tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Crowther <>
Subject RE: Blocking threads in Tomcat
Date Tue, 01 Jul 2008 09:02:10 GMT
Tomcat version?
Java version?
Anything in the servlet that synchronises on a common lock?

In general, one worker thread handles one request, from start to finish; then it's returned
to the pool to be reused.  Is that what you would expect?

                - Peter

> From: Fredrik Tolf []
> Sent: 01 July 2008 05:11
> To: Tomcat Users List
> Subject: Blocking threads in Tomcat
> Hi list!
> I've had some issues with requests not being carried out in
> parallel by
> Tomcat. My problem is that I haven't been able to figure out when a
> worker thread blocks and when it does not.
> To try and pin down the behavior, I did a little experiment. I took a
> servlet that I had, that handles to separate URLs; let's call
> them "/a"
> and "/b". To try out the parallelism, I added a little delay in the
> servlet code by calling Thread.sleep(10000). I then tried them out in
> two browser tabs, and I find the results much enigmatic.
> When I try to access "/a" in one tab and "/b" in another,
> they both load
> in 10 seconds each -- that is, if I start the request for "/a" at
> 12:00:10 and the request for "/b" at 12:00:15, the request
> for "/a" will
> finish at 12:00:20, and the request for "/b" will finish at
> 12:00:25. As
> one would expect.
> However, when I request "/a" in both tabs, the requests seem to be
> carried out in sequence -- that is, if I again st´╗┐art the
> request in tab
> 1 for "/a" at 12:00:10 and the request for in tab 2 for, also
> for "/a",
> at 12:00:15, the request for tab 1 will finish at 12:00:20, and the
> request for tab 2 will finish at 12:00:30.
> Why is this? Is Tomcat explicitly not handling two requests for the
> exact same URL in parallel? It is the only explanation I can think of,
> but I cannot figure out how or why it would make sense. If it
> is indeed
> the case, can I somehow tell Tomcat to not do that?
> Thanks for your attention!
> Fredrik Tolf
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:
View raw message