Professional Documents
Culture Documents
Jmeter
JMeter is a Java based desktop application that can be used for performance testing of different kinds
of client-server applications like websites, web services, databases, FTP servers etc. It is an open source
tool provided by Apache without licensing cost.
The following types of applications that can be tested by Jmeter
Websites - HTTP and HTTPS
Web Services - REST and SOAP
Database Servers
FTP Servers
LDAP Servers
Mail Servers - SMTP, POP3, IMAP
Shell Scripts
TCP Servers
JMeter simulates a group of users sending requests to a target server, and return statistics that show
the performance/functionality of the target server / application via tables, graphs etc.
Advantages of JMeter
1.Free of cost- It is an open source product with zero licensing cost.
2.Can load test different kinds of- It can be used for performance testing of all kinds of applications
ranging from - Web applications, web services, database, LDAP, shell scripts etc.
3.Platform independent- As JMeter is 100% Java based, so it is platform independent and can run in
multiple platforms.4.Record and Playback feature- JMeter provides record and playback option along
with drag and drop feature which makes it easier and faster to create scripts.
5.Customizable- Since JMeter is open source, developers can customize its source code as per their
specific requirements.
6.Supports distributed load testing- JMeter supports distributed load testing feature in which we can
create master-slave setup for carrying out load test on multiple machines.
7.Good community support- JMeter has many online tutorials and helping community support. It also
has freely available plugins that help in different aspects of script creation and analysis.
Note : To run Jmeter in your machine you should installed java/JDk in your machine.
Note : Based on your machine bit , you have to download the java(jdk) from oracle website.
Following are the steps on how to install Java in Windows for JDK 8 free download for Windows 64
bit and installation.
Step :1 : Download JDK from oracle website(Refer above SC).
Step 2: To download any software from oracle it is required to sign in to oracle website. If you don’t
have the access to oracle then you have create the user name and password for login.
Performance Testing by Madhu Reddy
Step 5: After the downloading the JDK, run the exe for install JDK. Click Next .
Step 6: Select the PATH to install Java in Windows… You can leave it Default. Click next.
Step 4: Click on environment variables button as shown in the above SC. Then the following pop
window you can see.
Performance Testing by Madhu Reddy
Strep 5: Click on New button and provide variable name and path like below.
Finally click on OK button. This is how will set the environment variable for Java.
Note: Now how to verify this ?
Open cmd in your machine . check java version . In the termoinal/command line you are able to see
the java version is you successfully configured the path. Refer below SC.
Note : Like java , you have to set the environment variable for jmeter as well.
8. Report preparation.
Proof Of Concept(POC) : As part of POC, I will try to understand the application architecture, what
kind of application is this? Which technology they used to develop this application. Which
communication mechanism they used to develop this application and complexity of the application. I
will try to identify which tool is compatible for this application, if it is Jmeter or load runner which
protocol is compatible for this application, whether it is a single/multiple protocols. As part of POC, I
am going to record simple business scenarios, execute with minimal users & report the response times
to the client by preparing the PPT. Based on the POC, Client has to understand which tool he
supposed to buy, which protocol we supposed to buy.
Outcomes : You can finalize testing tool and protocol for testing.
Requirements Gathering: Being a performance tester we have to gather the requirements with the
help of Business Analyst or from the stack holder/client. As part of the requirement we have to
gather like what are the critical business transaction (CBTs) , What Is the response time for each and
every transaction / request , no of transactions per hour, TPS,throughput , How much load we have
to apply on the application , What kind of testings we have to trigger/perform on the client
application, and also we have to gather the resource utilizations thread should stats of the servers like
CPU , memory utilizations.
Once you gather the requirements , you have to get the approval from the client , managers ,
leads ,network team and also from architects .
When ever we don’t have the Service level agreement , at that time we have to trigger the baseline
test to identify the response times of all the requests.
What is your approach to gather NFR, if client doesn’t know anything about performance
testing?
Scenario-1: The Application is in production
If the application is already in production , then we have to get the production logs of that
application using Splunk tool. From the tool we will collect one year historical data. From that data
identify peak month , peak week , peak day and peak hour .Based on the visitors you can identify no.
of users, based on the page views you can identify no. of transactions. Based on the pages you can
identify the CBT’s, based on the IP address we can identify the location/region from where the users
are accessing the application.
Scenario-2: The Application is not in production
If the application is not in production then there are two scenarios . In one scenarios we have get the
competitor statistics and in the second scenario we will get the statistics of the client’s core business.
Get the competitor statistics: Lets assume you have a client . for him you have to prepare the
application related to Byju’s application. So at that time to gather the requirements what we will do
is , using the network traffic utility tools you can gather competitor statistics & identify NFR’s in
terms of peak hours, half peak hours, no. of users, no. of page views from which location they are
accessing the application, which pages mostly access by end users & what are the expected response
times for every page.
Get the stats from the core business: IF your client has the core business. Then we have to get the core
business statistics. Let say your client is selling the vegetables from different places . You have to
understand the requirements clearly like how many people are coming to the stores, how many
Performance Testing by Madhu Reddy
transactions are happening per hour , what is peak hour , how many items the client is selling . These
and all things we have to analyze and also reach out to the Business analyst as well to identify the
requirements.
Scenario-3: The Application is completely new application(Green field/new application)
If it is a completely new application then we have to keep in touch with the business analyst and also
with the stack holder/client.
Outcome : You will gather the requirements (SLA)
Test Plan: Test plan is nothing but it we can consider as road map of test. Test Plan contains objective
of the test, scope, items out of scope, procedure, approach, test data, CBT’s, types of testing,
monitoring, application architecture, tool architecture, deliverables, roles & responsibilities,
environment, risks & migrations, entry criteria, exit criteria, prerequisites & assumption.
Entry Criteria: Whenever the Pre-requisites are satisfied that is called Entry Criteria.
Exit Criteria: Whenever derived statistics are meeting expected statistics that can be considered as
Exit Criteria.
Work Load Model: Work load model is very important for the performance testers why because in this
doc we will include like what are the CBTs,peak hours , scenarios,Load , types of testing and no of
transactions . This is a high level doc. With the help of work load model we will design the scenarios
for the testings .
Scripting : After preparing the work load or the documentation part we will start working on the
scripting using any tool. As part of POC we will finalize the tool. So using the same tool we will
prepare the scripting and we will validate that script to ensure the script is working fine.
Test data Preparation : While preparing and validating the script itself we will identify the test data
is required for the load test. So based on our test requirement we have to identify and then we have
create the test data.
We can create the test data by taking the help either from the dev team or from the functional
testers. In some scenarios from the portal/UI performance tester can create the test data.
Executions : Once the scripting is done and also test data set up is done then we will design the
scenario. Post the scenario design we will execute the testings on the client application.
Analysis : Post the execution phase , what we have to do we have to compare the expected statistics
with the derived statistics. If two are meeting we will publish the report if not we can concentrate to
identify the bottlenecks.
Report preparation : Once the test got complete then we have to prepare the report to publish with
the team and also with the client.
Test Plan : When ever you launched the jmeter by default we can see the test plan as shown in
below screen shot.
Properties:
Name : You can give any meaning full name as a test plan name. In general we will give project name
as a test plan name. For example your project name is facebook. Then we can give test plan name as
Testplan_facebook.
Comments : As a comment you can give any meaning full comment. Lets say you are running perf
test on the build V1.1 . then you can write the comment as “This is the script is prepared for V1.1.”
Performance Testing by Madhu Reddy
User defined variables : Under this area we can mention the user defined variables using “add” button.
Lets say you are creating the user defined variable for url . then
Under name enter the variable name(url) , and enter Value(192.168.1.11) under value. Refer the
below SC.
Run tear down thread groups after shutdown of main threads : Once the test got completed few of
the users are at the middle so we have to instruct the tool saying that either the users has to
complete the total iterations/loop or not.
If you check this option , the test can run till all the users comes to rest. I mean after completing the
iteration only yours can stop to perform their actions.
If you Un check this option , then jmeter can kill the users who ever at the middle of the
iterations/loops.
The following are the few of the commonly used test plan elements
1. Thread Group :Thread Groups are used to simulate virtual users in a performance test. We can
have multiple thread groups simulating different types of operations performed by users on an
application.
2. Sampler : Samplers are the different requests which we can send to the server being tested. JMeter
provides us various samplers like - HTTP, FTP, TCP, JDBC etc request samplers.
3. Logic Controllers : Logic controller allow us to customize the way the Sampler requests is sent to
the server. A common example of Logic Controller is Loop controller which makes a request multiple
times to the server.
4. Timers : Timers are used to halt the test execution for specified duration. Basically we use Timers
to simulate real user wait Time or think time.
5. Assertions :Assertions are used to perform some validations to check the correctness of the response
received from the server.
6. Listeners : Listeners in JMeter are used to save, view and analyze the test results in graphical or
tabular forms.
7. Config elements : Config elements in JMeter are used to configure or modify the sampler requests
made to the server. These elements are added at the same or higher level of the samplers that we
want to configure.
Note : The test plan should have atleast one thread group.
Threads (Users): In general by default we can add three types Threads to the test plan based on our
project requirement. You can see the thread types in the below SC.
1. Thread group 2. setup Thread group 3. Tear down thread group
Performance Testing by Madhu Reddy
Thread Group : Thread group can be used to simulate/generate/create the users/virtual users. Using
the thread group we can apply load on the application which is under test.
With out thread group in a test plan we can not execute the test. So minimum onethread group we
should add to the test plan. Based on our requirement we can add ‘n’ number of thread groups.
How to add thread group: Right click on the test plan , mouse over on add , here we can see the
thread group element. Click on it. Refer below SC.
Name : You can give any meaning name as a name of the thread group.
Lets say you are working on facebook application.And in that application you are working on home
module . Then Name you can give like “Thread_Group_Home”.
Comments : Comments you can give any or you can leave over there . No issue .
Action to be taken after a Sampler Error :
Configurations inside the "Action to be taken after a Sampler Error" block are used to configure the
test for actions performed in case of any sampler error, because of no response from server or any
assertion error-
1. Continue - In case of sampler error the test should continue.
Performance Testing by Madhu Reddy
2. Start Next Thread Loop - The test continues with next thread execution.
3. Stop Thread - The current thread gets stopped in case of error.
4. Stop Test - The thread is stopped gracefully, completing the current sampler request.
5. Stop Test Now - Abrupt stopping of thread in case of any error.
Note : In general we will enable the stop test radio button while debugging the test and will enable
the continue radio button for the load testings.
Thread Properties ; Configurations inside the "Thread Properties" block
1. Number of Threads(users) - The number of virtual users to be simulated. Lets say you have to apply
50 users load on the application under test. What you to do , directly come to this property , here
enter the number 50 . If you want execute the test with 1000 then simply enter 1000.
2. Ramp-up Period(in seconds) - Gradually increasing the load on the application is called Rampup.
The total amount of time taken to get all the thread started.
How to calculate ramp up time :
The client don’t provide the ramp up time. Being the testers we have to decide the ramp up for the
client’s app.
Lats assume you have to trigger the test with 1000 users .
No of users/ threads = 1000
Ramp Up time = no of users X 30 %
= 1000 X 0.3
= 300
So there fore ramp is 300 in sec. So you can give ramp up time as 300 sec in this scenario.
Note : 30 % is the industry standard percentage . Some cases organization to organization the
percentage may vary.
3. Loop Count- This is the count of the number of loop iteration performing a set of
operations defined inside a thread group.
Lets say you to iterate your script for one time then you have to provide loop count as ‘1’ . At that
time what ever the requests has been added to thread group , all those can execute for one time . If
you give loop count as 2 . then all the requests can be execute for 2 times.
4. Loop Count Forever- When checked, it disables or overrides the loop count value and causes the
loop to run infinitely until manually stopped.
5. Delay Thread Creation until needed - This is used to delay the thread creation till a value specified
in this field(in seconds).
Specify Thread life time :
Configurations inside the "Specify Thread life time " block-
1. Duration(seconds) - Duration specifies the duration of the test, once reached the test stops.
Suppose you want to execute your test for 10mints . then calculate the time in sec and provide the
same here at the duration. I mean you have to enter 600 in this scenario.
2. Startup delay(seconds) - On running a Test Script, JMeter will wait for the startup delay specified.
Lets consider one example here , the server is not available now , that is available after one hour but
due to priority task you are planned to go out. Now how to run the test. Simply you enter the time
in seconds here and hit on the play button.
So jmeter, what it will do , it will wait for specified delay time and after this time it will start to
execute the test.
Performance Testing by Madhu Reddy
Note : Set up and tear down thread groups properties are similar as like as thread group.
See below SC.