1. Trang chủ
  2. » Công Nghệ Thông Tin

WebSphere Studio Application Developer Version 5 Programming Guide part 69 pdf

10 237 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 205,99 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Profiling applicationsIn this chapter, we discuss the architecture for profiling, the process of profiling Java processes, and the performance analysis tools provided with Application De

Trang 1

654 WebSphere Studio Application Developer Version 5 Programming Guide

Scrubbing output folder

Analyzing sources

Compiling ItsoProGuideBasicWeb/Java Source/itso/bank/facade

Compiling ItsoProGuideBasicWeb/Java Source/itso/basicweb/control

Compiling ItsoProGuideBasicWeb/Java Source/itso/basicweb/filter

Compiling ItsoProGuideBasicWeb/Java Source/itso/basicweb/listener

Compiling ItsoProGuideBasicWeb/Java Source/itso/jbwp

Reading saved built state for project ItsoProGuideEJB

Reading saved built state for project ItsoProGuideJava

Build done

[warExport] Exporting: ItsoProGuideBasicWeb Updating

[warExport] Exporting: ItsoProGuideBasicWeb Done

BUILD SUCCESSFUL Total time: 5 seconds RunAnt.run done

The output file ItsoProGuideBasicWeb.war was created in the output directory c:\ItsoProGuideTest\dist as specified in the build.xml script

Summary

In this chapter we introduced you to the Ant build tool and explained how to perform a build of both a simple Java application and a full J2EE application

We also described how to run the Ant tool outside of Application Developer for easier integration into your build process

Trang 2

Chapter 20. Profiling applications

In this chapter, we discuss the architecture for profiling, the process of profiling Java processes, and the performance analysis tools provided with Application Developer

20

Trang 3

656 WebSphere Studio Application Developer Version 5 Programming Guide

Profiling architecture

Application Developer provides the developer with a set of tools to allow for early analysis of performance related issues in Java applications The profiling tools can be used to gather performance information on applications that are running:

򐂰 Inside an application server, such as WebSphere

򐂰 As a standalone Java application

򐂰 On the same machine as Application Developer

򐂰 On a remote machine from Application Developer

򐂰 In multiple JVMs Using filters, you can focus on classes that you are interested in and omit tracing for others

Traditionally, performance profiling is done once an application is getting close to deployment or when it has already been deployed Using the Application Developer profiling tools allows you to move this analysis to a much earlier phase

in the development cycle, therefore giving you more time to modify your architecture based on any problems detected

Profiling creates a number of different graphical and tabular views of a Java program’s run-time behavior, and simplifies identifying and diagnosing performance related problems

The basic architecture of the profiling tools involves the JVM, (Java Virtual Machine), where the application is running, an agent running inside the JVM capturing profiling information, an agent controller that controls the agent and retrieves profiling information, and the performance analyzer inside Application Developer The relationships between the components is shown Figure 20-1 The agent runs inside the JVM and uses the Java Virtual Machine Profiler Interface, (JVMPI), to interface with the JVM If you are interested in more information about JVMPI, the following Sun Web site has details:

http://java.sun.com/products/j2se/1.3/docs/guide/jvmpi/jvmpi.html

Trang 4

Figure 20-1 Application Developer profiling architecture

Profiling Java processes

In this section, we will use the ItsoProGuide enterprise application that we developed so far We start a server in profiling mode, and use this application to collect profiling data, and later analyze the collected data

We also run some of the Web application processes to collect and analyze data

Agent Controller

Before you can start using the profiling tools, be sure that you have the Agent Controller installed, and that it is started as a service on the host where the application to profile is running

Installing the Agent Controller is explained in “Installing the Agent Controller” on page 792

Once the Agent Controller is installed, ensure that it is started as a service Click

Start -> Settings -> Control Panel, then select Administrative tools and Services You should see an entry for the IBM Agent Controller in the list of services (Figure 20-2)

Agent Controller

Java Virtual Machine

User App

Performance Analyzer Control Interface

View er

Formatter

Application Developer

control

data

control

data

Agent

Trang 5

658 WebSphere Studio Application Developer Version 5 Programming Guide

Figure 20-2 IBM Agent Controller service entry

Profiling an application in the WebSphere Test Environment

When you have made sure that the Agent Controller is installed and started, you are ready to start profiling your application

We assume here that you have created the ItsoServertest server, as described

in “Creating a server for testing” on page 224

To begin, you must start your test server in profiling mode To do so, switch to Server perspective and select the ItsoServer in the Servers view, then select

Profile from the context menu

Figure 20-3 shows the server in the Server view once it has started in profiling mode

Figure 20-3 Server started in profiling mode

Attaching to a Java process

To start a new profiling session, select Profile -> Attach -> Java Process. We

