build-monitor-test-plan.html
14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<!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.
-->
<!-- start the processing -->
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../docs/css/style.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Apache JMeter - User's Manual: Building a Monitor Test Plan (DEPRECATED)</title>
<style>
.code { font-weight: bold; }
</style>
</head>
<body bgcolor="#ffffff" text="#000000" link="#525D76">
<table border="0" cellspacing="0">
<tr>
<td align="left">
<a href="http://www.apache.org"><img style="margin: 0px 30px 0px 0px" title="Apache Software Foundation" width="261" height="106" src="../../docs/images/asf-logo.png" border="0"/></a>
</td>
<td align="right">
<a href="http://jmeter.apache.org/"><img width="259" height="88" src="../../docs/images/jmeter.png" alt="Apache JMeter" title="Apache JMeter" border="0"/></a>
</td>
</tr>
</table>
<table border="0" cellspacing="4">
<tr><td>
<hr noshade size="1"/>
</td></tr>
<tr>
<td 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>12. Building a Monitor Test Plan (DEPRECATED)</strong></a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>Note this feature is deprecated since JMeter 3.1</td></tr>
</table>
</p>
<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 additional 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>12.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
<tt class="code">1</tt>, 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 <span class="menuchoice">
<span class="guimenuitem">Add</span> </span>
menu, and then select
<span class="menuchoice">
<span class="guimenuitem">Add</span> → <span class="guimenuitem">ThreadGroup</span> </span>
.</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><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../../docs/images/screenshots/webtest/threadgroup.png"/><br>
<font size="-1">
Figure 12.1. Thread Group with Default Values</font></td></tr></table>
<p>Change the loop count to forever (or some large number) so that enough samples are generated.</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>12.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
( <span class="menuchoice">
<span class="guimenuitem">Add</span> → <span class="guimenuitem">Config element</span> → <span class="guimenuitem">HTTP Authorization Manager</span> </span>
). Enter the username
and password for your webserver.
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>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.
</td></tr>
</table>
</p>
</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>12.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
( <span class="menuchoice">
<span class="guimenuitem">Add</span> → <span class="guimenuitem">Sampler</span> → <span class="guimenuitem">HTTP Request</span> </span>
). Then, select the HTTP Request element
in the tree and edit the following properties):
<ol>
<li>Change the Name field to "<tt class="code">Server Status</tt>".</li>
<li>Enter the IP address or Hostname</li>
<li>Enter the port number</li>
<li>Set the Path field to "<tt class="code">/manager/status</tt>" if you're using Tomcat.</li>
<li>Add a request parameter named "<tt class="code">XML</tt>" in uppercase. Give it a value of
"<tt class="code">true</tt>" in lowercase.</li>
<li>Check "<tt class="code">Use as Monitor</tt>" 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>12.4 Adding Constant Timer</strong></a></font>
</td></tr>
<tr><td>
<blockquote>
<p>Add a timer to this thread group
( <span class="menuchoice">
<span class="guimenuitem">Add</span> → <span class="guimenuitem">Timer</span> → <span class="guimenuitem">Constant Timer</span> </span>
).
Enter <tt class="code">5000</tt> milliseconds in the "<tt class="code">Thread Delay</tt>" 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>12.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
( <span class="menuchoice">
<span class="guimenuitem">Add</span> → <span class="guimenuitem">Listener</span> → <span class="guimenuitem">Simple Data Writer</span> </span>
). 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>12.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
( <span class="menuchoice">
<span class="guimenuitem">Add</span> → <span class="guimenuitem">Listener</span> → <span class="guimenuitem">Monitor Results</span> </span>
).
</p><p>
By default, the Listener will select the results from the first connector in the sample response.
The Connector prefix field can be used to select a different connector.
If specified, the Listener will choose the first connector which matches the prefix.
If no match is found, then the first connector is selected.
</p><p>There are two tabs in
the monitor results listener. The first is the "<tt class="code">Health</tt>", which displays the status of
the last sample the monitor received. The second tab is "<tt class="code">Performance</tt>", which shows a
historical view of the server's performance.
</p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../../docs/images/screenshots/monitor_health.png"/><br>
<font size="-1"></font></td></tr></table>
<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><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../../docs/images/screenshots/monitor_screencap.png"/><br>
<font size="-1"></font></td></tr></table>
<p>The performance graph shows four 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>
<br>
<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>
</td>
</tr>
<tr><td>
<hr noshade size="1"/>
</td></tr>
<tr>
<td>
<table width=100%>
<tr>
<td>
<font color="#525D76" size="-1"><em>
Copyright © 1999-2017, Apache Software Foundation
</em></font>
</td>
<td align="right">
<font color="#525D76" size="-1"><em>
$Id: build-monitor-test-plan.xml 1767315 2016-10-31 15:52:25Z pmouawad $
</em></font>
</td>
</tr>
<tr><td colspan="2">
<div align="center"><font color="#525D76" size="-1">
Apache, Apache JMeter, JMeter, the Apache feather, and the Apache JMeter logo are
trademarks of the Apache Software Foundation.
</font>
</div>
</td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<!-- end the processing -->