Re: Too many threads
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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Too many threads
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=2 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=0x2aaac4a5e000 nid=0x348b runnable [0x4143c000..0x00 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. 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=0x2aaac4a5e000 nid=0x348b runnable [0x4143c000..0x00 004143cd90] java.lang.Thread.State: RUNNABLE at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) - locked 0x2aaac0a902e8 (a java.net.SocksSocketImpl) at java.net.ServerSocket.implAccept(ServerSocket.java:453) at java.net.ServerSocket.accept(ServerSocket.java:421) at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(Unknown Source) at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(Unknown Source) at java.lang.Thread.run(Thread.java:619) ContainerBackgroundProcessor[StandardEngine[Catalina]] daemon prio=10 tid=0x2aaac4a5d800 nid=0x348a waiting on condition [0x4133b000..0x4133bd10] java.lang.Thread.State: TIMED_WAITING (sleeping) at java.lang.Thread.sleep(Native Method) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(Unknown Source) at java.lang.Thread.run(Thread.java:619) Low Memory Detector daemon prio=10 tid=0x2aaac8023400 nid=0x3455 runnable [0x..0x] java.lang.Thread.State: RUNNABLE CompilerThread1 daemon prio=10 tid=0x2aaac8020800 nid=0x3454 waiting on condition [0x..0x410373e0] java.lang.Thread.State: RUNNABLE CompilerThread0 daemon prio=10 tid=0x2aaac801f000 nid=0x3453 waiting on condition [0x..0x40f36360] java.lang.Thread.State: RUNNABLE Signal Dispatcher daemon prio=10 tid=0x2aaac801dc00 nid=0x3452 waiting on condition [0x..0x] java.lang.Thread.State: RUNNABLE Finalizer daemon prio=10 tid=0x2aaac42bac00 nid=0x344d in Object.wait() [0x40d35000..0x40d35c10] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on 0x2aaac08e0be0 (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116) - locked 0x2aaac08e0be0 (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159) Reference Handler daemon prio=10 tid=0x2aaac42b9800 nid=0x344c in Object.wait() [0x40c34000..0x40c34d90] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on 0x2aaac08e01b0 (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:485) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116) - locked 0x2aaac08e01b0
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 7913010869 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=2 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org