You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jon Drukman <js...@cluttered.com> on 2012/05/10 21:06:26 UTC
Connection timeout
I have a commercial app running Tomcat 6. I don't really know anything
about Tomcat, so I need some help with performance tuning.
What happens is that a small percentage of connections from our client
machines just timeout on the connect. I assume I'm running into some
limitation in Tomcat.
Here's what I put in my server.xml:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="3000"
connectionLinger="-1"
acceptCount="500"
maxKeepAliveRequests="1"
enableLookups="false"
redirectPort="8443" />
The machine in question is an Amazon "Extra Large" instance, so it
should be plenty beefy.
Do those settings look good? Is there any other place I can tune the
system to have it accept more simultaneous clients, or have a deeper
wait queue?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Connection timeout
Posted by Igor Cicimov <ic...@gmail.com>.
Typing this from my phone so sorry for top posting no other option.
You might also check your garbage collection which can introduce some
pauses in some cases. Just a thought ...
On May 11, 2012 7:26 AM, "Jon Drukman" <js...@cluttered.com> wrote:
> Caldarale, Charles R <Chuck.Caldarale <at> unisys.com> writes:
>
> > Using JConsole or VisualVM would be a good start.
>
> OK, I'll take a look at those.
>
> > > There's only one app running on this tomcat, if that makes
> > > any difference.
> >
> > Does it connect to a database (or any other external resource)?
> > If so, are you using a connection pool for the
> > DB? You may have threads queuing up waiting for a
> > connection to become available.
>
> no, there is no external dependency that i'm aware of.
>
> -jsd-
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Connection timeout
Posted by Jon Drukman <js...@cluttered.com>.
Caldarale, Charles R <Chuck.Caldarale <at> unisys.com> writes:
> Using JConsole or VisualVM would be a good start.
OK, I'll take a look at those.
> > There's only one app running on this tomcat, if that makes
> > any difference.
>
> Does it connect to a database (or any other external resource)?
> If so, are you using a connection pool for the
> DB? You may have threads queuing up waiting for a
> connection to become available.
no, there is no external dependency that i'm aware of.
-jsd-
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Connection timeout
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jon Drukman [mailto:jsd@cluttered.com]
> Subject: Re: Connection timeout
> Is there any way to find out how many threads are being used
> at a given moment?
Using JConsole or VisualVM would be a good start. Either of those will let you see what's going on with threads, heap memory, and CPU usage. Those tools will also let you take thread dumps to find out where threads are looping or stuck, if you observe that behavior.
> There's only one app running on this tomcat, if that makes
> any difference.
Does it connect to a database (or any other external resource)? If so, are you using a connection pool for the DB? You may have threads queuing up waiting for a connection to become available.
- 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Connection timeout
Posted by Jon Drukman <js...@cluttered.com>.
Pid <pid <at> pidster.com> writes:
> The basic point we're making is that you are twiddling the wrong knobs.
OK, good to know.
> If you want to handle more connections, increase the size of the thread
> pool that handles requests, don't increase the size of the queue of
> requests waiting to be handled.
This is what I set it to. I am still getting random timeouts.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="3000"
connectionLinger="-1"
acceptCount="100"
maxThreads="2000"
maxKeepAliveRequests="1"
enableLookups="false"
redirectPort="8443" />
I don't know if the timeouts are caused by running out of threads though, there
is nothing in any of the catalina logs to indicate that.
Is there any way to find out how many threads are being used at a given
moment?
> You might also consider implementing the Executor, if you're going to
> have a lot of threads.
>
> http://tomcat.apache.org/tomcat-6.0-doc/config/executor.html
There's only one app running on this tomcat, if that makes any difference.
thanks
-jsd-
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Connection timeout
Posted by Pid <pi...@pidster.com>.
On 10/05/2012 21:40, Jon Drukman wrote:
> Caldarale, Charles R <Chuck.Caldarale <at> unisys.com> writes:
>
>> You keep contradicting yourself: is it a massive box, or can it
>> only support a miniscule number of threads?
>> Pick one.
>
> Where did I say it could only support a miniscule number of threads?
> I'm sorry if I accidentally gave that impression.
>
> It's a massive box. We are expecting massive traffic today. I believe
> the box can
> handle it. I assume the out-of-the-box Tomcat configuration is conservative
> (please correct me if I'm wrong).
The basic point we're making is that you are twiddling the wrong knobs.
If you want to handle more connections, increase the size of the thread
pool that handles requests, don't increase the size of the queue of
requests waiting to be handled.
You might also consider implementing the Executor, if you're going to
have a lot of threads.
http://tomcat.apache.org/tomcat-6.0-doc/config/executor.html
>>>> You can also use the NIO connector if you want more more concurrency.
>>
>>> Explain please, or link?
>>
>> http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
>
> Explain to someone who has no idea what that page is saying :)
There are multiple connectors to choose from.
p
--
[key:62590808]
Re: Connection timeout
Posted by Jon Drukman <js...@cluttered.com>.
Caldarale, Charles R <Chuck.Caldarale <at> unisys.com> writes:
> You keep contradicting yourself: is it a massive box, or can it
> only support a miniscule number of threads?
> Pick one.
Where did I say it could only support a miniscule number of threads?
I'm sorry if I accidentally gave that impression.
It's a massive box. We are expecting massive traffic today. I believe
the box can
handle it. I assume the out-of-the-box Tomcat configuration is conservative
(please correct me if I'm wrong).
> > > You can also use the NIO connector if you want more more concurrency.
>
> > Explain please, or link?
>
> http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
Explain to someone who has no idea what that page is saying :)
-jsd-
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Connection timeout
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jon Drukman [mailto:jsd@cluttered.com]
> Subject: Re: Connection timeout
> > Do you really want to queue up requests, rather than just accepting them
> > and assigning them to threads?
> Well, I assume at some point I may run out of threads.
> > * 400 is a guess - I've got no idea how many clients you have.
> Could be up to a few thousand. This is a pretty massive box so it should
> be able to handle it. The app itself is fairly lightweight.
You keep contradicting yourself: is it a massive box, or can it only support a miniscule number of threads? Pick one.
> > You can also use the NIO connector if you want more more concurrency.
> Explain please, or link?
http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
- 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Connection timeout
Posted by Jon Drukman <js...@cluttered.com>.
Pid <pid <at> pidster.com> writes:
> Not really. Did you change the connectionTimeout downwards from the
> default 60 secs to 3 secs?
Yes. Although the original version of the file was 20 seconds.
The clients (which I wrote) all have a 3 second connect timeout, so it seemed
to make sense to make the server work the same way. Is that not right?
> > Is there any other place I can tune the system to have it accept more
> > simultaneous clients, or have a deeper wait queue?
>
> Do you really want to queue up requests, rather than just accepting them
> and assigning them to threads?
Well, I assume at some point I may run out of threads.
> You've increased the acceptCount from 100 to 500, whereas it would
> probably just be better to revert that change and increase maxThreads
> from 200 to 400* - if you've got the resources to spare.
>
> There should be entries in the log files stating that Tomcat has reached
> maxThreads if that's really an issue.
There are no entries in the log files that would indicate that is the case, yet
something is causing the timeout.
> You can also use the NIO connector if you want more more concurrency.
Explain please, or link?
> * 400 is a guess - I've got no idea how many clients you have.
Could be up to a few thousand. This is a pretty massive box so it should
be able to handle it. The app itself is fairly lightweight.
-jsd-
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Connection timeout
Posted by Pid <pi...@pidster.com>.
On 10/05/2012 20:06, Jon Drukman wrote:
> I have a commercial app running Tomcat 6. I don't really know anything
> about Tomcat, so I need some help with performance tuning.
>
> What happens is that a small percentage of connections from our client
> machines just timeout on the connect. I assume I'm running into some
> limitation in Tomcat.
>
> Here's what I put in my server.xml:
>
> <Connector port="8080" protocol="HTTP/1.1"
> connectionTimeout="3000"
> connectionLinger="-1"
> acceptCount="500"
> maxKeepAliveRequests="1"
> enableLookups="false"
> redirectPort="8443" />
You're using the BIO connector with the default maxThreads of 200.
http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
> The machine in question is an Amazon "Extra Large" instance, so it
> should be plenty beefy.
>
> Do those settings look good?
Not really. Did you change the connectionTimeout downwards from the
default 60 secs to 3 secs?
> Is there any other place I can tune the system to have it accept more
> simultaneous clients, or have a deeper wait queue?
Do you really want to queue up requests, rather than just accepting them
and assigning them to threads?
You've increased the acceptCount from 100 to 500, whereas it would
probably just be better to revert that change and increase maxThreads
from 200 to 400* - if you've got the resources to spare.
There should be entries in the log files stating that Tomcat has reached
maxThreads if that's really an issue.
You can also use the NIO connector if you want more more concurrency.
p
* 400 is a guess - I've got no idea how many clients you have.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
--
[key:62590808]