You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alexey Vlasov <re...@renton.name> on 2009/03/04 22:52:34 UTC

Too many threads

Hi.

After daemon starting parenting process creayes too many threads. I
would like to know if they are useful and if not how to lessen their
number.

$ pstree -p -a tomcat
java,10869 -server -Xms128M -Xmx256M-Djava.util.logging.manager=org.apache.juli.Cl
  |-{java},10877
  |-{java},10883
  |-{java},10884
  |-{java},10885
  |-{java},10886
  |-{java},10887
  |-{java},10888
  |-{java},10889
  |-{java},10890
  |-{java},10898
  |-{java},10899
  |-{java},10900
  |-{java},10918
  |-{java},10919
  |-{java},10920
  |-{java},10921
  |-{java},10922
  |-{java},11909
  |-{java},11928
  |-{java},7641
  |-{java},10067
  |-{java},10069
  |-{java},10828
  |-{java},28452
  |-{java},28453
  |-{java},28454
  `-{java},8381

$ ps axuwww

79130    10869  0.0  0.6 610632 105532 pts/5   Sl   Mar03   1:37
/opt/sun-jdk-1.6.0.06/bin/java -server -Xms128M -Xmx256M
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=/home/tomcat/http//conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=/home/tomcat/http//conf/logging.properties
-classpath
/home/tomcat/http/lib/:/home/tomcat/http//lib:/opt/sun-jdk-1.6.0.06/lib/tools.jar:/home/tomcat/http//bin/bootstrap.jar:/home/tomcat/http//bin/tomcat-juli.jar:/home/tomcat/http//lib:/opt/sun-jdk-1.6.0.06/lib/tools.jar:/home/tomcat/http//bin/bootstrap.jar:/home/tomcat/http//bin/tomcat-juli.jar
-Dcatalina.base=/home/tomcat/http/ -Dcatalina.home=/home/tomcat/http/
-Djava.io.tmpdir=/home/tomcat/http//temp
org.apache.catalina.startup.Bootstrap start

My server.xml
<?xml version='1.0' encoding='utf-8'?>

<Server port="50002" shutdown="50002">
    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="off" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <GlobalNamingResources>
        <Resource name="UserDatabase" auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved"
                  factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                  pathname="conf/tomcat-users.xml" />
    </GlobalNamingResources>
    <Service name="Catalina">
        <Connector address="123.123.123.123" port="50002" protocol="HTTP/1.1"
                   connectionTimeout="20000" maxThreads="10" minSpareThreads="2" maxSpareThreads="5" />
        <Engine name="Catalina" defaultHost="localhost">
            <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                   resourceName="UserDatabase"/>
            <Host name="localhost"  appBase="/home/tomcat/http/webapps"
                  unpackWARs="true" autoDeploy="true"
                  xmlValidation="false" xmlNamespaceAware="false">
            </Host>
        </Engine>
    </Service>
</Server>


-- 
BRGDS. Alexey Vlasov.

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


Re: Too many threads

Posted by Alexey Vlasov <re...@renton.name>.
Hi Martin.

Thank you for your answer.

If I have understood correctly, I use Http11Protocol Connector, as it is
default connector for attribute protocol and it isn't set in my
server.xml (I wrote full listing of this file it in my first letter).
And this is clear from the line of the log of catalina.out:
...
Mar 5, 2009 9:32:46 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-123.123.123.123-50002

And I don't have attribute executor anywhere.

Mar 5, 2009 9:32:46 PM org.apache.catalina.startup.Catalina start

On Wed, Mar 04, 2009 at 05:12:47PM -0500, Martin Gainty wrote:
> 
> check your Connectors:
> 
> are you using the tomcatThreadPool executor?
> <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"   maxThreads="150" minSpareThreads="4"/>
> <Connector executor="tomcatThreadPool" port="tomcatThreadPoolPort"
> ....
> />
> 
> or are you using the NIOConnector?
>     <Connector port="NIConnectorPort" 
>     useSendfile="true" 
>     useExecutor="true" 
>     acceptorThreadCount="1"
>     pollerThreadCount="1"
>     pollerThreadPriority="java.lang.Thread#NORM_PRIORITY"
>     selectorTimeout="1000"
>     useComet="true"
>     prcessCache="200"
>     socket.directBuffer="false"
>     socket.rxBufSize="25188"
>     socket.txBufSize="43800"
>     socket.appReadBufSize="8192"
>     socket.appWriteBufSize="8192"
>     socket.bufferPool="500"
>     socket.bufferPoolSize="100000000"
>     socket.processorCache="500"
>     socket.keyCache="500"
>     socket.eventCache="500"
>     socket.tcpNoDelay="false"
>     socket.soKeepAlive="true"
>     socket.soTimeout="5000"
>     protocol="org.apache.coyote.http11.Http11NioProtocol" 
>     maxThreads="150" 
>     connectionTimeout="60000" 
>     redirectPort="8443" />
> 
> ?
> Martin 
> ______________________________________________ 
> Disclaimer and confidentiality note 
> Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 
> 
> 
> 
> 
> > Date: Thu, 5 Mar 2009 00:52:34 +0300
> > From: renton@renton.name
> > To: users@tomcat.apache.org
> > Subject: Too many threads
> > 
> > Hi.
> > 
> > After daemon starting parenting process creayes too many threads. I
> > would like to know if they are useful and if not how to lessen their
> > number.
> > 
> > $ pstree -p -a tomcat
> > java,10869 -server -Xms128M -Xmx256M-Djava.util.logging.manager=org.apache.juli.Cl
> >   |-{java},10877
> >   |-{java},10883
> >   |-{java},10884
> >   |-{java},10885
> >   |-{java},10886
> >   |-{java},10887
> >   |-{java},10888
> >   |-{java},10889
> >   |-{java},10890
> >   |-{java},10898
> >   |-{java},10899
> >   |-{java},10900
> >   |-{java},10918
> >   |-{java},10919
> >   |-{java},10920
> >   |-{java},10921
> >   |-{java},10922
> >   |-{java},11909
> >   |-{java},11928
> >   |-{java},7641
> >   |-{java},10067
> >   |-{java},10069
> >   |-{java},10828
> >   |-{java},28452
> >   |-{java},28453
> >   |-{java},28454
> >   `-{java},8381
> > 
> > $ ps axuwww
> > 
> > 79130    10869  0.0  0.6 610632 105532 pts/5   Sl   Mar03   1:37
> > /opt/sun-jdk-1.6.0.06/bin/java -server -Xms128M -Xmx256M
> > -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> > -Djava.util.logging.config.file=/home/tomcat/http//conf/logging.properties
> > -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> > -Djava.util.logging.config.file=/home/tomcat/http//conf/logging.properties
> > -classpath
> > /home/tomcat/http/lib/:/home/tomcat/http//lib:/opt/sun-jdk-1.6.0.06/lib/tools.jar:/home/tomcat/http//bin/bootstrap.jar:/home/tomcat/http//bin/tomcat-juli.jar:/home/tomcat/http//lib:/opt/sun-jdk-1.6.0.06/lib/tools.jar:/home/tomcat/http//bin/bootstrap.jar:/home/tomcat/http//bin/tomcat-juli.jar
> > -Dcatalina.base=/home/tomcat/http/ -Dcatalina.home=/home/tomcat/http/
> > -Djava.io.tmpdir=/home/tomcat/http//temp
> > org.apache.catalina.startup.Bootstrap start
> > 
> > My server.xml
> > <?xml version='1.0' encoding='utf-8'?>
> > 
> > <Server port="50002" shutdown="50002">
> >     <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="off" />
> >     <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
> >     <GlobalNamingResources>
> >         <Resource name="UserDatabase" auth="Container"
> >                   type="org.apache.catalina.UserDatabase"
> >                   description="User database that can be updated and saved"
> >                   factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
> >                   pathname="conf/tomcat-users.xml" />
> >     </GlobalNamingResources>
> >     <Service name="Catalina">
> >         <Connector address="123.123.123.123" port="50002" protocol="HTTP/1.1"
> >                    connectionTimeout="20000" maxThreads="10" minSpareThreads="2" maxSpareThreads="5" />
> >         <Engine name="Catalina" defaultHost="localhost">
> >             <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> >                    resourceName="UserDatabase"/>
> >             <Host name="localhost"  appBase="/home/tomcat/http/webapps"
> >                   unpackWARs="true" autoDeploy="true"
> >                   xmlValidation="false" xmlNamespaceAware="false">
> >             </Host>
> >         </Engine>
> >     </Service>
> > </Server>
> > 
> > 
> > -- 
> > BRGDS. Alexey Vlasov.
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> 
> _________________________________________________________________
> Windows Live? Groups: Create an online spot for your favorite groups to meet.
> http://windowslive.com/online/groups?ocid=TXT_TAGLM_WL_groups_032009

