Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

An Introduction to WebSphere Application Server Performance Tuning Toolkit

Part2: Analyzing Problem Scenarios

Shishir Narain (nshishir@in.ibm.com), IT Architect, IBM
Shishir Narain photo
Shishir Narain is Open Group certified Master IT Specialist with mature skills in IBM middleware products. He works in IBM Lab Services for WebSphere at India Software Labs, Gurgaon. He has 12 years of experience developing solutions for multiple clients. He has a Master of Technology degree from Indian Institute of Technology, Kanpur.
(An IBM developerWorks Contributing Author)
Tao Zhang (zhangtbj@cn.ibm.com), Software Engineer, IBM
author photo
Zhang Tao (Jordan) joined IBM in 2009. He works in IBM China Software Development Lab WebSphere Application Server SVT team in Beijing. He is interested in WebSphere Migration, Intelligent Management, and high availability.
Wang Yu (wyuyuw@cn.ibm.com), Software Engineer, IBM
author photo
Wang Yu (Edward) is a software engineer at the IBM China Software Development Lab in Beijing. He is a member of WebSphere Application Server SVT team. He is also interested in WebSphere Application Server performance analysis, performance tuning, problem diagnosis, and high availability.

Summary:  WebSphere® Application Server is a key component of enterprise architecture, and performance bottlenecks can affect multiple applications. This tutorial series introduces WebSphere Application Server Performance Tuning Toolkit, which can be used for uncovering performance bottlenecks and tuning the WebSphere Application Server infrastructure. This part presents several more problem scenarios and shows how PTT can help in detecting and resolving the issues.

Date:  24 Oct 2012
Level:  Intermediate PDF:  A4 and Letter (1646 KB | 21 pages)Get Adobe® Reader®

Activity:  9957 views
Comments:  

Deadlock problems

In a deadlock problem, two or more threads are stuck waiting for each other to release a lock. Neither thread can proceed when a deadlock occurs.

Triggering the problem

Listing 1 shows the code changes required in TradeAppServlet to trigger the deadlock.

Listing 1: Code for triggering deadlock

if(TradeConfig.isDeadLock()){
        deadLockMethod();
    }
public void deadLockMethod(){
    try {
        synchronized (lock1) { 
              // lock1 is defined in Methods and Static Variables tab
              Thread.sleep(5000);
              synchronized (lock2) {
            }
        }
        synchronized (lock2) { 
              // lock2 is defined in Methods and Static Variables tab          
              Thread.sleep(5000);         
              synchronized (lock1) {
            }
        }
       } catch (Exception e) {
           e.printStackTrace();
       }

Before triggering the deadlock problem, make sure that the JMeter stress program is running and the PTT is monitoring the server. In the Server tab of the DayTrader home page (http://host:port/daytrader), select the Deadlock checkbox and click Update Configuration to trigger a deadlock.


Figure 1: DayTrader configuration screen
screen                         shot of DayTrader configuration screen

Monitoring and Investigating the problem

You can see when a dead lock problem occurs by looking for throughput alerts on the dashboard, as shown in Figure 2.


Figure 2: PTT dashboard with alerts
dashboard                         showing alerts

Next, you must determine why the servlet response time is increasing. Java can provide runtime process details without the need to change to debug mode. You can use a thread dump, which is essentially a snapshot of all threads running inside the Java Virtual Machine (JVM), to learn more about the problem. It provides the stack trace of the Java threads and captures the exact code being executed at that instant.

To analyze the problem, first generate the thread dump from the PTT workbench, as shown in Figure 3.


Figure 3: Generating Thread Dump from PTT
menus to                         generate a thread dump

The thread dump file is generated in the profile root folder of the server. The dump file contains data in raw form. You can analyze this dump file using the Thread and Monitor Dump Analyzer tool of the IBM Support Assistant (ISA; see part 1 of this tutorial). Create a case in the ISA tool and import this thread dump file. Process this file using the Thread and Monitor Dump Analyzer tool, to get the analyzed output in the file having the name in format "javacore.xxxx_jca.html". Check the analysis results to further narrow down the problem. See Figure 4.


Figure 4: Thread and Monitor Dump Report
screen                         for selecting dump analysis

Click the Java Monitor Dump file link (see Figure 5). On expanding the Monitor Owner, you can see that multiple threads of Web Container are waiting. Expand a Web Container entry to get a detailed Monitor Dump Report.


Figure 5: Monitor Dump Report
detailed                         dump report

The detailed Java Monitor dump report clearly points out the issue and the code that is causing the problem.

org/apache/geronimo/samples/daytrader/web/TradeAppServlet.
      syncMethod(TradeAppServlet.java:218(Compiled Code))
at org/apache/geronimo/samples/daytrader/web/TradeAppServlet.
     performTask(TradeAppServlet.java:252(Compiled Code))
at org/apache/geronimo/samples/daytrader/web/TradeAppServlet.
     doGet(TradeAppServlet.java:172(Compiled Code))

As you can see, the PTT provides alerts about performance degradation. It then helps generate the thread dump. You can then use the ISA tool to analyze the dump and pinpoint the exact bad code.

2 of 8 | Previous | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=840753
TutorialTitle=An Introduction to WebSphere Application Server Performance Tuning Toolkit
publish-date=10242012
author1-email=nshishir@in.ibm.com
author1-email-cc=
author2-email=zhangtbj@cn.ibm.com
author2-email-cc=
author3-email=wyuyuw@cn.ibm.com
author3-email-cc=