How to test database performance with jmeter

Tram Ho

I. Reasons for testing database performance.

The performance of a product in software is an important factor. When it comes to performance, most people only hear about performance testing on consumer websites, which are third page pages, CDN pages and plugins. Almost everyone forgets performance testing on Db. If your site is calling stored procedures or complex queries, it can take a long time to process your data. It is important for you to know that checking the performance of the database and the load capacity. One of the open source tools is JMeter that helps you evaluate performance. Please note that I am taking the example of MSSQL Server but you can test any database with JMeter.

Database performance testing is used to identify performance issues before the database is brought to the end user. Database load testing is used to test application databases such as performance, reliability, and usability of user loads. Load testing includes simulating actual user loads for target database applications and is used to determine the behavior of database applications when multiple users are pressing the application at the same time. Database performance testing is used to identify performance issues before deploying database applications to end users. Check database loads used to check for database performance issues. Database application on performance, reliability and scalability using different user loads. Load testing includes simulating actual user loads for target database applications and is used to determine the behavior of database applications when multiple users are pressing the application at the same time. II. Performance and load tests for databases with Jmeter

2.1. Condition

Java 8

Jmeter 5.0

Install Java 8 from the oracle site:

Java SE Development Kit 8 – Downloads

Install JMeter from apache site. https://jmeter.apache.org/download_jmeter.cgi

Step 1: Need to create a demo database

It consists of the basic steps as we initially created the database for the system then created the tables of fields and entered data for the database to stay.

Step 2: Download Mysql connect java

Java 8 JMeter 5.0 Install Java 8 from oracle site: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Install JMeter from apache site. https://jmeter.apache.org/download_jmeter.cgi This file is intended to be used as a third party to provide a bridge between your Jmeter and your databases. And Jmeter is also an open source, thanks to this file, we can easily connect to the database.

Step 3: So you need to copy mysql jdbc library to lib JMeter’s lib folder:

Step 4: Create a plan on Apache-jmeter

Right-click [Thread Group] -> Select [Config Element] → Select [Add JDBC Connection Configuration]

Step 5: Create a connection to My SQL

In the JDBC Connection Configuration, you need to specify all your database connection configurations.

Explain:

[Variable Name for Created pool] will be used in subsequent SQL query requests, so it is important to provide a valid name. This variable name uniquely identifies the connection groups basically the settings you provided in Configuration.

[Max Number of Connections]: You can mention any number depending on your needs. This value opens the number of connections specified in the group at a time. (Example: 1)

[Database URL: jdbc: Database management system: Address to the database / database name to be used

Exactly with this connection source there are 2 types we need to pay attention to:

MySQL: jdbc: mysql: // localhost: 3306 /, where localhost is the name of the server hosting your database, and 3306 is the port number

Java DB: jdbc: derby: testdb; create = true, where testdb is the name of the database to connect to, and create = true instructs the DBMS to create the database.

Select JDBC driver class is: com.jdbc.Drive.class (select depending on the type of database management system you use)

Enter the MySQL username and password.

Step 6: Create a request to MySQL

Enter a variable Name (required and must be the same as the variable Name in the JDBC connection configuration above) Enter the SQL statement to query the database.

Note: Select the correct query type of SQL statement, here my statement is INSERT so I leave the query type as Update Statement.

Step 7: Check the spin results we will return to the old problem product.

Reference link: https://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html?fbclid=IwAR3zB8x5urSvZI2QzJFqre1ttAemSA_XJH-KkkLydkKAm_zY0Rf2fUHGtNI https://medium.com/@ganeshsirsi load-testing-using-jmeter-ms-sql-470045303785

Share the news now

Source : Viblo