want to run the profiling against the process that is already running, namely the server process that we started earlier From this menu you could also launch a new process, as described in “Launch Java process for profiling” on page 663

Trang 6

In the dialog that is displayed, you should see the process ID of the server process listed Expand unknown[PID:XXXX] in the Agents list to see the

available agents (Figure 20-4)

Figure 20-4 Attach Java process - select agent

There are two agents available for you to select: Java Profiling Agent and J2EE Request Profiler

The Java Profiling Agent collects data within the boundaries of a single Java

Virtual Machine's (JVM) execution space The agent is attached to a JVM in which the profiled application runs Profiling focuses on the level of an agent or process and provides the following types of sequence diagrams:

򐂰 Object interactions

򐂰 Class interactions

򐂰 Thread interactions

The J2EE Request Profiler is an agent that resides within the application server

process for the purpose of collecting data from the interception points of the application's requests The J2EE Request Profiler uses the Agent Controller to externalize this data so that it can be rendered by the various views provided by the Profiling perspective of the Workbench

The J2EE Request Profiler collects data from requests arriving in EJB containers

as well as Web containers This data collection mechanism enables the creation

of sequence diagrams, which represent interactions among servlets, JSPs, and

Trang 7

660 WebSphere Studio Application Developer Version 5 Programming Guide

enterprise beans, while ignoring other artifacts of the application infrastructure that do not represent the business logic of the application The collected data enables the creation of a variety of different diagrams, which are defined for specific levels of the profiling hierarchy (monitors, hosts, processes, and agents) The Sequence Diagram views of the Profiling perspective offer the following diagram types:

򐂰 Host interactions

򐂰 Process interactions

򐂰 Thread interactions

򐂰 Object interactions

򐂰 Class interactions Click All>> to select both the Java Profiling Agent and the J2EE Request Profiler Click Next to proceed to the next page of the wizard On this page, you can change the default name of the monitor Normally you will leave the defaults on this page (Figure 20-5)

Figure 20-5 Attach Java process - select project and monitor Click Next to proceed to the Profiling Filters page (Figure 20-6) On this page, there are several existing sets of filters for you to select from

You can select one of the predefined filters, edit a filter, or add a new one

Note: A filter limits the profiling data that is collected by package or class

name

Trang 8

Figure 20-6 Attach Java process - set filters

򐂰 Default—Normally you do not want to include system classes in profiling The

default filter does this for you

򐂰 WebSphere J2EE—Filters com.tivoli* and db2j* in addition to the default

򐂰 WebSphere Studio—Stricter filter that changes two filters: com.ibm.etools*

and org.eclipse*

Click Next, and you are taken to a page where you an specify more profiling options (Figure 20-7):

򐂰 Start profiling after a number of invocations or time period (remove startup invocations)

򐂰 Collect boundary classes and instance-level information in the execution flow Click Finish

Trang 9

662 WebSphere Studio Application Developer Version 5 Programming Guide

Figure 20-7 Attach Java process - profiling options

Start monitoring

The profiling perspective with the Profiling Monitor view opens with the two agents You are reminded with a pop-up window that you have to start monitoring We have connected so far, but we have not started monitoring The process along with both monitors are shown in the Profiling Monitor view (Figure 20-8) Select them both and select Start Monitoring from the context menu to begin gathering statistics

Figure 20-8 Profiling Monitor

Trang 10

To collect data, run some of the Web transactions, for example:

򐂰 Select the ItsoProGuideBasicWeb project and Run on Server

򐂰 Enter a customer number, then select an account, run a deposit, and list the transactions records

򐂰 If you have implemented the EJBs and the Banking facade that calls the BankEJB session bean (see “Adapting the Web applications” on page 436) then the EJBs are used to access the EJBBANK database

򐂰 Retrieve the collected data using the Refresh Views icon or select

Refresh Views from the context menu of an agent

򐂰 Run a second sequence of deposit and list transactions for another customer

򐂰 Refresh the view

Stop monitoring by selecting Pause Monitoring in the Profiling Monitor view

Performance analysis views

To access the different profiling views, use the icons on the toolbar:

򐂰 for Heap view

򐂰 for Object References view

򐂰 for Execution Flow view

򐂰 for Package Statistics view

򐂰 for Class Instance Statistics view

򐂰 for Class Method Statistics view

򐂰 for Instance Statistics view

򐂰 for Method Statistics view See “Performance analysis” on page 666 for further details

Launch Java process for profiling

In addition to attaching to running processes, as you did when profiling Web applications, you can also launch Java processes for profiling

We use the ItsoProGuideJava Java project, described in “Creating a Java project” on page 94

Select Profile -> Launch -> Java Process and the Launch Java Process wizard opens (Figure 20-9)

Ngày đăng: 03/07/2014, 20:20

TỪ KHÓA LIÊN QUAN