You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vitaly Baranovsky 2 <vi...@gmail.com> on 2008/02/12 22:45:56 UTC

Will be any problem if I set minSpareThreads=0 maxSpareThreads=0

Hi!

I have application developed not by me. This application adds new data to
http threads at each requests. So, periodically there is memory overload,
because threads are not destroyed after each request because of thread pool.

So, workaround for me is turn off thread pool, I think. So, as far as I
know, best way to do this is to set minSpareThreads=0 maxSpareThreads=0.

Is this a best way to turn off thread pool? What's happened with tomcat if I
turn of thread pool?

Thanks!
-- 
View this message in context: http://www.nabble.com/Will-be-any-problem-if-I-set-minSpareThreads%3D0-maxSpareThreads%3D0-tp15443784p15443784.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: Will be any problem if I set minSpareThreads=0 maxSpareThreads=0

Posted by Vitaly Baranovsky <ba...@liga.net>.
> Will this not break the application? Does it not rely on this information?

No, application uses thread local only for storing temporary data.


> Or, are we talking about an application that incorrectly uses
> ThreadLocal variables and needs to be "fixed" without modifying the code?

Yes.


> What about adding code? You could easily write a Filter that would be
> invoked after every request to clean-out the ThreadLocal data. That way,
> you would not have to try these thread pool tricks.

Great idea, thanks!


Christopher Schultz-2 wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Vitaly,
> 
> Vitaly Baranovsky 2 wrote:
> | Yes, data is added to ThreadLocal with every request.
> | I can't modify this application.
> |
> | Does anybody knows, how to turn off thread pool? I want threads are
> created
> | before each requests and destroyed after each request. I thought
> | minSpareThreads=0 maxSpareThreads=0 can do this...
> 
> Will this not break the application? Does it not rely on this information?
> 
> Or, are we talking about an application that incorrectly uses
> ThreadLocal variables and needs to be "fixed" without modifying the code?
> 
> What about adding code? You could easily write a Filter that would be
> invoked after every request to clean-out the ThreadLocal data. That way,
> you would not have to try these thread pool tricks.
> 
> If that's an option, I'll give you some suggestions.
> 
> - -chris
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkezC1gACgkQ9CaO5/Lv0PAKtQCeJyhybmCQXHn8iWBBBGbId1oL
> i3UAoKwvc2buTJPIGRcSbz/x/TP8Ab55
> =oiwk
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Will-be-any-problem-if-I-set-minSpareThreads%3D0-maxSpareThreads%3D0-tp15443784p15460832.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: Will be any problem if I set minSpareThreads=0 maxSpareThreads=0

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

Vitaly,

Vitaly Baranovsky 2 wrote:
| Yes, data is added to ThreadLocal with every request.
| I can't modify this application.
|
| Does anybody knows, how to turn off thread pool? I want threads are
created
| before each requests and destroyed after each request. I thought
| minSpareThreads=0 maxSpareThreads=0 can do this...

Will this not break the application? Does it not rely on this information?

Or, are we talking about an application that incorrectly uses
ThreadLocal variables and needs to be "fixed" without modifying the code?

What about adding code? You could easily write a Filter that would be
invoked after every request to clean-out the ThreadLocal data. That way,
you would not have to try these thread pool tricks.

If that's an option, I'll give you some suggestions.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkezC1gACgkQ9CaO5/Lv0PAKtQCeJyhybmCQXHn8iWBBBGbId1oL
i3UAoKwvc2buTJPIGRcSbz/x/TP8Ab55
=oiwk
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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: Will be any problem if I set minSpareThreads=0 maxSpareThreads=0

Posted by Vitaly Baranovsky 2 <vi...@gmail.com>.
Yes, data is added to ThreadLocal with every request.
I can't modify this application.

Does anybody knows, how to turn off thread pool? I want threads are created
before each requests and destroyed after each request. I thought
minSpareThreads=0 maxSpareThreads=0 can do this...


Christopher Schultz-2 wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Vitaly,
> 
> Vitaly Baranovsky 2 wrote:
> | I have application developed not by me. This application adds new data
> to
> | http threads at each requests. So, periodically there is memory
> overload,
> | because threads are not destroyed after each request because of thread
> pool.
> 
> If data is added to the thread (in ThreadLocal?) with every request,
> then you will eventually fill-up memory no matter what. Setting minSpare
> and maxSpare to zero is likely to result in a thread pool of size 1 (or
> stop Tomcat from handling /any/ requests... I'm not sure) where the
> single thread lives forever and you run out of memory anyway.
> 
> Are you able to modify the application? Perhaps thread-storage is not
> ideal...
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkeyFr8ACgkQ9CaO5/Lv0PDLAgCfWOpqexEzxZNleSqxyuugoiPv
> BQEAoKTsUlyYC9R8eXQiZhRU4f7BxVCk
> =u8ls
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Will-be-any-problem-if-I-set-minSpareThreads%3D0-maxSpareThreads%3D0-tp15443784p15450225.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: Will be any problem if I set minSpareThreads=0 maxSpareThreads=0

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

Vitaly,

Vitaly Baranovsky 2 wrote:
| I have application developed not by me. This application adds new data to
| http threads at each requests. So, periodically there is memory overload,
| because threads are not destroyed after each request because of thread
pool.

If data is added to the thread (in ThreadLocal?) with every request,
then you will eventually fill-up memory no matter what. Setting minSpare
and maxSpare to zero is likely to result in a thread pool of size 1 (or
stop Tomcat from handling /any/ requests... I'm not sure) where the
single thread lives forever and you run out of memory anyway.

Are you able to modify the application? Perhaps thread-storage is not
ideal...

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkeyFr8ACgkQ9CaO5/Lv0PDLAgCfWOpqexEzxZNleSqxyuugoiPv
BQEAoKTsUlyYC9R8eXQiZhRU4f7BxVCk
=u8ls
-----END PGP SIGNATURE-----

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