File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes Web application worker threads running for a long time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Web application worker threads running for a long time" Watch "Web application worker threads running for a long time" New topic
Author

Web application worker threads running for a long time

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

Hi guys,

In one of our web application we are having some issues with 100% CPU utilization and we are trying to figure out the cause. We've taken a thread dump at an interval of about half an hour and a few of the worker threads are runnable in both dumps and I'm trying to figure out whether they are serving the same request or different requests but don't have knowledge of thread dumps so looking for some help

Like this is the stack trace of one of the threads in the two dumps



From the looks of it the same thread is having a lock on different objects in both cases so it might be a different request but out of 50 worker threads same 5 threads are active in both dumps (and their stack trace is also the same apart from some hex codes) so its a little confusing. Can we know whether its the same request with thread dump? I can attach more thread dumps of the other 4 threads.

Thanks in advance.


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Rishi Shehrawat
Ranch Hand

Joined: Aug 11, 2010
Posts: 218

You can use VisualVM, it has a plugin for thread dump analysis. This can show blocked threads. You mentioned that you are investigating cause for 100% CPU utilization. Normally threads waiting on locks do not cause 100% CPU utilization. For 100% CPU utilization, it might be useful to look at GC activity. You can enable GC logs for this OR VisualVM can also be used.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

Looks like the same thread serving two unrelated requests, since the various stream objects that are being locked are a completely different set in the each stack trace. If looks like the threads are just working on compressing the response data.

What kind of data are being returned here -- anything really large?

[Jess in Action][AskingGoodQuestions]
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

Thanks Rishi and Ernest. I'll take a memory dump and see if there's anything wrong there. As for the response, its just a normal web page though its heavier than a normal web page. I think the images don't matter and the size of the html itself is around 200KB in an extreme case (uncompressed). I'm using sitemesh, can sitemesh with the compression filter cause such problems?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web application worker threads running for a long time