• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

packer/H27-Aug-2021-1,3451,130

terraform/H27-Aug-2021-497349

README.mdH A D27-Aug-20213.1 KiB3322

README.md

1# Terraform Consul Load Testing
2Consul Load Testing is used to capture baseline performance metrics for Consul under stress. This will assist in ensuring there are no performance regressions during releases and substantial changes to Consul. Per the defaults, the test runs for 10 minutes with 25 virtual users spawned by k6. Instance sizes for test instances are `t2.small` and for the Consul cluster `m5n.large`.  All metrics from Consul are pushed to a datadog dashboard for user review.
3
4This relies on the [Gruntwork's Terraform AWS Consul Module](https://github.com/hashicorp/terraform-aws-consul) which *by default* creates 3 Consul servers across 3 availability zones. A load test instance which has an image that is configured with the necessary scripts and [k6](https://k6.io/) is created and sends traffic to a load balancer. The load balancer will distribute requests across the Consul clients who will ultimately forward the requests to the servers.
5
6<img src="loadtestdiagram.png" width="500" height="300"/>
7
8# Load Test Automation
9This can only be run on PRs that a Dev Build has been made for. When a PR has the `pr/load-test` Github Label applied this will kick off a Github Action. This Github Action will trigger Circle CI to run a Terraform Apply that runs a load test against the Dev Build Consul binary. The GitHub Action will paste the CircleCI load test workflow URL to the PR as a comment.
10
11## How to use
12[Terraform](https://www.terraform.io/downloads.html) and [Packer](https://www.packer.io/downloads), AWS and [Datadog](https://docs.datadoghq.com/getting_started/) are required to use this. All of this, except the AWS resources that will be utilized, are free.
13
14This repo has the following folder structure:
15* packer: This contains all the necessary stuff to make the load test and the Consul AMI to be utilized in Terraform.
16* terraform: This contains all the relevant Terraform files
17
18
19## Getting Started
20
211) Download all necessary tools listed (Terraform, Packer)
222) Set up an [AWS account](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/) and a [Datadog account](https://docs.datadoghq.com/getting_started/) - downloading the Datadog client is not necessary.
233) Configure your AWS credentials using one of the [options supported by the AWS
24  SDK](http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html). Usually, the easiest option is to
25  set the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_DEFAULT_REGION` environment variables.
264) Follow the [Packer README](./packer/README.md) to generate your load test and Consul AMIs
275) Follow the [Terraform README](./terraform/README.md) to stand up the infrastructure in AWS
286) Watch the results in either your datadog dashboard or in the output of your Terraform Apply
29
30
31## Debugging in Datadog
32Consul has hundreds of metrics to choose from. We recommend reading over [Datadog's article](https://www.datadoghq.com/blog/consul-metrics/#communication-metrics) that breaks down relevant Consul metrics, especially on their "communication" portion. This test runs solely based on making requests to endpoints which is what makes that section so relevant.
33