Professional Documents
Culture Documents
D85093
Edition 1.0
January 2014
D83171GC10
Activity Guide
Workshop
Performance Tuning
Oracle WebLogic Server 12c:
Disclaimer
This document contains proprietary information and is protected by copyright and other intellectual property laws. You may copy and
print this document solely for your own use in an Oracle training course. The document may not be modified or altered in any way.
Except where your use constitutes "fair use" under copyright law, you may not use, share, download, upload, copy, print, display,
perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization
of Oracle.
The information contained in this document is subject to change without notice. If you find any problems in the document, please
report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not
warranted to be error-free.
Trademark Notice
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective
owners.
Authors
Elio Bonazzi, Mark Lindros
Table of Contents
Practices for Lesson 5: Monitor and Tune Server Performance .............................................................. 5-1
Practices for Lesson 5: Overview............................................................................................................. 5-2
Practice 5-1: Configuring Server Stuck Thread Behavior .......................................................................... 5-3
Practice Solution ..................................................................................................................................... 5-6
Practice 5-2: Configuring Automatic Restarting of a Failed Server ............................................................ 5-7
Practice Solution ..................................................................................................................................... 5-12
Practice 5-3: Configuring WebLogic Overload Protection .......................................................................... 5-13
Practice Solution ..................................................................................................................................... 5-18
Practice 5-4: Configuring Log Filters for the WebLogic Server .................................................................. 5-19
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
Practices Overview
There are no practices for this lesson.
Practices Overview
In the practices for this lesson, you set up the course lab environment and learn how to perform
basic application load testing tasks.
IMPORTANT NOTE!! This is a practice environment, with load generation tools running on the
same machines being performance tested. Each machine is also a virtual machine (VM) running
on the same single physical machine. This class will also get deployed across a big variety of
different environments around the world. As a result, you should focus mainly on the
methodology and use of the tools in this course rather than the actual results that can be
Overview
This practice shows you how to set up the initial course environment used for all the practices of
the course. You also verify that the WebLogic domain used for the course is functioning
properly. The following image depicts the architecture of the domain used for this practice.
Tasks
1. Connect to the host01 and host02 machines.
a. Connect via VNC to host01:
On the main machine's desktop, double-click the VNC Viewer - host01 icon to start
VNC for host01.
b. Run the following command on host01 to start the domains AdminServer. The
startAdmin.sh script is located in this course's bin folder, which is in your PATH so
it can be executed from any folder location on host01.
$ startAdmin.sh
Note: The scripts used in this course automatically set the terminal window title to
AdminServer, server1, and server2 for each WebLogic server instance that runs within
that window.
c. Wait for the administration server to start.
d. Run the following command on host01 to start the domains server1 managed server.
The startServer1.sh script is located in this course's bin folder, which is in your
d. Verify that all three servers, AdminServer, server1, and server2, are in the RUNNING
state.
5. In the MAIN terminal window on host01, run the cleanup script (optional).
Note: This course uses the cleanup.sh script to restore the domain to its original state. It
Practice Solution
There is no solution for this practice. All practices depend on this lesson, most notably step 2 to
set the initial environment.
Practice Solution
Chapter 2 - Page 7
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Overview
This practice provides you with a very high-level view of the applications used in this course.
Viewing an auction:
The Create Auction and Bid features of the application are not used for this course.
Going Shopping:
The jconsole GUI allows interaction with StressTestOS. Users can start and stop the process
that cause stress on the system:
The Memory Exhaustion application allows users to simulate running out of memory in a
Practice Solution
There is no solution for this practice. All practices are based on this information, but no practices
depend on this practice.
Practice Solution
Chapter 2 - Page 20
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Overview
This practice shows you how to set up Grinder to place a load on an application. You load the
Auction application to get some metrics to establish the baseline performance characteristics of
the application when running in a steady state. You will record performance metrics including
CPU utilization, application throughput, response time, hard disk utilization, memory utilization,
and network utilization. These performance metrics will be used in subsequent practices for
comparison with other performance numbers to see if performance improves or declines. The
primary purpose of this practice is to give you hands-on experience with running the tools and
analyzing the resources used in this course.
The image above depicts the architecture of the domain used for this practice:
There are two machines, host01 and host02.
Each machine is hosting a WebLogic managed server, server1 on host01 and server2
on host02.
Both servers form a cluster and have the Auction application deployed.
Dependencies
This practice depends on practice 2-1 for setting up the course environment.
Tasks
1. Connect to the host01 and host02 machines by using VNC.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice02-03
$ ./setup.sh
This script does the following:
Restores the domain to its original state
Starts the wlsadmin AdminServer
Deploys the SimpleAuctionWebAppDb application to the cluster
Starts the server1 managed server on host01
Starts the server2 managed server on host02
b. Wait for all servers to log that they are in the RUNNING state before continuing.
3. Configure the Grinder proxy.
The Grinder proxy runs on the machine and intercepts web browser requests made with the
browser. It uses this to create load scripts by capturing and recording these requests to
form the infrastructure used to load test your application.
a. Launch Firefox on host01.
d. Here is a brief explanation of the columns for CPU utilization for the top command.
Use this as a reference when you are monitoring CPU utilization on each machine.
Column Description
Cpu0..n Represents each CPU instance on the machine
%us Percentage of time spent executing user processes that were not
prioritized, or niced
%sy Percentage of time spent executing the kernel and its processes
%ni Percentage of time spent executing user processes that were
prioritized, or niced
f. On the main toolbar, if it is not already selected, click the Start collecting statistics
button.
g. On the main toolbar, click the Start the worker processes button. Click OK if you are
prompted to run the agents default property file.
h. As the agent runs, the left pane displays the number of collected samples along with
the response time and throughput statistics of the samples.
i. As the agent runs, use the Linux System Monitor to monitor CPU utilization.
j. In the Results tab of the Grinder console, locate the Successful Tests column.
k. Return to the Grinder Agent terminal window and verify that the test script finished:
2013-09-10 14:27:09,771 INFO host01.example.com-0: finished
2013-09-10 14:27:10,261 INFO agent: finished, waiting for
console signal
l. Locate the Total section in the lower left area of the Grinder console. This contains the
performance numbers for the Grinders load testing.
Chapter 2 - Page 28
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
Oracle University and In Motion Servicios S.A. use only
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
m. You can also review the total lines in Grinders table output:
Tool Description
including network activity
mpstat Displays activities for every processor on the machine
pmap Displays the memory map of a running process
netstat Displays network connections, routing tables, and related statistics
ss Displays network socket statistics
Grinder Grinder displays reports that provide average response and throughput
metrics for its load tests. You can also use the Grinder console to see charts
for performance characteristics of your tests.
c. On the main toolbar, click the Reset the worker processes button. When prompted
to reset the console statistics, click Yes.
d. Run the tests more than once to give yourself a chance to try different tools to capture
these metrics in different ways. Record the results of each test, and compare each of
them to get an idea of the deviations between each test run and exactly how the
application it performing. When working on each test, make sure that there is sufficient
time left to complete all the practices in the lesson.
8. Increase the load and record performance metrics again.
Now you will change the load that Grinder places on your application to push the system a
little harder. You are trying to determine a reliable steady state load that the current
environment and configuration can manage without problems.
a. Modify the grinder.properties file so that it looks like the following:
grinder.processes=2
grinder.threads=50
grinder.runs=2
grinder.logDirectory=logs
grinder.numberOfOldLogs=2
grinder.script=auction-application.py
b. Record the same metrics again and ask yourself the following questions:
How do the numbers differ from the previous run?
What factor does having the Grinder application running on the host01 machine
have?
Was the application response time or throughput better or worse?
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. Any practices that use Grinder depend on students knowing how to perform these
tasks.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder.
3. Execute the solution script for this practice:
Practice Solution
Chapter 2 - Page 32
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Overview
Now that you have set up and run the Grinder load testing tool against the Auction application,
you are ready to start putting more load on the application to see how far it can be pushed. This
practice builds on the previous practice, and has you modify the test case settings to increase
the load on the application, and has you use various tools to measure the performance
characteristics of the application, machine, and JVM. You will push the application until a
system resource that the application depends upon reaches capacity. Then you will use
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment.
Practice 2-3 for configuring Grinder and establishing initial baseline performance
numbers of the Auction application in this environment.
Tasks
1. Ensure that the environment from practice 2-3 is still running.
a. This practice reuses the practice 2-3 environment. If the environment is not running,
then perform the solution steps for practice 2-3, and then return to this practice.
2. Increase the load placed on the system and the application using Grinder.
a. Increase the settings of the grinder.properties file to increase the load on your
application.
b. While the application is running, monitor the following system resources using the
same tools described in the table from practice 2-3. Write down the performance
numbers you see in a form similar to the following. You may also want to take note of
the number of successful tests and number of errors.
Use a separate sheet of paper for each host so you can compare numbers easily.
CPU Disk Network Used Free Mean Mean # #
I/O I/O Memory Memory Response TPS Successful Errors
time Tests
c. Run the tests more than once to give yourself a chance to try different tools to capture
these metrics in different ways. Record the results of each test, and compare each of
them to get an idea of the deviations between each test run and exactly how the
application it performing. Just keep your mind on how long each test takes to run
because you have other practices to perform.
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
results returned than actually are. This can occur because the Grinder Agent was not able to
contact the Grinder Console to report its statistics.
In my load testing, none of the WebLogic servers crashed. I am not too surprised because
WebLogic has been designed to handle heavy loads and failures gracefully. Although we have
not configured any overload protection features at this point, WebLogic managed to outperform
the CPU and the system.
After you get a suitable load that pushes the system without over-saturating it, you can run the
system load at that level, and then you can analyze the application and system to see where
performance of the current system shows room for improvement. For example, the system is
running and providing 100 TPS, but analysis of the application may show that requests are
taking a long time to return from a particular application component, or the database, and so on.
Practice Solution
There is no solution for this practice. No practices depend on this practice.
Practice Solution
Chapter 2 - Page 36
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Practice Solution
Chapter 2 - Page 37
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
Oracle University and In Motion Servicios S.A. use only
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Practices Overview
In these practices, you will selectively stress test the major components of a server computer
(CPU, Disk/IO, and network) using a provided stress test application; you will use the tools
provided by Linux to monitor the activity induced on the system by the stress test tool.
The table below shows what Linux/UNIX tool you will be using, its parameters (if applicable),
and what practice/step you encounter the commands/tools:
Overview
In this practice, you use the StressTestOS application, located in
/practices/tune/practice03-01, to generate some load on the CPU of the host01
server and, while the CPU is under stress, you use various utilities (mpstat, Gnome System
Monitor, gkerrlm and sar to monitor and assess the CPU load produced by StressTestOS.
The StressTestOS Java application will be run on the host01 host. A companion application,
called SocketServer, must be run on host02. The socket server application running on
host02 is accessed by StressTestOS when network activity must be simulated.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment
Tasks
1. Connect to the host01 and host02 machines.
2. Open three terminal windows on host01.
3. In a terminal window on host01, navigate to /practices/tune/practice03-01 and
launch the StressTestOS application.
$ cd /practices/tune/practice03-01
$ java jar StressTestOS.jar
StressTestOS started
4. Open a terminal window on host02.
5. In a terminal window on host02, navigate to /practices/tune/practice03-01 and
launch the SocketServer application.
$ cd /practices/tune/practice03-01
$ java jar SocketServer.jar
Waiting for clients to connect
6. In an available terminal window on host01, launch the Gnome System Monitor application:
$ gnome-system-monitor &
Note the ampersand (&) character at the end of the line. It forces the shell to launch the
application and return the prompt so that a user can submit more commands.
11. Under "Local Processes" select StressTestOS.jar and click "Connect." The initial
connection attempts fails, because an insecure (that is, non-TLS) connection is detected.
Click "Insecure" to proceed using an insecure connection:
12. jconsole starts. Click the "MBeans" tab, and then click the StressTestOSAgent
MBean. Click the "Controlbn" node under StressTestOSAgent. Finally, click the
"Operations" node in the StressTestOSAgent MBean tree. The right pane in the
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
jconsole window displays a page with several controls which can be used to invoke
methods provided by StressTestOS:
14. jconsole responds with a little feedback window, stating that the method was successfully
invoked:
16. Select the second terminal window you created in step 2, where the last command entered
was the launching of gkrellm. Experiment with the sar, ps, iostat, mpstat and
vmstat commands:
$ sar -u 1 3
Linux 2.6.39-400.109.3.el6uek.x86_64 (host01.example.com) 09/20/2013 _x86_64_
(2 CPU)
The "sar u 1 3" command displays real-time CPU usage every 1 second for 3 times. In your
environment, expect to see slightly different numbers; however, with three active threads
stressing the two CPUs, you should see an idle time close to 50%
Once again, your environment will show similar, but not identical, statistics. With three
threads running CPU stress tasks, iostat shows you that the CPU of the system is only
idle approximately 10% of the time, while 88% of the CPU cycles are taken by the system
to satisfy the CPU stressing tasks. Less than 1% of CPU time is spent in system (or
"kernel") mode, which shows a very healthy system. It is the system time which should be
carefully monitored, values exceeding 20~30% indicate that the system is spending too
long in kernel mode.
19. The command mpstat shows the multi-processor CPU statistics. When invoked with the
"-P ALL 2" options, it displays statistics for all CPUs, every two seconds:
$ mpstat -P ALL
04:13:00 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
04:13:02 AM all 86.87 0.00 0.76 0.00 0.00 0.00 0.00 0.00 12.37
04:13:02 AM 0 86.87 0.00 1.01 0.00 0.00 0.00 0.00 0.00 12.12
04:13:02 AM 1 87.37 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12.63
04:13:02 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
04:13:04 AM all 88.61 0.00 0.51 0.00 0.00 0.00 0.00 0.00 10.89
04:13:04 AM 0 88.32 0.00 0.51 0.00 0.00 0.00 0.00 0.00 11.17
04:13:04 AM 1 87.94 0.00 1.01 0.00 0.00 0.00 0.00 0.00 11.06
04:13:04 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
04:13:06 AM all 89.90 0.00 1.26 0.00 0.00 0.00 0.00 0.00 8.84
20. Stop the StressTestCPU() method. Select the jconsole window and click the
"StopCPUStress" button. Keep an eye on sysmon and gkrellm, and after a few
seconds re-run the CPU statistics commands you run previously (sar, ps, mpstat,
and so on.) Compare the differences in their output, after the CPU stress tasks have been
stopped. Example: after having stopped the CPU stress tasks, the system used to develop
this course showed that the StressTestOS application, which previously was taking more
than 55% of CPU, dropped to 5.7%:
$ ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
%CPU PID USER COMMAND
15.0 4759 oracle /usr/NX/bin/nxagent -D -options
6.8 5216 oracle gnome-system-monitor
5.7 7804 oracle java -jar StressTestOS.jar
3.7 4677 nx sshd: nx@notty
3.1 7138 root gkrellm
3.0 2540 oracle ora_vktm_oggcoh
2.5 5455 oracle jconsole
1.0 4775 nx /usr/NX/bin/nxssh -B -E
0.5 4926 oracle /usr/lib/vmware-tools/sbin64/vmtoolsd -n
As usual, your environment will show some differences, but the crucial point is that after
stopping the CPU stress tasks, the StressTestOS application is not anymore at the top of
the list of most expensive applications running on the system.
21. Feel free to experiment with StressTestOS and jconsole. For example, increase the
number of threads from three to five or ten, click on StressCPU and observe how the
system reacts to the heavier stress tasks. DO NOT exceed twenty threads; otherwise, the
system could become unresponsive and difficult to control, short of an abrupt shutdown.
22. When you finish experimenting with CPU statistics, leave jconsole open but remember to
click the StopCPUStress button. jconsole will be used in the next practice.
Practice Solution
There is no solution for this practice. However, you can apply the lessons learned in this
practice to subsequent practices in this course.
Practice Solution
Chapter 3 - Page 10
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Overview
In this practice, you use the StressTestOS application, set up during practice 3-1, to cause
Disk I/O activity on the system and you use the various Linux provided commands to assess
and analyze the Disk I/O statistics as reported by the system under stress.
Tasks
1. Enter 5 as a parameter for the StressDisk() method, which will instruct StressTestOS
to spawn five threads which will generate heavy disk I/O activity.
3. Within the new terminal window, use the su command to log in as the super user (root).
The password for the root user is oracle:
$ su
Password: ******
#
Note: You must be logged in as root to run the iotop command
4. In the window where you are logged in as root, invoke the iotop command:
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm
%util
xvda 0.00 2788.00 0.00 160.00 0.00 11064.00 69.15 13.73 29.76 0.65
10.40
xvdd 0.00 0.00 0.00 10.00 0.00 80.00 8.00 0.01 0.50 0.10
0.10
6. The "-d" option for the iostat command causes the display of only I/O statistics:
/home/oracle>iostat -d 2
7. The gkrellm application, which you left running in the background, visually show a heavy
disk activity in its "Disk" portion, towards the bottom:
Practice Solution
There is no solution for this practice. However, you can apply the lessons learned in this
practice to subsequent practices in this course.
Practice Solution
Chapter 3 - Page 15
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Overview
In this practice, you use the StressTestOS application, set up during practice 3-1, to cause
network activity on the system and you use the various Linux provided commands to assess
and analyze the virtual memory and I/O statistics as reported by the system under stress.
Tasks
1. Make sure the socket server application is running on host02. You should have launched
the SocketServer application during practice 3-1, step 5. Select the VNC host02 window
and verify that the SocketServer application is still running in a terminal window:
/home/oracle>netstat -i
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 59374 0 0 0 59022 0 0 0 BMRU
lo 16436 0 1726 0 0 0 1726 0 0 0 LRU
/home/oracle>netstat -i
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 93960 0 0 0 93604 0 0 0 BMRU
lo 16436 0 1846 0 0 0 1846 0 0 0 LRU
/home/oracle>
4. The Gnome System Monitor application, which you left running in the background, should
show and increasing network activity, in the lower part of the window, under "Network
History:"
The table below explains the output produced by sar when invoked with the "-n DEV"
option:
rx: 102.29 Mbit/s 15623 p/s tx: 8.85 Mbit/s 15624 p/s
rx | tx
--------------------------------------+------------------
bytes 149.51 MiB | 12.99 MiB
--------------------------------------+------------------
max 105.58 Mbit/s | 9.17 Mbit/s
average 102.07 Mbit/s | 8.87 Mbit/s
min 92.84 Mbit/s | 8.12 Mbit/s
--------------------------------------+------------------
packets 188000 | 188001
--------------------------------------+------------------
max 16201 p/s | 16201 p/s
average 15666 p/s | 15666 p/s
min 14356 p/s | 14357 p/s
--------------------------------------+------------------
time 12 seconds
9. Feel free to experiment with StressTestOS stop the current execution, increase the
number of threads (with moderation) and re-launch the network stressing application.
Re-run the various monitoring commands and check if the increased number of threads
determine a visible increase in system load.
10. IMPORTANT: The StressNetwork application produces very large log files in the /tmp
directory. You should periodically delete those files using the command: "rm f
/tmp/*.log.*" to prevent the system disk from becoming full.
11. When you finish the practice, you can stop the StressTestOS application. You can either
request an application shutdown by clicking the "Request Shutdown" button in jconsole,
or you can type CTRL-C in the window that is running StressTestOS. Remember also to
stop the SocketServer application running on host02. Select the VNC host02 window and
type CTRL-C in the window which is running SocketServer.
12. Leave both VNC windows open and do not close any of the terminal sessions opened so
far inside either host01 or host02. They will be re-used in the next practice.
Practice Solution
There is no solution for this practice. However, you can apply the lessons learned in this
practice to subsequent practices in this course.
Practice Solution
Chapter 3 - Page 22
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Overview
In this practice, you change several Linux kernel parameters which mainly affect the way the
system handles a large number of connections. You will modify four kernel parameters making
those changes permanent (the parameter changes will survive reboots.)
Tasks
1. Select the VNC host01 window. Select the terminal session connected to the system as
root (it is recognizable because the prompt ends with a hash sign (#) instead of a dollar
sign.) Print to screen the current value for the kernel parameters:
1) tcp_keepalive_time
2) tcp_keepalive_intvl
3) tcp_keepalive_probes
4) tcp_max_syn_backlog
The values are stored in the directory /proc/sys/net/ipv4 located in the virtual file
system which stores the runtime system information. To print their values, you use the
cat command:
# cat /proc/sys/net/ipv4/tcp_keepalive_time
7200
# cat /proc/sys/net/ipv4/tcp_keepalive_intvl
75
# cat /proc/sys/net/ipv4/tcp_keepalive_probes
9
# cat /proc/sys/net/ipv4/tcp_max_syn_backlog
2048
2. This means that the keepalive routines wait for two hours (7200 secs) before sending the
first keepalive probe, and then resend it every 75 seconds. If no ACK response is
received for nine consecutive times, the connection is marked as broken. In addition, the
half-open connection queue length is set to 2048, which is not enough. The defaults values
are set too high for keepalive and too low for max_sync_backlog, so you want to
change them to something more appropriate. You decide to configure the host so that
keepalive starts after ten minutes of channel inactivity, and then send probes in intervals
of one minute. Because of the high instability of your network trunk and the low value of the
interval, suppose you also want to increase the number of probes to 20. You also want to
increase the half-open connection queue to 4096. Edit (using either gedit or vi) the file
/etc/sysctl.conf and append the following lines at the bottom of the file:
net.ipv4.tcp_keepalive_time=600
net.ipv4.tcp_keepalive_intvl=60
net.ipv4.tcp_keepalive_probes=20
net.ipv4.tcp_max_syn_backlog=4096
3. Save the /etc/sysctl.conf file and leave the editor. In order to force the system to
load the new kernel parameters, you must run the sysctl p command as logged in as
"root." In the same window where you edited the /etc/sysctl.conf file, run the
sysctl command. The output from sysctl p is a list of all parameters loaded:
7. Save the file and leave the editor. Run the sysctl command. The output from
sysctl p is a list of all parameters loaded:
[root@host01 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
Many lines omitted for brevity
Practice Solution
There is no solution for this practice. However, you can apply the lessons learned in this
practice to subsequent practices in this course.
Practice Solution
Chapter 3 - Page 26
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Practices Overview
In the practices for this lesson, you monitor and tune parameters associated with the Java
HotSpot JVM. First, you tune Java garbage collection, load test an application, and monitor
garbage collection and application performance to perceive differences with different collectors.
Next, you use Java command-line tools to monitor and manage JVM processes. Then, you use
various graphical tools to monitor and manage JVM processes.
Overview
In this practice, you experiment with configuring different garbage collectors for an application,
loading the application, and monitoring the performance results for comparison.
The following image depicts the architecture of the domain used for this practice.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment.
Practice 2-3 for configuring Grinder and establishing initial baseline performance
numbers of the Auction application in this environment.
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice04-01
$ ./setup.sh
This script does the following:
Restores the domain to its original state
Starts the wlsadmin AdminServer
Deploys the SimpleAuctionWebAppDb application to the cluster
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
resources folder if you prefer to not create the file yourself. Remember that you must
create this file for each host if you want to monitor both managed servers because the
domain folder is not a shared file system. However, for this practice, using the file for
server2 is not recommended because it will take too long. There is a lot of work to do
for this course and the goals are accomplished by focusing on one server. You will
modify this same file, directly in the DOMAIN_HOME/bin folder for the remaining
practices in this lesson.
c. Experiment by setting the different settings in the table below and starting the servers
with the new settings. Remember to start the servers using the startAdmin.sh,
startServer1.sh, and startServer2.sh scripts. Try answering the questions in
step 3b again.
complete, and in other cases you may have to stop the test because the JVM is failing to keep
up with the load.
I was impressed with the G1 collector when run in a 50 MB heap. Not only was it able to finish
all the tests, but it also managed some decent performance numbers even in such a
constrained environment. I never even set any threshold parameters for it to follow. Did you
notice similar results?
My baseline test for a default 256-512 MB heap and parallel throughput collector settings were:
11.2 ms average response time, 72.5 average / 281 peak TPS
My 50 MB G1 collector test run produced the following numbers, which were very on par with
much less memory:
19.0 ms average response time, 75 average / 265 peak TPS
Practice Solution
There is no solution for this practice. No practices depend on this practice. However, the
setUserOverrides.sh script is introduced in this lesson. This script is used in other
practices, but is supplied by only this practice for this lesson. Other lessons provide their own
script file by default.
Overview
In this practice, you use Java command-line tools to obtain and analyze performance-related
metrics of running WebLogic Server JVM processes. These tools may be used freely throughout
the rest of the practices in this course if they seem appropriate and suitable to you. The
following image depicts the architecture of the domain used for this practice.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment.
Practice 2-3 for configuring Grinder and establishing initial baseline performance
numbers of the Auction application in this environment.
The setUserOverrides.sh script in
/practices/tune/practice04-01/resources. You will need to copy this file
and use it again any time you run the setup.sh script for a practice.
IMPORTANT! You can now leave Grinder running and reuse it for practices that use the
Auction application, or run it separately for each practice when needed the same way you did
for practice 4-1.
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice04-02
$ ./setup.sh
This script does the following:
Restores the domain to its original state. This includes removing the
setUserOverrides.sh script. If you need this script again in the future, copy it
from practice 4-1 to the domains bin folder again, open it in the gedit editor and
Option Description
-q Suppresses all output except for the lvmids of JVM processes. This
option cannot be used with the other options.
-m Displays the arguments passed to the main method of the running JVM
-l Displays the full package name of the main class or full path of the
applications JAR file
-v Displays the arguments passed to the JVM
-V Displays the arguments passed to the JVM using a flags file
-J Used to pass options to the underlying JVM run with jps
hostname Specifies the hostname of the remote host where jstatd is running so
you can use jps to retrieve lvmids of JVMs remotely on that host
port Specifies the port of the remote host where jstatd is running. This port
should match the port used to run jstatd.
Example usage with WebLogic on the same machine:
Option Description
-nr Tells jstatd to not create an RMI registry if one is not already
running
jcmd [options]
jcmd [pid | main-class] PerfCounter.print
jcmd [pid | main-class] command [arguments]
jcmd [pid | main-class] -f file
Option Description
-l Displays the list of running Java processes including their PID, main
class, command-line arguments
-h -help Displays a help message
Here are some examples of using jcmd (for reference, 19719 refers to a WebLogic
Server instances PID):
Example Description
jcmd Displays the PID and class names for
running JVM processes
jcmd 19719 help Displays the available jcmd commands
for the process with the specified PID
jcmd 19719 help VM.flags Displays detailed jcmd help for an
available command
jcmd 19719 Thread.print Displays a thread dump of a JVM
jcmd 19719 GC.class_histogram Displays a list of classes ordered by
those that are using the most memory
jcmd 19719 VM.command_line Displays the JVM command line. Use
this to display the command line used to
start WebLogic Server.
jcmd 19719 VM.system_properties Displays the system properties that are
set for a JVM. Use this to display
system properties set for WebLogic
Server.
jcmd 19719 VM.version Displays the version of the JVM running
in the specified process. Use this to
know what JVM version is running your
WebLogic Server instances.
Example Description
jcmd 19719 PerfCounter.print Displays a bunch of performance
counters for the JVM. Use this to get a
dump of numbers you can use to
analyze WebLogic / JVM performance.
Option Description
-flag name Displays the name and value of the specified
command-line argument
-flag [+|-]name Enables or disables the specified boolean
command-line argument
-flag name=value Sets the specified command-line argument to the
specified value
-flags Displays command-line arguments passed to the
JVM
Option Description
-sysprops Displays Java system properties for the JVM
-h -help Displays a help message
Here are some examples of using jinfo (for reference, 19719 refers to a WebLogic
Server instances PID):
Example Description
jinfo -help Displays the jinfo usage statement
The first example uses a single general command-line option, either -help or -
options. When a general option is used, no other options are valid. General options
are described in the following table:
Option Description
-help
-options Displays a list of options available with the jstat
Option Description
command. The description of these options is listed
in the next table.
Output options and other arguments are described in the following table:
Option Description
-class Displays class loader statistics
-compiler Displays JIT compiler statistics
Several of jstats command options produce displays with headings that can be
cryptic at first glance. Execute the following command to view the documentation for
jstat to see descriptions of the columns for each option:
$ firefox resources/jstat.html &
Find the examples of using jstat in the documentation and review them. The jstat
tool is very useful for analyzing Java heap and garbage collection statistics. The table
below shows more examples of using jstat:
Example Description
jstat -gcutil -h 10 19719 2000 Displays a list of garbage collection
statistics, including the size and
performance of each space in the heap.
Prints a header every 10 lines, and prints
a new row every 2000 ms.
jstat -gcutil -h 10 Displays the same statistics as the
c. Experiment with jstat to perform the following tasks. You can optionally run Grinder
to cause the numbers to have more meaning:
Display the jstat help message.
Display the list of jstat options.
Display garbage collection and heap statistics for the JVM running server1.
Display garbage collection and heap statistics for the JVM running server2 from the
host01 machine. Hint: Requires using jstatd, which may still be running from an
earlier step in this practice.
Include timestamp information in your output.
d. Experiment with these commands on your own for 5 minutes.
7. Use jstack to view and analyze JVM thread stack traces.
a. Read this note on jstack: The jstack tool is used to display stack traces of Java
threads for a Java process, core file, or a remote debug server. This is very useful for
obtaining runtime information about your WebLogic Server instances. Thread dumps
are displayed in the console window where the command is executed, rather than the
servers logs or console window. You should redirect the output of jstack to different
files for comparisons. This is because a thread dump is only a single snap shot in time
of the state of a server. Thread dumps have to be analyzed over a series of thread
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
dumps to track any trends in how threads are executing or having issues. From a
performance perspective, jstack provides only information pertaining to threads that
are stuck, long-running, locked, or busy. They do not provide performance numbers or
metrics to measure performance. It is up to you to analyze what the threads are doing
and to determine if they are stuck. And from an administrative perspective, you would
not be expected to understand the methods listed in stack traces because they are
written by developers. You would be focused mainly on trends of thread deadlocks or
overtly active threads. Our application is functioning well at this point, so you should
not detect any locked threads or performance issues at this point. When you are
working with stuck thread behavior in this course, you will have a chance to use
jstack again.
Option Description
-F Force a thread dump when jstack [-l] pid
does not respond.
-l Display a long listing that includes information about
locks, such as a list of owned
java.util.concurrent ownable subscribers.
-m Display a mixed mode listing of Java and native
C/C++ frames in the thread dump.
-h -help Display a help message.
Here are some examples of using jstack (for reference, 19719 refers to a WebLogic
Server instances PID):
Example Description
jstack -l 19719 Displays a thread dump of Java threads
running in the JVM running WebLogic
server1. Prints a detailed long listing.
jstack -m 19719 Displays a thread dump of Java threads
running in the JVM running WebLogic
server1. This prints native methods as
well as Java methods.
the JVM main class. You may naturally have a better feel for one or more tools than other tools
initially. The most commonly used tool is gcutil, because it supplies good details of the Java
heap space.
During this practice, you were asked what the difference was between using jps to get JVM
information remotely versus using operating system commands. The first thing that you should
have noticed is that you have to use SSH to execute commands on the other host. SSH is much
harder to set up than jstatd and the command to get information is easier. Of course if you
have access to the remote server you could just run the local jps command instead. The jps
command only requires that Java is installed on both machines, and that the jstatd process is
running.
The primary focus of this practice is to get you used to obtaining and analyzing JVM
Practice Solution
There is no solution for this practice. Other practices in this lesson depend on the experience
gained in this practice. Additionally, the experience gained in this practice can be applied in
subsequent lessons.
Overview
In this practice, you use Java VisualVM to monitor your running WebLogic Server instances
graphically. The following image depicts the architecture of the domain used for this practice.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment.
Practice 2-3 for configuring Grinder and establishing initial baseline performance
numbers of the Auction application in this environment.
The setUserOverrides.sh script in
/practices/tune/practice04-01/resources. You will need to copy this file
and use it again any time you run the setup.sh script for a practice.
Tasks
1. Connect to the host01 and host02 machines using VNC.
2. Set up the practice.
a. Perform the following commands on host01 to set up the environment for this practice.
If your servers are still running from the previous practice, then you should skip running
the setup.sh script.
$ cd /practices/tune/practice04-03
$ ./setup.sh
This script does the following:
Restores the domain to its original state. This includes removing the
setUserOverrides.sh script. If you need this script again in the future, copy it
from practice 4-1 to the domains bin folder again, open it in the gedit editor and
leave it open to save again whenever it is needed.
case, understanding which methods or threads are using the most memory or CPU is
also something that interests a developer more because they are the ones who have
to go back to the code and try to improve the results.
5. Use VisualVM to answer the following questions. You may run Grinder to load the
application for some of the questions.
a. What is the operating system architecture?
b. Is the server running in production mode?
c. Find the graphic charts for CPU, heap, and thread monitoring. What are the
characteristics of these metrics? You should see a gradual increase in memory,
followed by occasional declines as garbage collections occur. If the heap appears to be
too jagged, meaning that there are frequent memory spikes and drops, then memory
Here is an example of another chart showing the heap and garbage collection in a
shorter time period:
f. Alternatively, you can dock the tab in the main window so both tabs are visible at the
same time for side-by-side viewing as well.
g. Run Grinder and watch the monitoring tabs for each server to see how each behaves.
Alternatively, you can stop remotely monitoring server2 and start another instance of
VisualVM locally on host02 so you can see CPU metrics.
While the application is loaded by Grinder, you can see the CPU reacting to the
workload. The orange line represents the CPU utilization, while the blue line represents
the CPU utilized to perform garbage collection.
Practice Solution
There is no solution for this practice. Other practices in this lesson depend on the experience
gained in this practice. Additionally, the experience gained in this practice can be applied in
subsequent lessons.
Overview
This practice continues your journey into exploring some of the graphical tools available to you
for gaining visibility into your JVM processes that are running WebLogic Server. You will install
VisualGC as a plug-in into VisualVM, and use it to graphically visualize how garbage collection
is really taking place in the application. Next, you run jconsole and connect it to your running
WebLogic server instances to view some of the same metrics, but also to browse the live
MBean tree of your WebLogic server. Then you install and run GCHisto to view garbage
collection history of your running WebLogic Server. The following image depicts the architecture
of the domain and tools used for this practice.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment.
Practice 2-3 for configuring Grinder and establishing initial baseline performance
numbers of the Auction application in this environment.
Practice 4-3 for using VisualVM.
Tasks
1. Connect to the host01 and host02 machines using VNC.
2. Set up the practice.
a. Perform the following commands on host01 to set up the environment for this practice.
If your servers are still running from the previous practice, then you should skip running
the setup.sh script.
b. The Plugins dialog window appears. Click the Downloaded tab and click Add Plugins.
h. Now you should be able to visually see your Java heaps and how they are being used.
You can change the refresh rate, but it refreshes automatically at an acceptable rate.
command-line tools, this visual representation provides you with an instant and intuitive
way of knowing how garbage collection is working. You get more detailed information
from the command-line, but get fast results with a visual tool.
o. Close all VisualVM instances.
5. Use jconsole to monitor and analyze your JVMs running WebLogic Server.
a. Verify that your domain is running and that server1 is running with a heap size of
50 MB.
b. The jconsole tool is included with the JVM. It is located in the Java bin directory,
which is in your path. Execute the following command to start jconsole:
$ jconsole
space to see which space the graphics represent. You can click each space to change
the overall chart to display the graph for that space.
k. Browse to server1 (try each one to find the correct attributes) > AuctionImageServlet >
SimpleAuctionWebAppDb > ServletRuntime > server1_/SimpleAuctionWebAppDb >
Attributes. You should see a list of attributes for the MBean.
l. Run Grinder to load the application. Let it run for a few moments to generate some
data.
m. Click Refresh on the page in jconsole to update attribute data values. You should
see some real numbers in your display. If you keep refreshing the screen, you can see
the numbers change as the server tries to work through the load that is generated by
Grinder. This includes execution average time, total execution time, invocation count,
and more. This is one way to view WebLogic Server runtime statistics, but is still a lot
of effort to try to access information that should be more easily available. But still, it
does provide the information you need.
n. Double-click attributes to expand them into a graphical chart. You may need to run
Grinder again to see worthwhile results.
o. Experiment with jconsole on your own for 5 minutes.
Practice Solution
There is no solution for this practice. No practices depend on this practice.
Overview
The primary diagnostic tools that were part of the JRockit JVM implementation are now part of
the HotSpot JVM. The first of these tools is Mission Control. In this practice, you use Mission
Control to monitor and analyze your WebLogic servers. You can compare how this tool works
with the other tools you used in previous practices. The following image depicts the architecture
of the domain and tools used for this practice.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment.
Practice 2-3 for configuring Grinder and establishing initial baseline performance
numbers of the Auction application in this environment.
Java Development Kit version 1.7.0 update 40. Mission Control and Flight Recorder
features are not present before this release.
Tasks
1. Connect to the host01 and host02 machines by using VNC.
2. Set up the practice.
a. Perform the following commands on host01 to set up the environment for this practice.
If your servers are still running from the previous practice, then you should skip running
the setup.sh script.
Overview controls:
Dashboard controls:
Chart controls:
These controls allow you to view more specific data that is focused on
your monitoring requirements. JMS provides a button to easily allow you
to revert to the default settings.
MBeans Displays the MBean tree of the running server. Because you are
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
Tab Description
(MBean connected to a managed server, you can only view runtime data. The
Browser) default page displays the java.lang.OperatingSystem MBean,
which displays important performance metrics for the running JVM.
MBeans At the bottom of the MBeans screen, there are two tabs. The Triggers tab
(Triggers) enables you to configure threshold conditions for MBean metrics. You
Runtime This tab displays a memory chart, JVM memory statistics, and system
(Memory) memory statistics by default. You can customize what is shown on this
page. Included on this page is a listing of free and used swap memory.
Runtime This tab displays garbage collection statistics for the young and tenured
(Garbage generations. You can customize what is shown on this page. Metrics are
Collection) displayed in a table format. The display includes the number of GC
threads per space by default.
Runtime This tab displays each of the memory heap spaces, the associated usage
(Memory numbers, and graphical bars to show real time memory usage in the JVM
Pools) much like VisualGC. The format is slightly different, but the information is
similar.
Tab Description
Runtime This tab displays a live thread graph chart, live threads table with CPU,
(Threads) deadlock detection, and allocated bytes details per thread. It also displays
stack traces for selected threads. You can customize what is shown on
this page.
MBean Tasks
11. Create a chart from an MBean attribute.
a. Open java.lang > MemoryPool > Eden Space > Usage > used.
b. Right-click the value and select Visualize.
c. In the Create Chart dialog, click Add Chart.
Note: You can add attributes to existing charts from this interface.
d. Click OK.
e. Click on the General Page and review the chart you just created.
Runtime Tasks
You can run Grinder during your exploration of the Runtime tab to make your results more
interesting.
17. Explore each of the tabs encompassed by the Runtime button on your own for a few
minutes.
18. Enable CPU Profiling, Deadlock Detection, and Allocation in the Threads tab to see JMC
populate all the columns.
Finishing Up
19. Leave the environment running for the next practice.
The next practice uses Grinder and the same environment so it is best to leave it running.
Practice Solution
There is no solution for this practice. Other practices in this lesson depend on the experience
gained in this practice. Additionally, the experience gained in this practice can be applied in
subsequent lessons.
Overview
The primary diagnostic tools that were part of the JRockit JVM implementation are now part of
the HotSpot JVM. The next tools originating from JRockit that is now part of the HotSpot JVM is
the Java Flight Recorder (formerly known as the JRockit Flight Recorder). In this practice, you
use Java Flight Recorder (JFR) to monitor and analyze your WebLogic servers. You can
compare how this tool works with the other tools you used in previous practices. The image
below depicts the architecture of the domain and tools used for this practice.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment.
Practice 2-3 for configuring Grinder and establishing initial baseline performance
numbers of the Auction application in this environment.
Practice 4-5 for using Mission Control
Java Development Kit version 1.7.0 update 40. Mission Control and Flight Recorder
features are not present before this release.
Tasks
1. Connect to the host01 and host02 machines using VNC.
2. Set up the practice.
a. Perform the following commands on host01 to set up the environment for this practice.
If your servers are still running from the previous practice, then you should skip running
the setup.sh script.
Option Description
certain time interval.
Continuous recording Records JVM events continuously for the
duration of the JVMs lifecycle. You can
truncate data by setting either a maximum size
of the data file, or a maximum age for events
stored in the data file. This is useful for
constantly monitoring your JVM, and
preserving a certain time period of events
leading up to an issue.
b. You should see the following tab groups, or icons, along the left-hand side of the
screen. Follow along in your Flight Recorder with each topic. Take a few moments to
experiment with each topic and tab.
General
Sub Tab Description
Overview Provides general high-level information, such
as CPU and heap metrics
JVM Information Provides information about the JVM that was
recorded
Memory
Sub Tab Description
Overview Provides high-level memory usage, garbage
collection, and thread allocation statistics
Garbage Collection Provides a graphic and textual snapshot of
garbage collection activity for the JVM that
was recorded. Note that in the Heap graph
that GC pause times are superimposed with
heap use. The Heap and Garbage Collections
graphs also have several tabs you can view.
GC Times Provides high-level statistics about garbage
collections that occurred in the JVM that was
recorded. You can use the values here to see
the longest GC pauses and in which spaces
they occurred.
GC Configuration Provides data for how the heap and
generations are configured and sized.
Allocations Provides information about objects that were
allocated within the JVM, both in thread local
allocation bytes (TLAB) and outside thread
local space. You can use this to see how large
and frequent allocations are in the JVM over
time.
Object Statistics Provides details about objects that are
allocated in the heap during the selected time
period, the top growing objects, and the
percentage of heap they use
The Code tab group is more for developers that want to see how well their code is
optimized and working within the server JVM.
Code (More for Developers)
Sub Tab Description
Overview Provides high-level information about which
packages and classes are spending the most
time executing in the JVM
Hot Methods Provides information about which methods are
spending the most time executing in the JVM,
and where they were called in the stack.
Threads
Sub Tab Description
Overview Provides a high-level view of how CPU and
threads are used by the JVM and the system.
Hot Threads Provides a list of threads that spend the most
time executing. You can review the stack trace
for the thread to get more details about what it
was executing at the time.
Threads
Sub Tab Description
Contention Provides information about threads that
compete for a synchronization lock, blocked
threads, and details about each thread.
Latencies Provides information about when threads are
not executing code. You can see how much
time your threads are waiting, blocked, or
sleeping. Note that if there is no load on the
application that a lot of threads waiting is not
I/O
Sub Tab Description
Overview Provides information on file and socket reads
and writes. You can use this information to
see how I/O intensive your JVM is, and where
I/O occurs the most.
File Read Provides information on file reads that
occurred during the selected recording time
period. You can view file reads by thread, by
event, over time, and related stack traces.
File Write Provides information on file writes that
occurred during the selected recording time
period. You can view file writes by thread, by
event, over time, and related stack traces.
Socket Read Provides information on socket reads that
occurred during the selected recording time
period. You can view socket reads by thread,
by event, over time, and related stack traces.
Socket Write Provides information on socket writes that
occurred during the selected recording time
period. You can view socket writes by thread,
by event, over time, and related stack traces.
System
Sub Tab Description
Overview Provides information about the hardware
where the JVM is running
Processes Provides information for all processes in the
system
Environment Variables Provides a list of the environment variables
that were set when the JVM was started. This
Notice that when you click the Events icon that the left-hand pane displays a tree
of event types that you can include in the view of charts on the right-hand pane.
Experiment with each of the settings on the left and see how they change the view on
the right. At this point, you will not see any data associated with WebLogic Server
because that data is captured either through WebLogic Diagnostic Framework (WLDF)
notifications or opening a Flight Recorder recording contained in a WebLogic
diagnostic image.
Events
Sub Tab Description
Overview Provides a detailed breakdown of event data
for a particular time period. You can select a
period of time to analyze, see the producers of
the events, and view details of the different
event types.
Log Provides details for events. You can sort by
column data, Duration for example, to see
which events took the longest to execute.
Graph Provides activity graphically by which thread
performed the work.
Threads Provides performance metrics on a per thread
basis.
Stack Traces Provides stack traces for threads.
Histogram Provides tools for analyzing events grouped
by a certain property, which can also be used
with an operative set of events with matching
properties.
c. Now that you have followed along in Mission Control to explore these topics in this
practice, take a few minutes to explore parts of the interface that interest you before
going to the next step.
administrators (if this is not also you) can investigate those queries and tables to see
where a problem may exist. Perhaps a table wasnt indexed properly? This is one way
to identify the issue and the cause faster.
q. Take a few minutes and experiment with the settings on this page and the other tabs.
9. Experiment with Flight Recorder commands.
a. Review the commands in the following table and use them for the following step.
Command Description
jcmd pid JFR.start [options] Start a Flight Recorder recording from the
command line
Practice Solution
There is no solution for this practice. Although no other practices depend on this lesson, the
experience gained can be applied in subsequent lessons.
Practices Overview
In these practices, you configure the WebLogic Server to handle stuck threads. You then deploy
an application that creates stuck threads, and observe the affected managed server reboot after
the stuck threads thresholds you configured are exceeded.
You also configure WebLogic to react when it transitions to the OVERLOADED state. You
deploy an application that exhausts the servers memory, and observe how WebLogic Server
functions when a managed server is overloaded.
Finally, you configure logging and log filtering, adopting a strategy that allows for accurate
Overview
In this practice, you configure WebLogic Server to manage when it encounters stuck threads.
You set the maximum number of threads after which the server is transitioned into the FAILED
state, and the number of seconds a thread must be continuously working before the server
considers it a stuck thread. Additionally, you configure WebLogic to force an immediate
shutdown of the server after its state has been transitioned to a FAILED state.
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice05-01
$ ./setup.sh
This script does the following:
Restores the domain to its original state
Starts Node Manager on each host
Starts the domain using Node Manager
3. Wait for all servers to log that they are in the RUNNING state before continuing.
4. Configure stuck thread handling on server2.
Note: You are modifying the behavior that the WebLogic server will adopt when stuck
threads are detected. You want WebLogic to automatically shut down the server when a
certain threshold of stuck threads is exceeded. By default, the WebLogic server does not
perform any action.
a. Log in to the WebLogic administration console.
b. Navigate to Environment > Servers to display the servers configured for this domain.
c. Click server2.
d. Click the Configuration > Overload tabs to display the configuration settings related to
the WebLogic server behavior under stress.
e. Click Lock & Edit.
f. Set Failure Action to Force Immediate Shutdown of this server. This tells WebLogic to
automatically force this server to shut down when the server enters into a failed state.
g. Set Max Stuck Thread Time to a low value of 6 (seconds). You deploy an application in
the next practice that artificially causes stuck threads and this enables you to observe
the behavior of WebLogic without waiting for too long.
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
h. Set Stuck Thread Count to a low value of 4 (threads). In the next practice, you use the
application that causes stuck threads; initially you spawn three stuck threads to
observe the behavior of WebLogic before the thread threshold is exceeded.
Subsequently, you will instruct the application to spawn five stuck threads, causing
server2 to enter into a failed state.
d. Increase Restart Delay Seconds from 0 to 2. You want to give both WebLogic and
Linux a chance to clean memory and resources (like TCP/IP connections) after the
server has been abruptly shut down after reaching its stuck thread threshold.
e. Ensure Auto Restart is selected so Node Manager will automatically restart this server.
f. Save and activate your changes to realize your configuration.
6. Restart server2 for changes to take effect.
a. Navigate to Environment > Servers > Control.
d. Click the icon to cause a continuous refresh of the Summary of Servers page. After
a few seconds, the state for server2 changes to SHUTDOWN.
e. Select server2 again and click Start to instruct WebLogic to request the Node Manager
running on host02 to start server2.
f. Confirm Yes.
g. Wait for the state of server2 to change to RUNNING.
h. This practice configures the server for stuck thread handling. The next practice builds
on this practice to cause a stuck thread condition to occur. Leave the WebLogic
administration console and domain running as it is used in practice 5-2.
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. The subsequent practices of this lesson depend on this practice.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder.
3. Execute the solution script for this practice:
$ ./solution.sh
This script performs the following:
Overview
In this practice, you deploy the StuckThreads application to server2. StuckThreads provides a
very simple input page where you specify how many stuck threads you want to create and for
how long those threads should run. In practice 5-1, you set the stuck thread count threshold to
four. Initially, you will create three long-running stuck threads and you will assess the behavior
shown by WebLogic server when stuck threads are detected. Subsequently, you will ask
StuckThreads to spawn five stuck threads, thus exceeding the stuck thread count threshold and
the failure of server2. After the server has failed, WebLogic will automatically shut down server2
and the Node Manager will restart it.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment
Practice 5-1 for starting and configuring the domain used for this practice
Tasks
1. Deploy the StuckThreads application.
a. Perform the following commands to navigate to the practice folder and deploy the
StuckThreads application:
$ cd /practices/tune/practice05-02
$ ./deploy.sh
b. Within the WebLogic administration console, navigate to Deployments and verify that
the application is deployed properly and is ready to service requests.
2. Run the StuckThreads application.
a. Click the StuckThreads link to open its configuration page.
b. Click the Testing tab.
c. Click the link displayed in the Test Point column that links to the index.jsp page
hosted on host02.
e. You are instructing the StuckThreads application to spawn three threads, which will run
uninterrupted for five minutes, which is enough time to assess the behavior of the
WebLogic server under that level of stress. Click submit and then click the Firefox tab
corresponding to the WebLogic administration console.
f. Click the Servers link to display the servers running in the domain.
i. Find the System Status pane in the administration console. Does it indicate that there
could be a problem?
j. You should see that WebLogic has changed the state for server2 to Critical. Click the
Critical (1) link in the System Status pane to display the Health Information window,
which shows three stuck threads detected running in server2.
b. Write down the activation time for server2. You compare this value with its value after
forcing a restart to verify that Node Manager has in fact restarted the server.
j. The System Status panel shows one server in critical condition. Click the Critical(1) link
to display the Health Information window, which shows that server2 is not reachable.
This condition is only visible for a few seconds, the time required to restart the server
plus the idle time you set up previously to allow for memory and network cleanup (two
seconds).
Practice Solution
There is no solution for this practice.
Overview
In this practice, you configure the memory parameters accessed by WebLogic when a server
becomes overloaded. You then use an ad-hoc application, SaturateMemory, to induce memory
exhaustion on one server, and monitor the behavior of the WebLogic server when overload
protection is configured.
Tasks
1. Configure server2 memory overload protection.
a. Within the WebLogic administration console, navigate to Environment > Servers >
server2 > Configuration > Overload to display the overload protection settings for
server2.
b. Click Lock & Edit.
c. Change the Failure Action value to Ignore, take no action.
f. Reset the Stuck Thread parameters to their defaults as shown in the following table:
Field Value
Stuck Thread Count 0
Max Stuck Thread Time 600
e. Click Submit and the application spawns three threads, each allocating a large chunk
of memory. If the amount of memory available in the JVM running server2 is already
sufficiently low and garbage collection does not free up a lot of memory, calling the
SaturateMemory application once is enough to cause an OVERLOADED state for
server2.
f. Sometimes, calling the SaturateMemory application once is not enough to trigger an
OVERLOADED condition. This could happen because after the initial memory allocation
requested by SaturateMemory, garbage collection is performed by the JVM and more
than 10 percent of memory becomes available. In this case, you must click the link
Re-launch SaturateMemory page at the bottom of the page and request another batch
of threads to allocate more memory. Usually, running SaturateMemory twice is
5. Click the Overloaded link in the System Status pane to drill down on the server affected by
low memory.
a. The domain Monitoring > Health page is shown, and server2 is displayed as a link.
c. Click the plus (+) sign on the left of server2 again to drill down on server2 components
to get more details about where the problem lies.
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. No subsequent practices of this lesson depend on this practice.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder
(/practices/tune/practice05-03).
3. Execute the solution script for this practice:
$ ./solution.sh
Overview
In this practice, you initially change the default log level to obtain more debugging information.
Subsequently, you define log filters to improve the accuracy of logging, avoiding unnecessary
log verbosity for WebLogic subsystems that you are not interested in tracing.
Dependencies
Tasks
1. Configure server2 logging levels.
a. In the WebLogic administration console, navigate to Environment > Servers > server2
> Logging > General to display the overload protection settings for server2.
b. Click Lock & Edit.
c. Scroll to the bottom of the window and click the Advanced link to open advanced
configuration options.
d. Set Minimum severity to log to Trace.
e. Set Severity Level for the Log file to Trace.
f. Set Severity Level for standard out to Debug.
g. Set stdout Stack Trace Depth to -1. This forces all stacktrace frames to be displayed.
h. Save your changes. Do not activate yet.
2. Configure WebLogic debugging for server2, which can potentially cause verbose logging.
a. Click the Debug tab.
b. Expand the weblogic node to display a list of all its debug categories.
c. Expand the transaction node to display its debug categories.
d. Expand the jdbc node, and then select DebugJTAJDBC.
Practice Solution
There is no solution for this practice.
Practices Overview
In the practices for this lesson, you experiment with features that affect performance when using
WebLogic clusters. First, you review the domains default unicast cluster configuration. Next,
you configure the domain to use multicast cluster communication. You monitor both types of
cluster communication by using the WebLogic administration console. Then you configure and
compare the performance of different session persistence types.
Overview
This practice shows you how to use the WebLogic administration console to view unicast and
multicast performance metrics, and how to configure both protocols. The following image
depicts the architecture of the domain used for this practice.
Unicast cluster messaging: Unicast cluster messaging uses the TCP/IP networking protocol
to send heartbeat and JNDI state messages to all server members of a cluster. WebLogic
clustering breaks a cluster up into groups of 10 servers, with each group getting assigned a
group leader. The group leader is responsible for receiving messages from its group members,
and relaying them on to the other group members, as well as other group leaders in the cluster.
Multicast cluster messaging: Multicast cluster messaging uses the UDP networking protocol
to send heartbeat and JNDI state messages to all server members of a cluster. All WebLogic
server cluster members send UDP network traffic over a common address and port that all
servers listen to for cluster messages. UDP is a simple networking protocol that does not
provide any guarantee of message delivery, ordering, or duplicate prevention. WebLogic is
responsible for using multicast in a way that makes its use reliable. UDP messages are light and
fast on the network.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice06-01
$ ./setup.sh
you could watch the metrics in real time to see how much traffic each server is
handling for cluster messaging.
d. Customize the table to view more metrics. Click the Customize this table link and add
the following columns to the display:
Column Description
Fragments Received The total number of messages received from
the cluster
Fragments Sent The total number of messages sent to the
cluster
example, if CPU utilization is pinned to 100%, it is very possible that the kernel calls
to execute networking instructions are not even getting scheduled to execute in the
first place. This is a CPU performance problem, not necessarily a cluster messaging
problem.
9. Shut down the environment.
a. When you are done with this practice, execute the following command to shut the
environment down and return the domain to its original state.
$ cleanup.sh
b. If any dialog boxes appear asking if you want to close a terminal window, click OK to
close the window.
c. You should notice that the AdminServer and all managed server terminal windows and
Practice Solution
There is no solution for this practice. No practices depend on this practice.
Overview
This practice has you experiment with configuring different HTTP session persistent
mechanisms in WebLogic for a shopping cart application, and monitoring the performance
results for comparison. First, you load the application using in-memory session replication to
persist sessions. Next, you load the application using file-based session persistence. Then you
run JDBC session persistence. You record and compare the performance results of each to
evaluate how well each performs. The following images depict the architecture of the domain
used for this practice.
In-memory session persistence: Session state is replicated in memory between duplicate
File-based session persistence: Session state is persisted in a file store that is configured on
a shared file system that is accessible to server1 and server2.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice06-02
$ ./setup.sh
This script does the following:
Restores the domain to its original state
Starts the wlsadmin AdminServer
Deploys the ShoppingCart application to the cluster with in-memory session
replication configured
7. Experiment with the three session persistence configurations and Grinder on your own for
15 minutes. Use monitoring tools to view CPU, network I/O, and disk I/O during your tests.
Based on your results, try to answer the following questions. Use the following table as
reference for some different ways you can monitor system resources:
Command / Tool Description
top CPU and memory usage
sar -P ALL 1
sar -b 1 Monitor network I/O
sar -n DEV
Practice Solution
There is no solution for this practice. No practices depend on this practice.
Practices Overview
A web application (SimpleAuctionDbSLSB_EAR), by design performs a lot of database
interaction, seems to be running slow. WebLogic Server creates connections as and when
required. Every JDBC query that is executed is compiled and then executed.
Whenever a new connection is needed, WebLogic Server creates a new connection by
accessing the database. In production environments, this can be avoided by creating all these
connections during server start-up. Furthermore, JDBC queries can be cached to save precious
compile time. In addition, Pinned-To-Thread is an option that can improve performance by
enabling execute threads to keep a pooled database connection even after the application
During the course of these practices (7-1 to 7-3), you will use The Grinder to stress test the
SimpleAuctionDbSLSB_EAR application, modifying JDBC parameters between each test,
and you will record the result of each test in the following table:
The following diagram shows the stress test architecture based on The Grinder:
Overview
In this practice, you run The Grinder to exercise the SimpleAuctionDbSLSB_EAR application.
The first run shows the impact of setting the JDBC parameters as follows:
Parameter Setting
Initial Capacity 5
Maximum Capacity 10
Minimum Capacity 5
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands in a terminal window on host01 to set up the
environment for this practice:
$ cd /practices/tune/practice07-01
$ ./setup.sh
This script does the following:
Restores the domain to its original state
Starts the wlsadmin AdminServer
Deploys the SimpleAuctionDbSLSB_EAR application to the cluster
Starts the server1 managed server on host01
Starts the server2 managed server on host02
b. Wait for all servers to log that they are in the RUNNING state before continuing.
3. Verify that the Oracle RDBMS is running. Select the VNC host02 window. Open one
terminal window; in the bash shell, make sure the database is running by verifying that the
pmon process for orcl is running:
$ ps ef | grep pmon
oracle 21491 1 0 Oct13 ? 00:01:10 ora_pmon_orcl
oracle 22816 14868 0 02:27 pts/2 00:00:00 grep pmon
a. Make sure the Oracle listener is running:
$ lsnrctl status
b. If the pmon_orcl process is not running on host02 or if the listener is not running, run
the startDB1.sh script:
$ startDB1.sh
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 19-OCT-2013 03:05:18
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /u01/app/db11g/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is
/u01/app/db11g/product/11.2.0/dbhome_1/network/admin/listener.ora
Many lines omitted for brevity
Basically, this setting instructs the Grinder to skip sampling the initial ramp-up time. In
the terminal window where you launched the Grinder console, execute the prompt.sh
command to open a new terminal window. When the new window appears, set its title
to Grinder Agent.
c. Start the Grinder Agent:
$ java net.grinder.Grinder
2013-10-19 18:18:31,725 INFO agent: The Grinder 3.11
2013-10-19 18:18:31,834 INFO agent: connected to console at localhost/127.0.0.1:6372
2013-10-19 18:18:31,834 INFO agent: waiting for console signal
d. In the Grinder Console window, click the Start the worker processes icon to run the
test.
Your results will differ from the example above. Write down the significant statistics and
copy them into the table at the beginning of this practice (Practices Overview).
i. After you have copied the significant statistics to the table in the Practices Overview
section of this document, you must reset the worker processes. Click the Reset the
worker processes icon in the Grinder Console.
7. Modify the JDBC connection pool parameters before launching another Grinder run.
a. In the WebLogic administration console, select Services > Data sources >
jdbc/AuctionDB to display settings for the data source.
b. Click the Connection Pool tab. Scroll down until the parameters Initial Capacity,
Maximum Capacity, and Minimum Capacity are visible. Change their value to 15:
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. Practice 7-2 depends on this practice because it expects the connection pool
parameters Initial Capacity, Maximum Capacity, and Minimum Capacity to be set to 15.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder.
3. Execute the solution script for this practice:
$ ./solution.sh
Overview
In this practice, you increase the Statement Cache Size for JDBC connection pools in WebLogic
Server and you assess the impact of this modification using the Grinder.
Dependencies
Practice 7-1 has been completed. The WebLogic domain is running, the Admin Server and the
two managed servers are in a healthy state, the OHS is running and configured as a load
balancer, and the Grinder Console and the Grinder Agent are running.
b. Select the Grinder Console window. Click the Start the worker processes icon to run a
new test.
c. Monitor the Grinder Agent window until the message, agent: finished, waiting for
console signal appears, meaning that the run has completed.
d. Click the Stop collecting statistics icon to stop the collection of statistics.
e. In the Grinder Console, click the Results tab, scroll down to the bottom of the window,
and write down the totals for the last run. Copy those numbers in the table in the
Practices Overview section of this document.
f. After you have copied the significant statistics to the table in the Practices Overview
section of this document, you must reset the worker processes. Click the Reset the
worker processes icon in the Grinder Console.
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. Practice 7-3 depends on this practice because it expects the connection pool
parameters Initial Capacity, Maximum Capacity, and Minimum Capacity to be set to 15 and
Statement Cache Size also to be set to 15.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder.
3. Execute the solution script for this practice:
Overview
In this practice, you enable the Pinned-To-Thread feature and run the Grinder twice. In the first
run, you enable a Statement Cache Size of 10 statements. In the second run, you increase the
Statement Cache Size to 35 and assess the impact of such a change.
Dependencies
Practices 7-1 and 7-2 have been completed. The WebLogic domain is running, the Admin
Server and the two managed servers are in a healthy state, OHS is running and configured as a
load balancer. The ORCL Oracle database instance is started and running and the listener is
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice07-03
$ ./setup.sh
This script does the following:
Restores the domain to its original state
Starts the wlsadmin AdminServer
Deploys the SimpleAuctionDbSLSB_EAR application to the cluster
Starts the server1 managed server on host01
Starts the server2 managed server on host02
b. Wait for all servers to log that they are in the RUNNING state before continuing.
2. Configure Pinned-to-Thread.
a. Within the WebLogic administration console, navigate to Environment > Servers and
verify that all servers are in the RUNNING state.
b. Verify that the SimpleAuctionDbSLSB_EAR application is deployed and active.
c. Select Services > Data Sources > jdbc/AuctionDB > Connection Pool to display
settings for the data source connection pool.
d. Scroll down until the Statement Cache Size parameter becomes visible. Change its
value to 10 and save your changes.
e. Scroll back to the bottom of the Settings for jdbc/AuctionDB window and click the
Advanced link.
f. Select the Pinned-To-Thread check box.
3. You must restart the two managed servers to realize your configuration changes.
a. Within the WebLogic administration console, select Environment > Servers > Control to
display the controls for managing servers in the domain.
b. Select the check boxes for server1 and server2
c. Click Shutdown and select Force Shutdown Now.
d. Wait for the servers to shut down.
b. Select the Grinder Console window. Click the Start the worker processes icon to run a
new test.
c. Monitor the Grinder Agent window until the agent: finished, waiting for console signal
message appears, meaning that the run has completed.
d. Click the Stop collecting statistics icon to stop the collection of statistics.
e. In the Grinder Console, click the Results tab, scroll down to the bottom of the window,
and write down the totals for the last run. Copy those numbers to the table in the
Practices Overview section of this document.
f. After you have copied the significant statistics to the table in the Practices Overview
section of this document, you must reset the worker processes. Click the Reset the
worker processes icon in the Grinder Console.
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. No practices depend on this practice.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder.
3. Execute the solution script for this practice:
$ ./solution.sh
This script performs the following:
Overview
In this practice, you deploy an application, which allows you to compare the timings of a
sequence of single insert statements against the timings of batch insertions/updates. The
alternative is between accepting the JDBC connection default, which is auto-commit enabled,
and disabling the auto-commit feature, sending a bunch of statements to the database engine
and commit only once, at the end.
This course is aimed primarily at WebLogic Server administrators, rather than developers.
However, the performance gains that can be achieved through this technique are such that the
administrator should be aware of it. Proactive WebLogic administrators should make sure that
Assumptions
The WebLogic domain wlsadmin domain is running, the Admin Server and the two managed
servers are in a healthy state. The ORCL Oracle database instance is started and running and
the listener is accepting connections.
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice07-04
$ ./setup.sh
This script does the following:
Restores the domain to its original state
Starts the wlsadmin AdminServer
Starts the server1 managed server on host01
Starts the server2 managed server on host02
b. Wait for all servers to log that they are in the RUNNING state before continuing.
3. For this practice, you create a new connection pool.
a. Within the WebLogic administration console, select Services > Data Sources to display
the configuration page for data sources.
b. Click New and select Generic Data Source.
c. Enter jdbc/BatchUpd in both the Name and JNDI Name fields.
d. Accept Oracle as the database type, and click Next.
e. Select Oracle's Driver (Thin) for Application Continuity; Versions: 11.2.0.3 and later,
and click Next.
f. In the Create a New JDBC Data Source window, deselect Supports Global
Transactions, accept the other default values, and click Next.
k. Active changes. The Administration Console signals that all changes have been
activated and no restart is necessary.
4. Deploy and rename the TestBatchUpdates application.
a. Use the WebLogic administration console to deploy the
/practices/tune/practice07-04/TestBatchUpdates.war application to
server1 and server2. Change the deployment name to BatchUpdates. By default, the
suggested name is TestBatchUpdates.
c. Select the second tab that appears in Firefox, named Testing Batch Updates.
d. The Batch Update Application welcome page is displayed. The page shows two code
snippets that illustrate the different techniques used to submit a high number of insert
statements to the database engine. You can choose the number of insert statements
and the method used to submit them (either Batch Update or Single Update). Try the
Single Update option first.
f. This time, select the Batch Update radio button and click submit.
g. The Batch Update statistics should show a definite advantage in using batch updates
over a sequence of single updates.
h. Feel free to repeat the test several times, varying the number of statements to be
submitted between tests. (Do not exceed 3000 statements to avoid running out of
resources.)
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. No practices depend on this practice.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder.
3. Execute the solution script for this practice:
$ ./solution.sh
This script performs the following:
Overview
In this practice, you configure some basic Oracle RDBMS parameters, which are usually the
source of problems when a WebLogic server is accessed by a high number of users. Tuning an
Oracle RDBMS requires talent and experience, and is definitely outside the scope of this
course. However, the hints suggested here can be used as the first step when Oracle DBAs are
not readily available.
Tasks
1. Select the VNC host02 window.
c. Use sqlplus to connect to the Oracle RDBMS as sysdba and verify that the
processes and open_cursors parameters have the new values:
/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Oct 13 02:31:34
2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 -
64bit Production
NAME VALUE
-------------------- ------------------------
processes 300
open_cursors 600
Practice Solution
There is no solution for this practice.
Practices Overview
In the practices for this lesson, you experiment with work managers and how they affect
performance. First, you create and configure work managers for two instances of the Auction
application and run some load tests to see how the applications perform. Next, you deploy the
stuck threads application and experiment with configuring work manager thread constraints.
Then you configure WebLogic to gracefully manage stuck threading scenarios with work
managers.
Overview
Each WebLogic Server instance uses a self-tuning thread pool to process all requests, and all
types of requests have the same level of service by default. Work managers enable
administrators to prioritize different services, applications, and application components by using
request classes and constraints.
The following diagram shows the environment that you will use to experiment with the work
manager feature. You will deploy multiple versions of the Auction application and stress test
both concurrently using the Grinder. You run Grinder tests before and after configuring work
managers.
Dependencies
This practice depends on:
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice08-01
$ ./setup.sh
This script does the following:
Restores the domain to its original state
Starts the wlsadmin AdminServer
Deploys the applications to the cluster
Starts server1 and server2
b. Wait for all servers to log that they are in the RUNNING state before continuing.
3. Verify that all servers started.
a. Log in to the WebLogic administration console.
b. Navigate to Environment > Servers and verify that all servers are in the RUNNING
state.
4. Verify that the two versions of the SimpleAuction application are deployed.
SimpleAuctionWebAppDb2
f. Keep these metrics available for comparison after running the work manager tests.
Also, be sure to keep the terminal windows open to run Grinder again.
7. Create global work managers.
Use the WebLogic administration console to create two work managers. Use the following
table to configure each with the proper settings. Work manager configuration is located in
the console at Environment > Work Managers. Edit each work manager and configure new
request classes for each.
Work Manager Target Request Fair Share
Name Class
HighPriorityWM cluster1 FairShare90 90
LowPriorityWM cluster1 FairShare10 10
8. Redeploy both Auction applications by using a deployment plan to assign a work
manager to each application.
a. Locate the deployment plan files at
/practices/tune/practice08-01/resources. Confirm that each refers to one
of your work managers. For example:
<variable>
<name>SimpleAuctionWeb_DispatchPolicy</name>
<value>HighPriorityWM</value>
</variable>
b. Perform the following commands to redeploy the applications by using the supplied
deployment plans:
$ cd /practices/tune/practice08-01
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
$ ./redeploy.sh
c. Test that each application has deployed successfully using a browser.
Note: This drives some traffic that causes each work manager to do some processing.
http://host01:7777/SimpleAuctionWebAppDb1
http://host01:7777/SimpleAuctionWebAppDb2
d. Return to the console.
e. In the Domain Structure panel, select Deployments.
f. Click the Monitoring > Workload tab.
g. Locate the Work Managers table. Use the Completed Requests column to confirm that
each application is linked to the correct work manager.
b. While the client agents are running, return to the console and refresh the page to view
the work load. You should see that HighPriorityWM is getting a larger share of the
workload and LowPriorityWM is getting a lower share of the workload. Due to the
performance of the machine, this may not be totally accurate. The idea is for you to
learn how to tune work managers, even if the numbers do not support the features
exactly.
application was sent the same number of requests. However, while they are
processing WebLogic ensures that the high priority request class processes faster.
e. Open the Grinder log files and find the total test results. Write the results in a table
similar to the following:
After Work Manager Configuration:
Metric Mean Test Mean TPS Successful Errors
Time (ms) Tests
SimpleAuctionWebAppDb1
SimpleAuctionWebAppDb2
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. No practices depend on this practice.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder.
3. Execute the solution script for this practice:
$ ./solution.sh
This script performs the following:
Overview
This practice shows you how to configure and monitor work manager thread constraints. You
configure one work manager to use a minimum threads constraint of 10, which causes
WebLogic to guarantee that 10 threads are executing simultaneously for configured
applications. You also configure one work manager to use a maximum threads constraint of 5,
which causes WebLogic to throttle the number of simultaneously executing threads to a
maximum of 5. This shows you two of the possible ways to control how WebLogic dispatches
requests to your applications. The following image depicts the architecture of the domain used
for this practice.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment
Tasks
1. Connect to the host01 and host02 machines.
be executing no more than 5 requests. After the Grinder agents stop loading the
application, these metrics will be set to 0, so you have to view the metrics while the
application is loaded by Grinder.
12. Shut down the environment.
a. When you are done with this practice, execute the following command to shut the
environment down.
$ cleanup.sh
b. If any dialog boxes appear asking if you want to close a terminal window, click OK to
close the window.
c. You should notice that the AdminServer, server1, and server2 terminal windows and
the servers that were running in them are all shut down now. If any terminal windows
The public URL for this blog in case you want to view it after class is:
https://blogs.oracle.com/WebLogicServer/entry/threads_constraints_in_work_ma
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. No practices depend on this practice.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder.
3. Execute the solution script for this practice:
$ ./solution.sh
This script performs the following:
Practices Overview
In these practices, you experiment with JSP and EJB settings, which can have a significant
impact on performance. Initially, you deploy the SimpleAuctionWebAppDb application without
precompiling its JSP pages and you submit a Grinder run; subsequently, you re-deploy the
same application, this time pre-compiling the JSP pages, and you compare the response time of
the two runs.
Similarly, in practice 9-2, you deploy the SimpleAuctionDbSLSB_EAR application, which
initially runs with the initial-beans-in-free-pool parameter set to 2 and the max-
Overview
In this practice, you use The Grinder twice, initially to stress test the
SimpleAuctionWebAppDb application, which has been deployed with no precompiled JSP
pages. Subsequently, you run The Grinder again, after having re-deployed the application with
all JSP pages precompiled. You populate the following table at each run, and you compare the
results at the end of the practice.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice09-01
$ ./setup.sh
This script does the following:
Restores the domain to its original state
Starts the wlsadmin AdminServer
Deploys the SimpleAuctionWebAppDb application to the cluster
Starts server1 and server2
b. Wait for all servers to log that they are in the RUNNING state before continuing.
3. Select the VNC host02 window.
a. Open one terminal window by clicking the Terminal icon.
b. In the bash shell, make sure that the database is running by verifying that the pmon
process for orcl is running:
/home/oracle> ps ef | grep pmon
oracle 21491 1 0 Oct13 ? 00:01:10 ora_pmon_orcl
oracle 22816 14868 0 02:27 pts/2 00:00:00 grep pmon
c. Make sure that the Oracle listener is running. Enter the lsnrctl command "status:"
/home/oracle> lsnrctl status
d. If the pmon_orcl process is not running on host02 or if the listener is not running,
run the start db script:
/home/oracle>startDB1.sh
e. Select the VNC host01 window and make sure that OHS is running:
/home/oracle> cd /u01/app/fmw2/instances/webtier_1/bin
/u01/app/fmw2/instances/webtier_1/bin>./opmnctl status
Processes in Instance: webtier_1
b. When The Grinder console starts, in the "Ignore 0 samples" field in the console,
set the value to 10 to give WebLogic time to tune its own performance based on the
simulated load. Basically, this setting instructs The Grinder to skip sampling the initial
ramp-up time.
c. In the Terminal window, where you launched The Grinder console, enter the
"prompt.sh" command to open an additional Terminal window. When the new
window appears, click the "Terminal"->"Set Title" menu option to name the
window caption "Grinder Agent".
d. Start The Grinder Agent:
/practices/tune/practice09-01> java net.grinder.Grinder
e. In the Grinder Console window, click the "Start the worker processes" icon to
run the test. The Grinder responds with an alert window, stating that the worker
processes will run taking their parameters from the "grinder.properties" file. Click
"OK" to proceed.
f. The Grinder run starts, you can assess the Grinder feedback in the Grinder Console
window:
5. You should monitor the Grinder Agent window every now and then. When the run finishes,
you get the following message, which appears at the bottom of the Grinder Agent window:
2013-10-19 18:41:19,931 INFO host01.example.com-0: finished
2013-10-19 18:41:21,292 INFO host01.example.com-1: finished
2013-10-19 18:41:21,665 INFO agent: finished, waiting for console signal
a. Select The Grinder Console window and click the "Stop collecting statistics"
icon to stop the collection of statistics.
b. On the right side of the Grinder Console window, click the Results tab.
c. Scroll to the bottom of the "Results" tab.
(Your results will no doubt differ from the preceding example.) Write down the significant
statistics and copy them into the table at the beginning of this practice (Practice 9-1
Overview).
d. After you have copied the significant statistics to the table in the "Practice 9-1
Overview" section of this practice, you must reset the worker processes. Click the
Reset the worker processes" icon in the Grinder Console.
The agent console should report that a reset message was received, and that the agent is
ready to receive commands from The Grinder console.
b. Select "The Grinder Console" window. Click the "Start the worker processes" icon to
run a new test.
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. No practices depend on this practice.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder
(/practices/tune/practice09-01).
3. Execute the solution script for this practice:
$ ./solution.sh
Overview
In this practice, you run The Grinder stress testing the SimpleAuctionDbSLSB_EAR
application initially configured to have its EJBs set up with minimal pools. You then redeploy the
same application, this time increasing the pool size for stateless EJBs and you run The Grinder
again, to see if the parameter change made a difference in the performance observed across
the two runs.
Dependencies
This practice depends on:
Practice 2-1 for setting up the course environment
Tasks
1. Connect to the host01 and host02 machines.
2. Set up the practice environment.
a. Perform the following commands on host01 to set up the environment for this practice:
$ cd /practices/tune/practice09-02
$ ./setup.sh
This script does the following:
Restores the domain to its original state
Starts the wlsadmin AdminServer
Deploys the SimpleAuctionDbSLSB_EAR application to the cluster
Starts server1 and server2
b. Wait for all servers to log that they are in the RUNNING state before continuing.
3. Verify that all servers started.
a. Log in to the WebLogic administration console.
b. Navigate to Environment > Servers and verify that all servers are in the RUNNING
state.
c. Navigate to Deployments. Make sure that the SimpleAuctionDbSLSB_EAR
application is deployed, active, and with a health state of "OK."
Copyright 2014, Oracle and/or its affiliates. All rights reserved.
d. Perform the run and at the end, write down the statistics accumulated during the run.
6. Re-run The Grinder using this configuration. At the end of the run, write down the
accumulated statistics and compare them with the previous The Grinder run.
Practice Solution
Perform the following tasks if you did not complete this practice and want to use the finished
solution. No practices depend on this practice.
Solution Tasks
1. Open a new terminal window on host01.
2. Change the current directory to the current practice folder
(/practices/tune/practice09-02).
3. Execute the solution script for this practice:
$ ./solution.sh