• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New to threading. Help me analyze this excerpt from the dump

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"http-localhost-8080-70" daemon prio=10 tid=0x00002aaba8a28800 nid=0x611d in Object.wait() [0x0000000046275000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00002aab1e6a9708> (a org.apache.tomcat.util.net.JIoEndpoint$Worker)
at java.lang.Object.wait(Object.java:485)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.await(JIoEndpoint.java:416)
- locked <0x00002aab1e6a9708> (a org.apache.tomcat.util.net.JIoEndpoint$Worker)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:442)
at java.lang.Thread.run(Thread.java:619)


I am investigating slow performance of my app. 65% of the threads are in this state (WAITING).
I cant understand what the locked and waiting lines mean. Please explain.

Pappu
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


When a thread executes line 02. it will show up as -locked <instance address> (type).
When a thread executes line 04. it will show up as - waiting on <instance address> (type).

You can also get 'locked' if you use a synchronized method in an instance of the JIoEndpoint.Worker class. The problem is that you have a lot of threads wait()ing and maybe not enough notify()s happening.
 
Pappu Kumar
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steve,

Thanks for the prompt response. Another problem is that i don't know what needs to happen for the notify to take place.
Clearly the thread is busy doing something.

Can you recommend something in order to get much more detailed info ? For ex : I would like to what business methods in my app are waiting and which ones are slow to notify.

Hope i make sense.
Pappu
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Luke wrote:The problem is that you have a lot of threads wait()ing and maybe not enough notify()s happening.



Or maybe you have a lot of threads waiting because there is nothing to do. For example, an app server with little to do will have most of the worker threads waiting for work.

To figure out the issue, the number of waiting threads is not enough -- you need to also take stack traces to see what they are waiting for too.

Henry
 
Pappu Kumar
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Henry,

I downloaded TDA to analyze my thread dumps and this is what it said :

Overall Thread Count 322
Overall Monitor Count 209
Number of threads waiting for a monitor 0
Number of threads locking a monitor 184
Number of threads sleeping on a monitor 216
Number of deadlocks 0
Number of Monitors without locking threads 0

67% of all threads are sleeping on a monitor.
This might indicate they are waiting for some external resource (e.g. database) which is overloaded or not available or are just waiting to get to do something (idle threads). You should check the sleeping threads with a filter excluding all idle threads.

"Number of threads sleeping on a monitor 216" - Doesn't this mean that they are waiting for a notify ?

I am going to try and get the stack trace and see what i can find.

Pappu
 
Pappu Kumar
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

Quick question. I am running Jboss. I got the thread dump using "/jstack pid" command but the dump file don't show any application classes that are being invoked.
The file contains Threads like i showed in my first post.

How do i get a stack trace that shows my application classes as well ?

Pappu
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can trigger the JVM to dump the stack traces for all threads -- via a kill -QUIT for unix, and a control break for windows.

Henry
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Papppu,

What is TDA?
 
Pappu Kumar
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://tda.dev.java.net/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic