Mock tests, Interview questions, Tutorials and Tech news
 
 
Home > Programming / tutorials > Load testing using Apache JMeter

Load testing using Apache JMeter

JMeter is a desktop application used to load test functional behavior and measure performance. It is used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more).

JMeter supports HTTP, HTTPS, FTP, SOAP, POP3, JDBC, thus enabling its use to test most of the applications. It has record and playback capability which enables easy test case creation. But, it can directly record only HTTP requests and supports HTTPS spoofing which is not completely reliable.

Steps to setup JMeter and create test plan :-

  1. Download the latest version of JMeter from the website http://jakarta.apache.org/
  2. Run the batch file in JMeter folder -> bin -> jmeter.bat

Below is the snap shot of the Apache JMeter Tool.

Apace Jmeter

3.Right click “add à Config element àHttp Request Defaults

Apace Jmeter

4. Fill the server / ip address and port details

Path can specify the landing web page for ex: login / home page

Apace Jmeter

5. Create a Proxy server and provide the port number for which the browser listens

Apace Jmeter

6. Change the Browser LAN settings, set the same port as that we set in the JMeter proxy settings.

Apace Jmeter

7. Click on the Start button in the Http proxy server window.

8. Open the browser and type the URL http://jakarta.apache.org/

9. And browse the jmeter links.

10. Click on Stop button in the Http proxy server window.

Apace Jmeter

Above snapshot shows the recorded test data.

11. Add the Summary Report

Apace Jmeter

12. Open the Thread Group window and change the number of threads / users to 5 (you can change the value to any number which you want to record).

Apace Jmeter

13. Select Run -> Start in the JMeter menu options.

14. Summary Report will be populated with the test results for the modified number of users set in the thread group window.

Following problem might occur when you are trying to test the web application using the JMeter.

Problem Analysis

I am trying to do the load testing of our web application using JMeter tool.

I setup the JMeter client in my local machine.

And did the proxy setting as below

Apace Jmeter

When I am trying to test the application residing in the LAN, I am able to test the applications properly

But when I am trying to test the internet applications I am getting the following exception

Exception Trace.

java.net.UnknownHostException: www.google.com at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at java.net.Socket.connect(Socket.java:469) at java.net.Socket.(Socket.java:366) at java.net.Socket.(Socket.java:239) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) at org.apache.jmeter.protocol.http.sampler.HTTPSampler2.sample(HTTPSampler2.java:854) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1037) at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:195)

Please let me know if you have any idea / solution for this issue.

Solution

If we are testing from behind a firewall/proxy server, we may need to provide JMeter with the firewall/proxy server hostname and port number. To do so, run the jmeter.bat/jmeter file from a command line with the following parameters:

Example : jmeter -H my.proxy.server -P 8000 -u username -a password -N localhost

So I think we need to find the firewall / proxy server details to test this or we need to test this outside LAN network.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Mixx
  • Google Bookmarks
  • IndianPad
  • Reddit
Categories: Programming / tutorials Tags: , ,
  1. maria
    December 23rd, 2010 at 10:10 | #1

    hello!!!
    Perfet !!!
    but I change http client jmeter with -J httpclient.localaddress in file log apache not write config localaddress because????

  1. June 14th, 2010 at 22:04 | #1
Get Adobe Flash playerPlugin by wpburn.com wordpress themes