Browse DevX
Sign up for e-mail newsletters from DevX


Load Testing with Apache JMeter : Page 3

Got a handle on how much your Website can handle? Use Apache's new Jmeter to perform fast, easy load testing on your Web pages, Web applications, and databases.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Applying a Load

Figure 5. Apply a larger load to the thread.

Now that youve verified that you can pull up our files, its time to expand the range covered by the test. Firstly, change the numbers in the Tthread Ggroup. Figure 5shows 50 threads that will ramp-up at five a second for ten seconds. A Loop Count of 12 is also specified—for a total of 600 requests (50 threads X 12 loops).

Right now, JMeter tries to hit the server with as many requests as it can, as fast as it can (after the ramp up period). This load is not very realistic. You can space the threads out a little more by adding a timer. To do this, right click on the thread group and select Add->Timer->Gaussian Random Timer. Set the values to those displayed in Figure 6.

Figure 6. The Gaussian Random Timer simulates the timing between hits more realistically.

This will delay the threads somewhere between three seconds (the constant delay) and four seconds (the constant delay plus the deviation) per request.

You can view your data in graph form by adding a Graph Results listener. Right click on each of your thread groups and select Add->Listener->Graph Results.

Before you run your tests, clear the data from the last test run. Click on Run in the top Menu and then click on Clear All (or do a Ctrl-E). Also, click on the Test Plan in the left pane and select the "Run each Thread Group separately." Now, run the tests again and click on the graph results for the Small File Thread Group while they are running.

Looking at the Data
The first thing you should notice is that there is a green square that appears in the upper right corner of the window. This indicates that the tests are running.

Data points should appear on the screen while the tests are running. After running the tests on the Apache Tomcat Web server, on an AMD AthlonTM XP 2000+ 1.66GHZ processor with 512MB of system memory, our collected data was as follows:

<![if !supportEmptyParas]> <![endif]>

Average (ms)

Median (ms)

Throughput (requests/minute)

Deviation (ms)

Small File (~50K)





Large File (~250K)





So, on average, a file that was five times larger took about 2 times longer to serve under the same load.

A Few Things to Keep in Mind
Make sure you run your performance tests before and after any optimizations are made to determine whether you have in fact made any improvement. If you have a Web application that you are testing and your code changes didn't make any improvement, revert to what you had originally. Many times, performance optimizations make your code ugly. It is usually not good to hang on to changes that make your code harder to read when those changes didn't make any significant improvement on your performance.

Another thing to keep in mind is that there are a number of variables that affect the performance of an application. Every little factor from processor speed and amount of RAM to the Web server version can make a huge difference in your performance analysis. Running performance tests in a development environment that differs from your production environment can often be a misleading and misdirected effort.

Another point of concern is network latency, which will occur if you're testing against a remote server. If you have a staging server that you use for testing purposes, you can run JMeter against that server from a remote network in order to see how network latency might affect your application. You may also want to use the built-in scheduler feature to run your remote tests at different times of the day to account for varying network latency.

Javid Jamae is the president of Jamae Consulting, a software development and consulting firm that provides business, training, and development services to large and small companies. You can contact Javid at javid.jamae@jamaeconsulting.com.
Thanks for your registration, follow us on our social networks to keep up-to-date