You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by vi...@yahoo.co.in on 2012/11/05 07:54:43 UTC

Tomcat 6.0 threads

Hi All,

Can somebody please help me out in stopping the surplus threads which get created in tomcat 6.0 as we dont have "maxSpareThreads" attribute anymore in it ..
How can we close these threads

Thanks for ur help,
Vicky



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


Re: Tomcat 6.0 threads

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vicky,

On 11/5/12 1:54 AM, vicky007aggarwal@yahoo.co.in wrote:
> Can somebody please help me out in stopping the surplus threads
> which get created in tomcat 6.0 as we dont have "maxSpareThreads"
> attribute anymore in it .. How can we close these threads

1. Use an Executor
2. Use maxIdleTime

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

iEYEARECAAYFAlCYhl8ACgkQ9CaO5/Lv0PA2JACggrLeL2mosB3QZc6RMXbl29Xn
ZlwAoJShaqFIn1iKvAZQf3piy6u0NjPp
=iflL
-----END PGP SIGNATURE-----

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


Re: Tomcat 6.0 threads

Posted by vi...@yahoo.co.in.
Thanks a ton Chris, i got my answer. Applause  for giving your time. ;)


On Nov 6, 2012, at 9:13 AM, Christopher Schultz <ch...@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Vicky,
> 
> On 11/5/12 5:12 AM, vicky007aggarwal@yahoo.co.in wrote:
>> Mark actually i have a scenario in which my application receives 
>> variable amount of request depending on time . So at one point i
>> have an approx around 400 users concurrently accessing my
>> application as a result i have an approx 400 threads but when the
>> request count decreases the thread count still remains 400 which
>> eventually eat up my system resources.
> 
> If you have 400 threads running, your resources are already "eaten".
> Does anything get worse over time?
> 
> Honestly, if your system can't handle its peak load, then you need to
> make other arrangements (such as load-balancing, or lowering the
> thread pool size at the expense of average response time).
> 
> In a default configuration, Tomcat should drop idle threads after 1
> minute of idle time per thread (so 60 seconds + some slop after a
> thread handles its last request, the request-processing thread should
> die). If that isn't happening, please post your configuration and your
> observations (and be *very* specific, including your methodology for
> counting live threads, the timestamps at which you applied the user
> load and sampled the live threads, etc.).
> 
>> To cater to this situation i would like to know the option by which
>> i can close my unused threads as maxSparethreads doesnt exist
>> anymore in tomcat 6.0
> 
> maxIdleTime
> 
> But honestly, I don't think you'll need it unless the default of 1
> minute isn't appropriate for you.
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
> 
> iEYEARECAAYFAlCYh18ACgkQ9CaO5/Lv0PBOMACeOiDOSJXpcA+0WCg4kABa07X1
> 6TcAn3OXp/NPUWAbWDRl5O0g0keQ4NWA
> =WQTx
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

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


Re: Tomcat 6.0 threads

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vicky,

On 11/5/12 5:12 AM, vicky007aggarwal@yahoo.co.in wrote:
> Mark actually i have a scenario in which my application receives 
> variable amount of request depending on time . So at one point i
> have an approx around 400 users concurrently accessing my
> application as a result i have an approx 400 threads but when the
> request count decreases the thread count still remains 400 which
> eventually eat up my system resources.

If you have 400 threads running, your resources are already "eaten".
Does anything get worse over time?

Honestly, if your system can't handle its peak load, then you need to
make other arrangements (such as load-balancing, or lowering the
thread pool size at the expense of average response time).

In a default configuration, Tomcat should drop idle threads after 1
minute of idle time per thread (so 60 seconds + some slop after a
thread handles its last request, the request-processing thread should
die). If that isn't happening, please post your configuration and your
observations (and be *very* specific, including your methodology for
counting live threads, the timestamps at which you applied the user
load and sampled the live threads, etc.).

> To cater to this situation i would like to know the option by which
> i can close my unused threads as maxSparethreads doesnt exist
> anymore in tomcat 6.0

maxIdleTime

But honestly, I don't think you'll need it unless the default of 1
minute isn't appropriate for you.

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

iEYEARECAAYFAlCYh18ACgkQ9CaO5/Lv0PBOMACeOiDOSJXpcA+0WCg4kABa07X1
6TcAn3OXp/NPUWAbWDRl5O0g0keQ4NWA
=WQTx
-----END PGP SIGNATURE-----

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


Re: Tomcat 6.0 threads

Posted by vi...@yahoo.co.in.
Mark actually i have a scenario in which my application receives variable amount of request depending on time . So at one point i have an approx around 400 users concurrently accessing my application as a result i have an approx 400 threads but when the request count decreases the thread count still remains 400 which eventually eat up my system resources. To cater to this situation i would like to know the option by which i can close my unused threads as maxSparethreads doesnt exist anymore in tomcat 6.0

Pls advise 

Thanks,
Vicky


On Nov 5, 2012, at 1:46 PM, Mark Eggers <it...@yahoo.com> wrote:

> On 11/4/2012 10:54 PM, vicky007aggarwal@yahoo.co.in wrote:
>> Hi All,
>> 
>> Can somebody please help me out in stopping the surplus threads which
>> get created in tomcat 6.0 as we dont have "maxSpareThreads" attribute
>> anymore in it .. How can we close these threads
>> 
>> Thanks for ur help, Vicky
> 
> I've never noticed a lot of surplus threads when running Tomcat - even
> when not using the Executor. Look at the actual number of threads
> reported in the the "running thread" portion of Probe, or better yet
> enable JMX and use VisualVM with the JMX plugin.
> 
> On a quiet Tomcat 6.0.35 running on Fedora 17 with jre 1.6.0_37 I see 22
> threads (ps -FL [pid] | wc -l). This is with all of the examples loaded
> . . . but I've not accessed that Tomcat so probably things are a bit quieter than normal.
> 
> The real question running throughout all three of your threads now is
> why are you so concerned about the number of threads.
> 
> The Executor will help balance some load on high traffic sites,
> otherwise the private thread pools with appropriately tuned values
> should work fine.
> 
> A note on "appropriately tuned values" - the defaults are usually quite
> adequate for a large number of use cases. That's why they're the defaults.
> 
> So again, the real question is what perceived issue are you trying to
> solve by being so concerned with the number of Connector - based threads?
> 
> . . . . just my two cents.
> /mde/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

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


Re: Tomcat 6.0 threads

Posted by Mark Eggers <it...@yahoo.com>.
On 11/4/2012 10:54 PM, vicky007aggarwal@yahoo.co.in wrote:
> Hi All,
>
> Can somebody please help me out in stopping the surplus threads which
> get created in tomcat 6.0 as we dont have "maxSpareThreads" attribute
> anymore in it .. How can we close these threads
>
> Thanks for ur help, Vicky

I've never noticed a lot of surplus threads when running Tomcat - even
when not using the Executor. Look at the actual number of threads
reported in the the "running thread" portion of Probe, or better yet
enable JMX and use VisualVM with the JMX plugin.

On a quiet Tomcat 6.0.35 running on Fedora 17 with jre 1.6.0_37 I see 22
threads (ps -FL [pid] | wc -l). This is with all of the examples loaded
. . . but I've not accessed that Tomcat so probably things are a bit 
quieter than normal.

The real question running throughout all three of your threads now is
why are you so concerned about the number of threads.

The Executor will help balance some load on high traffic sites,
otherwise the private thread pools with appropriately tuned values
should work fine.

A note on "appropriately tuned values" - the defaults are usually quite
adequate for a large number of use cases. That's why they're the defaults.

So again, the real question is what perceived issue are you trying to
solve by being so concerned with the number of Connector - based threads?

. . . . just my two cents.
/mde/

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