Skip to content

Commit

Permalink
Some loadtesting improvements to solve common issues (#15360)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfairburn authored Nov 30, 2023
1 parent 837602a commit b31e452
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 89 deletions.
1 change: 1 addition & 0 deletions infrastructure/loadtesting/terraform/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.external_modules
.terraform.lock.hcl
83 changes: 0 additions & 83 deletions infrastructure/loadtesting/terraform/.terraform.lock.hcl

This file was deleted.

10 changes: 5 additions & 5 deletions infrastructure/loadtesting/terraform/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resource "aws_ecs_service" "fleet" {
launch_type = "FARGATE"
cluster = aws_ecs_cluster.fleet.id
task_definition = aws_ecs_task_definition.backend.arn
desired_count = 10
desired_count = var.fleet_containers
deployment_minimum_healthy_percent = 100
deployment_maximum_percent = 200
health_check_grace_period_seconds = 30
Expand Down Expand Up @@ -142,7 +142,7 @@ resource "aws_ecs_task_definition" "backend" {
},
{
name = "FLEET_MYSQL_MAX_OPEN_CONNS"
value = "5"
value = "10"
},
{
name = "FLEET_MYSQL_READ_REPLICA_USERNAME"
Expand All @@ -158,7 +158,7 @@ resource "aws_ecs_task_definition" "backend" {
},
{
name = "FLEET_MYSQL_READ_REPLICA_MAX_OPEN_CONNS"
value = "5"
value = "10"
},
{
name = "FLEET_REDIS_ADDRESS"
Expand Down Expand Up @@ -284,8 +284,8 @@ resource "aws_ecs_task_definition" "migration" {
}

resource "aws_appautoscaling_target" "ecs_target" {
max_capacity = 10
min_capacity = 10
max_capacity = var.fleet_containers
min_capacity = var.fleet_containers
resource_id = "service/${aws_ecs_cluster.fleet.name}/${aws_ecs_service.fleet.name}"
scalable_dimension = "ecs:service:DesiredCount"
service_namespace = "ecs"
Expand Down
16 changes: 16 additions & 0 deletions infrastructure/loadtesting/terraform/helpers/setup-darwin_arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e

VERSION="0.1.0"
PLUGIN_PATH="${HOME}/.terraform.d/plugins/registry.terraform.io/paultyng/git/${VERSION}/darwin_arm64"
TERRAFORMRC="${HOME}/.terraformrc"

pushd /tmp
git clone [email protected]:paultyng/terraform-provider-git.git
Expand All @@ -16,3 +17,18 @@ mv terraform-provider-git ${PLUGIN_PATH}
cd ..
rm -rf /tmp/terraform-provider-git
popd

if [ -f "${TERRAFORMRC}" ]; then
echo "Moving ${TERRAFORMRC} to ${TERRAFORMRC}.old before replacing"
mv "${TERRAFORMRC}" "${TERRAFORMRC}.old"
fi
cat <<-EOF > "${HOME}/.terraformrc"
provider_installation {
filesystem_mirror {
path = "/Users/$(whoami)/.terraform.d/plugins"
}
direct {
exclude = ["registry.terraform.io/paultyng/*"]
}
}
EOF
8 changes: 7 additions & 1 deletion infrastructure/loadtesting/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ variable "loadtest_containers" {
default = 0
}

variable "fleet_containers" {
description = "The number of containers running Fleet"
type = number
default = 10
}

variable "db_instance_type" {
description = "The type of the loadtesting db instances. Default is db.r6g.4xlarge."
type = string
Expand All @@ -30,4 +36,4 @@ variable "redis_instance_type" {
description = "the redis instance type to use in loadtesting. default is cache.m6g.large"
type = string
default = "cache.m6g.large"
}
}

0 comments on commit b31e452

Please sign in to comment.