You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/performance/README.md
+28-27Lines changed: 28 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ We have performance tests which give us a benchmark of how NRLF performs under l
6
6
7
7
### Prep the environment
8
8
9
-
Perf tests are generally conducted in the perftest env. There's a selection of tables in the perftest env representing different pointer volume scenarios e.g. perftest-baseline vs perftest-1million (todo: update with real names!).
9
+
Perf tests are generally conducted in the perftest env. There's a selection of tables in the perftest env representing different pointer volume scenarios e.g. perftest-baseline vs perftest-15m vs perftest-55m
10
10
11
11
#### Pull certs for perftest
12
12
@@ -17,45 +17,44 @@ make truststore-pull-all ENV=perftest
17
17
18
18
#### Point perftest at a different pointers table
19
19
20
-
We (will) have multiple tables representing different states of NRLF in the future e.g. all patients receiving an IPS (International Patient Summary), onboarding particular high-volume suppliers.
21
-
22
-
In order to run performance tests to get figures for these different states, we can point the perftest environment at one of these tables.
23
-
24
-
Currently, this requires tearing down the existing environment and restoring from scratch:
25
-
26
-
1. Follow instructions in terraform/infrastructure/readme.md to tear down the perf test environment.
27
-
- Do **not** tear down shared account-wide infrastructure
28
-
2. Update `perftest-pointers-table.name_prefix` in `terraform/account-wide-infrastructure/test/dynamodb__pointers-table.tf` to be the table name you want, minus "-pointers-table"
29
-
- e.g. to use the baseline table `nhsd-nrlf--perftest-baseline-pointers-table`, set `name_prefix = "nhsd-nrlf--perftest-baseline"`
30
-
3. Update `dynamodb_pointers_table_prefix` in `terraform/infrastructure/etc/perftest.tfvars` same as above.
31
-
- e.g. to use the baseline table `dynamodb_pointers_table_prefix = "nhsd-nrlf--perftest-baseline"`
32
-
4. Commit changes to a branch & push
33
-
5. Run the [Deploy Account-wide infrastructure](https://github.com/NHSDigital/NRLF/actions/workflows/deploy-account-wide-infra.yml) workflow against your branch & `account-test`.
34
-
- If you get a terraform failure like "tried to create table but it already exists", you will need to do some fanangaling:
35
-
1. make sure there is a backup of your chosen table or create one if not. In the AWS console: dynamodb > tables > your perftest table > backups > create backup > Create on-demand backup > leave all settings as defaults > create backup. This might take up to an hour to complete.
36
-
2. once backed up, delete your table. In the AWS console: dynamodb > tables > your perftest table > actions > delete table
37
-
3. Rerun the Deploy Account-wide infrastructure action.
38
-
4. Terraform will create an empty table with the correct name & (most importantly!) read/write IAM policies.
39
-
5. Delete the empty table created by terraform and restore from the backup, specifying the same table name you've defined in code & selecting the matching customer managed encryption key.
40
-
6. Run the [Persistent Environment Deploy](https://github.com/NHSDigital/NRLF/actions/workflows/persistent-environment.yml) workflow against your branch & `perftest` to restore the environment with lambdas pointed at your chosen table.
41
-
7. You can check this has been successful by checking the table name in the lambdas.
42
-
- In the AWS console: Lambda > functions > pick any perftest-1 lambda > Configuration > Environment variables > `TABLE_NAME` should be your desired pointer table e.g. `nhsd-nrlf--perftest-baseline-pointers-table`
20
+
We have multiple tables representing different states of NRLF in the future e.g. all patients receiving an IPS (International Patient Summary), onboarding particular high-volume suppliers.
21
+
22
+
In order to run performance tests to get figures for these different volumes, we can point the perftest environment at one of these tables.
23
+
24
+
To do this, we change an environment variable which defines which table our lambdas talk to and deploy changes.
25
+
26
+
1. Update `dynamodb_pointers_table_name` to be the desired table name in [terraform/infrastructure/etc/perftest.tfvars](terraform/infrastructure/etc/perftest.tfvars) e.g.
If you've followed these steps, you will also need to [generate permissions](#generate-permissions) as the organisation permissions will have been lost when the environment was torn down.
32
+
2. To avoid erasing the test permissions when you deploy these changes, make sure to run through the steps to [generate permissions](#generate-permissions)
33
+
3. Apply your changes
34
+
35
+
```sh
36
+
cd ./terraform/infrastructure
37
+
make init TF_WORKSPACE_NAME=perftest-1 ENV=perftest
38
+
make ENV=perftest USE_SHARED_RESOURCES=true apply
39
+
```
40
+
41
+
4. You can verify this has been successful by checking the table name in the lambdas.
42
+
- In the AWS console: Lambda > functions > pick any perftest-1 lambda > Configuration > Environment variables > `TABLE_NAME` should be your desired pointer table e.g. `nhsd-nrlf--perftest-baseline-pointers-table`
45
43
46
44
#### Generate permissions
47
45
48
46
You will need to generate pointer permissions the first time performance tests are run in an environment e.g. if the perftest environment is destroyed & recreated.
49
47
50
48
```sh
49
+
assume nhsd-nrlf-mgmt
50
+
51
51
# In project root
52
52
make perftest-generate-permissions # makes a bunch of json permission files for test organisations
53
53
make get-s3-perms ENV=perftest # will take all permissions & create nrlf_permissions.zip file
54
54
make build
55
55
56
56
# apply this new permissions zip file to your environment
57
57
cd ./terraform/infrastructure
58
-
assume nhsd-nrlf-mgmt
59
58
make init TF_WORKSPACE_NAME=perftest-1 ENV=perftest
60
59
make ENV=perftest USE_SHARED_RESOURCES=true apply
61
60
```
@@ -111,9 +110,11 @@ Regenerates the input files from the current state of a given perftest table & u
This will generate a csv extract of the given pointer table containing a row per pointer. To run the perf tests, you will need an extract larger than the number of test iterations. The default extract size is 2 million - this can be changed in the make file command by updating the value of`--extract-size`. Too big and the test runners will take a long time to load the file.
117
+
117
118
## Assumptions / Caveats
118
119
119
120
- Run performance tests in the perftest environment only\*
0 commit comments