Hope you are doing well !!
As we all may know basics of JMeter, Now it’s time to learn something new or advanced in JMeter so in this blog, we are covering some advanced topics in JMeter so let’s start…
What is Distributed Mode in JMeter ?
- Distributed Testing is a kind of testing which use multiple systems to perform Testing
- It is applied for testing websites and server applications when they are working with multiple clients simultaneously
Distributes Testing uses the Client-Server Model as the Figure below :
- Master : The system running JMeter GUI, control each slave
- Slave : The system running JMeter-server, receive a command from the master and send a request to a server under test.
- Target : The web server under test, get a request from slaves.
How to Configure & Run Test in JMeter Distributed Mode :
- Open slave systems, go to jmeter/bin directory and execute file “jmeter-server.bat”
Assume that a slave machine has IP address: 188.8.131.52 On windows, we should see a window appear like the
following figure :
2. On the master systems, go to /bin directory and edit file jmeter.properties, search “remote_hosts” and add IP slave machine as below
3. On the master machine, run JMeter GUI and open the test plan which we want to use
4. For starting the test for a single client, Click Run on the menu bar then select Remote start -> select the IP address of the slave machine
5. For starting the test for all client, Click Run on the menu bar then select Remote Start All
6. we can see the test results in the JMeter (master) once test execution finishes
Distributed Mode Limitations :
- RMI cannot communicate across subnets without a proxy; therefore neither can JMeter without a proxy.
- Since version 2.9, JMeter sends all the test results stripping Response data to the controlling console, this allows us to reduce impact on network IO. Ensure you monitor your network traffic so that this traffic does not incur contention
- A single JMeter client running on a 2-3 GHz CPU (recent CPU) can handle 1000-2000 threads depending on the type of test.
API Testing in JMeter :
- Application Programming Interface (API) allows one software to interact with another software. It is a messenger that takes a request from one system to another system, provides the requirements, and gets the response back to the requesting system.
- API acts as a messenger between two systems.
For example, when you visit a restaurant, the waiter serves as the middleman who takes your order from the menu and serves it from the kitchen. Here, the waiter is the API that takes the request from system A (Customer). Then, go to system B (Kitchen) and tell system B what system A wants. Finally, it takes the expected response of the request and carries it back to system A.
API Testing in JMeter :
- Firstly, We have to start JMeter and select the Test Plan.
- Next, Right click on the Test Plan and Add a Thread Group.
- Then We have to add HTTP Request and enter the Server name or IP of the API and set the Path and Parameters.
Right click on Thread Group > Select Sampler > Add HTTP Request
- Next, We need to search the REST APIs that are freely available on the internet. Copy the Server Name, Path, and Parameters for that particular API.
- Copy the values in the HTTP Request of JMeter Test Plan.
- Now, add a Listener to view the results of your Test.
Right click on HTTP Request > Select Listeners > Add View Results Tree or View Results in Table
- The final step is to just Run your Test Plan. We can increase the number of Threads in order to increase the Load on the API. The Test Result will show the Request and Response tab for the HTTP Request.
I hope you enjoyed it and it helped you !!