Wednesday, October 3, 2012

Jmeter - Recording through JMeter using HTTP Proxy Server


Hi Friends,

We have already see how to test single page in Jmeter in which we don't require HTTP Proxy server. But what if we have to test a process which include two or more click on a page and url are changing because of that.

Steps:

1 . Add :
     Config Element > HTTP request default
      Server Name:  www.abc.com 
      Path:    /

     Timer > Guassian Random Timer
      Deviation: 100
      Constant Delay : 300

      Listener > Summary Report

      Logic Controller > Recording Controller  
      All the recording will come under this.

2.  Workbench > Non Test Element > HTTP Proxy Server
Port :8080
Type: HTTP request
URL Patterns to exclude :  .*\.jpg      ,   .*\.png    , .*\.js   ,   .*\.jpeg   etc
Donot start Http server right now.


3. Mozilla > Tools > Option > Networks > Setting
 Set Manual proxy config :  
 HTTP Proxy:localhost        port:8080
check : Use this proxy server for all products

4. Now open mozilla and go to website :  www.abc.com
It shd not open as we have not started proxy server yet.

5. Now go to workbench > Http proxy server and click on START button.
Now all the http request will be captured by recorder. So simply click on few link for which you want to do load test eg Search some product name in website or go to home page and product page etc.

6. Stop the proxy server.

7. Clean the recording script means remove un necessary urls of third party etc.

8. Now go to thread group and run.

RESULT:

1. Normally we check Average load time of page as load increases.
2. Througput vs Load vs Error rate
Throughput in /sec shd increase in starting and get stable after some time and start decreasing rapidly.

In my case i searched a keyword in an ecommerce website eg "apple iphone" and got following result:


User/Sec Througput [/sec] Error Rate

1 ----------> 0.9 ----------> 0
2 ----------> 2.1 ----------> 0
4 ----------> 3.2 ----------> 0
5 ----------> 3.2 ----------> 0
6 ----------> 3 ----------> 0
7 ----------> 4.3 ----------> 0
8 ----------> 5.3 ----------> 0
10 ----------> 9.2 ----------> 0
12 ----------> 12.3 ----------> 0
16 ----------> 14.9 ----------> 0
24 ----------> 16.9 ----------> 0
40 ----------> 17.9 ----------> 0
60 ----------> 18 ----------> 0
62 ----------> 11.9 ----------> 0
64 ----------> 10.1 ----------> 0
66 ----------> 18 ----------> 0
76 ----------> 12 ----------> 0
80 ----------> 16 ----------> 0
90 ----------> 18 ----------> 0
100 ----------> 18 ----------> 0
110 ----------> 18 ----------> 0.4
120 ----------> 16 ----------> 8
130 ----------> 18 ----------> 19
200 ----------> 22 ----------> 48
400 ----------> 44 ----------> 70
800 ----------> 54 ----------> 85

So throughput keep on increasing from 0.9/sec till 54/sec but when user/sec rate is at 110 then at that point Error % start increasing means request start bouncing from server.

So i can say website is meant to handle 100 user/sec with 18/sec throughput and 0%  Error rate.

Hope this blog clear few doubts!!!

Regards
Sheetal Singh

JMeter - Important Plugins for Jmeter


Hi ,


So friends we have learnt enough about how to set up basic JMETER, if not then follow my previous blog:
http://basicjmetersetup.blogspot.com/2011/10/basic-jmeter-setup-to-test-single-web.html#!/2011/10/basic-jmeter-setup-to-test-single-web.html

Here we will learn how to add few plugins in  JMeter

Steps:

1. Download JMeter-Plugins-0.4.1.zip file and unzip it
http://code.google.com/p/jmeter-plugins/wiki/PerfMon

2. Go to path C:\.......\Downloads\JMeterPlugins-0.4.2 and copy "JMeterPlugins" jar and paste it into
C:\............\jakarta-jmeter-2.4\jakarta-jmeter-2.4\lib\ext

Look into Jmeter > Thread Group > Add > Listener > lot of jp@gc files all over ...we can use these listener to see various graphs

3.Now go to
C:\..........\Downloads\JMeterPlugins-0.4.2\serverAgent
 and run "startAgent" window batch file.

