Bootstrap FreeKB - JMeter - Create a test plan to test a database (JDBC)
JMeter - Create a test plan to test a database (JDBC)

Updated:   |  JMeter articles

This assumes you have downloaded and installed JMeter.

Meter is run by issuing this command. JMeter provides both a GUI and a command line interface. These commands will open the JMeter GUI.

# Windows
{jmeter_install_root}/bin/jmeter.bat

# Linux
{jmeter_install_root}/bin/jmeter


It definitely makes sense to first run the JMeter GUI to build your test plan and then you can go with the command line once you have your test plan files ready. When you first launch JMeter, you should get a view like this.

 

TEST PLAN - .jmx file

Let's say you want to test the performance your SQL database. You can use JMeter to simulate a bunch of users quering the database to see how well the database is able to respond to a bunch of requests. For example, let's say you want to see how the database holds up when 60 users submit a query. 

To perform this test, you need to create what is called a "test plan". A test plan is actually nothing more than an XML file with the .jmx extension, such as example.jmx. 

 

Define how much traffic you are going to simulate (Thread Group)

In the left panel of the JMeter GUI, right-click on Test Plan and select Add Threads (users) > Thread Group. In this example, 60 requests (threads) will be submitted with a 1 second (ramp up period) delay between each request, and the test will be repeated 1 time (loop count).

 

Define the database being tested

In the left panel of the JMeter GUI, right-click on Thread Group and select Add > Config Element JDBC Connection Configuration. In this example, requests will be targetted to a MySQL database. Be aware that the password cannot be hidden, which is a pretty serious limitation of JMeter.

 

Create a SQL query

In the left panel of the JMeter GUI, right-click on Thread Group and select Add > Sampler > JDBC Request. In this example, everything from the example table will be selected.

 

Save your Test Plan as a .jmx file

Now select File > Save Test Plan as

 

Run the test

You are now ready to run your test plan.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter ebf8f8 in the box below so that we can be sure you are a human.