Showing posts with label jmeter. Show all posts
Showing posts with label jmeter. Show all posts

2015-01-01

How to perform client side web performance testing in JMeter?

In this article we will see how can we do client side performance testing using Jmeter Plugins.

I will be using jmeter webdriver plugins. Before starting this topic, please have some basic on what is client side performance testing from my previous post.So, lets start with

Installation :

1. Install Jmeter and Plug ins from below links following this post.
->Jmeter
-> Plugins(you may choose only web driver, but I prefer all of them)

2. Download Selenium Server from here. (you need java to run that)

3. Download Firefox 26 from Archive. Why 26? because jmeter webdriver plugins supports firefox 26. Here is link where you see supports the details.
Note: This can be tricky if you have updated Firefox version. In that case you can do like me.
->Disable firefox update checking
-> Install in new folder in separate directory name.
installation

->When you run this one for the first time , just cancel initial update process. As you have disabled firefox update(in your updated firefox), make sure you see the update settings disabled in this firefox 26 too.

Note : This part is little tricky, I have provided separate post to resolve it.
For Jmeter Remote Execution or local, it is better to to have only one firefox (version 26) with no auto update settings which will minimize complexity for test execution.

4. Keep firefox 26, selenium server in path variable. To check, type firefox from command line and run. You should see, firefox 26 launched in desktop.

image
image
image

5. Setting Jmeter: Usually , we do not need any extra things for webdriver sampler. But, as we need debugging, we might use this following property in user.properties file.
webDriverJmeter

It enables sub sampling which is good for debugging. 
webdriver.sampleresult_class=true
Let me explain more in how it works: JMeter webdriver sampler is just an extension of http sampler, not alternative, with a script editor. When it runs, it actually calls firefox driven by webdriver. That means, it send its instruction to mainly webdriver and, webdriver does every thing. Now, you might be wondering how code goes to web deriver. Like as other code support, webdriver core run as external code following JSR specification. It is actually JavaScript execution. And, you see, it is just like as webdriver java code with some basic modification due to jmeter adoption. I will provide separate blog or coding.

And after you write the steps as webdriver script, use listeners to get time. Like as other samplers, you use listeners to debug sensibly.
Browser supporting : 
Just follow this link which tells the configurable browser names that are supported by webdriver sampler. You can see this from jmeter also,
image

Time Measurement:

webdriver sampler calculates time from this line of code
WDS.sampleResult.sampleStart()
to this line of code
WDS.sampleResult.sampleEnd()

So, for debugging, we need sub samples which will be shown as child of main sample. For this purpose, we need to activate sampleresult_class true. After activation we can do sub sampling like

WDS.sampleResult.sampleStart()
//Brows to a URL
//Add user name and password
WDS.sampleResult.subSampleStart('Log In request')
//Click Log in
WDS.sampleResult.subSampleEnd(true)
//Check title
//do some another process
WDS.sampleResult.sampleEnd()
In view result tree listener, you can see , main sample contain sub sample name “'Log In request'”. And a main sample can have multiple sub sample. That means, we can calculate each time separately from result tree.

Note that, sub samples will not be shown separately in tabular format listeners or graphs.
And, if we need to measure particular transaction . we can split single test among multiple webdriver sample. Like, a sampler for log in, a sampler for doing some work in home page, a sampler for messaging. In this way, we can see results in reports. Usually each business transaction is measured in separate sample where as detail steps are sub sampled.

Writing first script :

To write webdriver sampler script , you need to add webdriver sampler(sampler –>webdriver sampler) with any browser (driver)configuration. See image from browser supporting section to get the driver configuration elements.
I will provide separate post for how to write webdriver test script with an example. You can see some nice guidelines form wedriver sampler wiki.

Test Planning :

As we know from my previous post on client side performance test, this test should run from single user or thread. As jmeter sampler populate browser with webdriver, this has me particular hardware requirement. That is, it will occupy a single thread of a processor. That means, if you want to run webdriver sampler, you need at least 2 core CPU. Why 2 core, another one is for Jmeter. So, if you have 8 core CPU, you can run only 7 threads for webdriver samplers. So, for testing we have to add separate thread group or test block for webdriver sampler.

We will run for measuring client execution time on
1. When there is not much user load, .
2. When average load on server ,
3. When High load(considered as peak load)

Sometimes , It is also better to test under
1. Beyond capacity , where error can be occurred or may just after error condition.
2. As continuous performance testing. Usually, people run selected regression test with jmeter daily or weekly.

Again, formula is simple, 1 thread of CPU for single client performance testing. 

And, you run the test simply like as Jmeter test, that's all. More detail will be in my blog with example.

Thanks …:)

2013-09-28

Book Review- Performance Testing With JMeter 2.9



In this article I am going to talk about a book on Jmeter recently published from Packt Publisher. I was lucky to get an offer to review this book as a technical reviewer before publishing (you may find in the book). Today I am going to talk little more about the book. 

Most of we know , jmeter have its own documentation and which is pretty enough and rich.

So, why we need book. Why we want to invest. Practically, jmeter documentation is bit too much technical from the beginning. For a new person, it is a little bit complex. At least I felt that when I have started.  Frankly, I have struggled a lot while going through very details. And we can learn only core jmeter form its documentation. 
 But, the is very useful in this case. It is very careful regarding its presentation. It is organized in such way to so that it can be very helpful for beginners. We can start testing very quickly without knowing much inner details.  And, it creates an impression of being very easy to new learners. Besides that, this is the only book that contains Jmeter plug-in explanations. Jmeter plug-in was created to overcome the advantages of Load Runner over jmeter. No book contains this much detail and useful information about jmeter plug-in. This is the cover page of the book

 

So, Who are the readers? The book is useful if you are
1. A new person to performance testing with jmeter
2. You are using jmeter for certain time and you want to use advance features
3. You are doing R&D on tools, and you want to know detail about what Jmeter can do
4. You are a java expert and you want to make a tool like as jmeter, you can gather information as well as get the code and requirements.

Advantages of this book :
1. Most of the testing comes with examples and detail description. So, it gives clear idea and useful information before start practicing and implementing.
2. Very good explanations on side technology that are used( i.e. - Regular Expression , JSON etc)
3. Very useful explanation on advance topics like session, cookie, URL rewrite.
4. Spatial chapter on server monitoring (profMon) and distributed testing which are very helpful & necessary for industry standard testing.
5. The packaging of the books is very good. I got a hard copy of the book.

Some Disadvantages:
1. I admit, the book could have more image to explain. I guess, author want to keep book more thin and cheap.
2. The book could add some more detail chapters on how to get useful reports. As we know, jmeter used to provide raw results (unlike load runner), we have to process the results in to report manually. Some example with ideas regarding reporting would have been very useful.
3. The books still looks a bit technical not from be beginning but in later on. So, if we run through chapter without practicing, it might be little complex.

My opinion: The book is perfect for a new person as well as for regular jmeter users. It would be very useful if there were some explanation about extending jmeter  codes to make new custom tools as well as how to customize jmeter and plugins on project and scenario basis. 
And, I think this book is worth buying for both learning and industry level performance testing. You can buy this book from amazon

Thanks...:) 

2013-06-26

PerfMon-JMeter Server Monitoring PlugIn

In this article we are going to see what are additional features/items added after installing jmeter plugin (Google Plugin) and what we can do with it. I will discuses about Listeners only. To know about basic of jmeter see my this page. And, the process to install plug in , see this post.

What is PerfMon plugins? It is a server monitor plugin , where we can check the health of the server from jmeter while running. The supported list is here. And we can test on web server that we are generating load on as well as remote servers where our remote agents are running.
So, by the objective of the plug in, we clearly understand there will be two component. One is, jmeter listener which will be running with jmeter. And another one will be on the server, which will send info to jmeter listener about the server.
From this download link, download server plugins(currently version 2.2.1), and install plugins to jemter.

-After download the server agent on server, and run startAgent.bat in windows or startAgent.sh in Linux server. It will open UDP/TCP server ports where jmeter will communicate.

-Now, we have to add jp@gc - PerfMon Metrics Collector  this listener in our jmeter test plan. (controller PC, where we are running jmeter)

-Select jp@gc - PerfMon Metrics Collector and click add a row
-In a row, we have to add server IP/address( where the server agent is present),Port number, the information that we want (CPU/memory) from a selectable comb and a metric parameter. So, here is a generic screenshot.

So, now we can run, our test and see the log file. I have used a sample dummy sampler(not real test) to get some viewable report.
Running screen shot1
Running screen shot2


Metric parameter:
Metric parameter are sub type or options under main metric controller. It is basically a string constructor that goes as parameter. It helps for making understandable metrics as well as helps to get specific info that we need. So, for Nine type of metric controllers we have nine metric parameters. Screenshots are here.
1. Metric parameter-CPU
2. Metric parameter-Memory
3. Metric parameter-Disk IO 
4. Metric parameter-Network IO
5. Metric parameter-Swap 
6. Metric parameter-TCP
7. Metric parameter-JMX 
8. Metric parameter-EXEC
9. Metric parameter-TAIL

Agent Tweaking :
1. We can enable or disable any port by shell command. Port 0 for disabled. We have to run our startAgent.sh/bat in following manner 
Syntax : $ ./startAgent.sh --<ProtocallPort> <port number>
Ex : To enable UDP at port 5000 : we need to run this in command prompt.
$ ./startAgent.sh --udp-port 5000
Or, to disable TCP port
$ ./startAgent.sh --tco-port 0

2. We can Auto Shutdown agent after test completion
Syntax : $ ./startAgent.sh --<ProtocallPort> <port number> --auto-shoutdown
 EX- $ ./startAgent.sh --udp-port 5000 --auto-shutdown

3. We can use system Info showing for system object while running, 
$ ./startAgent.sh --sysinfo

Notes : 
-No Need Admin privilege in the server
-Server agent needs JRE 1.4+ version. So, you need that installed in server.(or you can add jre package inside the folder. In that case, you have to edit bat file)
-We can use multiple servers. To do that , multiple server should have the agent.

Agent Extension : Following this interface kg.apc.perfmon.client.Transport , we can use this plug in for other software using, like custom performance monitor. I will make a separate post on how can we make a class on JAVA to use this plugin for getting information.

Thanks...:)...

2013-05-23

Function Helper in Jmeter

In this article we are going to see function helper of jmeter. As we know, we use jmeter function to get various information for using as data while testing and we use this format {$__functionName(parameter1, parameter 2, ...)} to use them

So, what is Function Helper? It's simple an UI that helps to understand the functions and provide the variable string directly usable in the jmeter scripts. To start Function Helper, we need to
open jmeter  > Click Options > click Function Helper Dialog.


And we will get this UI.
 

The working is simple,
Step1: Select a function from drop down
Step2: Insert value according the description of the paramter
Step 3: Click Generate and we will get formatted string used in jmeter script.
If we need multiple variables, we can add or delete( depends on which function we use)

Thanks..:)