How to Load Test Opening a URL on a Remote Machine with JMeter
Sometimes we need to open a URL on a remote machine, i.e visit a website on a remote machine. This can be useful when we want to load test a view counter that counts unique users to a website from unique IPs, or download the counter to a website. Of course, this task can be accomplished with Apache JMeter™. We just need to have access to one Master machine and one or more Slave machines that have JMeter downloaded on them.
The JMeter GUI will be run from the Master. This machine will control the test. The JMeter Servers will be run from the Slaves. These machines will receive commands from the Master machine and send requests to the necessary URL.
The tested website is the target URL across the web. In our case it will be the BlazeDemo website (http://blazedemo.com/).
Let’s set up the proper configuration to accomplish this task.
Setting Up the Software
1. Check your machines’ Java version. All machines should have the same version of Java.
2. Make sure all machines have the same JMeter version. In my case, all of the machines have the 3.2 version of JMeter.
3. Check your firewall settings. The JMeter/RMI (Remote Method Invocation) port should be opened on all machines, port 1099 by default.
4. Start the JMeter server on the Slave machine. To do that, run the following command in the terminal from JMeter’s bin folder:
The output of this command should be a message similar to:
This means the server is started and ready to work, where XXX.XX.XX.XX is the slave ip.
5. Update the remote hosts list on the Master machine. To do that, open the jmeter.properties file, which is located in JMeter’s bin folder, with your favorite text editor. Find the remote_hosts option and update it with the slave ip.
6. Start JMeter on the Master machine and make sure the slave ip is presented in the menu.
Run -> Remote Start -> XXX.XX.XX.XX
Creating a JMeter Script to Open a URL on a Remote Machine
7. Add a Thread Group to the Test plan.
Test plan -> Add -> Thread (Users) -> Thread Group
8. Add an HTTP Request that opens the necessary URL.
Thread Group -> Add -> Sampler -> HTTP Request
Set the following value:
- Server name or IP: blazedemo.com
9. Add a View Results Tree listener to the Thread Group.
Thread Group -> Add -> Listener -> View Results Tree
10. Run the script on the remote machine.
Run -> Remote Start -> XXX.XX.XX.XX
11. Check the results of the test in the listener.
As we can see, the request passed. But we can’t actually see the response data of the request in the listener. This is because of the sample sending mode when remote testing. The default sample sending mode is StrippedBatch. StrippedBatch removes the response data from successful samples.
Viewing Response Data
To view the response data in the listener, we need to change the JMeter mode to Standard. The Standard mode sends response data from all samples synchronously.
12. Start JMeter in Standard mode on the Master machine. Nothing needs to be done on the Slave Machines.
Flag -J is responsible for sample sending mode.
13. Run the script on the remote machine and check the results.
The request passed and the results are shown in the listener. We can see that the website was loaded successfully.
That’s it! You now know how to performance test opening a URL on a remote machine with JMeter. I hope this blog post helps you solve some of your problems.
I also suggest you read another awesome blog post about distributed testing in JMeter. It will help give you a better understanding of using remote machines.
Learn more advanced JMeter capabilities from our free JMeter academy.
You might also find these useful:
Interested in writing for our Blog? Send us a pitch!