it will show default port 4444 and waiting for connection........

4.Now plugins are ready for use just simply go to
Thread Group > Add > Listener > and here lot of option will be available to get different response.


Regards
Sheetal Singh

JMeter - Basic Jmeter Setup To Test Single Web Page



Dear Friends,

This is my first blog and i decided to write this because i find lot of difficulties in  using Jmeter for load testing. Here i am going to write basic jmeter testing steps in windows for single page to load.


STEPS:


  1. Download  2.5.1.zip file from :    http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi
  2. Extract zip file and run exe file present in path: C:\Users\Downloads\jakarta-jmeter-2.4.zip\jakarta-jmeter-2.4\bin
  3. Run exe file and Jmeter UI will get appear with Test plan and workbench.                                      Note:Test Plan - Only one test plan exist per jmeter instance                                                        Note:Workbench - Used for temporary work and not used if we are testing a single web page.
     4.  Add :Test Plan > Add > Thread Group  [Thread group indicates no. of user]
          Thread Group > Add > Listener >Result Tree [To see response of one request]
          Thread Group > Add > Listener >Summary report [To see aggregate report]              
     5.  Add: Thread Group > Add > Config Element > Http Request  Default                                        
          Here add website homepage name in "Server Name/IP fields" i.e add "www.google.com" and leave
          "path" fileds blank. Refer Fig 5.1

    Fig 5.1 - http request sampler
    Fig 6.1 - Response code 200



    6.   Add:  Thread Group > Add >Sampler > Http Request                                                                     Here change the "Name"  as "Home Page" just to show this is for homepage and leave Server/IP and path fields as blank as we have already added default value in config file.                      

    7.   Add:  Thread Group > Add >Sampler > Http request                                                                      Here change Name fields as "Product page" i.e any internal page of website and leave server/IP name as blank as we have already defined in config file and set path of page as "/product_page.php".      
                                                                                                                                                                Note: Sampler used to send request to web server and to receive request from web server and as we are using Http request here hence adding http request sampler.

    8.  In Thread Group:
      Users: 50
      Ramp Up per : 10
      Loop Count:1
      It show that user/sec i.e.  50/10 =5 user/sec are hitting website and continue till 10sec with this rate. hence 5user/sec * 10 =50 user.

      9.  Now go to Run > Start or Cntrl+R
      Note: As we are testing only single page so no need to add  Workbench >Add >Non Test Element >Http Proxy server . This is required when recording no. of page in sequence. And here no need to set mozilla/browser proxy to localhost etc....etc.

      10.Also add "Gaussian Random Timer",  Thread Group > Timer > Gaussian Timer
      Deviation= 1000 ms
      Constant Delay = 3000 ms

      11. To re run test with different thread group just clear result using Cntrl+E


      Basic funda to understand what is Jmeter:





      Now will see aggregate report:
      • Samples: [count]It shows no of user we are executing i.e 50 user in our case.
      • Average: [mili sec]: This is actual parameter which tells about performance of web page. eg 300 shows for 50 user average time taken to get page loads is 300ms.
      • Min and Max:[msec] :This is min/max time taken for page to get load.
      • Std. Dev: [] This shows how many exceptional cases were found which were deviating from the average value of the receiving time.   The lesser this value more consistent the time pattern is assumed. Standard deviation is measured in same unit as average i.e in ms in this case. Std deviation shd be ideally zero.
      • Error %: This value indicated the percentage of error.  In our case 50 calls were made and all are received successfully this means 0 error.  If there are any calls not received properly they are counted  as errors and the percentage of error occurrence against the actual calls made is displayed in this value. System breakeven can also be calculated from error%. If after some point error % increase drastically means all request get bounced from web server.
      • Throughput: [request/sec]: Ideal graph of through put is increases gradually and become stable got long time. And as througput becomes low drastically that point is breakeven point.It shd be ideally high.It increases as load increases for some time and then become constant and after that degards as load further increases.
      So to test a page look for
      Average[shd be 0]
      Error% [shd be 0]
      Throughput request/sec : [shd increase initially and then stable at one point and come down again]
      Std Deviation:[msec] [shd be 0]

      Thanks
      Sheetal Singh