Wednesday, 20 November 2013

Load test on sql server using JMeter.

Steps to put load on Sql Server 2005/2008 using JMeter.

Pre-requisites:
  • Download Jmeter 2.8 and above
  • Download JMeterPlugins.jar and copy it to apache-jmeter-<version number>\lib\ext.
  • Precheck ojdbc-11.2.0.3.jar file in lib folder.
NOTE: Operating system used to run JMeter was Windows XP

Steps:
  • Go to bin folder. (inside JMeter installed/unzipped folder)
  • Open jmeter.bat file.
  • Right click on Test Plan ans navigate till Add -> Threads(Users) -> Thread Group. Click on Thread Group.

  • Again do right click on Test Plan ans navigate till Add -> Threads(Users) -> jp@gc - Ultimate Thread Group. Click on jp@gc - Ultimate Thread Group.
 
  •  Click on jp@gc - Ultimate Thread Group and change Start Thread Count and Hold Load For, Sec to 60
  • Right click on jp@gc - Ultimate Thread Group and select JDBC Request as show below.

 
  • Go to JDBC Request page.
  • Select Variable Name as BI.
  • Select Query Type as Select Statement from drop down list.
  • Mention your query in Query section you want to execute to put load on sql server.
  • Right click on jp@gc - Ultimate Thread Group and select JDBC Connection Configuration as show below. 
 

  • Go to DBC Connection Configuration page.
  • Select Variable Name as BI
  • Change Max Number Of Connections as per your requirement.
  • Keep default configuration at all places except Database COnnection Configuration.
    • In Database COnnection Configuration, do the changes as below:
      • Database URL: jdbc:sqlserver://<IP of machine where sql server instance is running>:<sql server port number>;instanceName=<hostname/computer name>;databaseName=<database name where you want to execute the query>
      • JDBC Driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver
      • Username: sa
      • Password: <sa password>
  • Add Listeners like Summary Report and View result Tree as show below.
 
 
Here we are done with jmx file configuration. Now start the JMeter and it will start pushing load on sql server.
 
Hope this blog will help users who wish to do load testing on sql servers.