I have had a lot of success using JMeter to provide quick performance tests, and this guide will help you get started with JMeter. I have used JMeter with success on web applications, web services and databases, and I find that it works extremely well. I have even used JMeter on .NET projects. This doesn't cover performance testing best practices. I will save those for another post.
Download and install the Java SDK
- Download the SDK from Oracle here (Note: Recommend Java SE 6 update 27. I've had issues with update 29)
- Run the installer. Take note of the install location
- Add $java_install_dir/bin/ to your system path
Install JMeter
- Download JMeter from Apache's website: http://jmeter.apache.org/download_jmeter.cgi
- Unzip to a location on your machine.
- Add $jmeter_install_dir/bin to your path (Note: if you are using Windows, then I recommend just creating a shortcut to $jmeter_install_dir/bin/jmeter.bat)
- Run the bin/jmeter command and you should see JMeter open a window.
Recording a Script
The following instructions will setup JMeter to record a performance script that you can use for replay. This is the fastest way of setting up a performance test script.
- Right-click on Test Plan and then select Add > Threads (Users) > and Create a ThreadGroup
- Right-click on the Workbench then select Add > Non-Test Elements > HTTP Proxy Server
- Set the Target Controller to "Test Plan > Thread Group"
- Set the Grouping to "Store 1st sampler of each group only"
- Add Exclusions
- Change Port (Optional)
- Start the Proxy Server
- Click the Start button on the Http Proxy Server
- Update IE to use a Proxy Server
- Internet Options
- Connections Tab
- LAN Settings
- Click 'User Proxy Server'
- Enter localhost and port.
- Click OK and OK.
- Start clicking through your application (make sure JMeter is recording your clicks)
- Save the recording.
Adding Listeners
JMeter uses listeners to record the results of the performance test. Take a look at the various types of listeners here and add one by right clicking on the Thread Group and adding a Listener there.
Running a Performance Test
Once your script is recorded and you have added listeners, make sure you save your script. Now you can run it!
- Open up the ThreadGroup node and make the following changes:
- Change the Number of Threads to the number of concurrent users you would like to run in the performance test.
- Change the Ramp-up Period to the number of seconds it takes for all the users to start.
- In the menu, click Run, Start.
- Sit back and watch JMeter ramp up!
Final Thoughts
This post is intended to get you started with a simple JMeter performance test. I also only focused on using JMeter to performance test a web application. JMeter can performance test web apps, databases, JMS servers, email servers, LDAP servers, web services, and much more. I recommend taking a look at JMeter's manual, available here.
Share this: