r4dx / terraform-aws-jmeter

Easy way to create jMeter cluster with terraform on your AWS infrastructure.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terraform-aws-jmeter

Easy way to create jMeter cluster with terraform on your AWS infrastructure.

How to use

  1. Create jMeter script (I suggest you to use jMeter UI for that purposes)
  2. Generate ssh keys - e.g. you can use ssh-keygen tool
ssh-keygen -t rsa -C "loadServer" -P '' -f loadServer
  1. Create terraform main.tf - here's example you can use.

N.B. Please see variables.tf for full reference on terraform-aws-jmeter variables - at least be sure to change instance types as you can't do much with micro instances.

provider "aws" {
  region = "${var.aws_region}"
  access_key = "${var.aws_access_key}"
  secret_key = "${var.aws_secret_key}"
}

module "jmeter_cluster" {
  source = "github.com/r4dx/terraform-aws-jmeter"

  aws_region = "${var.aws_region}"
  slave_ssh_public_key_file = "ssh/loadServer.pub"
  master_ssh_private_key_file = "ssh/loadServer"
  master_ssh_public_key_file = "ssh/loadServer.pub"
  jmx_script_file = "script.jmx"
}
  1. Use this commands to create infrastructure
# terraform get
# terraform apply
  1. Ssh on master node and start the load test - N.B. You can get master node public ip using terraform show command.
# ssh -i "loadServer" ec2-user@<MASTER_PUBLIC_IP>
[ec2-user@<HOSTNAME> ~]$ cd /jmeter-master/
[ec2-user@<HOSTNAME> jmeter-master]$ python master_start.py

N.B. It requires some time to start slave nodes and in case they're didn't for some reason, you can do it manually by SSHing to slave nodes and executing /apache-jmeter-3.0/bin/jmeter-server command 6. You can destroy the infrastructure with terraform destroy

How does it work

terraform-aws-jmeter creates one master instance and autoscaling group with jmeter workers. Both master and workers share the same security group which allows all ingress and egress communications inside the group, only ssh ingress connections for other world. It allows egress communications for all ports for outside world as well though to make sure jmeter can access resource it's testing. Master and workers instances are bootstrapped with jMeter 3 (N.B. only jMeter 3 is currently supported) and ready to work - master automatically discovers workers by searching for instances in autoscaling group.

Here's the graph generated by terraform - I've removed provider.aws node for better readability.

Terraform Graph

Prerequisites

HashiCorp Terraform

Links

  1. http://jmeter.apache.org/usermanual/remote-test.html
  2. http://aws.amazon.com/
  3. https://www.terraform.io/
  4. http://jmeter.apache.org/

About

Easy way to create jMeter cluster with terraform on your AWS infrastructure.

License:Apache License 2.0


Languages

Language:HCL 76.3%Language:Python 23.7%