diff --git a/.gitignore b/.gitignore index 9702b29..2d8e7b6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,8 @@ terraform.tfstate nome-da-implantacao-keypair data.csv00* .terraform.tfstate.lock -*.pem \ No newline at end of file +*.pem +.terraform.lock.hcl +.log +.terraform.tfstate.lock.info +jmeter.log \ No newline at end of file diff --git a/README.md b/README.md index 7f5eb13..9a1cf4d 100644 --- a/README.md +++ b/README.md @@ -5,23 +5,20 @@ This module proposes a simple and uncomplicated way to run your load tests creat ![bp](https://raw.githubusercontent.com/marcosborges/terraform-aws-loadtest-distribuited/v0.0.7-alpha/assets/blueprint.png) ---- -## Basic usage with Taurus - -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. +## Basic usage with JMeter ```hcl module "loadtest" { source = "marcosborges/loadtest-distribuited/aws" - version = "0.0.4-alpha" + version = "1.0.0" name = "nome-da-implantacao" - executor = "bzt" - loadtest_dir_source = "./load-test-plan" - loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" *.yml" - nodes_size = 3 + executor = "jmeter" + loadtest_dir_source = "./assets" + loadtest_entrypoint = "jmeter -n -t -R \"{NODES_IPS}\" *.jmx" + nodes_size = 2 subnet_id = data.aws_subnet.current.id } @@ -34,21 +31,30 @@ data "aws_subnet" "current" { } ``` +![bp](https://github.com/marcosborges/terraform-aws-loadtest-distribuited/raw/master/assets/example-basic.png) + + +![bp](https://github.com/marcosborges/terraform-aws-loadtest-distribuited/raw/master/assets/jmeter-dashboard.png) + + + --- -## Basic usage with JMeter +## Basic usage with Taurus + +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 = "marcosborges/loadtest-distribuited/aws" - version = "0.0.4-alpha" + version = "1.0.0" name = "nome-da-implantacao" - executor = "jmeter" - loadtest_dir_source = "./assets" - loadtest_entrypoint = "jmeter -n -t -R \"{NODES_IPS}\" *.jmx" - nodes_size = 3 + executor = "bzt" + loadtest_dir_source = "./load-test-plan" + loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" *.yml" + nodes_size = 2 subnet_id = data.aws_subnet.current.id } @@ -61,9 +67,9 @@ data "aws_subnet" "current" { } ``` - --- + ## Advanced Config: The module also provides advanced settings. @@ -81,7 +87,7 @@ The module also provides advanced settings. module "loadtest" { source = "marcosborges/loadtest-distribuited/aws" - version = "0.0.3-alpha" + version = "1.0.0" subnet_id = data.aws_subnet.current.id @@ -178,6 +184,10 @@ data "aws_ami" "my_image" { --- +## Defaults + +**Instance type:** https://aws.amazon.com/pt/ec2/instance-types/c5/ + ## Examples with another executors diff --git a/assets/example-basic.png b/assets/example-basic.png new file mode 100644 index 0000000..11cd9d1 Binary files /dev/null and b/assets/example-basic.png differ diff --git a/assets/jmeter-dashboard.png b/assets/jmeter-dashboard.png new file mode 100644 index 0000000..24341d0 Binary files /dev/null and b/assets/jmeter-dashboard.png differ diff --git a/examples/basic/.terraform.lock.hcl b/examples/basic/.terraform.lock.hcl new file mode 100644 index 0000000..210b198 --- /dev/null +++ b/examples/basic/.terraform.lock.hcl @@ -0,0 +1,57 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "3.63.0" + constraints = ">= 3.63.0" + hashes = [ + "h1:v9aPF3aaBpk0uSO5pfggYJKGgP/Ur28hZRJs1jS+ttI=", + "zh:42c6c98b294953a4e1434a331251e539f5372bf6779bd61ab5df84cac0545287", + "zh:5493773762a470889c9a23db97582d3a82035847c8d3bd13323b4c3012abf325", + "zh:550d22ff9fed4d817a922e7b84bd9d1f2ef8d3afa00832cf66b8cd5f0e6dc748", + "zh:632cb5e2d9d5041875f57174236eafe5b05dbf26750c1041ab57eb08c5369fe2", + "zh:7cfeaf5bde1b28bd010415af1f3dc494680a8374f1a26ec19db494d99938cc4e", + "zh:99d871606b67c8aefce49007315de15736b949c09a9f8f29ad8af1e9ce383ed3", + "zh:c4fc8539ffe90df5c7ae587fde495fac6bc0186fec2f2713a8988a619cef265f", + "zh:d0a26493206575c99ca221d78fe64f96a8fbcebe933af92eea6b39168c1f1c1d", + "zh:e156fdc964fdd4a7586ec15629e20d2b06295b46b4962428006e088145db07d6", + "zh:eb04fc80f652b5c92f76822f0fec1697581543806244068506aed69e1bb9b2af", + "zh:f5638a533cf9444f7d02b5527446cdbc3b2eab8bcc4ec4b0ca32035fe6f479d3", + ] +} + +provider "registry.terraform.io/hashicorp/null" { + version = "3.1.0" + hashes = [ + "h1:vpC6bgUQoJ0znqIKVFevOdq+YQw42bRq0u+H3nto8nA=", + "zh:02a1675fd8de126a00460942aaae242e65ca3380b5bb192e8773ef3da9073fd2", + "zh:53e30545ff8926a8e30ad30648991ca8b93b6fa496272cd23b26763c8ee84515", + "zh:5f9200bf708913621d0f6514179d89700e9aa3097c77dac730e8ba6e5901d521", + "zh:9ebf4d9704faba06b3ec7242c773c0fbfe12d62db7d00356d4f55385fc69bfb2", + "zh:a6576c81adc70326e4e1c999c04ad9ca37113a6e925aefab4765e5a5198efa7e", + "zh:a8a42d13346347aff6c63a37cda9b2c6aa5cc384a55b2fe6d6adfa390e609c53", + "zh:c797744d08a5307d50210e0454f91ca4d1c7621c68740441cf4579390452321d", + "zh:cecb6a304046df34c11229f20a80b24b1603960b794d68361a67c5efe58e62b8", + "zh:e1371aa1e502000d9974cfaff5be4cfa02f47b17400005a16f14d2ef30dc2a70", + "zh:fc39cc1fe71234a0b0369d5c5c7f876c71b956d23d7d6f518289737a001ba69b", + "zh:fea4227271ebf7d9e2b61b89ce2328c7262acd9fd190e1fd6d15a591abfa848e", + ] +} + +provider "registry.terraform.io/hashicorp/tls" { + version = "3.1.0" + hashes = [ + "h1:fUJX8Zxx38e2kBln+zWr1Tl41X+OuiE++REjrEyiOM4=", + "zh:3d46616b41fea215566f4a957b6d3a1aa43f1f75c26776d72a98bdba79439db6", + "zh:623a203817a6dafa86f1b4141b645159e07ec418c82fe40acd4d2a27543cbaa2", + "zh:668217e78b210a6572e7b0ecb4134a6781cc4d738f4f5d09eb756085b082592e", + "zh:95354df03710691773c8f50a32e31fca25f124b7f3d6078265fdf3c4e1384dca", + "zh:9f97ab190380430d57392303e3f36f4f7835c74ea83276baa98d6b9a997c3698", + "zh:a16f0bab665f8d933e95ca055b9c8d5707f1a0dd8c8ecca6c13091f40dc1e99d", + "zh:be274d5008c24dc0d6540c19e22dbb31ee6bfdd0b2cddd4d97f3cd8a8d657841", + "zh:d5faa9dce0a5fc9d26b2463cea5be35f8586ab75030e7fa4d4920cd73ee26989", + "zh:e9b672210b7fb410780e7b429975adcc76dd557738ecc7c890ea18942eb321a5", + "zh:eb1f8368573d2370605d6dbf60f9aaa5b64e55741d96b5fb026dbfe91de67c0d", + "zh:fc1e12b713837b85daf6c3bb703d7795eaf1c5177aebae1afcf811dd7009f4b0", + ] +} diff --git a/examples/basic/README.md b/examples/basic/README.md index 27b526b..61a43c2 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -20,4 +20,11 @@ module "loadtest-distribuited" { } ``` + +![bp](https://github.com/marcosborges/terraform-aws-loadtest-distribuited/raw/master/assets/example-basic.png) + + +![bp](https://github.com/marcosborges/terraform-aws-loadtest-distribuited/raw/master/assets/jmeter-dashboard.png) + + --- diff --git a/examples/basic/main.tf b/examples/basic/main.tf index f283e52..1756464 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -2,16 +2,15 @@ module "loadtest" { source = "../../" #source = "marcosborges/loadtest-distribuited/aws" - #version = "0.0.8-alpha" + #version = "1.0.0" name = "nome-da-implantacao" - executor = "jmeter" + executor = var.executor #"jmeter" loadtest_dir_source = "../plan/" nodes_size = 2 - loadtest_entrypoint = "jmeter -n -t jmeter/*.jmx -R \"{NODES_IPS}\" -l /var/logs/loadtest -e -o /var/www/html -Dnashorn.args=--no-deprecation-warning -Dserver.rmi.ssl.disable=true " + loadtest_entrypoint = "jmeter -n -t jmeter/*.jmx -R \"{NODES_IPS}\" -l /loadtest/logs -e -o /var/www/html/jmeter -Dnashorn.args=--no-deprecation-warning -Dserver.rmi.ssl.disable=true " ssh_export_pem = true subnet_id = data.aws_subnet.current.id -} - +} \ No newline at end of file diff --git a/examples/basic/output.tf b/examples/basic/output.tf index e03ffc0..8c7dc97 100644 --- a/examples/basic/output.tf +++ b/examples/basic/output.tf @@ -16,4 +16,9 @@ output "nodes_public_ip" { output "nodes_private_ip" { value = module.loadtest.nodes_private_ip description = "The private IP address of the nodes instances." +} + +output "dashboard_url" { + value = "http://${coalesce(module.loadtest.leader_public_ip, module.loadtest.leader_private_ip)}/${var.executor}" + description = "The URL of the loadtest dashboard." } \ No newline at end of file diff --git a/examples/basic/variables.tf b/examples/basic/variables.tf new file mode 100644 index 0000000..c8d1955 --- /dev/null +++ b/examples/basic/variables.tf @@ -0,0 +1,4 @@ +variable "executor" { + description = "Executor name" + default = "jmeter" +} \ No newline at end of file diff --git a/examples/isolated/README.md b/examples/isolated/README.md index 95a7bcf..a341014 100644 --- a/examples/isolated/README.md +++ b/examples/isolated/README.md @@ -4,22 +4,29 @@ In its basic use it is necessary to provide information about which network will ```hcl module "loadtest" { - source = "../../" + #source = "marcosborges/loadtest-distribuited/aws" + #version = "1.0.0" name = "nome-da-implantacao" executor = "jmeter" loadtest_dir_source = "../plan" - loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" *.yml" - nodes_size = 3 - - subnet_id = data.aws_subnet.current.id + nodes_size = 2 + loadtest_entrypoint = "jmeter -n -t jmeter/*.jmx -R \"{NODES_IPS}\" -l /loadtest/logs -e -o /var/www/html/jmeter -Dnashorn.args=--no-deprecation-warning -Dserver.rmi.ssl.disable=true" + subnet_id = module.vpc.private_subnets[0].id } -data "aws_subnet" "current" { - filter { - name = "tag:Name" - values = ["subnet-prd-a"] +module "vpc" { + source = "terraform-aws-modules/vpc/aws" + name = "my-vpc" + cidr = "10.0.0.0/16" + azs = ["us-east-1a"] + private_subnets = ["10.0.1.0/24"] + enable_nat_gateway = true + enable_vpn_gateway = true + tags = { + Terraform = "true" + Environment = "load-test" } } ``` diff --git a/examples/isolated/main.tf b/examples/isolated/main.tf index 9ab6f0c..4b31805 100644 --- a/examples/isolated/main.tf +++ b/examples/isolated/main.tf @@ -1,23 +1,15 @@ module "loadtest" { - source = "../../" - + #source = "marcosborges/loadtest-distribuited/aws" + #version = "1.0.0" name = "nome-da-implantacao" - executor = "jmeter" + executor = var.executor loadtest_dir_source = "../plan" nodes_size = 2 - - #loadtest_entrypoint = "bzt -q -o execution.0.distributed=\"{NODES_IPS}\" *.yml" - loadtest_entrypoint = "jmeter -n -t *.jmx -R \"{NODES_IPS}\" -l ./logs -e -o ./results -Dserver.rmi.localport=50000 -Dserver_port=1099 -Dserver.rmi.ssl.disable=true -Djava.rmi.server.hostname=$PRIVATE_IP" - #loadtest_entrypoint = "jmeter -n -t *.jmx -R \"{NODES_IPS}\" -l ./logs -e -o ./results " - - ssh_export_pem = true - + loadtest_entrypoint = "jmeter -n -t jmeter/*.jmx -R \"{NODES_IPS}\" -l /loadtest/logs -e -o /var/www/html/jmeter -Dnashorn.args=--no-deprecation-warning -Dserver.rmi.ssl.disable=true" subnet_id = module.vpc.private_subnets[0].id - } - module "vpc" { source = "terraform-aws-modules/vpc/aws" name = "my-vpc" diff --git a/examples/isolated/output.tf b/examples/isolated/output.tf index e03ffc0..8c7dc97 100644 --- a/examples/isolated/output.tf +++ b/examples/isolated/output.tf @@ -16,4 +16,9 @@ output "nodes_public_ip" { output "nodes_private_ip" { value = module.loadtest.nodes_private_ip description = "The private IP address of the nodes instances." +} + +output "dashboard_url" { + value = "http://${coalesce(module.loadtest.leader_public_ip, module.loadtest.leader_private_ip)}/${var.executor}" + description = "The URL of the loadtest dashboard." } \ No newline at end of file diff --git a/examples/isolated/variables.tf b/examples/isolated/variables.tf new file mode 100644 index 0000000..c8d1955 --- /dev/null +++ b/examples/isolated/variables.tf @@ -0,0 +1,4 @@ +variable "executor" { + description = "Executor name" + default = "jmeter" +} \ No newline at end of file diff --git a/examples/plan/jmeter/basic.jmx b/examples/plan/jmeter/basic.jmx index 85d132f..bc2abe3 100644 --- a/examples/plan/jmeter/basic.jmx +++ b/examples/plan/jmeter/basic.jmx @@ -16,14 +16,15 @@ continue false - -1 + 1 - 10 + 20 10 true 30 - + 5 true + true @@ -31,18 +32,20 @@ google.com - + 443 https GET - true - false + false + true true false + true + true - - + 1000 + 6000 @@ -50,18 +53,20 @@ microsoft.com - + 443 https GET - true - false + false + true true false + true + true - - + 1000 + 6000 @@ -69,18 +74,20 @@ facebook.com - + 443 https GET - true - false + false + true true false + true + true - - + 1000 + 6000 diff --git a/examples/plan/jmeter/jmeter.log b/examples/plan/jmeter/jmeter.log new file mode 100644 index 0000000..a2eb54a --- /dev/null +++ b/examples/plan/jmeter/jmeter.log @@ -0,0 +1,153 @@ +2021-11-02 01:40:50,037 INFO o.a.j.u.JMeterUtils: Setting Locale to en_EN +2021-11-02 01:40:50,112 INFO o.a.j.JMeter: Loading user properties from: /opt/apache-jmeter-5.4.1/bin/user.properties +2021-11-02 01:40:50,113 INFO o.a.j.JMeter: Loading system properties from: /opt/apache-jmeter-5.4.1/bin/system.properties +2021-11-02 01:40:50,121 INFO o.a.j.JMeter: Copyright (c) 1998-2021 The Apache Software Foundation +2021-11-02 01:40:50,121 INFO o.a.j.JMeter: Version 5.4.1 +2021-11-02 01:40:50,121 INFO o.a.j.JMeter: java.version=14.0.2 +2021-11-02 01:40:50,122 INFO o.a.j.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM +2021-11-02 01:40:50,122 INFO o.a.j.JMeter: os.name=Linux +2021-11-02 01:40:50,122 INFO o.a.j.JMeter: os.arch=amd64 +2021-11-02 01:40:50,122 INFO o.a.j.JMeter: os.version=5.4.0-89-generic +2021-11-02 01:40:50,122 INFO o.a.j.JMeter: file.encoding=UTF-8 +2021-11-02 01:40:50,122 INFO o.a.j.JMeter: java.awt.headless=null +2021-11-02 01:40:50,122 INFO o.a.j.JMeter: Max memory =8589934592 +2021-11-02 01:40:50,122 INFO o.a.j.JMeter: Available Processors =8 +2021-11-02 01:40:50,137 INFO o.a.j.JMeter: Default Locale=English (EN) +2021-11-02 01:40:50,137 INFO o.a.j.JMeter: JMeter Locale=English (EN) +2021-11-02 01:40:50,138 INFO o.a.j.JMeter: JMeterHome=/opt/apache-jmeter-5.4.1 +2021-11-02 01:40:50,138 INFO o.a.j.JMeter: user.dir =/home/marcosborges/s9c_jmeter_terraform_loadtest_provisioner/examples/plan/jmeter +2021-11-02 01:40:50,138 INFO o.a.j.JMeter: PWD =/home/marcosborges/s9c_jmeter_terraform_loadtest_provisioner/examples/plan/jmeter +2021-11-02 01:40:50,138 INFO o.a.j.JMeter: IP: 127.0.1.1 Name: marcosborges FullName: marcosborges +2021-11-02 01:40:50,608 INFO o.a.j.JMeter: Setting LAF to: com.github.weisj.darklaf.DarkLaf:com.github.weisj.darklaf.theme.DarculaTheme +2021-11-02 01:40:51,694 INFO o.a.j.JMeter: Loaded icon properties from org/apache/jmeter/images/icon.properties +2021-11-02 01:40:54,107 INFO o.a.j.JMeter: Loading file: basic.jmx +2021-11-02 01:40:54,110 INFO o.a.j.s.FileServer: Default base='/home/marcosborges/s9c_jmeter_terraform_loadtest_provisioner/examples/plan/jmeter' +2021-11-02 01:40:54,111 INFO o.a.j.s.FileServer: Set new base='/home/marcosborges/s9c_jmeter_terraform_loadtest_provisioner/examples/plan/jmeter' +2021-11-02 01:40:54,305 INFO o.a.j.s.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2 +2021-11-02 01:40:54,326 INFO o.a.j.s.SaveService: Using SaveService properties version 5.0 +2021-11-02 01:40:54,328 INFO o.a.j.s.SaveService: Using SaveService properties file encoding UTF-8 +2021-11-02 01:40:54,329 INFO o.a.j.s.SaveService: Loading file: basic.jmx +2021-11-02 01:40:54,358 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/html is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser +2021-11-02 01:40:54,358 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for application/xhtml+xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser +2021-11-02 01:40:54,359 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for application/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser +2021-11-02 01:40:54,359 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser +2021-11-02 01:40:54,359 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/vnd.wap.wml is org.apache.jmeter.protocol.http.parser.RegexpHTMLParser +2021-11-02 01:40:54,359 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/css is org.apache.jmeter.protocol.http.parser.CssParser +2021-11-02 01:40:54,386 INFO o.a.j.s.FileServer: Set new base='/home/marcosborges/s9c_jmeter_terraform_loadtest_provisioner/examples/plan/jmeter' +2021-11-02 01:41:40,188 ERROR o.a.j.g.a.Save: Failed to backup file: /home/marcosborges/s9c_jmeter_terraform_loadtest_provisioner/examples/plan/jmeter/basic.jmx +java.nio.file.AccessDeniedException: /opt/apache-jmeter-5.4.1/backups/basic-000001.jmx + at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?] + at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?] + at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?] + at sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:246) ~[?:?] + at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:601) ~[?:?] + at sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:258) ~[?:?] + at java.nio.file.Files.copy(Files.java:1299) ~[?:?] + at org.apache.commons.io.FileUtils.doCopyFile(FileUtils.java:1392) ~[commons-io-2.8.0.jar:2.8.0] + at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:885) ~[commons-io-2.8.0.jar:2.8.0] + at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:835) ~[commons-io-2.8.0.jar:2.8.0] + at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:802) ~[commons-io-2.8.0.jar:2.8.0] + at org.apache.jmeter.gui.action.Save.createBackupFile(Save.java:381) ~[ApacheJMeter_core.jar:5.4.1] + at org.apache.jmeter.gui.action.Save.backupAndSave(Save.java:244) ~[ApacheJMeter_core.jar:5.4.1] + at org.apache.jmeter.gui.action.Save.doAction(Save.java:173) ~[ApacheJMeter_core.jar:5.4.1] + at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:87) ~[ApacheJMeter_core.jar:5.4.1] + at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0(ActionRouter.java:69) ~[ApacheJMeter_core.jar:5.4.1] + at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316) ~[?:?] + at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) ~[?:?] + at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?] + at java.awt.EventQueue$4.run(EventQueue.java:715) ~[?:?] + at java.security.AccessController.doPrivileged(AccessController.java:391) [?:?] + at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) [?:?] + at java.awt.EventQueue.dispatchEvent(EventQueue.java:740) [?:?] + at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [?:?] + at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [?:?] + at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [?:?] + at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) [?:?] + at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:?] + at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) [?:?] +2021-11-02 01:42:11,478 INFO o.a.j.e.StandardJMeterEngine: Running the test! +2021-11-02 01:42:11,479 INFO o.a.j.s.SampleEvent: List of sample_variables: [] +2021-11-02 01:42:11,479 INFO o.a.j.s.SampleEvent: List of sample_variables: [] +2021-11-02 01:42:11,481 INFO o.a.j.e.u.CompoundVariable: Note: Function class names must contain the string: '.functions.' +2021-11-02 01:42:11,482 INFO o.a.j.e.u.CompoundVariable: Note: Function class names must not contain the string: '.gui.' +2021-11-02 01:42:11,808 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, *local*) +2021-11-02 01:42:11,861 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group +2021-11-02 01:42:11,862 INFO o.a.j.e.StandardJMeterEngine: Starting 20 threads for group Thread Group. +2021-11-02 01:42:11,862 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error +2021-11-02 01:42:11,862 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=20 ramp-up=10 delayedStart=true +2021-11-02 01:42:11,863 INFO o.a.j.t.ThreadGroup: Started thread group number 1 +2021-11-02 01:42:11,863 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started +2021-11-02 01:42:16,876 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1 +2021-11-02 01:42:16,905 INFO o.a.j.p.h.s.HTTPHCAbstractImpl: Local host = marcosborges +2021-11-02 01:42:16,913 INFO o.a.j.p.h.s.HTTPHC4Impl: HTTP request retry count = 0 +2021-11-02 01:42:16,915 INFO o.a.j.s.SampleResult: Note: Sample TimeStamps are START times +2021-11-02 01:42:16,915 INFO o.a.j.s.SampleResult: sampleresult.default.encoding is set to ISO-8859-1 +2021-11-02 01:42:16,915 INFO o.a.j.s.SampleResult: sampleresult.useNanoTime=true +2021-11-02 01:42:16,915 INFO o.a.j.s.SampleResult: sampleresult.nanoThreadSleep=5000 +2021-11-02 01:42:17,261 INFO o.a.j.p.h.s.h.LazyLayeredConnectionSocketFactory: Setting up HTTPS TrustAll Socket Factory +2021-11-02 01:42:17,265 INFO o.a.j.u.JsseSSLManager: Using default SSL protocol: TLS +2021-11-02 01:42:17,265 INFO o.a.j.u.JsseSSLManager: SSL session context: per-thread +2021-11-02 01:42:17,399 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-2 +2021-11-02 01:42:17,765 INFO o.a.j.u.SSLManager: JmeterKeyStore Location: type JKS +2021-11-02 01:42:17,768 INFO o.a.j.u.SSLManager: KeyStore created OK +2021-11-02 01:42:17,768 WARN o.a.j.u.SSLManager: Keystore file not found, loading empty keystore +2021-11-02 01:42:17,926 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-3 +2021-11-02 01:42:18,456 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-4 +2021-11-02 01:42:18,982 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-5 +2021-11-02 01:42:19,507 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-6 +2021-11-02 01:42:20,034 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-7 +2021-11-02 01:42:20,559 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-8 +2021-11-02 01:42:21,086 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-9 +2021-11-02 01:42:21,611 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-10 +2021-11-02 01:42:22,138 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-11 +2021-11-02 01:42:22,664 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-12 +2021-11-02 01:42:23,189 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-13 +2021-11-02 01:42:23,715 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-14 +2021-11-02 01:42:24,242 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-15 +2021-11-02 01:42:24,766 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-16 +2021-11-02 01:42:25,060 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-5 +2021-11-02 01:42:25,060 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-5 +2021-11-02 01:42:25,185 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-2 +2021-11-02 01:42:25,185 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-2 +2021-11-02 01:42:25,291 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-17 +2021-11-02 01:42:25,577 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-6 +2021-11-02 01:42:25,577 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-1 +2021-11-02 01:42:25,577 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-6 +2021-11-02 01:42:25,578 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-1 +2021-11-02 01:42:25,585 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-7 +2021-11-02 01:42:25,585 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-7 +2021-11-02 01:42:25,700 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-4 +2021-11-02 01:42:25,700 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-4 +2021-11-02 01:42:25,737 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-8 +2021-11-02 01:42:25,737 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-8 +2021-11-02 01:42:25,799 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-3 +2021-11-02 01:42:25,799 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-3 +2021-11-02 01:42:25,815 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-18 +2021-11-02 01:42:25,855 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-9 +2021-11-02 01:42:25,855 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-9 +2021-11-02 01:42:26,341 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-19 +2021-11-02 01:42:26,343 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-10 +2021-11-02 01:42:26,343 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-10 +2021-11-02 01:42:26,748 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-11 +2021-11-02 01:42:26,748 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-11 +2021-11-02 01:42:26,865 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-20 +2021-11-02 01:42:27,290 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-13 +2021-11-02 01:42:27,290 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-13 +2021-11-02 01:42:27,304 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-14 +2021-11-02 01:42:27,304 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-14 +2021-11-02 01:42:27,413 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-12 +2021-11-02 01:42:27,413 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-12 +2021-11-02 01:42:27,810 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-16 +2021-11-02 01:42:27,810 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-16 +2021-11-02 01:42:28,116 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-17 +2021-11-02 01:42:28,116 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-17 +2021-11-02 01:42:28,454 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-15 +2021-11-02 01:42:28,454 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-15 +2021-11-02 01:42:28,503 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-18 +2021-11-02 01:42:28,504 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-18 +2021-11-02 01:42:28,952 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-19 +2021-11-02 01:42:28,952 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-19 +2021-11-02 01:42:29,640 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-20 +2021-11-02 01:42:29,640 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-20 +2021-11-02 01:42:29,644 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test +2021-11-02 01:42:29,646 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*) diff --git a/executor.tf b/executor.tf index 88f6de9..a1a92f0 100644 --- a/executor.tf +++ b/executor.tf @@ -1,13 +1,29 @@ locals { auto_execute = var.auto_execute - nodes_private_ips = ( - var.executor == "jmeter" ? - join(",",aws_instance.nodes.*.private_ip) : - "['${join("','",aws_instance.nodes.*.private_ip)}']" - ) - leader_private_ip = aws_instance.leader.private_ip + + executors = { + jmeter = { + nodes_ips = join(",",aws_instance.nodes.*.private_ip) + } + bzt = { + nodes_ips = "['${join("','",aws_instance.nodes.*.private_ip)}']" + } + locust = { + nodes_ips = join(",",aws_instance.nodes.*.private_ip) + leader_ip = local.leader_private_ip + } + k6 = { + waiting = "#" + nodes_ips = "" + } + } + + executor = lookup(local.executors, var.executor, "") + waiting_command = "while [ ! -f /tmp/finished-setup ]; do echo 'waiting setup to be instaled'; sleep 5; done" + nodes_ips = local.executor.nodes_ips + } resource "null_resource" "executor" { @@ -29,17 +45,27 @@ resource "null_resource" "executor" { #EXECUTE SCRIPTS provisioner "remote-exec" { inline = [ - #"while [ ! -f /var/lib/apache-jmeter-5.3/bin/jmeter ]; do sleep 10; done", "echo 'START EXECUTION'", + local.waiting_command, + ] + } + + provisioner "remote-exec" { + inline = [ "echo DIR: ${var.loadtest_dir_destination}", "cd ${var.loadtest_dir_destination}", + "echo PATH: $PATH", "echo JVM_ARGS: $JVM_ARGS", - "echo ${replace(var.loadtest_entrypoint, "{NODES_IPS}", local.nodes_private_ips)}", - replace(var.loadtest_entrypoint, "{NODES_IPS}", local.nodes_private_ips) + "sudo chmod 777 /var/www/html -Rf", + "sudo rm -rf /var/www/html/*", + "sudo rm -rf /loadtest/logs", + "echo ${replace(var.loadtest_entrypoint, "{NODES_IPS}", local.nodes_ips)}", + replace(var.loadtest_entrypoint, "{NODES_IPS}", local.nodes_ips) ] } - triggers = { - always_run = timestamp() - } + + # triggers = { + # always_run = timestamp() + # } } diff --git a/nodes.tf b/nodes.tf index 024aeff..c6d9583 100644 --- a/nodes.tf +++ b/nodes.tf @@ -35,6 +35,14 @@ resource "aws_instance" "nodes" { source = var.loadtest_dir_source } + provisioner "remote-exec" { + inline = [ + "echo 'START EXECUTION'", + "while [ ! -f /tmp/finished-setup ]; do echo 'waiting setup to be instaled'; sleep 5; done", + "sleep 10" + ] + } + tags = merge( var.tags, var.nodes_tags diff --git a/scripts/entrypoint.leader.full.sh.tpl b/scripts/entrypoint.leader.full.sh.tpl index 904ebc3..e1a4a1a 100644 --- a/scripts/entrypoint.leader.full.sh.tpl +++ b/scripts/entrypoint.leader.full.sh.tpl @@ -6,12 +6,12 @@ sudo yum install -y pcre2-devel.x86_64 python gcc python3-devel tzdata curl unzi # APACHE sudo systemctl enable httpd sudo systemctl start httpd -sudo chmod -R 777 /var/www/html +sudo chmod -r 777 /var/www/html sudo rm -rf /var/www/html/* # TAURUS export BZT_VERSION="1.16.0" -sudo pip3 nstall bzt==$BZT_VERSION +sudo pip3 install bzt==$BZT_VERSION # JMETER export MIRROR_HOST=https://archive.apache.org/dist/jmeter @@ -33,6 +33,10 @@ sudo tar -xzf /tmp/apache-jmeter-$JMETER_VERSION.tgz -C /opt export PATH="$PATH:$JMETER_BIN" echo "PATH=$PATH" >> /etc/environment +sudo echo "#!/bin/bash" > /etc/profile.d/script.sh +sudo echo "export PATH=\"\$PATH:\$JMETER_BIN\"" >> /etc/profile.d/script.sh +sudo chmod +x /etc/profile.d/script.sh + export PRIVATE_IP=$(hostname -I | awk '{print $1}') echo "PRIVATE_IP=$PRIVATE_IP" >> /etc/environment @@ -52,4 +56,4 @@ sudo curl -L --silent https://search.maven.org/remotecontent?filepath=kg/apc/jme sudo curl -L --silent https://search.maven.org/remotecontent?filepath=kg/apc/jmeter-plugins-tst/2.5/jmeter-plugins-tst-2.5.jar -o $JMETER_PLUGINS_FOLDER/jmeter-plugins-tst-2.5.jar - +touch /tmp/finished-setup diff --git a/scripts/entrypoint.node.full.sh.tpl b/scripts/entrypoint.node.full.sh.tpl index 7ffb0e2..3555112 100644 --- a/scripts/entrypoint.node.full.sh.tpl +++ b/scripts/entrypoint.node.full.sh.tpl @@ -5,7 +5,7 @@ sudo yum install -y pcre2-devel.x86_64 python gcc python3-devel tzdata curl unzi # TAURUS export BZT_VERSION="1.16.0" -sudo pip3 nstall bzt==$BZT_VERSION +sudo pip3 install bzt==$BZT_VERSION # JMETER export MIRROR_HOST=https://archive.apache.org/dist/jmeter @@ -23,6 +23,10 @@ curl -L --silent $JMETER_DOWNLOAD_URL > /tmp/apache-jmeter-$JMETER_VERSION.tgz sudo mkdir -p /opt sudo tar -xzf /tmp/apache-jmeter-$JMETER_VERSION.tgz -C /opt +sudo echo "#!/bin/bash" > /etc/profile.d/script.sh +sudo echo "export PATH=\"\$PATH:\$JMETER_BIN\"" >> /etc/profile.d/script.sh +sudo chmod +x /etc/profile.d/script.sh + # ADD JMETER UM PATH export PATH="$PATH:$JMETER_BIN" echo "PATH=$PATH" >> /etc/environment @@ -45,5 +49,11 @@ sudo curl -L --silent https://search.maven.org/remotecontent?filepath=kg/apc/jme sudo curl -L --silent https://search.maven.org/remotecontent?filepath=kg/apc/jmeter-plugins-prmctl/0.4/jmeter-plugins-prmctl-0.4.jar -o $JMETER_PLUGINS_FOLDER/jmeter-plugins-prmctl-0.4.jar sudo curl -L --silent https://search.maven.org/remotecontent?filepath=kg/apc/jmeter-plugins-tst/2.5/jmeter-plugins-tst-2.5.jar -o $JMETER_PLUGINS_FOLDER/jmeter-plugins-tst-2.5.jar +source ~/.bashrc + +touch /tmp/finished-setup + # START JMETER NODE -jmeter-server -Dserver.rmi.localport=50000 -Dserver_port=1099 -Dserver.rmi.ssl.disable=true -Djava.rmi.server.hostname=$PRIVATE_IP \ No newline at end of file +jmeter -s -Dserver.rmi.localport=50000 -Dserver_port=1099 -Dserver.rmi.ssl.disable=true -Djava.rmi.server.hostname=$PRIVATE_IP -j /tmp/jmeter-server.log + + diff --git a/security.tf b/security.tf index 5ef6b89..2e18808 100644 --- a/security.tf +++ b/security.tf @@ -7,35 +7,10 @@ resource "aws_security_group" "loadtest" { vpc_id = data.aws_vpc.current.id ingress { - description = "JMeter Server Port" - from_port = 1099 - to_port = 1099 - protocol = "TCP" - cidr_blocks = [data.aws_vpc.current.cidr_block] - } - - ingress { - description = "JMeter Port" - from_port = 4445 - to_port = 4445 - protocol = "TCP" - cidr_blocks = [data.aws_vpc.current.cidr_block] - } - - ingress { - description = "JMeter RMI Server Ports" - from_port = 50000 - to_port = 50000 - protocol = "TCP" - cidr_blocks = [data.aws_vpc.current.cidr_block] - } - - ingress { - description = "JMeter RMI Server Ports2" - from_port = 60000 - to_port = 60000 - protocol = "TCP" - cidr_blocks = [data.aws_vpc.current.cidr_block] + from_port = 0 + to_port = 0 + protocol = "-1" + self = true } ingress { diff --git a/variables.tf b/variables.tf index 5147c70..268949e 100644 --- a/variables.tf +++ b/variables.tf @@ -62,7 +62,7 @@ variable "leader_ami_id" { variable "leader_instance_type" { description = "Instance type of the cluster leader" type = string - default = "t2.medium" + default = "c5n.large" } variable "leader_tags" { @@ -86,7 +86,7 @@ variable "nodes_ami_id" { variable "nodes_intance_type" { description = "Instance type of the cluster nodes" type = string - default = "t2.medium" + default = "c5n.xlarge" } variable "nodes_tags" { @@ -173,13 +173,13 @@ variable "jmeter_version" { variable "leader_jvm_args" { description = "JVM Leader JVM_ARGS" type = string - default = " -Xms2g -Xmx2g -XX:MaxMetaspaceSize=256m -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20 " + default = " -Xms3g -Xmx4g -Dnashorn.args=--no-deprecation-warning " } variable "nodes_jvm_args" { description = "JVM Nodes JVM_ARGS" type = string - default = "-Xms2g -Xmx2g -XX:MaxMetaspaceSize=256m -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20 -Dnashorn.args=--no-deprecation-warning -XX:+HeapDumpOnOutOfMemoryError " + default = "-Xms5g -Xmx10g -Dnashorn.args=--no-deprecation-warning" } variable "taurus_version" {