Skip to content

Latest commit

 

History

History
110 lines (69 loc) · 3.23 KB

terraform_loadtest.md

File metadata and controls

110 lines (69 loc) · 3.23 KB

Running a load-test with a Terraform deployment

This guide describes how to setup and run a load-test using a Terraform deployment.
Following this process it is possible to create a complete load-test system in a mostly automated form.
This is the recommended way to load-test a Mattermost instance for production.

Prerequisites

  • Terraform. Version 0.12 is required.
  • AWS credentials to be used as described here
  • A Mattermost E20 license, required to run the load-test through the coordinator

Note

If authenticating using the AWS credentials file, the profile to use is mm-loadtest.

Clone the repository

git clone https://github.com/mattermost/mattermost-load-test-ng

Enter the source directory

cd mattermost-load-test-ng

Copy and modify the required configuration

In order to start the deployment process, it is required to configure the deployer appropriately.

cp config/deployer.default.json config/deployer.json

Detailed documentation for the deployer's config can be found here.

Deployment

Setup ssh-agent

For the deployer to work, a ssh-agent needs to be running and loaded with a private key.

eval $(ssh-agent -s)
ssh-add PATH_TO_KEY

PATH_TO_KEY should be replaced with the path to the matching private key for SSHPublicKey, as previously configured.

Create a new deployment

go run ./cmd/ltctl deployment create

This command can take several minutes to complete when creating a full deployment.
Once done, it will output information about the entire cluster. Everything will be now ready to start a new load-test.

Optionally configure coordinator and load-test

When starting a load-test with the ltctl command, required configuration files are automatically uploaded to the instance hosting the coordinator. If no files are found, defaults will be used.

Copy default config

To configure the coordinator, config/coordinator.json should be created and/or edited.

cp config/coordinator.default.json config/coordinator.json

Its documentation can be found here.

Copy default config

To configure the load-test config/config.json, should be created and/or edited.

cp config/config.default.json config/config.json

Its documentation can be found here.

Run the coordinator

go run ./cmd/ltctl loadtest start

This will begin to run the load-test across the whole cluster of load-test agents.

Stop the running load-test

go run ./cmd/ltctl loadtest stop

This will stop the currently running load-test.

Destroy the current deployment

When done with a deployment, it's suggested to run:

go run ./cmd/ltctl deployment destroy

This will permanently destroy all resources for the current deployment.