You are on page 1of 41

Day3 Session

Questionnaire?
1.What are the important resources to be considered before
conducting a load test?
2.What is the peak load a machine can with stand?
3.Why should we distribute load ?
4.What is Soak test?
5.What is a Web-Service?
6.List some Statistical Metrics.
Agenda
• Load-Distribution
• Purpose
• Pre-requisites
• Process
• Adding a Plug-in
• Protocols in Jmeter
• JDBC
• SOAP
• LDAP
• Listeners
• Results and Analysis
Load Distribution:
Purpose:
Load Distribution is the process of controlling load
generator machines centrally .It generates load in more
realistic manner and also give back accurate test results.
Pre-requisites:
For load distribution
• Ensure that Jmeter installed in the systems is of same
version.
• The firewall on both “Master” and “Slave” systems
should be disabled.
Architecture
Process :
Slave Machine:
• Go to Jmeter > bin directory and run jmeter-server.bat
• Open jmeter-server.bat and search for “START rmiregistry”
Replace rmiregistry with C:\j2sdk1.4.2\jre\bin\rmiregistry.

Example: “START C:\j2sdk1.4.2\jre\bin\rmiregistry”.

Master Machine:
• Open Jmeter>bin>jmeter.properties file.
• Replace “remote hosts=127.0.0.1” with the IP address of
slave machine.
(For eg:172.26.3.213,172.26.2.144).
Adding plug-in
Plug-ins incorporate the feature of extensibility in the tool. To
Enhance the functionality of the tool, add the readily available
.jar files to D:\Jmeter\lib or D:\Jmeter\lib\ext as per the
requirement.

Customization:
Download Jmeter’s source version to get the source code.
Required tool customization can be done by this.
Protocols

Apart from HTTP and HTTPS Jmeter supports wide range


of protocols viz JDBC ,SOAP ,LDAP .In Jmeter
terminology a protocol is represented by “Sampler”.
Some Of them are:-
• JDBC
• SOAP
• LDAP
JDBC

Pre-requisites:
• To use MySQL driver, its .jar file should be copied to
the JMeter lib directory.
• Create a database and insert data into tables.
JDBC
Process:
JDBC Sampler
1) Create a basic test plan to test a database server.
2) Add users to the thread group.
3) Right click on Thread Group>Add>Sampler>JDBC Request.
4) Right click on Thread group>Add>Configuration Element> JDBC
Connection Configuration.
Click on JDBC Request and give the variable name as ‘MySQL’
Select a query type
Enter the appropriate Query in the Query Field. For Example Enter ‘Select
* from table name’.
JDBC
Connection Configuration:
Click on JDBC Connection Configuration and give the following
details
Variable name : MySQL (this is the same name given in
the variable name of JDBC Request).
Database URL : [jdbc]:[database type]://[hostname:
port]/[database name]i.e.
jdbc:mysql://127.0.0.1:8080/application.
JDBC Driver class: com.mysql.jdbc.Driver
Username: root ( Default user name of MySql)
Password: mysql (Default password of MySql)
Simple JDBC Result
Web-Service
What is a Web Service?
• Web Service is a software system designed to support
interoperable Machine to Machine interaction over a
Network.
• It is based on already existing and well-known HTTP
protocol.
• It refers to clients and servers that communicate using
XML messages that follow the SOAP standard.
Web-Service(SOAP)Request
Pre-Requisites:

• The sampler requires mail.jar and activation.jar. This is


because Apache SOAP requires these libraries.
• An application server running behind.
• A Web Service deployed on the application server.
• A WSDL URL to test
Process:
i) Write the functionality in java (or any other)
ii) Write build file in xml
iii) Start application server (JBoss).
iv) Deploy java files using ant
v) Web service created successfully
vi) Send SOAP request
vii) Receive SOAP response
Note:
Here is a Calculator Web service deployed in JBoss Appserver,
with methods add() and subtract () is being tested using
JMETER. We use Jmeter to send the SOAP request, the
methods of Web service in the Appserver process the SOAP
request and response obtained is seen in JMETER.
SOAP Sampler

a) Go to JBoss run.bat file to start the application server.


In the Internet Explorer type :
http://localhost:8080 to view the home page of JBoss.
http://localhost:8080/jbossws/services to view list of web-
services.
b)In Jmeter go to:
Thread Group->Add->Sampler->Web Service (SOAP)
Request to add Sampler.
c)Copy the URL into WSDL URL column of JMETER and
press Load WSDL.
SOAP Request Schema:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://webservice1/">
<soapenv:Header> </soapenv:Header>
<soapenv:Body>
<web:subtract> invoking subtract method

<arg0>5000</arg0> arguments passed


