Skip to content

Instantly share code, notes, and snippets.

@warnergodfrey
Last active December 14, 2017 01:10
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save warnergodfrey/8037420 to your computer and use it in GitHub Desktop.
Save warnergodfrey/8037420 to your computer and use it in GitHub Desktop.
Instructions for running remote JMeter

Instructions for running remote JMeter

Server

Create a AWS instance

aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type m1.medium --key-name MyKeyPair --security-groups MySecurityGroup

SSH to remote server

ssh <aws_instance_hostname>

Install JDK 1.7

yum install java-1.7.0-openjdk.x86_64

Install JMeter

cd /tmp
wget http://mirror.mel.bkb.net.au/pub/apache//jmeter/binaries/apache-jmeter-2.10.tgz
cd /opt
tar -xvzf /tmp/apache-jmeter-2.10.tgz 
echo "export JMETER_HOME=/opt/apache-jmeter-2.10" >> $HOME/.bash_profile
source $HOME/.bash_profile

Create new jmeter.properties file

cd $HOME
echo "server.rmi.localport=1099" >> jmeter.properties

Run server

$JMETER_HOME/bin/jmeter-server -Djava.rmi.server.hostname=`GET http://169.254.169.254/latest/meta-data/local-ipv4` -p jmeter.properties &

Open logs

tail -f jmeter-server.log

Client

Install JMeter (on a Mac)

brew install jmeter

Create new jmeter.properties file

echo "client.rmi.localport=60000" > jmeter.properties

Open reverse tunnel from AWS to your localhost

ssh -R 60000:localhost:60000 root@<aws_instance_hostname>

Run the test plan

export JVM_ARGS="-Djava.rmi.server.hostname=localhost"
bundle exec test.rb

OR, just use flood.io :-)

source 'https://rubygems.org'
gem 'ruby-jmeter', github: 'lukeck/ruby-jmeter'
aws_instance_hostname = "TODO"
test do
threads count: 10 do
visit name: 'Google Search', url: 'http://google.com'
end
end.run(
:gui => true,
:file => "jmeter.jmx",
:log => "jmeter.log",
:jtl => "jmeter.jtl",
:properties => File.join("jmeter.properties") + " -R " + aws_instance_hostname # script injection to to run remote tests!
)
@kblakshmi
Copy link

can we use multiple IPs for jmeter-server Djava.rmi.server.hostname = $multipleips (these multiple ips are getting by running one script which fetch ips - elasticbeanstack). Please guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment