Skip to content

Commit 820f06c

Browse files
anoop-surej-nhsankur-jain-nhs
authored andcommitted
VIA-591 AS/SB Update load-generator readme
(cherry picked from commit b4a6796)
1 parent 97152d7 commit 820f06c

File tree

1 file changed

+31
-4
lines changed
  • infrastructure/environments/test/load-generator

1 file changed

+31
-4
lines changed

infrastructure/environments/test/load-generator/readme.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Tag, promote, and deploy to the test environment, as per the [usual process](htt
1010

1111
### Build image
1212

13+
You should only need to build and upload an image if something has been modified in the load-generator Dockerfile.
14+
1315
#### Build image for deployment
1416

1517
```sh
@@ -33,9 +35,13 @@ docker push "$load_generator_ecr_repository_url":latest
3335

3436
### Check it's working
3537

36-
Manually upload the [test plan](/performance/vita-user-journey.jmx) to the s3 path `s3://gh-vita-***-load-testing/plans/`.
38+
Manually upload the [test plan](/performance/vita-user-journey.jmx) to the s3 path `s3://gh-vita-***-load-testing/plans/`. You should only need to do this if the test plan has been modified.
39+
40+
#### Triggering the task
3741

38-
Trigger the task from AWS console UI. For the number of desired tasks and threads, apply the formula
42+
Trigger the task from AWS console UI or via the aws-cli command. For the number of desired tasks and threads, apply the formula
43+
44+
##### Via AWS Console UI
3945

4046
```text
4147
Number of concurrent users = (Number of tasks) x (Number of threads/task)
@@ -47,7 +53,7 @@ Number of concurrent users = (Number of tasks) x (Number of threads/task)
4753
- Click `Deploy` -> `Run task`
4854
- Task details
4955
- `Task definition revision`: LATEST
50-
- `Desired tasks`: <based on above formula>
56+
- `Desired tasks`: `<based on above formula>`
5157
- `Task group`: load-generator
5258
- Environment
5359
- Existing cluster: fake-api-project-cluster
@@ -61,11 +67,32 @@ Number of concurrent users = (Number of tasks) x (Number of threads/task)
6167
- Change the default values as per need
6268
- `DURATION`: duration of the test in seconds
6369
- `RAMPUP`: seconds to ramp up concurrent threads linearly, 1 -> $THREADS
64-
- `THREADS`: the number of concurrent threads to use, <based on above formula>
70+
- `THREADS`: the number of concurrent threads to use (threads/task), `<based on above formula>`
6571
- `ENVIRONMENT`: the subdomain that represents the environment to run the test on, e.g. `test`
6672
- `S3_BUCKET`: the bucket name to use for test inputs and outputs
6773
- `TEST_PLAN`: the *.jmx file name to use as the JMeter test plan
6874

75+
##### Via aws-cli
76+
77+
These instructions assume you've named your profile `vita-test`.
78+
79+
```shell
80+
subnets=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=fake-api-project-public-subnet-1,fake-api-project-public-subnet-2,fake-api-project-private-subnet-1,fake-api-project-private-subnet-2" --profile vita-test | jq -r "[.Subnets[].SubnetId] | join(\",\")")
81+
82+
sec_group=$(aws ec2 describe-security-groups --filters "Name=tag:Name,Values=fake-api-service-sg" --profile vita-test | jq -r ".SecurityGroups[].GroupId")
83+
84+
aws ecs run-task \
85+
--cluster fake-api-project-cluster \
86+
--task-definition load-generator \
87+
--launch-type FARGATE \
88+
--platform-version LATEST \
89+
--count 10 \
90+
--group load-generator \
91+
--network-configuration "awsvpcConfiguration={subnets=[$subnets],securityGroups=[$sec_group],assignPublicIp=ENABLED}" \
92+
--overrides '{"containerOverrides": [{"name": "load-generator-container", "environment": [{"name": "DURATION", "value": "3600"}, {"name": "RAMPUP", "value": "300"}, {"name": "THREADS", "value": "40"}, {"name": "ENVIRONMENT", "value": "test"}, {"name": "S3_BUCKET", "value": "gh-vita-741448960880-load-testing"}, {"name": "TEST_PLAN", "value": "vita-user-journey.jmx"}]}]}' \
93+
--profile vita-test
94+
```
95+
6996
## Analysing the results
7097

7198
Download the test logs locally and generate a report using the following commands.

0 commit comments

Comments
 (0)