Load Testing with Apache JMeter | Remote Testing
The Third Application
The final application that we’ll test is a mixture of the two others, it’s a browser application using Struts to invoke the DVD web service system we have just tested. The response times will therefore be higher than times from the first two applications. Again we’ll test with a single thread and we’ll loop 100 times. The results are these:
Not a big surprise. The numbers are somewhat higher than the web service application. The test setup is a bit artificial. There’s only one user, so the numbers are the best (lowest) that can be expected. But what happens if we put 30, 50 or 100 users on the applications? Let’s finish by looking a bit into this rather complex area.
If you want to get realistic numbers for a load test then it’s important that the computer where JMeter runs has enough power to handle sending requests and receiving responses at the speed you’ve specified. You shouldn’t therefore run JMeter on the same computer as the web server, as we’ve been doing in this article. Even when JMeter is running on its own computer, there might not be sufficient resources. A good indicator of whether or not the JMeter computer is powerful enough is to watch it’s cpu usage. If it goes near 100% then you will probably not get accurate results.
One thing that’ll slow JMeter down is if you have many listeners active. Use only a simple listener like the Aggregate Report listener or write the responses to a file. All of the listeners have a field where you may enter the name of a file to record to. Later, when you want to see the results from your recording file, you simply enter its name in any of the listeners "file field" and you’ll get a report shown. This is a nice feature.
JMeter also has a "Batch" mode, or GUI-less mode, where you must give the name of a file containing a test plan and the name of a file to store the results. The format of the command is this:
jmeter –n –t<name_of_test_plan_file> -l<name_of_log_file>
If you don’t want to work without the GUI, you may run JMeter in "Server mode". This is a setup where JMeter is run on two computers. One runs the GUI and the other—the JMeter server—runs the communication to the web server (and to the JMeter client).
Here’s how you setup this configuration (see also JMeter’s User Manual, chapter 10).
On the JMeter Server computer you must first start the "RMI Registry application" that’s part of the JDK. You’ll have to put these three jars in the CLASSPATH first:
Now locate and run the rmiregistry application in the JDK bin directory. No parameters are needed.
Then start JMeter on the same computer:
The "s" indicates that it runs as a server.
On the JMeter client computer you must first enter the IP address of the JMeter Server into the jmeter.properties file found in the bin directory. Locate these lines:
# Remote Hosts - comma delimited remote_hosts=127.0.0.1
Insert the IP number of the JMeter Server instead of 127.0.0.1. You may now start JMeter in the normal GUI mode. You enter your test plan just like you’re used to, but when you’re ready to run, you select Remote Start from the menu:
Again, you should observe the load on the JMeter Server to see that it’s not the bottleneck in your setup.
I haven’t tried it myself, but the User’s Manual mentions that you may run more than one JMeter server from the same JMeter client. This would surely help putting a high load on your web server.