You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2006/05/20 00:48:45 UTC
svn commit: r407926 - in /jakarta/jmeter/branches/rel-2-1:
bin/jmeter.properties extras/bshremote.cmd extras/printvars.bsh
extras/remote.bsh xdocs/usermanual/best-practices.xml
xdocs/usermanual/component_reference.xml xdocs/usermanual/get-started.xml
Author: sebb
Date: Fri May 19 15:48:44 2006
New Revision: 407926
URL: http://svn.apache.org/viewvc?rev=407926&view=rev
Log:
Update bsh documentation and scripts
Added:
jakarta/jmeter/branches/rel-2-1/extras/bshremote.cmd (with props)
jakarta/jmeter/branches/rel-2-1/extras/printvars.bsh (with props)
Modified:
jakarta/jmeter/branches/rel-2-1/bin/jmeter.properties
jakarta/jmeter/branches/rel-2-1/extras/remote.bsh
jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/best-practices.xml
jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/component_reference.xml
jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/get-started.xml
Modified: jakarta/jmeter/branches/rel-2-1/bin/jmeter.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/bin/jmeter.properties?rev=407926&r1=407925&r2=407926&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/bin/jmeter.properties (original)
+++ jakarta/jmeter/branches/rel-2-1/bin/jmeter.properties Fri May 19 15:48:44 2006
@@ -382,11 +382,14 @@
# BeanShell Server properties
#
-# Define the port number as non-zero to start the server on that port
-#beanshell.server.port=0
+# Define the port number as non-zero to start the http server on that port
+#beanshell.server.port=9000
+# The telnet server will be started on the next port
+
#
# Define the server initialisation file
-#beanshell.server.file=initial.bsh
+beanshell.server.file=../extras/startup.bsh
+
#
# Define the intialisation files for BeanShell Sampler and Function elements
#beanshell.sampler.init=BeanShellSampler.bshrc
@@ -463,9 +466,10 @@
# the following line.
#jmeterengine.startlistenerslater=false
-#JMeterUtils
-#
-#search_paths=null
+
+# List of paths (separated by ;) to search for additional JMeter extension jars
+# These are in addition to lib/ext. Do not use this for utility jars.
+#search_paths=/app1/lib;/app2/lib
# Users can define additional classpath items by setting the property below
# Paths with spaces may cause problems for the JVM
Added: jakarta/jmeter/branches/rel-2-1/extras/bshremote.cmd
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/extras/bshremote.cmd?rev=407926&view=auto
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/extras/bshremote.cmd (added)
+++ jakarta/jmeter/branches/rel-2-1/extras/bshremote.cmd Fri May 19 15:48:44 2006
@@ -0,0 +1,16 @@
+@echo off
+rem Command file to send a script to a BeanShell server
+
+if not .%2 == . goto OK
+
+echo Please supply:
+echo.
+echo P1 = port (the http port)
+echo P2 = script file name
+sleep 2
+goto :EOF
+
+:OK
+
+echo Press ^C to return to
+java -cp ../lib/bsh-2.0b2.jar bsh.Remote bsh://localhost:%1 %2
\ No newline at end of file
Propchange: jakarta/jmeter/branches/rel-2-1/extras/bshremote.cmd
------------------------------------------------------------------------------
svn:eol-style = CRLF
Propchange: jakarta/jmeter/branches/rel-2-1/extras/bshremote.cmd
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: jakarta/jmeter/branches/rel-2-1/extras/printvars.bsh
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/extras/printvars.bsh?rev=407926&view=auto
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/extras/printvars.bsh (added)
+++ jakarta/jmeter/branches/rel-2-1/extras/printvars.bsh Fri May 19 15:48:44 2006
@@ -0,0 +1,11 @@
+// Sample script to print JMeter variables
+print(">>>>");
+Iterator i = vars.getIterator();
+while(i.hasNext())
+{
+ Map.Entry me = i.next();
+ if(String.class.equals(me.getValue().getClass())){
+ print(me);
+ }
+}
+print("<<<<");
Propchange: jakarta/jmeter/branches/rel-2-1/extras/printvars.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/extras/printvars.bsh
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: jakarta/jmeter/branches/rel-2-1/extras/remote.bsh
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/extras/remote.bsh?rev=407926&r1=407925&r2=407926&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/extras/remote.bsh (original)
+++ jakarta/jmeter/branches/rel-2-1/extras/remote.bsh Fri May 19 15:48:44 2006
@@ -1,9 +1,12 @@
// remote.bsh
// Sample remote file for use with bsh.remote
+// Usage:
+// java -cp bsh.jar bsh.Remote bsh://localhost:9000 bsh.remote
+//
//
print("Remote starting");
-print(args);
printprop("user.home");
printprop("user.dir");
// loglevel("DEBUG","jmeter");
-print("Remote ended");
\ No newline at end of file
+print("Remote ended");
+print("Press ^C to exit");
\ No newline at end of file
Modified: jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/best-practices.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/best-practices.xml?rev=407926&r1=407925&r2=407926&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/best-practices.xml (original)
+++ jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/best-practices.xml Fri May 19 15:48:44 2006
@@ -127,10 +127,58 @@
<li>Rather than using lots of similar samplers,
use the same sampler in a loop, and use variables (CSV Data Set) to vary the sample.
Or perhaps use the Access Log Sampler.
+[The Include Controller does not help here, as it adds all the test elements in the file to the test plan.]
</li>
<li>Don't use functional mode</li>
<li>Use CSV output rather than XML</li>
+<li>Only save the data that you need</li>
</ul>
+</section>
+
+<section name="§-num;.7 BeanShell server" anchor="beanshell_server">
+<p>
+The BeanShell interpreter has a very useful feature - it can act as a server,
+which is accessible by telnet or http.
+</p>
+<note>
+There is no security. Anyone who can connect to the port can issue any BeanShell commands.
+These can provide unrestricted access to the JMeter application and the host.
+<b>Do not enable the server unless the ports are protected against access, e.g. by a firewall.</b>
+</note>
+<p>
+If you do wish to use the server, define the following in jmeter.properties:
+</p>
+<pre>
+beanshell.server.port=9000
+beanshell.server.file=../extras/startup.bsh
+</pre>
+<p>
+In the above example, the server will be started, and will listen on ports 9000 and 9001.
+Port 9000 will be used for http access. Port 9001 will be used for telnet access.
+The startup.bsh file will be processed by the server, and can be used to define various functions and set up variables.
+The sample file defines methods for setting and printing JMeter properties.
+This is what you should see in the JMeter console:
+</p>
+<pre>
+Startup script running
+Startup script completed
+Httpd started on port: 9000
+Sessiond started on port: 9001
+</pre>
+<p>
+As a practical example, assume you have a long-running JMeter test running in non-GUI mode,
+and you want to vary the throughput at various times during the test.
+The test-plan includes a Constant Throughput Timer which is defined in terms of a property,
+e.g. ${__P(throughput)}. The following BeanShell commands could be used to monitor and change the test:
+</p>
+<pre>
+printprop("throughput");
+setprop("throughput","70");
+Thread.sleep(20000);
+setprop("throughput","80");
+</pre>
+These can be stored in a file, and sent to the server using the bsh.Remote class.
+See for example bshremote.cmd and remote.bsh in the extras/ directory.
</section>
Modified: jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/component_reference.xml?rev=407926&r1=407925&r2=407926&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/component_reference.xml Fri May 19 15:48:44 2006
@@ -2485,6 +2485,20 @@
<component name="Constant Throughput Timer" index="§-num;.6.4" screenshot="timers/constant_throughput_timer.png">
<description><p>This timer introduces variable pauses, calculated to keep the total throughput (in terms of samples per minute) as close as possible to a give figure. Of course the throughput will be lower if the server is not capable of handling it, or if other timers or time-consuming test elements prevent it.</p>
+<p>
+N.B. although the Timer is called the Constant Throughput timer, the throughput value does not need to be constant.
+It can be defined in terms of a variable or function call, and the value can be changed during a test.
+The value can be changed in various ways:
+</p>
+<ul>
+<li>using a counter variable</li>
+<li>using a JavaScript or BeanShell function to provide a changing value</li>
+<li>using the remote BeanShell server to change a JMeter property</li>
+</ul>
+<p>See <a href="best-practices.html">Best Practices</a> for further details.
+Note that the throughput value should not be changed too often during a test
+- it will take a while for the new value to take effect.
+</p>
</description>
<properties>
<property name="Name" required="No">Descriptive name for this timer that is shown in the tree. </property>
@@ -2505,7 +2519,6 @@
The shared algorithm should generate a more accurate overall transaction rate.
The non-shared algortihm should generate a more even spread of transactions across threads.</p>
</properties>
-
</component>
<component name="Synchronizing Timer" index="§-num;.6.5" screenshot="timers/sync_timer.png">
Modified: jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/get-started.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/get-started.xml?rev=407926&r1=407925&r2=407926&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/get-started.xml (original)
+++ jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/get-started.xml Fri May 19 15:48:44 2006
@@ -163,6 +163,11 @@
If you have developed new JMeter components,
then you should jar them and copy the jar into JMeter's /lib/ext directory. JMeter will
automatically find JMeter components in any jars found here.
+If you don't want to put the extension jars in the lib/ext directory,
+then define the property <b>search_paths</b> in jmeter.properties.
+Do not use lib/ext for utility jars; it is only intended for JMeter components.
+</p>
+<p>
Other jars (such as JDBC, and any support libaries needed by the JMeter code)
should be placed in the lib directory.</p>
<p>Note: JMeter will only find .jar files, not .zip.</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org