Monday 26 January 2015

Database Performance Testing Using Jmeter

Hi friends, this is my second post in Jmeter and in this post I'm gonna explain you how to test database using Jmeter and for that i will be using MySql database.

Step 1: Download MySql Java Connector 5.1.34 from the URL:http://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.34.

Step 2: Once download is complete then copy mysql-connector-java-5.1.34.jar into lib folder of Apache jmeter.


Step 3: Start Jmeter and right click on Test Plan and add Thread Group and give any value you want to give, I'm going to give value as 20.


Step 4 : Right click on Thread Group and add 'JDBC Connection Configuration' element and your element should look like this.


in the above image if you could see database URL:jdbc:mysql://localhost:3306:/forjmeter so here 3306 is port number of mysql and 'forjmeter' is the name of the database and make sure you have created 'forjmeter' database and also created table and inserted some values into table and you can change these things accordingly.

Step 5: Right click on Thread Group and add 'JDBC Request' and after adding write a query to fetch data from database as shown below and please make sure that Variable name is same in JDBC Request and JDBC Connection Configuration elements.


Step 6: Right click on Thread Group and add few listeners and I'm going to add three listeners.


Step 7: Now save the script and click on Start symbol to run the script.


So see 'View Result Tree' all are in green color it means it's a pass and also see 'Graph Results' in that Throughput is quite high so it means database is responding well.:)

Well, This is how you can test database performance using Jmeter and please write different scripts by changing elements to test your database.cheers


No comments:

Post a Comment