How I may help
Email me!
Call me using Skype client on your machine

JMeter Load Testing Tool

Here are my notes on installing, configuring, and using JMeter, the popular open-source load testing tool for Java.

This is a companion to my other pages on load testing tools, Testing

 

Topics this page:

  • Introduction
  • Installation
  • Invocation
  • Usage
  • Your comments???
  •  

    RSS XML feed for load testers RSS preview for load testers Site Map List all pages on this site 
    About this site About this site 
    Go to first topic Go to Bottom of this page


    Set screen JMeter

      tool JMeter from the Apache Jakarta project (first available 12/03), simulates a concurrent heavy load on a server, network or object and provides a graphical analysis of the strength of its overall performance under different load types.

      It's runs as a Java class, so JMeter does not process Javascript or applets embedded in HTML pages.

      A "Test Plan" is a container for "elements" which specifies the parameters for test runs.

      Each "Thread Group" simulates what LoadRunner calls an individual virtual user.
      Each "thread" is a unit of work that can be simultaneous or sequentially executed. (JMeter itself is multi-threaded).

      Right click on a thread group to add elements, which are executed in this order:

      1. Timers add delays between responses: Constant, Gaussian Random, Uniform Random, Constant Throughput, Synchronizing, BeanShell
      2. Pre-Processors execute functions before requests are sent: HTML Link Parser, HTTP URL Re-writing Modifier, HTML Parameter Mask, HTTP User Parameter Modifier, User Parameters, Counter, BeanShell PreProcessor
      3. Samplers are protocol specific. The JUnit Sample includes oneTimeSetUp and oneTimeTearDown methods. It scans jar files in jmeter/lib/junit (instead of /lib directory) for classes extending junit's TestCase class.
      4. Post-Processors execute functions after requests are sent. Regular Expression Extractor, XPath Extractor, Result Status Action Handler, Save Responses to a file, Generate Summary Results, BeanShell PostProcessor
      5. Assertions determine if the application is returning the results expected: Response, Duration, Size, XML, BeanShell, MD5Hex, HTML, XPath, XML Schema
      6. Listeners perform data collection, aggregation, and visualization (display): Sample Result Save Configuration, Graph Full Results, Graph Results, Spline Visualizer, Assertion Results, View Results Tree, Aggregate Report, View Results in Table, Simple Data Writer, Monitor Results, Distribution Graph (alpha), Aggregate Graph, Mailer Visualizer, BeanShell Listener, Summary Report

      • "Logical controller elements" tells JMeter when to send requests: Simple, Once Only, Loop, Random, Random Order, If, While, Switch, ForEach, Module, Throughput, Runtime, Interleave, Include, Transaction, Recording
      • "Generative Controller elements" communicate with applications.

      JMeter replicates test requests to multiple injectors using a Java RMIRegistry service. By default the application listens to port 1099.

     


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Installation and Configuration

      JMeter is a Java application, so a JRE or SDK first needs to be installed with a JAVA_HOME environment variable.

      Download JMeter, and install by unzipping to the C:\ root folder because the zip file was created jakarta-jmeter-2.2.

        "Parsing XML is CPU intensive. On a Pentium 4 2.4ghz cpu, 50 threads is the upper limit."

      The jmeter.properties text file in the bin folder stores settings such as IP addresses of remote_hosts.

      Unlike OpenSTA, JMeter is able to record traffic in native WinInet protocol as well as HTTP protocol, which may explain why OpenSTA response times stats vary from LoadRunner and JMeter for the same app/machine

     


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Invocation

      Start from within the bin folder within C:\jakarta-jmeter-2.2.

      Create a text file such as "j.bat" in a folder specified in PATH, such as C:\ and use Notepad to type a line such as:

        jmeter.bat -Ljmeter.engine=DEBUG -tC:\jakarta-jmeter-2.2\docs\demos\SimpleTestPlan.jmx
        pause

      If the site to be tested is behind a Proxy, add:

        -H my.proxy.server -P 8000 -u username -a password

      Edit the jmeter.properties file.

      Jmeter ignores the CLASSPATH environment variable and uses these environment variables:

        JMETER_BIN - JMeter bin directory (must end in \)
        JM_LAUNCH - java.exe (default) or javaw.exe
        JVM_ARGS - additional java options, e.g. -Dprop=val

      -v displays the version.

      -n specifies JMeter to run in non-gui (command line) mode.

      -t precedes the name of the JMX (jmeter test) file that contains the Test Plan.

      -l precedes the name of the JTL file to log sample results to.

      -r runs all remote servers specified in jmeter.properties (or remote servers specified on command line by overriding properties).

      JMeter automatically finds JMeter components in jars within the /lib/ext directory. So jars (not zips) such as JDBC and new custom JMeter components should go there.

     


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Usage

      Sample test plans that come loaded are:

      AssertionTestPlan.jmx
      AuthManagerTestPlan.jmx
      BeanShellAssertion.bsh
      ForEachTest2.jmx
      forEachTestPlan.jmx
      HeaderManagerTestPlan.jmx
      InterleaveTestPlan2.jmx
      InterleaveTestPlan.jmx
      JMSPointToPoint.jmx
      LoopTestPlan.jmx
      OnceOnlyTestPlan.jmx
      ProxyServerTestPlan.jmx
      SimpleTestPlan.jmx of Jakarta users
      URLRewritingExample.jmx

     


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Configuration

     


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Data Parametization

      http://wiki.apache.org/jakarta-jmeter/JMeterFAQ#head-87f846dad28fd6b2ad5eb0d44d527d572f810653

      Data files

     


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Extending JMeter

      JMeter's 9.8MB Java 1.4/AWT-based source can be altered to add plug-ins that reference custom objects such as those in custom JDBC apps.

      Download the source.

      JMeter samplers include:

        HTTP Request
        FTP Request
        JDBC Request
        Java object request
        LDAP Request
        SOAP/XML-RPC Request
        WebService (SOAP) Request

     


    Go to Top of this page.
    Previous topic this page
    Next topic this page

    Set screen Monitoring JMeter

      Since JMeter collects its own metrics from servers under test (such as CPU utilization), so if servers already have monitors in place, it's better to run JMeter without its normal monitors, and have the monitoring software monitor how many thread groups (vusers) is running.

      Here's how to instrument JMeter for the Intersperse console.

    1. Discover jmeter mbeans using the Intersperse JMX Remote Agent.

    2. Open the Jmeter.bat file and add a JAVA_OPTIONS environment variable that uses "-D" to specify several Java variables to JMeter at start-up:

        set JAVA_OPTIONS=%JAVA_OPTIONS%
        -Dcom.sun.management.jmxremote
        -Dcom.sun.management.jmxremote.port=8004
        -Dcom.sun.management.jmxremote.authenticate=false
        -Dcom.sun.management.jmxremote.ssl=false

    3. After adding %JAVA_OPTIONS% in Jmeter.bat file, the command to invoke Java should look like this:

        %JM_START% %JM_LAUNCH% %JVM_ARGS% %ARGS% %JAVA_OPTIONS% -jar ApacheJMeter.jar %JMETER_CMD_LINE_ARGS%

    4. Install the Intersperse JMXRemoteAgent into a separate directory on the JMeter machine:
      Launch the Intersperse Installer. Choose "Custom Install" and only select "JMXRemoteAgent".
    5. Invoke the JMX Remote Agent webconsole and add information about the JMeter server.
      This is done instead of manually editing the JMXRemoteAgent install directory file .... JMXRemoteAgent\config\JMXRemoteAgent\intersperse.jmxremoteagent.jsr160.servers where "host" is the machine hosting JMeter:

        remote.1.server.url=service\:jmx\:rmi\:///jndi/rmi\://host\:8004/jmxrmi
        remote.1.server.name=JMeter

        Note: The "\:" escape characters are automatically converted.

    6. Save the file and exit.
    7. Start the Jmeter application using jmeter.bat.
    8. Start the Intesperse JMX Remote Agent.
    9. On the Intersperse Console, view the Jmeter Mbeans Thread count, by navigating to "Threading Mbean" along with other Mbean "OS Monitoring" (such as cpu usage and memory usage).

     


    Go to Top of this page.
    Previous topic this page
    Next topic this page