-- 
BRGDS. Alexey Vlasov.

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


RE: Too many threads

Posted by Martin Gainty <mg...@hotmail.com>.
check your Connectors:

are you using the tomcatThreadPool executor?
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"   maxThreads="150" minSpareThreads="4"/>
<Connector executor="tomcatThreadPool" port="tomcatThreadPoolPort"
....
/>

or are you using the NIOConnector?
    <Connector port="NIConnectorPort" 
    useSendfile="true" 
    useExecutor="true" 
    acceptorThreadCount="1"
    pollerThreadCount="1"
    pollerThreadPriority="java.lang.Thread#NORM_PRIORITY"
    selectorTimeout="1000"
    useComet="true"
    prcessCache="200"
    socket.directBuffer="false"
    socket.rxBufSize="25188"
    socket.txBufSize="43800"
    socket.appReadBufSize="8192"
    socket.appWriteBufSize="8192"
    socket.bufferPool="500"
    socket.bufferPoolSize="100000000"
    socket.processorCache="500"
    socket.keyCache="500"
    socket.eventCache="500"
    socket.tcpNoDelay="false"
    socket.soKeepAlive="true"
    socket.soTimeout="5000"
    protocol="org.apache.coyote.http11.Http11NioProtocol" 
    maxThreads="150" 
    connectionTimeout="60000" 
    redirectPort="8443" />

