View Full Version : Thread waiting time
http://java-monitor.com/postedimages/1b87afde-38db-41a9-b257-3d7122244386.png
This java-monitor probe is really a great tool. I have a question on these graphs.
According to this graph from java-monitor probe there are lots of threads waiting (yellow part). Am I using some wrong strategy here? Could you explain me this graph little bit and tall me best strategy to avoid this.
kjkoster
20-04-2009, 19:59
Dear Jerry,
Thanks for the compliments about Java-monitor. I'm glad you like it. Spread the word. :-)
About threads. Their life is all about waiting, really. :-) What would help is to take thread dumps. Then close the office door, grab a coffee and start reading.
Reading the stack traces in the thread dumps will explain what your threads are waiting for. Waiting threads are not necessarily a bad thing. Creating a new thread and starting it up is quite expensive in terms of memory and processor resources. That's what thread pools are for.
If, on the other hand, all these threads are waiting for the same resource, you may run into the thundering herd problem (http://en.wikipedia.org/wiki/Thundering_herd_problem).
I'll tell you what, if you take a thread dump and read a bit, you can post the stack traces you don't understand. We'll read them together.
With 100 threads, posting the entire thread dump is maybe not such a good idea. :)
Kees Jan
Hi kees Jan,
Again a small question. How can I take thread dump? I am using linux+tomcat 5.5+jdk1.5
Thanks
kjkoster
21-04-2009, 19:18
Dear Jerry,
You can send the process a kill -3, which will cause Java to dump the threads to stdout. Or you can use jstack.
You can also look at the live threads using jconsole.
Kees Jan
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.