sseletskyy
12/19/2013 - 10:44 AM

Instructions for running remote JMeter

Instructions for running remote 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!
)

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'