• No se han encontrado resultados

Morfología de Sistemas

In document Diseño de Sistemas Profesor: (página 58-62)

Unidad 6: Morfología de Sistemas Simples

6.5 Morfología de Sistemas

Scenario

Users have reported intermittent database problems with the contacts application. You talk to a developer who guesses the problem might be in connecting to the database. You decide to gather some specific information about this application and how long it takes to make a database connection. You use application-scoped instrumentation to be able to gather this information.

Overview

In this practice, you configure an application-scoped diagnostic monitor. Application-scoped monitors are part of application-scoped diagnostic modules, so you add a diagnostic module to an application. You select a delegating monitor (it has predefined code locations, but you

choose the action to take). After the action has been triggered, you look at the data stored in the event archive.

Assumptions

You completed practice “3-1: Harvesting Diagnostic Metrics.” All instances of WebLogic Server are running.

Tasks

1. Enable instrumentation on the server named server1.

Note: For instrumentation to be available for an application, instrumentation must be

enabled on the server to which the application is deployed.

a. Access the administration console, log in, and lock the configuration. b. Navigate to your diagnostics module, server1-diagnostics.

Tip: In the Domain Structure: Diagnostics > Diagnostic Modules > server1- diagnostics.

c. Click the Configuration > Instrumentation tabs.

d. Select the Enabled check box.

Note: It is here that you could add instrumentation to this system-scoped diagnostic

module. This practice does not have you do that, however, because you will instead add instrumentation to an application-scoped diagnostic module.

e. Save and activate your changes. f. Minimize the admin console for later.

2. Add a WLDF descriptor file to an application. Then redeploy the application. a. Access host01.

b. Inspect the contents of the WLDF descriptor file provided under the current practice directory:

META-INF/weblogic-diagnostics.xml

Tip: Open a Terminal window, navigate to the current practice directory, and use the

cat command.

$> cd /practices/tshoot/practice04-01 $> cat META-INF/weblogic-diagnostics.xml

c. In a Terminal window run the jar utility to add the WLDF descriptor file to the

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Diagnostic Instrumentation

Chapter 4 - Page 4 $> cd /practices/tshoot/practice04-01 $> /u01/app/jdk/bin/jar uf /u01/domains/tshoot/wlsadmin/apps/contacts.war META-INF Note:

− Enter all commands on one line. Commands are sometimes displayed on more than one line due to space limitations.

− The jar utility option uf means to update the file specified.

− The file, contacts.war, is updated with the last parameter, the META-INF

directory.

d. Using the jar utility or the File Browser and Archive Mounter, inspect the

contacts.war file and confirm that the WLDF descriptor file was added to the WAR file’s META-INF directory.

Tip: To use the jar utility, run the jar as before, but replace uf with tf (table of contents for the file specified) and remove the META-INF at the end of the command.

$> /u01/app/jdk/bin/jar tf

/u01/domains/tshoot/wlsadmin/apps/contacts.war e. Minimize the VNC Viewer to use later.

f. Return to the admin console and lock the configuration. g. Select Deployments in the Domain Structure.

h. Select the check box next to the contacts application and click Update. i. Click Finish.

j. Activate the changes.

3. Generate a deployment plan for updating the WLDF module in the application by using the admin console.

a. In the Deployments table, click the name of the contacts application. b. Click the Configuration > Instrumentation tabs.

c. Lock the configuration again. d. Ensure Enabled is selected.

e. Scroll down and click the Add Monitor From Library button.

f. Move the JDBC_Around_GetConnection option from the Available column to the

Chosen column.

Note: This “around” monitor is triggered before and after a database connection is

retrieved. g. Click OK.

Note: Because this is a change to the application-scoped diagnostic monitor, and a

deployment plan does not yet exist for this application, the “Save Deployment Plan Assistant” is launched.

h.

Set the Path to:

/u01/domains/tshoot/wlsadmin/apps/contacts-plan.xml

i.

Click OK.

j. Return to the application’s Configuration > Instrumentation tabs. k. In the Included Classes text area enter:

Oracle University and In Motion Servicios S.A. use only

stcurr.*

Note: The class that gets the database connection is in the stcurr package. l. Click Save.

m. Do not activate changes yet. 4. Configure the delegating monitor.

a. In the Diagnostic Monitors in this Module table, select the new monitor.

b. Under Actions, move the TraceElapsedTimeAction from the Available column to the Chosen column.

Note: This action makes two event archive entries: one before and one after the

specified code location. It is only compatible with “Around” monitor types. c. Click Save.

d. Activate all your changes.

e. Return to the contacts application’s main configuration page and inspect the

Overview tab. Confirm that the Deployment Plan field now has a value. Tip: Make note of the file’s name and location.

f. Minimize the admin console for later.

g. Return to host01. Use a Terminal window or the File Browser to find and inspect the deployment plan file. The plan now has new variables, which will update the

weblogic-diagnostics.xml file. In the plan file, notice that there are now variables that start with “WLDFInstrumentationMonitor.”

Note: If you view the deployment plan file by using the gedit editor, make sure you do not make any changes to the file.

5. Deploy the latest version of the application, with the deployment plan. a. Return to the admin console and lock the configuration.

b. In the Domain Structure, select Deployments.

c. Select the check box next to the contacts application, and click the Update button. d. Select Update this application in place with new deployment plan changes.

Ensure that the Deployment plan path (under this option) is correct. e. Click Finish.

f. Activate the changes.

g. Ensure that the contacts application’s state is “Active.” 6. Run the application and inspect the generated events.

a. Use the Firefox web browser on the gateway machine. Enter the URL for the application:

http://host01.example.com:7011/contacts b. Click the browse all contacts link.

c. Click the [edit] link on a row.

d. Use the page to update some fields. Click the Update button.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Diagnostic Instrumentation

Chapter 4 - Page 6

f. Return to the admin console. From the Domain Structure panel, select Diagnostics >

Log Files.

g. Locate and select the EventsDataArchive log file for the server1 server. Click View.

Note:

If you don’t see any rows in the table, click the Customize this table link. Change the Time Interval to ensure you are going back far enough to see the events created. Click Apply.

− If after doing that, you still don’t see any rows, return to the task to “deploy the latest version of the application” and do it again.

h. Browse the generated events. Notice the Date column. For each “Before” and “After” event (look in the Type column) you can see how long connecting to the database took by comparing the times. (The number on the end is milliseconds.)

7. View “request performance” in the admin console.

Note: Because instrumentation is enabled, and the monitor is an “Around” type, you can

view request performance data by using the admin console.

a. In the Domain Structure, select Diagnostics > Request Performance.

b. For Servers select server1. For Interval select Last 5 mins (or a time that will include running the application).

c. Click the Refresh button.

d. View the results. To see what is “under” a request, click the “+” next to one.

e. To see the details of a request, click the string that identifies the request.

f. The details are displayed below the Requests tree.

Note: Above the details table are the WLDF context ID and the total elapsed time of

the request in milliseconds. The details include the class and method, the number of times the method was called in the request, the total milliseconds of the calls, the

Oracle University and In Motion Servicios S.A. use only

average milliseconds of the calls, the application name, the application module, and the method signature.

g. Close the admin console.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Diagnostic Instrumentation

Chapter 4 - Page 8

Practice Solution: Configuring and Monitoring Diagnostic Events

In document Diseño de Sistemas Profesor: (página 58-62)