?
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> Date: Thu, 5 Mar 2009 00:52:34 +0300
> From: renton@renton.name
> To: users@tomcat.apache.org
> Subject: Too many threads
> 
> Hi.
> 
> After daemon starting parenting process creayes too many threads. I
> would like to know if they are useful and if not how to lessen their
> number.
> 
> $ pstree -p -a tomcat
> java,10869 -server -Xms128M -Xmx256M-Djava.util.logging.manager=org.apache.juli.Cl
>   |-{java},10877
>   |-{java},10883
>   |-{java},10884
>   |-{java},10885
>   |-{java},10886
>   |-{java},10887
>   |-{java},10888
>   |-{java},10889
>   |-{java},10890
>   |-{java},10898
>   |-{java},10899
>   |-{java},10900
>   |-{java},10918
>   |-{java},10919
>   |-{java},10920
>   |-{java},10921
>   |-{java},10922
>   |-{java},11909
>   |-{java},11928
>   |-{java},7641
>   |-{java},10067
>   |-{java},10069
>   |-{java},10828
>   |-{java},28452
>   |-{java},28453
>   |-{java},28454
>   `-{java},8381
> 
> $ ps axuwww
> 
> 79130    10869  0.0  0.6 610632 105532 pts/5   Sl   Mar03   1:37
> /opt/sun-jdk-1.6.0.06/bin/java -server -Xms128M -Xmx256M
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> -Djava.util.logging.config.file=/home/tomcat/http//conf/logging.properties
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> -Djava.util.logging.config.file=/home/tomcat/http//conf/logging.properties
> -classpath
> /home/tomcat/http/lib/:/home/tomcat/http//lib:/opt/sun-jdk-1.6.0.06/lib/tools.jar:/home/tomcat/http//bin/bootstrap.jar:/home/tomcat/http//bin/tomcat-juli.jar:/home/tomcat/http//lib:/opt/sun-jdk-1.6.0.06/lib/tools.jar:/home/tomcat/http//bin/bootstrap.jar:/home/tomcat/http//bin/tomcat-juli.jar
> -Dcatalina.base=/home/tomcat/http/ -Dcatalina.home=/home/tomcat/http/
> -Djava.io.tmpdir=/home/tomcat/http//temp
> org.apache.catalina.startup.Bootstrap start
> 
> My server.xml
> <?xml version='1.0' encoding='utf-8'?>
> 
> <Server port="50002" shutdown="50002">
>     <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="off" />
>     <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
>     <GlobalNamingResources>
>         <Resource name="UserDatabase" auth="Container"
>                   type="org.apache.catalina.UserDatabase"
>                   description="User database that can be updated and saved"
>                   factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>                   pathname="conf/tomcat-users.xml" />
>     </GlobalNamingResources>
>     <Service name="Catalina">
>         <Connector address="123.123.123.123" port="50002" protocol="HTTP/1.1"
>                    connectionTimeout="20000" maxThreads="10" minSpareThreads="2" maxSpareThreads="5" />
>         <Engine name="Catalina" defaultHost="localhost">
>             <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>                    resourceName="UserDatabase"/>
>             <Host name="localhost"  appBase="/home/tomcat/http/webapps"
>                   unpackWARs="true" autoDeploy="true"
>                   xmlValidation="false" xmlNamespaceAware="false">
>             </Host>
>         </Engine>
>     </Service>
> </Server>
> 
> 
> -- 
> BRGDS. Alexey Vlasov.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Windows Liveā„¢ Groups: Create an online spot for your favorite groups to meet.
http://windowslive.com/online/groups?ocid=TXT_TAGLM_WL_groups_032009

Re: Too many threads

Posted by Alexey Vlasov <re...@renton.name>.
On Wed, Mar 11, 2009 at 06:25:08PM -0400, Christopher Schultz wrote:
>> But i've got one question left, can I set idle timeout for
>> the thread TP-Processor, after which they will die?
> 
> I think you have to use an <Executor> for that. See
> http://tomcat.apache.org/tomcat-6.0-doc/config/executor.html for
> details. 

Thank you. Now everything works perfectly.

-- 
BRGDS. Alexey Vlasov.

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


Re: Too many threads

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

Alexey,

On 3/11/2009 6:16 PM, Alexey Vlasov wrote:
> On Tue, Mar 10, 2009 at 11:04:43AM -0400, Christopher Schultz wrote:
>> My thread dump contained 5 JVM threads + 14 Tomcat threads + 1 MySQL
>> thread = 20 threads. You have 27, and you didn't tell us a thing about
>> what your application does.
> 
> "Default Tomcat home page" and Server-status/Tomcat Manager
> applications :)

Gotcha.

>>> <Connector address="123.123.123.123" port="50002" protocol="HTTP/1.1"
>>> connectionTimeout="20000" maxThreads="10" minSpareThreads="2" maxSpareThreads="5" />
>>
>> This is the only information you gave us that could help determine what
>> those threads are. If you take a thread dump and re-post, we might be
>> able to help.
> 
> Full thread dump Java HotSpot(TM) 64-Bit Server VM (10.0-b22 mixed mode):
> 
> "http-123.123.123.123-50002-Acceptor-0" daemon prio=10 tid=0x00002aaac4a5e000 nid=0x348b runnable [0x000000004143c000..0x000000
> 004143cd90]

It looks like the verbosity of Thread names have been increased from TC
5.5 to TC 6.0. I like this, because you can tell which <Connector>
created the thread.

> According to the written above everything is clear in the dump.
> Thank you so much for your help.

No problem. Often, newcomers to both Java and webapps in general can be
shocked to see how many threads are running. How many processors to you
have on this box? Looks like 8:

"GC task thread#0 (ParallelGC)"
"GC task thread#1 (ParallelGC)"
"GC task thread#2 (ParallelGC)"
"GC task thread#3 (ParallelGC)"
"GC task thread#4 (ParallelGC)"
"GC task thread#5 (ParallelGC)"
"GC task thread#6 (ParallelGC)"
"GC task thread#7 (ParallelGC)"

> But i've got one question left, can I set idle timeout for
> the thread TP-Processor, after which they will die?

I think you have to use an <Executor> for that. See
http://tomcat.apache.org/tomcat-6.0-doc/config/executor.html for
details. You should be able to use "maxIdleTime" to configure that. Just
remember to connect your <Connector> to your <Executor> by using the
"executor" attribute of the <Connector>, and remove all the
thread-configuration attributes from your <Connector>, too.

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

iEYEARECAAYFAkm4OkQACgkQ9CaO5/Lv0PBWJwCgjGMWzQ926Bt+cnKqG3rN7AUJ
kOMAn3jAu3YSRmL9N/4U6A+qtaApDsEd
=wHCS
-----END PGP SIGNATURE-----

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


Re: Too many threads

Posted by Alexey Vlasov <re...@renton.name>.
Hi Christopher.

On Tue, Mar 10, 2009 at 11:04:43AM -0400, Christopher Schultz wrote:
> > I
> > would like to know if they are useful and if not how to lessen their
> > number.
> 
> You should do a thread dump (send a SIG 3
> to your process and watch stdout)

Thank you, that has made much clearer.

> JVM-created threads (you can't eliminate these):
> 
> "main" - runs the main program
> "Reference Handler"   - GC thread
> "Finalizer"           - GC thread
> "Low Memory Detector" - GC thread
> "CompilerThread0"     - JIT thread
> "Signal Dispatcher"   - Handles signals
> 
> Tomcat-created threads:
> "ContainerBackgroundProcessor[StandardEngine[Catalina]]"
> "TP-Monitor"      - monitors the request handler thread pool
> "TP-Processor[n]" - these are the request handlers.
>                     You have configured your TC instance to have between
>                     2 and 10 of them. I wouldn't be surprised to find
>                     that you have 5 TP-Processor threads. I have 12.

> My thread dump contained 5 JVM threads + 14 Tomcat threads + 1 MySQL
> thread = 20 threads. You have 27, and you didn't tell us a thing about
> what your application does.

"Default Tomcat home page" and Server-status/Tomcat Manager
applications :)

> > <Connector address="123.123.123.123" port="50002" protocol="HTTP/1.1"
> > connectionTimeout="20000" maxThreads="10" minSpareThreads="2" maxSpareThreads="5" />
> 
> This is the only information you gave us that could help determine what
> those threads are. If you take a thread dump and re-post, we might be
> able to help.

Full thread dump Java HotSpot(TM) 64-Bit Server VM (10.0-b22 mixed mode):

"http-123.123.123.123-50002-Acceptor-0" daemon prio=10 tid=0x00002aaac4a5e000 nid=0x348b runnable [0x000000004143c000..0x000000
004143cd90]
   java.lang.Thread.State: RUNNABLE
   ...
[full dump in attach]

$ grep -c tid catalina.out
19

According to the written above everything is clear in the dump.
Thank you so much for your help.

But i've got one question left, can I set idle timeout for
the thread TP-Processor, after which they will die?

-- 
BRGDS. Alexey Vlasov.

Re: Too many threads

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

Alexey,

On 3/4/2009 4:52 PM, Alexey Vlasov wrote:
> After daemon starting parenting process creayes too many threads.

What is your definition of "too many"? More than one?

> I
> would like to know if they are useful and if not how to lessen their
> number.

I'm sure they are all useful. You should do a thread dump (send a SIG 3
to your process and watch stdout) on your app and see which of these
threads show up in the listing. Here's what I have in my TC 5.5.26
instance after a restart. I'm running Sun's JRE 1.5.0_13 on Linux 2.6
kernel.

JVM-created threads (you can't eliminate these):

"main" - runs the main program
"Reference Handler"   - GC thread
"Finalizer"           - GC thread
"Low Memory Detector" - GC thread
"CompilerThread0"     - JIT thread
"Signal Dispatcher"   - Handles signals

Tomcat-created threads:
"ContainerBackgroundProcessor[StandardEngine[Catalina]]"
"TP-Monitor"      - monitors the request handler thread pool
"TP-Processor[n]" - these are the request handlers.
                    You have configured your TC instance to have between
                    2 and 10 of them. I wouldn't be surprised to find
                    that you have 5 TP-Processor threads. I have 12.

I also have this one courtesy of my MySQL driver:
"MySQL Statement Cancellation Timer" - I'm guessing this cancels statements

> $ pstree -p -a tomcat
> java,10869 -server -Xms128M -Xmx256M-Djava.util.logging.manager=org.apache.juli.Cl

[snipped list of 27 threads]

My thread dump contained 5 JVM threads + 14 Tomcat threads + 1 MySQL
thread = 20 threads. You have 27, and you didn't tell us a thing about
what your application does.

> <Connector address="123.123.123.123" port="50002" protocol="HTTP/1.1"
> connectionTimeout="20000" maxThreads="10" minSpareThreads="2" maxSpareThreads="5" />

This is the only information you gave us that could help determine what
those threads are. If you take a thread dump and re-post, we might be
able to help.

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

iEYEARECAAYFAkm2gYsACgkQ9CaO5/Lv0PACHgCbBbmoS3oGA6O1WARR46FBdHyy
1tUAmwZ4FjEdN/MV9yrOvpPNsftueJyw
=Q1lT
-----END PGP SIGNATURE-----

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


Re: Too many threads

Posted by Juha Laiho <Ju...@iki.fi>.
Alexey Vlasov wrote:
> After daemon starting parenting process creayes too many threads. I
> would like to know if they are useful and if not how to lessen their
> number.

Could you tell how these threads harm you / hurt your system performance?
Threads are very lightweight objects, sharing a lot of things with
each other.

>         <Connector address="123.123.123.123" port="50002" protocol="HTTP/1.1"
>                    connectionTimeout="20000" maxThreads="10" minSpareThreads="2" maxSpareThreads="5" />

... or are you just wondering why the amount does not match the maxThreads
figure here?

The maxThreads is documented as follows:

The maximum number of request processing threads to be created
by this Connector, which therefore determines the maximum number
of simultaneous requests that can be handled. If not specified,
this attribute is set to 200.

So, it's just the threads allocated for the connector (which by the way
is also the limit of simultaneous requests your server can process at
any given time).

Tomcat (and the underlying Java Virtual Machine as well) organises its
own work by using threads; there are distinct threads for various
purposes.

I just took a thread count form a Tomcat on my home machine, and it's
limited to have 25 connector threads, and has a total of 40 threads,
so there are 15 threads on top of the connector threads, which seems
to be rather close to the situation you described (if I counted correctly,
you had 17 extraneous threads). There are various threads for JVM internal
operations (garbage collection etc), and others for Tomcat internal
operations.


I hope this helped to at least explain the situation.
-- 
..Juha

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