Distributed Load Testing in JMeter using VirtualBox
Tags: performance, testing, tutorial, webperf
Published: 2021-06-01 18:47:20

<!-- wp:paragraph -->
<p>In this blog article, we are going to use how you can run distributed load testing in JMeter using VirtualBox setup. I have already posted videos about <a href="https://www.youtube.com/watch?v=lORCJtspVJ4" target="_blank" rel="noreferrer noopener">distributed load testing on AWS</a> and <a href="https://qainsights.com/distributed-load-testing-in-jmeter-using-raspberry-pi-400/" target="_blank" rel="noreferrer noopener">Raspberry Pi</a>. You need more than one machine to run the load tests. But in this guide, you will use only your machine and run the JMeter tests by leveraging the VirtualBox software.</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"f9758732"} -->
<h2 class="gb-headline gb-headline-f9758732 gb-headline-text">Why distributed load testing?</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>By using one machine, you may not be able to inject more load to your application under test. If you want to stress test your application, you need more threads. Your system resource utilization will reach its limits, if you are trying to inject more threads.  </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To inject more load, you need to more machines to scale horizontally. JMeter has Master-Worker mode where you can run your tests in server mode.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>You will have one master machine with multiple worker machines; master machine will send the instructions to worker machines. After receiving the instructions, worker machines will execute the test plan as per the design.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you want more load, you need more machines.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here is the video version of this guide:</p>
<!-- /wp:paragraph -->

<!-- wp:embed {"url":"https://youtu.be/WSDMLAEksz4","type":"video","providerNameSlug":"youtube","responsive":true,"align":"center","className":"wp-embed-aspect-16-9 wp-has-aspect-ratio"} -->
<figure class="wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
https://youtu.be/WSDMLAEksz4
</div></figure>
<!-- /wp:embed -->

<!-- wp:heading -->
<h2 id="h-prerequisites">Prerequisites</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Ideally you need multiple machines to setup this master-worker. But for this demo, we are going to make use of VirtualBox to learn the concept of distributed load testing. This set up is not ideal for production usage as we are not using the multiple machines to inject the load.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Following are the prerequisites required:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Oracle VM VirtualBox Manager</li><li>CentOS image (or your favorite Linux distro)</li></ol>
<!-- /wp:list -->

