You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mirek Kopriva <mi...@gmail.com> on 2007/07/02 15:55:26 UTC
Tomcat Threads handling user Requests problem
Dear All,
I have a problem when too few (only 2) Tomcat's threads is handling my
requests.
First a little background on what I'm trying to do:
I have an web application, which loads a page. On loading the page there are
Ajax script calls (DWR framework),
requesting more data from the tomcat to be included into the calling page
dynamically.
There can be as many as 100 separate requests (not usual but possible) per a
page load via Ajax. Some of those
requests can take a while because of waiting for another application, I'm
trying to integrate with.
Now the problem. I can see only 2 Tomcat Threads, handling all of these
request, which as you can imagine can take a while.
Shouldn't tomcat take a new Thread from the Thread Pool for each Request up
to Maximum? Am I missing some configuration Tricks?
Here is the thread pool configuration taken from the Manager.:
Any Pointers/Suggestions/Tips would be greatly appreciated,
Best Regards,
Mirek
Max threads: 150 Min spare threads: 25 Max spare threads: 75 Current thread
count: 25 Current thread busy: 4
Max processing time: 226598 ms Processing time: 263.88 s Request count: 75
Error count: 14 Bytes received: 0.00 MB Bytes sent: 15.47 MB
Stage Time B Sent B Recv Client VHost Request *S* 8775 ms 0 KB 0 KB
127.0.0.1 localhost POST
/cmf/dwr/call/plaincall/FileDetailsDWRHelper.getFileChange.dwr
HTTP/1.1 *S* 2146
ms 0 KB 0 KB 127.0.0.1 localhost GET /manager/status HTTP/1.1 *R* ? ? ? ? ?
? *R* ? ? ? ? ? ? *S* 245751 ms 0 KB 0 KB 127.0.0.1 localhost POST
/cmf/dwr/call/plaincall/FileDetailsDWRHelper.getFileChange.dwr HTTP/1.1 *R*
? ? ? ? ? ?
P: Parse and prepare request S: Service F: Finishing R: Ready K: Keepalive
Re: Tomcat Threads handling user Requests problem
Posted by Mirek Kopriva <mi...@gmail.com>.
Hi Guys,
Thanks a lot for the prompt feedback.
Unfortunately it won't be acceptable to have users going to the registry to
improve the
performance of the application, so I will have to find out something else.
As custom multi-threading in an j2ee application is not recommended, I will
have to solve my problem
another way (MDB comes into my mind).
Thanks again,
Mirek
On 7/2/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>
>
> ----- Original Message -----
> From: "Rainer Jung" <ra...@kippdata.de>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Monday, July 02, 2007 8:24 PM
> Subject: Re: Tomcat Threads handling user Requests problem
>
>
> > Johnny Kewl wrote:
> >> Can you believe that, IE only allows 2 files downloaded at the same
> time,
> >> and then you have to dig into the registry.... get OPERA ;)
> >
> > The 2 connections are a recommendation for well-behaved http clients
> > coming from the http spec in order to keep server load related to one
> > client small. The 2 only limits the number of parallel connections to
> the
> > same server. In this special case it's not a Microsoft thing ...
>
> Yes, I know.... just having a little dig, IE7 is pretty cool, even does
> RSS
> feeds, and because of the HTTP/1.1 spec, the 2 file downloads per server
> is
> not really that terrible. I just like Opera.
> IE also does those "Web Site in an a single HTML file format", forget the
> name of the things, so its not half bad.... dont tell anyone, but I
> actually
> use both ;)
>
> >
> > Regards,
> >
> > Rainer
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Tomcat Threads handling user Requests problem
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message -----
From: "Rainer Jung" <ra...@kippdata.de>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Monday, July 02, 2007 8:24 PM
Subject: Re: Tomcat Threads handling user Requests problem
> Johnny Kewl wrote:
>> Can you believe that, IE only allows 2 files downloaded at the same time,
>> and then you have to dig into the registry.... get OPERA ;)
>
> The 2 connections are a recommendation for well-behaved http clients
> coming from the http spec in order to keep server load related to one
> client small. The 2 only limits the number of parallel connections to the
> same server. In this special case it's not a Microsoft thing ...
Yes, I know.... just having a little dig, IE7 is pretty cool, even does RSS
feeds, and because of the HTTP/1.1 spec, the 2 file downloads per server is
not really that terrible. I just like Opera.
IE also does those "Web Site in an a single HTML file format", forget the
name of the things, so its not half bad.... dont tell anyone, but I actually
use both ;)
>
> Regards,
>
> Rainer
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat Threads handling user Requests problem
Posted by Rainer Jung <ra...@kippdata.de>.
Johnny Kewl wrote:
> Can you believe that, IE only allows 2 files downloaded at the same
> time, and then you have to dig into the registry.... get OPERA ;)
The 2 connections are a recommendation for well-behaved http clients
coming from the http spec in order to keep server load related to one
client small. The 2 only limits the number of parallel connections to
the same server. In this special case it's not a Microsoft thing ...
Regards,
Rainer
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat Threads handling user Requests problem
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Here, I found a link so you can read about the PIPE stuff I'm waffling on
about
http://www.w3.org/Protocols/HTTP/Performance/
and it also give you a way to change it...
If you trick Tomcat into making it think its a HTTP/1.0 connection.... dont
ask me how but I imagine you can set the Ajax headers somewhere... then I
think you will see multiple connections..... but as the tests show....
HTTP/1.1 is probably faster anyway, and your server will probably fall over
on high volumes.....
----- Original Message -----
From: "Johnny Kewl" <jo...@kewlstuff.co.za>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Monday, July 02, 2007 7:34 PM
Subject: Re: Tomcat Threads handling user Requests problem
> Can you believe that, IE only allows 2 files downloaded at the same time,
> and then you have to dig into the registry.... get OPERA ;)
> Now that I advertised my favorite browser....
> I think its working and I have yet another theory ;)
> Modern browsers dont drop the connection, because establishing a
> connection is very expensive.... so effectively they make a pipe to the
> server, get the page, then suck down the images, and all the rest of it
> thru the "same" pipe... assuming that stuff is all on the same server.
> Think they call that stuff KEEP ALIVES, in general, its faster.
> So in fact I think that software is being very smart... its making one
> pipe for the browser and all the images and stuff.... and another pipe for
> the XMLHttpRequest, regardless of how many calls the script makes.... its
> probably faster than if a connection was made for everything in the web
> page and every script call.... and when you have 200 people using that
> page at the same time, I think you going to be very happy its only 2 and
> not 100 connections per page.
> Ajax design has to be done smartly.... you have to have something that
> keeps the users attention while you populate a table are whatever....
> otherwise they will get the urge to click again.
>
> So yes try that.... increase the connections on IE....
> http://blogs.msdn.com/ie/archive/2005/04/11/407189.aspx but I have a
> feeling it wont change.
> Or.... get Opera, I think it defaults to 8 connections to one server, and
> 20 max..... dont think it will change, but you just going to be happier
> anyway ;)
>
>
>
> ----- Original Message -----
> From: "Mirek Kopriva" <mi...@gmail.com>
> To: <us...@tomcat.apache.org>
> Sent: Monday, July 02, 2007 3:55 PM
> Subject: Tomcat Threads handling user Requests problem
>
>
>> Dear All,
>> I have a problem when too few (only 2) Tomcat's threads is handling my
>> requests.
>> First a little background on what I'm trying to do:
>> I have an web application, which loads a page. On loading the page there
>> are
>> Ajax script calls (DWR framework),
>> requesting more data from the tomcat to be included into the calling page
>> dynamically.
>>
>> There can be as many as 100 separate requests (not usual but possible)
>> per a
>> page load via Ajax. Some of those
>> requests can take a while because of waiting for another application, I'm
>> trying to integrate with.
>>
>> Now the problem. I can see only 2 Tomcat Threads, handling all of these
>> request, which as you can imagine can take a while.
>> Shouldn't tomcat take a new Thread from the Thread Pool for each Request
>> up
>> to Maximum? Am I missing some configuration Tricks?
>> Here is the thread pool configuration taken from the Manager.:
>> Any Pointers/Suggestions/Tips would be greatly appreciated,
>> Best Regards,
>> Mirek
>>
>> Max threads: 150 Min spare threads: 25 Max spare threads: 75 Current
>> thread
>> count: 25 Current thread busy: 4
>> Max processing time: 226598 ms Processing time: 263.88 s Request count:
>> 75
>> Error count: 14 Bytes received: 0.00 MB Bytes sent: 15.47 MB
>> Stage Time B Sent B Recv Client VHost Request *S* 8775 ms 0 KB 0 KB
>> 127.0.0.1 localhost POST
>> /cmf/dwr/call/plaincall/FileDetailsDWRHelper.getFileChange.dwr
>> HTTP/1.1 *S* 2146
>> ms 0 KB 0 KB 127.0.0.1 localhost GET /manager/status HTTP/1.1 *R* ? ? ? ?
>> ?
>> ? *R* ? ? ? ? ? ? *S* 245751 ms 0 KB 0 KB 127.0.0.1 localhost POST
>> /cmf/dwr/call/plaincall/FileDetailsDWRHelper.getFileChange.dwr HTTP/1.1
>> *R*
>> ? ? ? ? ? ?
>>
>> P: Parse and prepare request S: Service F: Finishing R: Ready K:
>> Keepalive
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat Threads handling user Requests problem
Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Can you believe that, IE only allows 2 files downloaded at the same time,
and then you have to dig into the registry.... get OPERA ;)
Now that I advertised my favorite browser....
I think its working and I have yet another theory ;)
Modern browsers dont drop the connection, because establishing a connection
is very expensive.... so effectively they make a pipe to the server, get the
page, then suck down the images, and all the rest of it thru the "same"
pipe... assuming that stuff is all on the same server.
Think they call that stuff KEEP ALIVES, in general, its faster.
So in fact I think that software is being very smart... its making one pipe
for the browser and all the images and stuff.... and another pipe for the
XMLHttpRequest, regardless of how many calls the script makes.... its
probably faster than if a connection was made for everything in the web page
and every script call.... and when you have 200 people using that page at
the same time, I think you going to be very happy its only 2 and not 100
connections per page.
Ajax design has to be done smartly.... you have to have something that keeps
the users attention while you populate a table are whatever.... otherwise
they will get the urge to click again.
So yes try that.... increase the connections on IE....
http://blogs.msdn.com/ie/archive/2005/04/11/407189.aspx but I have a
feeling it wont change.
Or.... get Opera, I think it defaults to 8 connections to one server, and 20
max..... dont think it will change, but you just going to be happier anyway
;)
----- Original Message -----
From: "Mirek Kopriva" <mi...@gmail.com>
To: <us...@tomcat.apache.org>
Sent: Monday, July 02, 2007 3:55 PM
Subject: Tomcat Threads handling user Requests problem
> Dear All,
> I have a problem when too few (only 2) Tomcat's threads is handling my
> requests.
> First a little background on what I'm trying to do:
> I have an web application, which loads a page. On loading the page there
> are
> Ajax script calls (DWR framework),
> requesting more data from the tomcat to be included into the calling page
> dynamically.
>
> There can be as many as 100 separate requests (not usual but possible) per
> a
> page load via Ajax. Some of those
> requests can take a while because of waiting for another application, I'm
> trying to integrate with.
>
> Now the problem. I can see only 2 Tomcat Threads, handling all of these
> request, which as you can imagine can take a while.
> Shouldn't tomcat take a new Thread from the Thread Pool for each Request
> up
> to Maximum? Am I missing some configuration Tricks?
> Here is the thread pool configuration taken from the Manager.:
> Any Pointers/Suggestions/Tips would be greatly appreciated,
> Best Regards,
> Mirek
>
> Max threads: 150 Min spare threads: 25 Max spare threads: 75 Current
> thread
> count: 25 Current thread busy: 4
> Max processing time: 226598 ms Processing time: 263.88 s Request count: 75
> Error count: 14 Bytes received: 0.00 MB Bytes sent: 15.47 MB
> Stage Time B Sent B Recv Client VHost Request *S* 8775 ms 0 KB 0 KB
> 127.0.0.1 localhost POST
> /cmf/dwr/call/plaincall/FileDetailsDWRHelper.getFileChange.dwr
> HTTP/1.1 *S* 2146
> ms 0 KB 0 KB 127.0.0.1 localhost GET /manager/status HTTP/1.1 *R* ? ? ? ?
> ?
> ? *R* ? ? ? ? ? ? *S* 245751 ms 0 KB 0 KB 127.0.0.1 localhost POST
> /cmf/dwr/call/plaincall/FileDetailsDWRHelper.getFileChange.dwr HTTP/1.1
> *R*
> ? ? ? ? ? ?
>
> P: Parse and prepare request S: Service F: Finishing R: Ready K: Keepalive
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat Threads handling user Requests problem
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mirek Kopriva [mailto:mirek1977@gmail.com]
> Subject: Re: Tomcat Threads handling user Requests problem
>
> Now the problem. I can see only 2 Tomcat Threads, handling
> all of these request, which as you can imagine can take a while.
This is the result of the browser complying with the HTTP RFC, which
recommends that a client open only two concurrent connections to a given
server. Nothing Tomcat can do about this. There is a registry setting
you can tweak in Windows to let IE6/7 open more than 2 at a time;
there's probably something equivalent in Firefox, but I don't know what
it is.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: [OT] Tomcat Threads handling user Requests problem
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Caldarale, Charles R
> Subject: RE: Tomcat Threads handling user Requests problem
>
> There is a registry setting you can tweak in Windows to let
> IE6/7 open more than 2 at a time; there's probably something
> equivalent in Firefox, but I don't know what it is.
For IE, look here:
http://support.microsoft.com/kb/282402/en-us
For Firefox, enter about:config, and edit the values for:
network.http.max-connections
network.http.max-connections-per-server
network.http.max-persistent-connections-per-proxy
network.http.max-persistent-connections-per-server
as needed.
http://kb.mozillazine.org/Network.http.max-connections
http://kb.mozillazine.org/Network.http.max-connections-per-server
http://kb.mozillazine.org/Network.http.max-persistent-connections-per-pr
oxy
http://kb.mozillazine.org/Network.http.max-persistent-connections-per-se
rver
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat Threads handling user Requests problem
Posted by David Delbecq <de...@oma.be>.
En l'instant précis du 02/07/07 15:55, Mirek Kopriva s'exprimait en ces
termes:
>
> There can be as many as 100 separate requests (not usual but possible)
> per a
> page load via Ajax. Some of those
> requests can take a while because of waiting for another application, I'm
> trying to integrate with.
Fun along the way :D
>
> Now the problem. I can see only 2 Tomcat Threads, handling all of these
> request, which as you can imagine can take a while.
> Shouldn't tomcat take a new Thread from the Thread Pool for each
> Request up
> to Maximum? Am I missing some configuration Tricks?
> Here is the thread pool configuration taken from the Manager.:
> Any Pointers/Suggestions/Tips would be greatly appreciated,
> Best Regards,
> Mirek
Indeed, tomcat grows serving thread until at maximum. But it grows only
if there are requests from client. I think you should check first that
it's not the dwr javascript on the client that is restricting to one
XmlHttpRequest at the time. You can use a toll like wireshark to sniff
you client/server connection and check what side is wrong.
If you see 100 different connection to your tomcat, all waiting for
answer and only 2 or 3 http thread on tomcat, then it's server side
fault, if you only see one connection at a time from client to server,
then it's the client fault :D
I bet dwr as safenet to avoid overloading server, and this safenet
restricts number of simultaneous ajax requests.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org