mirror of https://github.com/apache/jmeter.git
465 lines
16 KiB
HTML
465 lines
16 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
this work for additional information regarding copyright ownership.
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
(the "License"); you may not use this file except in compliance with
|
|
the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
|
|
<!-- Content Stylesheet for Site -->
|
|
|
|
|
|
<!-- start the processing -->
|
|
<!-- ====================================================================== -->
|
|
<!-- Main Page Section -->
|
|
<!-- ====================================================================== -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
|
|
|
|
|
|
|
|
<title>JMeter - User's Manual: Building a Monitor Test Plan</title>
|
|
</head>
|
|
|
|
<body bgcolor="#ffffff" text="#000000" link="#525D76">
|
|
<table border="0" cellspacing="0">
|
|
<!-- TOP IMAGE -->
|
|
<tr>
|
|
<td align="left">
|
|
<a href="http://jakarta.apache.org"><img width="505" height="48" src="../images/jakarta-logo.gif" border="0"/></a>
|
|
</td>
|
|
<td align="right">
|
|
<a href="http://jakarta.apache.org/jmeter/"><img width="221" height="102" src="../images/logo.jpg" alt="JMeter" title="JMeter" border="0"/></a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table border="0" width="100%" cellspacing="4">
|
|
<tr><td colspan="2">
|
|
<hr noshade size="1"/>
|
|
</td></tr>
|
|
|
|
<tr>
|
|
<!-- LEFT SIDE NAVIGATION -->
|
|
<td width="20%" valign="top" nowrap="true">
|
|
<p><strong>About</strong></p>
|
|
<ul>
|
|
<li> <a href="../index.html">Overview</a>
|
|
</li>
|
|
<li> <a href="../changes.html">Changes</a>
|
|
</li>
|
|
<li> <a href="../known_bugs.html">Known Bugs</a>
|
|
</li>
|
|
<li> <a href="../license.html">License</a>
|
|
</li>
|
|
<li> <a href="http://wiki.apache.org/jakarta-jmeter/JMeterCommitters">Contributors</a>
|
|
</li>
|
|
</ul>
|
|
<p><strong>Download</strong></p>
|
|
<ul>
|
|
<li> <a href="http://jakarta.apache.org/site/binindex.cgi#jmeter_binaries">Download Binary</a>
|
|
</li>
|
|
<li> <a href="http://jakarta.apache.org/site/sourceindex.cgi#jmeter_sources">Download Source</a>
|
|
</li>
|
|
<li> <a href="../nightly.html">Developer (Nightly) Builds</a>
|
|
</li>
|
|
</ul>
|
|
<p><strong>Documentation</strong></p>
|
|
<ul>
|
|
<li> <a href="../usermanual/index.html">User Manual</a>
|
|
</li>
|
|
<li> <a href="../api/index.html">Javadocs</a>
|
|
</li>
|
|
<li> <a href="../localising/index.html">Localisation (Translator's Guide)</a>
|
|
</li>
|
|
<li> <a href="../building.html">Building JMeter and Add-Ons</a>
|
|
</li>
|
|
<li> <a href="http://wiki.apache.org/jakarta-jmeter">JMeter Wiki</a>
|
|
</li>
|
|
<li> <a href="http://wiki.apache.org/jakarta-jmeter/JMeterFAQ">FAQ (Wiki)</a>
|
|
</li>
|
|
</ul>
|
|
<p><strong>Tutorials (PDF format)</strong></p>
|
|
<ul>
|
|
<li> <a href="../usermanual/jmeter_distributed_testing_step_by_step.pdf">Distributed Testing</a>
|
|
</li>
|
|
<li> <a href="../usermanual/jmeter_proxy_step_by_step.pdf">Recording Tests</a>
|
|
</li>
|
|
<li> <a href="../usermanual/junitsampler_tutorial.pdf">JUnit Sampler</a>
|
|
</li>
|
|
<li> <a href="../usermanual/jmeter_accesslog_sampler_step_by_step.pdf">Access Log Sampler</a>
|
|
</li>
|
|
<li> <a href="../extending/jmeter_tutorial.pdf">Extending JMeter</a>
|
|
</li>
|
|
</ul>
|
|
<p><strong>Community</strong></p>
|
|
<ul>
|
|
<li> <a href="http://jakarta.apache.org/site/getinvolved.html">Get Involved</a>
|
|
</li>
|
|
<li> <a href="http://jakarta.apache.org/site/mail.html">Mailing Lists</a>
|
|
</li>
|
|
<li> <a href="http://jakarta.apache.org/site/cvsindex.html">SVN Repositories</a>
|
|
</li>
|
|
</ul>
|
|
</td>
|
|
<td width="80%" align="left" valign="top">
|
|
<table>
|
|
<tr>
|
|
<td bgcolor="#525D76">
|
|
<div align="right"><a href="index.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Index</font></a></div>
|
|
</td>
|
|
<td bgcolor="#525D76">
|
|
<div align="right"><a href="listeners.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Next</font></a></div>
|
|
</td>
|
|
<td bgcolor="#525D76">
|
|
<div align="right"><a href="build-jms-topic-test-plan.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
<tr><td bgcolor="#525D76">
|
|
<font color="#ffffff" face="arial,helvetica,sanserif">
|
|
<a name="building"><strong>13. Building a Monitor Test Plan</strong></a>
|
|
</font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p >
|
|
In this section, you will learn how to create a
|
|
|
|
<a href="build-test-plan.html">
|
|
Test Plan
|
|
</a>
|
|
to monitor webservers. Monitors
|
|
are useful for a stress testing and system management. Used with stress
|
|
testing, the monitor provides addtion information about server performance.
|
|
It also makes it easier to see the relationship between server performance
|
|
and response time on the client side. As a system administration tool, the
|
|
monitor provides an easy way to monitor multiple servers from one console.
|
|
The monitor was designed to work with the status servlet in Tomcat 5. In
|
|
theory, any servlet container that supports JMX (Java Management Extension)
|
|
can port the status servlet to provide the same information.
|
|
</p>
|
|
<p >
|
|
For those who want to use the monitor with other servlet or EJB containers,
|
|
Tomcat's status servlet should work with other containers for the memory
|
|
statistics without any modifications. To get thread information, you will
|
|
need to change the MBeanServer lookup to retrieve the correct MBeans.
|
|
</p>
|
|
</blockquote>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td><br></td></tr>
|
|
</table>
|
|
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
<tr><td bgcolor="#525D76">
|
|
<font color="#ffffff" face="arial,helvetica,sanserif">
|
|
<a name="adding_server"><strong>13.1 Adding A Server</strong></a>
|
|
</font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p >
|
|
The first step is to add a
|
|
<a href="test_plan.html#thread_group">
|
|
Thread Group
|
|
</a>
|
|
|
|
element. The Thread Group tells JMeter the number of threads you want. Always use
|
|
1, since we are using JMeter as a monitor. This is very important for those not
|
|
familiar with server monitors. As a general rule, using multiple threads for a
|
|
single server is bad and can create significant stress.
|
|
|
|
</p>
|
|
<p >
|
|
Go ahead and add the ThreadGroup element by first selecting the Test Plan,
|
|
clicking your right mouse button to get the Add menu, and then select
|
|
Add --> ThreadGroup.
|
|
</p>
|
|
<p >
|
|
You should now see the Thread Group element under Test Plan. If you do not
|
|
see the element, "expand" the Test Plan tree by clicking on the Test Plan element.
|
|
</p>
|
|
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/webtest/threadgroup.png"><br>
|
|
<font size="-1">
|
|
Figure 10.1. Thread Group with Default Values
|
|
</font></td></tr></table></p>
|
|
<p >
|
|
Enter the name of the server.
|
|
</p>
|
|
</blockquote>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td><br></td></tr>
|
|
</table>
|
|
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
<tr><td bgcolor="#525D76">
|
|
<font color="#ffffff" face="arial,helvetica,sanserif">
|
|
<a name="adding_auth"><strong>13.2 HTTP Auth Manager</strong></a>
|
|
</font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p >
|
|
Add the
|
|
<a href="../usermanual/component_reference.html#HTTP_Authorization_Manager">HTTP Authorization Manager</a>
|
|
to the Thread Group element
|
|
(Add --> Config element --> HTTP Authorization Manager). Enter the username
|
|
and password for your webserver. Important note: the monitor only works with
|
|
Tomcat5 build 5.0.19 and newer. For instructions on how to setup Tomcat, please
|
|
refer to tomcat 5 documentation.
|
|
</p>
|
|
<ol >
|
|
|
|
|
|
<li >
|
|
leave the base URL blank
|
|
</li>
|
|
|
|
|
|
<li >
|
|
enter the username
|
|
</li>
|
|
|
|
|
|
<li >
|
|
enter the password
|
|
</li>
|
|
|
|
|
|
</ol>
|
|
</blockquote>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td><br></td></tr>
|
|
</table>
|
|
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
<tr><td bgcolor="#525D76">
|
|
<font color="#ffffff" face="arial,helvetica,sanserif">
|
|
<a name="adding_request"><strong>13.3 Adding HTTP Request</strong></a>
|
|
</font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p >
|
|
Add the
|
|
<a href="../usermanual/component_reference.html#HTTP_Request">HTTP Request</a>
|
|
to the Thread Group element
|
|
(Add --> Sampler --> HTTP Request). Then, select the HTTP Request element
|
|
in the tree and edit the following properties):
|
|
|
|
<ol >
|
|
|
|
|
|
<li >
|
|
Change the Name field to "Server Status".
|
|
</li>
|
|
|
|
|
|
<li >
|
|
Enter the IP address or Hostname
|
|
</li>
|
|
|
|
|
|
<li >
|
|
Enter the port number
|
|
</li>
|
|
|
|
|
|
<li >
|
|
Set the Path field to "/manager/status" if you're using Tomcat.
|
|
</li>
|
|
|
|
|
|
<li >
|
|
Add a request parameter named "XML" in uppercase. Give it a value of
|
|
"true" in lowercase.
|
|
</li>
|
|
|
|
|
|
<li >
|
|
Check "Use as Monitor" at the bottom of the sampler
|
|
</li>
|
|
|
|
|
|
</ol>
|
|
|
|
|
|
</p>
|
|
</blockquote>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td><br></td></tr>
|
|
</table>
|
|
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
<tr><td bgcolor="#525D76">
|
|
<font color="#ffffff" face="arial,helvetica,sanserif">
|
|
<a name="adding_timer"><strong>13.4 Adding Constant Timer</strong></a>
|
|
</font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p >
|
|
Add a timer to this thread group (Add --> Timer --> Constant Timer).
|
|
Enter 5000 milliseconds in the "Thread Delay" box. In general, using intervals shorter
|
|
than 5 seconds will add stress to your server. Find out what is an acceptable interval
|
|
before you deploy the monitor in your production environment.
|
|
</p>
|
|
</blockquote>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td><br></td></tr>
|
|
</table>
|
|
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
<tr><td bgcolor="#525D76">
|
|
<font color="#ffffff" face="arial,helvetica,sanserif">
|
|
<a name="adding_listener"><strong>13.5 Adding a Listener to Store the Results</strong></a>
|
|
</font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p >
|
|
If you want to save the raw results from the server, add a simple data
|
|
|
|
<a href="component_reference.html#listeners">
|
|
Listener
|
|
</a>
|
|
. If you want to save the
|
|
calculated statistics, enter a filename in the listener. If you want to save both
|
|
the raw data and statistics, make sure you use different filenames.
|
|
</p>
|
|
<p >
|
|
Select the thread group element and add a
|
|
<a href="../usermanual/component_reference.html#Simple_Data_Writer">Simple Data Writer</a>
|
|
listener
|
|
(Add --> Listener --> Simple Data Writer). Next, you need to specify a directory
|
|
and filename of the output file. You can either type it into the filename field, or
|
|
select the Browse button and browse to a directory and then enter a filename.
|
|
</p>
|
|
</blockquote>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td><br></td></tr>
|
|
</table>
|
|
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
<tr><td bgcolor="#525D76">
|
|
<font color="#ffffff" face="arial,helvetica,sanserif">
|
|
<a name="add_monitor_listener"><strong>13.6 Adding Monitor Results</strong></a>
|
|
</font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p >
|
|
Add the
|
|
<a href="component_reference.html#listeners">
|
|
Listener
|
|
</a>
|
|
by selecting the
|
|
test plan element (Add --> Listener -- > Monitor Results). There are two tabs in
|
|
the monitor results listener. The first is the "Health", which displays the status of
|
|
the last sample the monitor received. The second tab is "Performance", which shows a
|
|
historical view of the server's performance.
|
|
|
|
</p>
|
|
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/monitor_health.png"><br>
|
|
<font size="-1"> </font></td></tr></table></p>
|
|
<p >
|
|
A quick note about how health is calculated. Typically, a server will crash if
|
|
it runs out of memory, or reached the maximum number of threads. In the case of
|
|
Tomcat 5, once the threads are maxed out, requests are placed in a queue until a
|
|
thread is available. The relative importance of threads vary between containers, so
|
|
the current implementation uses 50/50 to be conservative. A container that is more
|
|
efficient with thread management might not see any performance degradation, but
|
|
the used memory definitely will show an impact.
|
|
</p>
|
|
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/monitor_screencap.png"><br>
|
|
<font size="-1"> </font></td></tr></table></p>
|
|
<p >
|
|
The performance graph shows for different lines. The free memory line shows how
|
|
much free memory is left in the current allocated block. Tomcat 5 returns the maximum
|
|
memory, but it is not graphed. In a well tuned environment, the server should never
|
|
reach the maximum memory.
|
|
</p>
|
|
<p >
|
|
Note the graph has captions on both sides of the graph. On the left is percent and
|
|
the right is dead/healthy. If the memory line spikes up and down rapidly, it could
|
|
indicate memory thrashing. In those situations, it is a good idea to profile the
|
|
application with Borland OptimizeIt or JProbe. What you want to see is a regular
|
|
pattern for load, memory and threads. Any erratic behavior usually indicates poor
|
|
performance or a bug of some sort.
|
|
</p>
|
|
</blockquote>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td><br></td></tr>
|
|
</table>
|
|
<table>
|
|
<tr>
|
|
<td bgcolor="#525D76">
|
|
<div align="right"><a href="index.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Index</font></a></div>
|
|
</td>
|
|
<td bgcolor="#525D76">
|
|
<div align="right"><a href="listeners.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Next</font></a></div>
|
|
</td>
|
|
<td bgcolor="#525D76">
|
|
<div align="right"><a href="build-jms-topic-test-plan.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr><td colspan="2">
|
|
<hr noshade size="1"/>
|
|
</td></tr>
|
|
<tr><td colspan="2">
|
|
<div align="center"><font color="#525D76" size="-1"><em>
|
|
Copyright © 1999-2007, Apache Software Foundation
|
|
</em></font></div>
|
|
</td></tr>
|
|
</table>
|
|
</body>
|
|
</html>
|
|
<!-- end the processing -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|