This blog post is just a start at documenting some of my experiences with jmeter. As far as load testing tools go, jmeter looks the most promising to me. It has an active community, supports many different databases and looks quite flexible as far as architecting different work loads goes.
The flexibility of jmeter also makes it hard to use. One can use jmeter for many other things besides databases so the initial set up is a bit oblique and there look to be many paths to similar results. As such, my understand and method for doing things will probably change considerably as I start to use jmeter more and more.
I’m installing it on a mac and using RDS instances.
brew install jmeter
Database Driver download (I’m using the following)
Created a test table
Startup up jmeter
$ which jmeter /usr/local/bin/jmeter $ jmeter Writing log file to: /Users/kylelf/jmeter.log
brings up a graphic window
Add your path to the database drivers at the bottom of the screen by clicking “Browse …” and going to your driver file and selecting it.
We are going to create the following (minimum setup for an example)
(right click on “Test Plan”)
Define how many connections to make and how many loops to make of the workload
interesting parts here are
Define what database to connect to
For Oracle make sure and change “Select 1″ to “Select 1 from dual” or you’ll get non-obvious error.
Name the pool. For example I call mine “orapool”
and fill out all the connection information
Define a SQL statement to run
Make sure and include the name of the thread pool created above. In my case it’s called “orapool”
add a SQL statement to run
create a widget to see the output
run your load and look at the output
Then click on “View Results Tree” to see the output.
I clicked on “View Results Tree” and then clicked on “JDBC Request” in red.
Then I’ll see some output. I choose “Response data” because it’s a bit more succinct and see the error. In this case there is an extra space ” ” at the end of “oracle.jdbc.OracleDriver “. Jmeter is sensitive to spaces. I’ve gotten a lot of errors because of spaces in fields such as variable names and such.
Correcting that it runs
All the setup might sound like a bit of a pain but once it’s set up, it’s easy to click through and make modifications.
All the setup is available in a text .jmx file and if you are brave you can edit directly there.
Look for “my” and replace
The above example is more or less pointless – sort of a “Hello World”.
From here though you can increase the number of threads, increase the number of loops, add more SQL statements.
Jmeter allows a lot of customization so you can add .cvs files for input values, capture output values into variables and use them in input values, have different types of loops with different users running concurrently etc.
More to come.
Christian Antognini gave a presentation at Oaktable World SF in Sept 2016. He was gracious enough to send along his functionally rich .jmx file and I’ll blog on that soon.