Sunday, January 1, 2012

Apache JMeter for Performance/Load Testing

In this post i will describe the benefits and usage of JMeter as well as the installation steps.

  • Introduction
  • Features
  • Installing JMeter
  • Using JMeter
    • Test plan
    • Building a simple web test plan
  • References

The Apache JMeter™ desktop application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions. 

Apache JMeter may be used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. You can use it to make a graphical analysis of performance or to test your server/script/object behavior under heavy concurrent load. 

  • Can load and performance test many different server types:
    • Web - HTTP, HTTPS
    • SOAP
    • Database via JDBC
    • LDAP
    • JMS
    • Mail - POP3(S) and IMAP(S)
  • Complete portability and 100% Java purity .
  • Full multithreading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by seperate thread groups.
  • Careful GUI design allows faster operation and more precise timings.
  • Caching and offline analysis/replaying of test results.
  • Highly Extensible:
    • Pluggable Samplers allow unlimited testing capabilities.
    • Several load statistics may be choosen with pluggable timers .
    • Data analysis and visualization plugins allow great extendibility as well as personalization.
    • Functions can be used to provide dynamic input to a test or provide data manipulation.
    • Scriptable Samplers (BeanShell is fully supported; and there is a sampler which supports BSF-compatible languages)

Installing JMeter
  • Download the appropriate jmeter package (Here)
  • Extract the package (e.g., Linux use tar xvf PACK_NAME)
  • Go to the bin directory (e.g. Linux cd PACK_PATH/bin)
  • Run the (Linux) jmeter.bat (Windows) (e.g. Linux ./jmeter on the terminal)
  • The previous step will require JVM to be installed on your machine (Here)
  • Check the PACK_PATH/docs for information of how to use it
Using JMeter

Test Plan

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, logic conrollers, sample generating controllers, listeners, timers, assertions, and configuration elements. For more information about Test plan see Building a Test Plan.

Building a simple web test plan 

See the Building a Web Test Plan tutorial on the apache web site, Also you may go and have a look at my latest article about Apache JMeter along with JSF.