<!-- wp:generateblocks/headline {"uniqueId":"610fb975"} -->
<h2 class="gb-headline gb-headline-610fb975 gb-headline-text">CentOS Image Download</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>To download the CentOS image, visit https://www.osboxes.org/centos/ (direct link), click on the latest version of the image; make sure you are downloading the 64-bit version.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8363,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-6.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-6.png" alt="CentOS Image download" class="wp-image-8363"/></a><figcaption>CentOS Image download</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>To view the credentials, click on Info tab as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8364,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-7.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-7.png" alt="CentOS Image Credentials" class="wp-image-8364"/></a><figcaption>CentOS Image Credentials</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>After downloading the image, extract it using 7z software. After extraction, you will get *.vdi file.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="h-oracle-vm-virtualbox-manager-download">Oracle VM VirtualBox Manager Download</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>To download the VirtualBox, visit https://www.virtualbox.org and click on <strong>Download </strong>button. Using the VirtualBox, you can run multiple guest operating systems locally.</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"1e089b36"} -->
<h2 class="gb-headline gb-headline-1e089b36 gb-headline-text">JMeter Master and Worker Machines Setup</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>Next step is to setup two machines (JMeter Master and JMeter Worker) in VirtualBox using the CentOS image.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>First, let us create the CentOS base image, from which we are going to clone it for two machines.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Launch <strong>VirtualBox</strong>, click on <strong>New </strong>button to create a new virtual machine as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8366,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-8.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-8.png" alt="Create new virtual machine" class="wp-image-8366"/></a><figcaption>Create new virtual machine</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In <strong>Create Virtual Machine</strong> dialog box, configure the settings as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8367,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-9.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-9.png" alt="Create new virtual machine config" class="wp-image-8367"/></a><figcaption>Create new virtual machine config</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Click on the <strong>yellow icon</strong> as shown above to map the downloaded vdi file. Then, click on <strong>Add </strong>button to map the vdi file and then click on <strong>Choose </strong>as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8368,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-10.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-10.png" alt="Create new virtual machine config" class="wp-image-8368"/></a><figcaption>Create new virtual machine config</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Now back to <strong>Create Virtual Machine</strong> dialog, click on <strong>Create </strong>button. This will create a new virtual machine named <code>CentOS Base</code>.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8369,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-11.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-11.png" alt="Create new virtual machine" class="wp-image-8369"/></a><figcaption>Create new virtual machine </figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:generateblocks/headline {"uniqueId":"7f2f5a17"} -->
<h2 class="gb-headline gb-headline-7f2f5a17 gb-headline-text">CentOS Base Image configuration</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>Before we start cloning this machine, we need to configure the network settings. Select the <strong>CentOS Base</strong> image, right click &gt; <strong>Settings</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Click on <strong>Network </strong>in <strong>CentOS Base - Settings</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Select <strong>Bridged Adapter</strong> as shown below, then click on <strong>OK</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":8370,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-12.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-12.png" alt="Bridged Adapter" class="wp-image-8370"/></a><figcaption>Bridged Adapter</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>This will create the bridged network and also you can access the internet from this virtual machines.</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"10a0bd27"} -->
<h2 class="gb-headline gb-headline-10a0bd27 gb-headline-text">Cloning the Virtual Machines</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>Next step is to clone this machine to create JMeter Master and JMeter Worker machines. Right click on the <strong>CentOS Base </strong>machine, then click on <strong>Clone</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>In <strong>Clone Virtual Machine</strong> dialog box, configure the below settings as-is. Then, click on <strong>Clone</strong>. This will create a new virtual machine named <strong>JMeter Master</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8371,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-13.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-13.png" alt="Cloning" class="wp-image-8371"/></a><figcaption>Cloning</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Repeat the same steps again to create <strong>JMeter Worker</strong>. After creating two machines, in the manager, you will see three machines as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8372,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-14.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-14.png" alt="List of machines" class="wp-image-8372"/></a><figcaption>List of machines</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:generateblocks/headline {"uniqueId":"8a4d844b"} -->
<h2 class="gb-headline gb-headline-8a4d844b gb-headline-text">Starting the Virtual Machines</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>Next step is to start the JMeter Master and JMeter Worker machines. Select the machine and then click on <strong>Start </strong>button as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8373,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-15.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-15.png" alt="Starting the virtual machine" class="wp-image-8373"/></a><figcaption>Starting the virtual machine</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>This will start the two machines which will take couple of minutes for the complete bootup. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>After successful boot, you will see the login screen for both the machines as shown below. Enter the password and hit enter to login into the machines.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":8374,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-16.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-16-1024x432.png" alt="CentOS Login Screen" class="wp-image-8374"/></a><figcaption>CentOS Login Screen</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>After logging in, launch the <strong>Terminal </strong>to make changes in the hosts and host name. You have to repeat the steps for both the machines.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To change the host name enter the below command and name your host as <code>jmetermast</code>er.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ sudo vi /etc/hostname</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>To change the hosts file, enter the below command and configure as shown in the below screenshot.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ sudo vi /etc/hosts</code></pre>
<!-- /wp:code -->

<!-- wp:image {"align":"center","id":8376,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-18.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-18.png" alt="Changing the hosts" class="wp-image-8376"/></a><figcaption>Changing the hosts</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>It is time to restart the machines. Enter the below command to restart.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ shutdown now -r</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>After restart login again and get the IP address using the below command. </p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ ifconfig</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Minimize the virtual machine windows, because it will be hard to navigate. Instead, we can use the SSH to login and perform the commands.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To login into the virtual machines, I am using <strong>MobaXterm </strong>software. But you can use your favorite.</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"99e564e8"} -->
<h2 class="gb-headline gb-headline-99e564e8 gb-headline-text">Installing Java in Master and Worker Machines</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>After you login into the master/worker machine, the first step is to download and install Java. To install Java, you can use the below command:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ sudo yum install java -y</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>This will install Java 8. To verify, you can issue the below command:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ java -version</code></pre>
<!-- /wp:code -->

<!-- wp:image {"align":"center","id":8380,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-19.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-19.png" alt="Java version check" class="wp-image-8380"/></a><figcaption>Java version check</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Repeat the same steps for Worker machine as well.</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"c2cff943"} -->
<h2 class="gb-headline gb-headline-c2cff943 gb-headline-text">Installing JMeter in Master and Worker Machines</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>To install JMeter, you can use the below command:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ curl -O https://downloads.apache.org//jmeter/binaries/apache-jmeter-5.4.1.tgz
</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>This will download the 5.4.1 tar file from JMeter site.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To veriy the integrity, you can issue the below command.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ sha512sum apache-jmeter-5.4.1.tgz
</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>The output string must match with the <strong>SHA512 </strong>value which you can get it from the JMeter site.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8381,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-20.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-20.png" alt="JMeter Download" class="wp-image-8381"/></a><figcaption>JMeter Download</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>To extract the tar file:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ tar -xzf apache-jmeter-5.4.1.tgz</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Now cd into bin folder:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ cd apache-jmeter-5.4.1/bin/</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Repeat the above steps in both the machines.</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"c35567ba"} -->
<h2 class="gb-headline gb-headline-c35567ba gb-headline-text">Distributed Load Testing Mode</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:generateblocks/headline {"uniqueId":"458a0735"} -->
<h2 class="gb-headline gb-headline-458a0735 gb-headline-text">JMeter Master Setup</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>In the master machine, open the <strong>user.properties</strong> using your favorite editor and configure the below properties.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ vim user.properties</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p><strong>user.properties</strong></p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>remote_hosts=&lt;worker_ip&gt;
server.rmi.localport=4000</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>By default, JMeter uses secured communication between the master and worker machines. To generate the secured tunnel, we need to make use of rmi key store. </p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>To add multiple workers, use comma separated values.</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Execute <code>create-rmi-keystore.sh</code> file to generate the keystore file as shown below. Let us go with the default values: <strong><code>rmi</code> </strong>as <strong>first and last name</strong> and the password as <code><strong><em>changeit</em></strong></code></p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8383,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-21.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-21.png" alt="keystore generation" class="wp-image-8383"/></a><figcaption>keystore generation</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><code>rmi_keystore.jks</code> will be generated in the bin folder. You have to place this file in all the worker machines.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To transfer this file to the worker machine, you can use scp command.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ scp rmi_keystore.jks osboxes@&lt;worker_ip&gt;:.</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Above command transfer the keystore to the home directory of the worker machine. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Next step is to disable to firewall service. If the firewall is enabled JMeter tests will not run in distributed mode.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To disable firewall:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ sudo systemctl stop firewalld.service</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>To check firewall status:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ sudo systemctl status firewalld.service</code></pre>
<!-- /wp:code -->

<!-- wp:generateblocks/headline {"uniqueId":"303dff29"} -->
<h2 class="gb-headline gb-headline-303dff29 gb-headline-text">JMeter Worker Setup</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>Open a new SSH session to login into worker machine. The keystore file now present in the home directory, paste that into <code>bin</code> folder.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Next step is to configure the <code>user.properties</code>. Open it in your favorite editor and configure the below property.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>server.rmi.localport=4000</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Now disable the firewall by following the above mentioned steps.</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"7ae52899"} -->
<h2 class="gb-headline gb-headline-7ae52899 gb-headline-text">Starting the Distributed Load Mode in Worker Machine</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>To begin the distributed load testing, first step is to start the worker machine. Issue the below command to get started.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ ./jmeter-server -Djava.rmi.server.hostname=&lt;Worker_IP&gt;</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p><strong>Output</strong></p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8384,"sizeSlug":"large","linkDestination":"media"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-22.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-22.png" alt="Worker Machine Startup" class="wp-image-8384"/></a><figcaption>Worker Machine Startup</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>If you get the above output, you are good.</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"97956de8"} -->
<h2 class="gb-headline gb-headline-97956de8 gb-headline-text">Starting the Distributed Load Testing in Master Machine</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>To begin the distributed load test, you can issue the below command.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ ./jmeter.sh -Djava.rmi.server.hostname=&lt;Master_IP&gt; -n -t examples/CSVSample.jmx -l Run1.log -R&lt;Worker_IP&gt;</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Above command start the sample JMeter test which is located in <code>examples</code> folder, store the output in current directory named <code>Run1.log</code>, the load will be injected using the remote worker machine (-R).</p>
<!-- /wp:paragraph -->

<!-- wp:generateblocks/headline {"uniqueId":"d23357da","element":"h4"} -->
<h4 class="gb-headline gb-headline-d23357da gb-headline-text">JMeter Master Output</h4>
<!-- /wp:generateblocks/headline -->

<!-- wp:image {"id":8387,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-23.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-23.png" alt="JMeter Master Ouput" class="wp-image-8387"/></a><figcaption>JMeter Master Ouput</figcaption></figure>
<!-- /wp:image -->

<!-- wp:generateblocks/headline {"uniqueId":"b8be6a09","element":"h4"} -->
<h4 class="gb-headline gb-headline-b8be6a09 gb-headline-text">JMeter Worker Output</h4>
<!-- /wp:generateblocks/headline -->

<!-- wp:image {"id":8388,"sizeSlug":"large","linkDestination":"media"} -->
<figure class="wp-block-image size-large"><a href="https://qainsights.com/wp-content/uploads/2021/05/image-24.png"><img src="https://qainsights.com/wp-content/uploads/2021/05/image-24.png" alt="JMeter Worker Output - Distributed Load Testing in JMeter using VirtualBox" class="wp-image-8388"/></a><figcaption>JMeter Worker Output - Distributed Load Testing in JMeter using VirtualBox</figcaption></figure>
<!-- /wp:image -->

<!-- wp:generateblocks/headline {"uniqueId":"4fbe0bd8"} -->
<h2 class="gb-headline gb-headline-4fbe0bd8 gb-headline-text">Important Points</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:list -->
<ul><li>Use the identical version of Java and JMeter in all the machines</li><li>Disable firewall</li><li>Master and Worker machines must be in the same subnet<ul><li>try pinging the machines from each other to verify the connectivity</li></ul></li><li>SSL for RMI certificate has the validity of <strong>7 days</strong> by default, make sure you generate the certificate once in 7 days. The number of days can be changed in the&nbsp;<code>create-rmi-keystore</code>&nbsp;file:&nbsp;<code>keytool -genkey -keyalg RSA -alias rmi -keystore rmi_keystore.jks -storepass changeit -validity 365 -keysize 2048 %*</code></li><li>If the test plan uses, plugins and/or CSV Data set config, make sure it is available in the worker nodes</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>Here is the GitHub Repo to star.</p>
<!-- /wp:paragraph -->

<!-- wp:buttons {"contentJustification":"center"} -->
<div class="wp-block-buttons is-content-justification-center"><!-- wp:button {"backgroundColor":"vivid-green-cyan"} -->
<div class="wp-block-button"><a class="wp-block-button__link has-vivid-green-cyan-background-color has-background" href="https://github.com/QAInsights/Remote-Distribution-Load-Testing-in-JMeter" target="_blank" rel="noreferrer noopener">GitHub Repo: Remote Distribution Load Testing in JMeter</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->

<!-- wp:generateblocks/headline {"uniqueId":"c4279134"} -->
<h2 class="gb-headline gb-headline-c4279134 gb-headline-text">Conclusion</h2>
<!-- /wp:generateblocks/headline -->

<!-- wp:paragraph -->
<p>For beginners, this setup might be overwhelming, but this guide will be very helpful to understand the setup without needing of multiple machines. This setup should not be used in production, this is just for learning purpose :).</p>
<!-- /wp:paragraph -->