Skip to Content

When the Web Application Server Java hangs during operation, or the CPU usage is too high, the best way to check what is going on there is to analyze some thread dumps.

The first question would be ‘what is a thread dump?’ or better ‘what is a thread?’

Threads are the so-called lightweight processes within an OS process. Both processes and threads provide the execution environment for our applications, although it is cheaper to create a new thread than creating a new process. The threads exist within an OS process and share the resources of that process. The mapping of java threads to processes depends on the operating system (it is not the same in Linux, Windows, etc.) The java platform uses a multithreaded execution. This means that every application uses one or several threads. In fact, there is a main thread which can create additional threads… This is the basis, but there is quite a lot of literacy about this.

So, how to configure this? Well, the java cluster nodes (dispatcher and servers) have different managers. Among them we can find:

  • Thread Manager: it handles the configuration of system threads.
  • Application Thread Manager: Configuration of threads that execute code of client application. Obviously, this manager is only relevant for the server nodes (as only the servers can execute application code).

We will talk about them later.

Then, what is a thread dump? A thread dump is, more or less, a picture of what the threads are doing at a certain point of time.

After this brief introduction, let’s go back to our hanging system. We need to analyze the activity of the threads, so we are going to create a series of thread dumps. For detailed instructions on how to create these thread dumps we can have a look at SAP note 710154, or use the Solution Manager Diagnostics.

It is very important to create more than one thread dump. A thread dump is like a snapshot, so we need several of them to be able to say whether the threads are stuck doing something or not. So, following the instructions of the mentioned note, or using the Diagnostics, we will create 3 or 5 thread dumps for every hanging node (dispatcher or servers) this way:

– Create one thread dump.
– Wait 30 seconds.
– Create another one.
– Wait 30 seconds.

You get the point… 🙂 

Ok, so we finally have our thread dump collection. And unfortunately it is not very user-friendly…Which tools are available to analyze them?

The first possibility is the Solution Manager Diagnostics, which is integrated into the Solution Manager. This tool allows us to create the thread dumps or to browse and upload manually created thread dumps. We only have to access the monitoring tab, and there go to tread dump analysis. If we upload a thread dump, we will see something like this:

This way we can start our analysis. 

The Solution Manager Diagnostics is a well-known tool, so I’d like to discuss another useful application called Thread Dump Viewer. Instructions on how to obtain and use the TDV can be found at SAP note 1020246 . Angel Penkov has also created a very good document on how to use this tool, which you can check here .

In the next weblog, we will check the most useful functions of this tool and we will also have a look to the most common thread hanging situations we can find.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply