From 2d8e4ee25006f8be83fff68ccb654fd1d9df785f Mon Sep 17 00:00:00 2001 From: Marcos Borges Date: Sun, 7 Nov 2021 22:45:11 -0300 Subject: [PATCH] Example of usage with Taurus BZT (#13) # Taurus Basic Configuration In its basic use it is necessary to provide information about which network will be used, where are your test plan scripts and finally define the number of nodes needed to carry out the desired load. ```hcl module "loadtest" { source = "../../" name = "nome-da-implantacao-taurus" executor = "bzt" loadtest_dir_source = "../plan/" loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" taurus/*.yml" nodes_size = 2 subnet_id = data.aws_subnet.current.id } data "aws_subnet" "current" { filter { name = "tag:Name" values = ["subnet-prd-a"] } } ``` --- --- README.md | 51 ++++++++++++++++++++-------------- examples/basic/README.md | 2 +- examples/basic/main.tf | 3 +- examples/plan/taurus/basic.yml | 45 +++++++++++++++++++++--------- examples/split-data/README.md | 2 +- examples/split-data/main.tf | 2 +- examples/taurus/README.md | 12 ++++---- examples/taurus/main.tf | 15 ++++------ executor.tf | 1 + leader.tf | 6 ---- slipter.tf | 2 +- 11 files changed, 80 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 3ad107b..e8739b5 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,16 @@ This module proposes a simple and uncomplicated way to run your load tests creat ## Basic usage with JMeter ```hcl -module "loadtest" { +module "loadtest-distribuited" { source = "marcosborges/loadtest-distribuited/aws" - + name = "nome-da-implantacao" executor = "jmeter" - loadtest_dir_source = "./assets" - loadtest_entrypoint = "jmeter -n -t jmeter/basic.jmx -R \"{NODES_IPS}\" *.jmx" + loadtest_dir_source = "examples/plan/" nodes_size = 2 + + loadtest_entrypoint = "jmeter -n -t jmeter/basic.jmx -R \"{NODES_IPS}\" -l /var/logs/loadtest -e -o /var/www/html -Dnashorn.args=--no-deprecation-warning -Dserver.rmi.ssl.disable=true " subnet_id = data.aws_subnet.current.id } @@ -35,8 +36,6 @@ data "aws_subnet" "current" { ![bp](https://github.com/marcosborges/terraform-aws-loadtest-distribuited/raw/master/assets/jmeter-dashboard.png) - - --- ## Basic usage with Taurus @@ -44,15 +43,16 @@ data "aws_subnet" "current" { In its basic use it is necessary to provide information about which network will be used, where are your test plan scripts and finally define the number of nodes needed to carry out the desired load. ```hcl -module "loadtest" { +module "loadtest-distribuited" { source = "marcosborges/loadtest-distribuited/aws" - + name = "nome-da-implantacao" - executor = "bzt" - loadtest_dir_source = "./load-test-plan" - loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" *.yml" + executor = "jmeter" + loadtest_dir_source = "examples/plan/" nodes_size = 2 + + loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" taurus/basic.yml" subnet_id = data.aws_subnet.current.id } @@ -84,22 +84,25 @@ The module also provides advanced settings. ```hcl module "loadtest" { + source = "marcosborges/loadtest-distribuited/aws" - - subnet_id = data.aws_subnet.current.id name = "nome-da-implantacao" executor = "bzt" - loadtest_dir_source = "./assets" + loadtest_dir_source = "examples/plan/" + loadtest_dir_destination = "/loadtest" - loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" *.yml" + loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" taurus/basic.yml" nodes_size = 3 + + subnet_id = data.aws_subnet.current.id + #AUTO SPLIT split_data_mass_between_nodes = { enable = true data_mass_filenames = [ - "../plan/data/data.csv" + "data/users.csv" ] } @@ -179,16 +182,22 @@ data "aws_ami" "my_image" { } ``` - --- +## Sugestion -## Defaults - -**Instance type:** https://aws.amazon.com/pt/ec2/instance-types/c5/ - +The [C5](https://aws.amazon.com/pt/ec2/instance-types/c5/) family of instances is a good choice for the load test. +|Model|vCPU|Mem (GiB)|Storage (GiB)|Network Band. (Gbps)| +|:---:|:---:|:---:|:---:|:---:| +|c5n.large| 2 | 5.25 | EBS | 25 -> 4.750| +|c5n.xlarge| 4 | 10.5 | EBS | 25 -> 4.750| +|c5n.2xlarge| 8 | 21 | EBS | 25 -> 4.750| +|c5n.4xlarge| 16 | 42 | EBS | 25 4.750| +|c5n.9xlarge| 36 | 96 | EBS | 50 9.500| +|c5n.18xlarge| 72 | 192 | EBS | 100 19.000| +|c5n.metal| 72 | 192 | EBS | 100 19.000| --- diff --git a/examples/basic/README.md b/examples/basic/README.md index cc2e4fe..26bda66 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -8,7 +8,7 @@ module "loadtest-distribuited" { source = "../../" #source = "marcosborges/loadtest-distribuited/aws" - name = "nome-da-implantacao" + name = "nome-da-implantacao-basic" executor = "jmeter" loadtest_dir_source = "../plan/" nodes_size = 2 diff --git a/examples/basic/main.tf b/examples/basic/main.tf index 1eb0ae8..476e86e 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -2,9 +2,8 @@ module "loadtest" { source = "../../" #source = "marcosborges/loadtest-distribuited/aws" - #version = "1.0.0" - name = "nome-da-implantacao" + name = "nome-da-implantacao-basic" executor = var.executor #"jmeter" loadtest_dir_source = "../plan/" nodes_size = 2 diff --git a/examples/plan/taurus/basic.yml b/examples/plan/taurus/basic.yml index 682e5ff..3822b12 100644 --- a/examples/plan/taurus/basic.yml +++ b/examples/plan/taurus/basic.yml @@ -1,18 +1,37 @@ execution: -- concurrency: 10 - ramp-up: 1m - hold-for: 5m - scenario: quick-test + - concurrency: 10 + ramp-up: 1m + hold-for: 5m + scenario: quick-test scenarios: quick-test: + #data-sources: + # - path: /loadtest/data/users.csv + # delimiter: ',' + # quoted: true + # encoding: "utf-8" + # loop: true + # variable-names: name,email,password + # random-order: false requests: - - - label: Google - url: https://google.com - - - label: Microsoft - url: https://microsoft.com - - - label: Facebook - url: https://facebook.com \ No newline at end of file + - label: Google + url: https://google.com + - label: Microsoft + url: https://microsoft.com + - label: Facebook + url: https://facebook.com + properties: + server.rmi.ssl.disable: true + +modules: + jmeter: + gui: false + version: 5.4.1 + properties: + mode: StrippedBatch + memory-xmx: 10G + cmdline: -l /loadtest/logs -e -o /var/www/html/taurus + +settings: + verbose: false \ No newline at end of file diff --git a/examples/split-data/README.md b/examples/split-data/README.md index 06cd5d6..a5899b6 100644 --- a/examples/split-data/README.md +++ b/examples/split-data/README.md @@ -15,7 +15,7 @@ module "loadtest" { source = "marcosborges/loadtest-distribuited/aws" - name = "nome-da-implantacao" + name = "nome-da-implantacao-spliter" executor = "jmeter" loadtest_dir_source = "../plan/" nodes_size = 2 diff --git a/examples/split-data/main.tf b/examples/split-data/main.tf index d8752a0..75f80cb 100644 --- a/examples/split-data/main.tf +++ b/examples/split-data/main.tf @@ -3,7 +3,7 @@ module "loadtest" { source = "../../" #source = "marcosborges/loadtest-distribuited/aws" - name = "nome-da-implantacao" + name = "nome-da-implantacao-spliter" executor = "jmeter" loadtest_dir_source = "../plan/" nodes_size = 2 diff --git a/examples/taurus/README.md b/examples/taurus/README.md index 95a7bcf..8bd30e2 100644 --- a/examples/taurus/README.md +++ b/examples/taurus/README.md @@ -1,4 +1,4 @@ -# Basic Config: +# Taurus Basic Configuration In its basic use it is necessary to provide information about which network will be used, where are your test plan scripts and finally define the number of nodes needed to carry out the desired load. @@ -7,11 +7,11 @@ module "loadtest" { source = "../../" - name = "nome-da-implantacao" - executor = "jmeter" - loadtest_dir_source = "../plan" - loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" *.yml" - nodes_size = 3 + name = "nome-da-implantacao-taurus" + executor = "bzt" + loadtest_dir_source = "../plan/" + loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" taurus/*.yml" + nodes_size = 2 subnet_id = data.aws_subnet.current.id } diff --git a/examples/taurus/main.tf b/examples/taurus/main.tf index 3888c7a..5cc0eb5 100644 --- a/examples/taurus/main.tf +++ b/examples/taurus/main.tf @@ -1,18 +1,15 @@ -provider "aws" { - region = "us-east-1" -} - module "loadtest" { source = "../../" - name = "nome-da-implantacao" - executor = "jmeter" - loadtest_dir_source = "../plan" - loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" *.yml" - nodes_size = 3 + name = "nome-da-implantacao-taurus" + executor = "bzt" + loadtest_dir_source = "../plan/" + loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" taurus/*.yml" + nodes_size = 2 subnet_id = data.aws_subnet.current.id + ssh_export_pem = false } data "aws_subnet" "current" { diff --git a/executor.tf b/executor.tf index ce4a099..269201e 100644 --- a/executor.tf +++ b/executor.tf @@ -74,6 +74,7 @@ resource "null_resource" "executor" { provisioner "remote-exec" { inline = [ "echo DIR: ${var.loadtest_dir_destination}", + "ls -lah ${var.loadtest_dir_destination}", "cd ${var.loadtest_dir_destination}", "echo ${local.entrypoint}", local.entrypoint diff --git a/leader.tf b/leader.tf index e5801e5..4c7a637 100644 --- a/leader.tf +++ b/leader.tf @@ -45,9 +45,3 @@ resource "aws_instance" "leader" { } ) } - - -resource "null_resource" "push_key_pair_to_leader" { - - -} \ No newline at end of file diff --git a/slipter.tf b/slipter.tf index 68dd580..50d502d 100644 --- a/slipter.tf +++ b/slipter.tf @@ -54,13 +54,13 @@ locals { # JOIN COMMANDS TO BE EXECUTED BY LEADER leader_cmds = concat( + ["echo AUTO SPLITER"], local.leader_split_cmds, local.leader_ssh_nodes_cleanup_cmds, local.leader_scp_cmds ) } - resource "null_resource" "spliter_execute_command" { # CONNECT TO LEADER