JMeter (Master/Slave)
Apache JMeter can be used in a master / slave mode allowing the distribution of load across multiple servers. This can be accessed by the GUI but also run in headless mode. In this blog post we will explain how to configure this on Debian GNU/Linux 10 (buster).
Installation
You will need to follow these steps to install JAVA, JMeter and configure the system. Repeat for each.
Step 1 – JAVA
Pre-Reqs -------- Download JAVA ------------- wget https://download.oracle.com/otn/java/jdk/13.0.2+8/d4173c853231432d94f001e99d882ca7/jdk-13.0.2_linux-x64_bin.deb Install DEB File ---------------- dpkg -i jdk-13.0.1_linux-x64_bin.deb Update JAVA version ------------------- update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-13.0.2/bin/java 2 update-alternatives --config java update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-13.0.2/bin/jar 2 update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-13.0.2/bin/javac 2 update-alternatives --set jar /usr/lib/jvm/jdk-13.0.2/bin/jar update-alternatives --set javac /usr/lib/jvm/jdk-13.0.2/bin/javac Update JDK.SH ------------- sudo nano /etc/profile.d/jdk.sh export J2SDKDIR=/usr/lib/jvm/jdk-13.0.2 export J2REDIR=/usr/lib/jvm/jdk-13.0.2 export PATH=$PATH:/usr/lib/jvm/jdk-13.0.2/bin:/usr/lib/jvm/jdk-13.0.2/db/bin export JAVA_HOME=/usr/lib/jvm/jdk-13.0.2 export DERBY_HOME=/usr/lib/jvm/jdk-13.0.2/db UPDATE SYSTEM ------------- source /etc/profile.d/jdk.sh
Step 2 - Install JMeter
wget https://mirrors.ukfast.co.uk/sites/ftp.apache.org//jmeter/binaries/apache-jmeter-5.3.zip unzip apache-jmeter-5.3.zip
Step 3 - Configure Host
Find IP address of machine -------------------------- ip a (take not of the IP machine address) Edit hosts and add IP address and hostname ------------------------------------------ nano /etc/hosts xxx.xxx.xxx.xxx hostname 127.0.0.1 localhost Save and Exit ** Repeat this proces on the master and slave machines **
Step 4 - Configure JMeter
Identitify the ip address of each machine (master and slaves) to be used in this step (ip a) -------------------------------------------------------------------------------------------- Edit jmeter.properties and enter the IP addresses of the slave machines ----------------------------------------------------------------------- nano apache-jmeter-5.3/bin/jmeter.properties # Remote Hosts - comma delimited remote_hosts=xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx
Step 5 - Add Certificate
Logon to JMeter Master and run the following command ------------------------------------------------------------- cd apache-jmeter-5.3/bin $ ./create-rmi-keystore.sh What is your first and last name? [Unknown]: A What is the name of your organizational unit? [Unknown]: B What is the name of your organization? [Unknown]: C What is the name of your City or Locality? [Unknown]: D What is the name of your State or Province? [Unknown]: E What is the two-letter country code for this unit? [Unknown]: F Is CN=A, OU=B, O=C, L=D, ST=E, C=F correct? [no]: yes Copy the generated rmi_keystore.jks to apache-jmeter-5.3/bin on the slave servers folder or reference it in property 'server.rmi.ssl.keystore.file'
Step 6 - Start JMeter Server
Logon to JMeter Slaves and run the following command ---------------------------------------------------- apache-jmeter-5.3/bin/jmeter-server Created remote object: UnicastServerRef2 [liveRef: [endpoint:[xxx.xxx.xxx.xxx:42625,SSLRMIServerSocketFactory(host=Debian/xxx.xxx.xxx.xxx, keyStoreLocation=rmi_keystore.jks, type=JKS, trustStoreLocation=rmi_keystore.jks, type=JKS, alias=rmi),SSLRMIClientSocketFactory(keyStoreLocation=rmi_keystore.jks, type=JKS, trustStoreLocation=rmi_keystore.jks, type=JKS, alias=rmi)](local),objID:[-306a2064:175579fc29c:-7fff, -894134118398015255]]]
Step 7 - Run JMeter Master
apache-jmeter-5.3/bin/jmeter -n -t examples/PerformanceTestPlanMemoryThread.jmx -r Creating summariser <summary> Created the tree successfully using smoketest.jmx Configuring remote engine: xxx.xxx.xxx.xxx Configuring remote engine: xxx.xxx.xxx.xxx Starting distributed test with remote engines: [xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx] @ Fri Oct 23 22:38:11 BST 2020 (1603489091087) Warning: Nashorn engine is planned to be removed from a future JDK release Remote engines have been started:[xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx] Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445 summary = 200 in 00:00:55 = 3.6/s Avg: 81 Min: 59 Max: 217 Err: 0 (0.00%) Tidying up remote @ Fri Oct 23 22:39:08 BST 2020 (1603489148213)
If all has gone well your test should execute and you should see the standard JMeter summary.