<arg1>3000</arg1>
</web:subtract>
</soapenv:Body>
</soapenv:EnvelopeData in the SOAP/XML-RPC Data column
SOAP Response Schema:
<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Header></env:Header>
<env:Body>
<web:subtractResponsexmlns:web='http://webservice1/'>
<return>2000</return> SOAP response
</web:subtractResponse>
</env:Body>
</env:Envelope>
Simple SOAP Result
LDAP
• The Lightweight Directory Access Protocol, or LDAP is an
application protocol for querying and modifying directory
services running over TCP/IP.
• A client starts an LDAP session by connecting to an LDAP
server, by default on TCP port 389. The client then sends an
operation request to the server, and the server sends responses
in turn.
Examples:
• Centralized up-to-date phone book in an organization.
• Printers connected over network.
There are four test scenarios of testing LDAP.
 Add Test
 This will add a pre-defined entry in the LDAP Server and calculate the
execution time.
 Modify Test
 This will create a pre-defined entry first, then will modify the created entry
in the LDAP Server. And calculate the execution time.
 Search Test
 This will create the entry first, then will search if the attributes are
available. It calculates the execution time of the search query..
 Delete Test
 This will create a pre-defined entry first, then it will be deleted from the
LDAP Server. The execution time is calculated.
Listeners
A listener is a component that shows the results of the samples.
The results can be shown in the form of a tree, tables, graphs
or simply written to a log file.

Types of listeners:
• Graph Results
• View Results Tree
• View Results in a Table
• Summary Report
• Aggregate Graph
• Aggregate Report
Graph Results listener:

It generates a simple graph that plots all sample times. The


throughput number represents actual number of
requests/minute the server handled + delays added to test and
JMeter's own internal processing time.

It includes:
• Data - plot the actual data values
• Average - plot the Average
• Median - plot the Median (midway value)
• Deviation - plot the Standard Deviation
• Throughput - plot the number of samples per unit of time
Graph Results
View Results Tree:
It is a tree of all sample responses, the time a sample took to
get this response and some response codes.
Request panel only shows the headers added by Jmeter.

View Results in a Table:


This visualizer creates a row for every sample result.

Summary Report:
The summary report creates a table row for each differently
named request in your test. This is similar to the Aggregate
Graph, except that it uses less memory.
View Results Tree:
View Results In a Table:
Summary Report:
Aggregate report :
Creates a table row for each differently named request in the
test. For each request, it totals the response information and
provides request count, min, max, average, error rate,
approximate throughput (request/second) and Kilobytes per
second throughput.

Aggregate graph :
Is similar to the aggregate report and provides an easy way to
generate bar graphs and save the graph.
Aggregate Report
Aggregate Graph
Results and Analysis
Factors involved:
• Throughput
• Response Time
• Latency
• Tuning
• Benchmarking
• Capacity Planning
Throughput:
It determines the capability of a system or product in
handling multiple transactions.
i.e Number of Requests or Business transactions processed
per unit time.
Response Time:
Is defined as the time elapsed between the point of Request
and the first Response from the product.
Note:- Not all the delay that happens between the Request
-Response Round-Trip is caused by the product.
Latency:
Is the delay caused by the application ,Operating system and
by the environment that are calculated separately.

N1 A1 N2
Data
Base
clien Web
Inte A2
t Serve
rnet Server
r
N4 N3
A3

Network Latency = N1+N2=N3+N4


Product Latency = A1+A2+A3
Actual Response Time =Network Latency + Product Latency
Tuning:
Is a method by which product performance is enhanced by
setting different values to the parameters of the Product ,O.S
and other components.
Benchmarking:
Comparing various parameters of the product(e.g. response
time , throughput etc) with those of competitive products.
Capacity Planning:
Exercise to find out what resources and configurations are
needed prior to installation or upgrade of the product.
Analyzing test results

This involves
• Calculating the mean of test result data
• Calculating the standard deviation
• 90% line
• Differentiating the performance data when the resources are
available completely as against when some background
activities were going on.
Mean:
Sum of the samples divided by the number of samples.
Performance numbers are to be reproducible . To ensure this,
all performance tests are repeated multiple times and the
average or mean is taken.

Some special cases:


a)Noise Removal and Re-plotting and re- calculating mean,
standard deviation.
b)Differentiating data that is coming from Cache and Server.
Standard Deviation:
Standard Deviation represents how much data varies from the
mean.
S.D shows how consistently are the performance numbers
reproducible.
90% Graph:
Percentage of transactions that were performed with in a given
time range.
e.g. say if the graph shows 90 percentile against 4.5 sec means
90 percentage of the times your transaction is served within 4.5
sec.
References:
http://jakarta.apache.org/

Download Jakarta 2.3.2 from


http://jakarta.apache.org/site/news/news-2008- q2.html#20080614.1.
Queries…?