Monday, 10 September 2012

JMeter basics

What is JMeter?
Apache JMeter is a pure Java desktop application used widely for performance testing and analyzing the overall system performance under different load types. It is freely-available tool and easy to use. It has a graphical user interface for creating the test plans along with various elements that make up a test plan. It has a variety of listeners that helps performance analysis simpler and less time consuming, making it a valuable asset in delivering quality code that is also highly scalable. It supports different protocols (HTTP(S), SOAP, JMS, JDBC, and LDAP etc).


This article will help the users who are new to JMeter

JMeter Download link http://jmeter.apache.org/download_jmeter.cgi
In Windows OS, launch JMeter by running jmeter.bat (apache-jmeter-2.7\bin\jmeter.bat)
Below screen can be seen on clicking jmeter.bat


Basic Components of JMeter

Test plan: The Test Plan is where the overall settings for a test are specified. A test plan describes a series of steps JMeter will execute when run. A complete test plan will consist of one or more Thread Groups, listeners, timers, assertions, and configuration elements.
The test plan should be saved before running the script however it will ask to save the test plan while running the script.

Workbench: The Workbench is like a working area.
Elements in Workbench:
•HTTP Proxy Server
•HTTP Mirror Server
•Property Display
HTTP Proxy Server will listen to the requests being sent from the web browser to the server. It
automatically creates HTTP Request samplers for each request sent.

Thread Group: A Thread Group defines a pool of users that will execute a particular test case against application. In the Thread Group GUI, configuration related to the number of users simulated (num of threads), the ramp up time (how long it takes to start all the threads), the number of times to perform the test, and optionally, a start and stop time for the test can be controlled.


Sampler: A sampler is something that sends a request to a server. JMeter comes with
different types of samplers. The sampler that will be used for testing web application
is HTTP Request. Samplers perform the actual work of JMeter. Each sampler (except Test Action) generates one or more sample results. The sample results have various attributes (success/fail, elapsed time, data size etc) and can be viewed in the various listeners.

Assertion: Assertions are used to perform additional checks on samplers, and are processed after every sampler in the same scope. To ensure that an Assertion is applied only to a particular sampler, add it as a child of the sampler. There are different types of assertions depending on type of expected response and type of check that need to perform.

Logic Controller: Logic Controllers determine the order in which Samplers are processed. It provides a mechanism for controlling the flow of the thread group. Adding a logic controller to a thread group is like adding if-then or dowhile logic to a program.

Listener:
A listener listens to the responses generated by samplers. Listeners can be used
to compile the results of the test run and to check that a sampler generates the expected
response. Most of the listeners perform several roles in addition to "listening" to the test results. They also provide means to view, save, and read saved test results.
Listeners can use a lot of memory if there are a lot of samples. Most of the listeners currently keep a copy of every sample in their scope.

1 comment:

  1. It's not recommended to use "Assertions" and "Listeners" when you load production server as it reduces performance. For debugging you are fine to use them but you have to tune up JMeter script before load testing.

    ReplyDelete