DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Trending

  • Guide To Selecting the Right GitOps Tool - Argo CD or Flux CD
  • How To Backup and Restore a PostgreSQL Database
  • The SPACE Framework for Developer Productivity
  • Hyperion Essbase Technical Functionality
  1. DZone
  2. Software Design and Architecture
  3. Performance
  4. Database Performance Testing With Apache JMeter

Database Performance Testing With Apache JMeter

Learn how to construct your database performance testing plan with all the most important elements, including a thread group, JDBC request, and summary report.

Rathnadevi Manivannan user avatar by
Rathnadevi Manivannan
·
Jul. 27, 17 · Tutorial
Like (3)
Save
Tweet
Share
35.14K Views

Join the DZone community and get the full member experience.

Join For Free

Database performance testing is used to identify performance issues before deploying database applications for end users. Database load testing is used to test the database applications for performance, reliability, and scalability using varying user load. Load testing involves simulating real-life user load for the target database applications and is used to determine the behavior of the database applications when multiple users hit the applications simultaneously.

Prerequisites

  • Install Java Development Kit.
  • Install Apache JMeter.

Use Case

Let's perform database load testing to measure the performance of a database using Apache JMeter by configuring MySQL JDBC driver.

Building Database Test Plan

A test plan describes a series of steps to be executed by JMeter on running a database test. To construct a test plan, the following elements are needed:

  • Thread group.
  • JDBC request.
  • Summary report.

Adding Users

The first step involved in creating a JMeter test plan is to add a thread group element. The element provides details about the number of users to be simulated, the frequency of requests to be sent by the users, and the number of requests to be sent by the users.

To add a thread group element, perform the following:

  • In the left pane, right-click Test Plan.
  • Select Add > Threads (Users) > Thread Group.
  • Provide the thread group name as JDBC Users.
  • Click Add to modify the default properties as:
    • No. of Threads (users): 10.
    • Ramp-Up Period (in seconds): 100.
    • Loop Count: 10, as shown in the below diagram:

thread_propertiesNote: The ramp-up period states the time taken to "ramp-up" to the full number of threads chosen. As 10 threads are used in our use case and the ramp-up period is 100 seconds, JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun. The query will be executed for 10 (threads)*10 (loop) = 100 times. Likewise, for 10 tables, the total number of samples is 100.

Adding JDBC Requests

To add a JDBC request, perform the following:

  • In the left pane, right-click Thread Group.
  • Select Add > Config Element > JDBC Connection Configuration.
  • Configure the following details:
    • Variable Name: myDatabase 
      • Note: This name needs to be unique, as it is used by the JDBC Sampler to identify the configuration to be used.
    • Database URL: jdbc:mysql://ipOfTheServer:3306/cloud
    • JDBC Driver class: com.mysql.jdbc.Driver
    • Username: Username of the database.
    • Password: Password for the database username, as shown in the below diagram:

jdbc_connection_configuration

Adding Sampler

To add a sampler, perform the following:

  • In the left pane, right-click Thread Group.
  • Select Add > Sampler > JDBC Request.
  • Provide the following details:
    • Variable Name: myDatabase (same as in the configuration element).
    • Enter the SQL Query string field as shown in the below diagram:

jdbc_request

Adding Listener to View/Store Test Results

A listener is used to store test results of all JDBC requests in a file and present the results.

To view the test results, perform the following:

  • In the left pane, right-click Thread Group.
  • Select Add > Listener > View Results Tree/Summary Report/Graph Results.
  • Save the test plan and click Run (Start or Ctrl + R) to run the test.

All the test results will be stored in the Listener.

Viewing Test Results

We can look at tree view, table view, graph view, and response time graph view.

Tree View

The results can be viewed in tree format, as shown in the below diagram:view_results_tree

Table View

The results can be viewed in table format, as shown in the below diagram:table_view

Graph View

The results can be viewed in graph format, as shown in the below diagram:graph_view

Response Time Graph View

The results can be viewed in graph format, as shown in the below diagram:response_time_graph_view

And that's it! 

Database Apache JMeter Testing Test plan Load testing application Requests Diagram Use case Graph (Unix)

Published at DZone with permission of Rathnadevi Manivannan. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Guide To Selecting the Right GitOps Tool - Argo CD or Flux CD
  • How To Backup and Restore a PostgreSQL Database
  • The SPACE Framework for Developer Productivity
  • Hyperion Essbase Technical Functionality

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: