|
1 | 1 | # LoadTest tool |
2 | 2 |
|
3 | 3 | ## Introduction |
4 | | -The LoadTest tool is based on [Locust](https://docs.locust.io/en/stable/index.html) which provides a UI for controlling the number of Users to spawn and make random requests. Currently its configured to make the request in the ratio 10 x Create ISA : 5 x Update ISA : 100 x Get ISA : 1 x Delete ISA. This means the User is 10 times likely to Create an ISA vs Deleting an ISA, and 10 times more likely to Get ISA vs Creating an ISA and so on. Subscription workflow is heavier on the Write side with the ratio of 100 x Create Sub : 50 x Update Sub : 20 x Get Sub : 5 x Delete Sub. |
| 4 | +The LoadTest tool is based on [Locust](https://docs.locust.io/en/stable/index.html) which provides a UI for controlling the number of Users to spawn and make random requests. |
| 5 | + |
| 6 | +## Available tests |
| 7 | + |
| 8 | +### ISA.py |
| 9 | + |
| 10 | +Create ISA on RID endpoints. |
| 11 | + |
| 12 | +Currently its configured to make the request in the ratio 10 x Create ISA : 5 x Update ISA : 100 x Get ISA : 1 x Delete ISA. This means the User is 10 times likely to Create an ISA vs Deleting an ISA, and 10 times more likely to Get ISA vs Creating an ISA and so on. |
| 13 | + |
| 14 | +Parameters: |
| 15 | + |
| 16 | +* `--uss-base-url`: Base URL of the USS, used to create ISAs. |
| 17 | + |
| 18 | +### Sub.py |
| 19 | + |
| 20 | +Create subscriptions on RID endpoints. |
| 21 | + |
| 22 | +Subscription workflow is heavier on the Write side with the ratio of 100 x Create Sub : 50 x Update Sub : 20 x Get Sub : 5 x Delete Sub. |
| 23 | + |
| 24 | +Parameters: |
| 25 | + |
| 26 | +* `--uss-base-url`: Base URL of the USS, used to create subscriptions. |
| 27 | + |
| 28 | +### SCD.py |
| 29 | + |
| 30 | +Create operational intents on SCD endpoints. |
| 31 | + |
| 32 | +Flights will be created based on parameters. |
| 33 | + |
| 34 | +Parameters: |
| 35 | + |
| 36 | +* `--uss-base-url`: Base URL of the USS, used to create subscriptions. |
| 37 | +* `--area-lat`: Latitude of the center of the area in which to create flights |
| 38 | +* `--area-lng`: Longitude of the center of the area in which to create flights |
| 39 | +* `--area-radius`: Radius (in meters) of the area in which to create flights |
| 40 | +* `--area-lat`: Maximum distance to cover for an individual flight |
| 41 | + |
| 42 | +### FlightsInSub.py |
| 43 | + |
| 44 | +Create subscriptions on N area and then create operational intents in thoses subscriptions using SCD endpoints. |
| 45 | + |
| 46 | +Flights and subscriptions will be created based on parameters. |
| 47 | +Clusters are shifted by approimatly 2*Radius on the latitude axe. |
| 48 | + |
| 49 | +There will be one subscriptions per area per client. |
| 50 | + |
| 51 | +Parameters: |
| 52 | + |
| 53 | +* `--uss-base-url`: Base URL of the USS, used to create subscriptions. |
| 54 | +* `--cluster-count`: Number of clusters to create |
| 55 | +* `--base-lat`: Latitude of the center of the first cluster |
| 56 | +* `--base-lng`: Longitude of the center of the first cluster |
| 57 | +* `--area-radius`: Radius (in meters) of the area in which to create flights |
| 58 | +* `--area-lat`: Maximum distance to cover for an individual flight |
5 | 59 |
|
6 | 60 | ## Adjusting workload ratio |
7 | | -In each files every action has a weight declared in the `@task(n)` decorator. You can adjust the value of `n` to suite your needs |
| 61 | +For `ISA.py` and `Sub.py`, every action has a weight declared in the `@task(n)` decorator. You can adjust the value of `n` to suite your needs |
8 | 62 |
|
9 | 63 | ## Run locally without Docker |
10 | 64 | 1. Go to the repository's root directory. We have to execute from root directory due to our directory structure choice. |
11 | 65 | 1. Install UV: https://docs.astral.sh/uv/getting-started/installation/ |
12 | 66 | 1. Set OAuth Spec with environment variable `AUTH_SPEC`. See [the auth spec documentation](../monitorlib/README.md#Auth_specs) |
13 | 67 | for the format of these values. Omitting this step will result in Client Initialization failure. |
14 | | -1. You have 2 options of load testing the ISA or Subscription workflow |
15 | | - |
16 | | - a. For ISA run: `AUTH_SPEC="<auth spec>" uv run locust -f ./monitoring/loadtest/locust_files/ISA.py -H <DSS Endpoint URL>` |
17 | 68 |
|
18 | | - b. For Subscription run: `AUTH_SPEC="<auth spec>" uv run locust -f ./monitoring/loadtest/locust_files/Sub.py -H <DSS Endpoint URL>` |
| 69 | +1. Run the loadtest: `AUTH_SPEC="<auth spec>" uv run locust -f ./monitoring/loadtest/locust_files/<Test.py> -H <DSS Endpoint URL> [Parameters]` |
19 | 70 |
|
20 | 71 | ## Running in a Container |
21 | 72 | Simply build the Docker container with the Dockerfile from the root directory. All the files are added into the container |
22 | 73 |
|
23 | 74 | 1. From the root folder of this repository, build the monitoring image with `make image` |
24 | | -1. Run Docker container; in general: |
| 75 | +1. Run Docker container; in general:: `docker run -e AUTH_SPEC="<auth spec>" -p 8089:8089 interuss/monitoring uv run locust -f loadtest/locust_files/<Test.py> -H <DSS Endpoint URL> [Parameters]` |
| 76 | +1. If testing local DSS instance, be sure that the loadtest (monitoring) container has access to the DSS container: `docker run -e AUTH_SPEC="DummyOAuth(http://oauth.authority.localutm:8085/token,uss1)" --network="interop_ecosystem_network" -p 8089:8089 interuss/monitoring uv run locust -f loadtest/locust_files/<Test.py> -H <DSS Endpoint URL> [Parameters]` |
| 77 | + |
| 78 | +## Use |
| 79 | +1. Navigate to http://127.0.0.1:8089 |
| 80 | +1. Start new test with number of Users to spawn and the rate to spawn them. |
| 81 | +1. For the Host, provide the DSS root endpoint used for testing. An example of such url is: http://dss.uss1.localutm/ in case local environment is setup with `make start-locally` |
25 | 82 |
|
26 | | - a. For ISA run: `docker run -e AUTH_SPEC="<auth spec>" -p 8089:8089 interuss/monitoring uv run locust -f loadtest/locust_files/ISA.py` |
| 83 | +## Examples to run tests locally |
27 | 84 |
|
28 | | - b. For Sub run: `docker run -e AUTH_SPEC="<auth spec>" -p 8089:8089 interuss/monitoring uv run locust -f loadtest/locust_files/Sub.py` |
| 85 | +Before running all examples: |
29 | 86 |
|
30 | | -1. If testing local DSS instance, be sure that the loadtest (monitoring) container has access to the DSS container: |
| 87 | +* `make image` |
| 88 | +* `make start-locally` |
31 | 89 |
|
32 | | - a. For ISA run: `docker run -e AUTH_SPEC="DummyOAuth(http://oauth.authority.localutm:8085/token,uss1)" --network="interop_ecosystem_network" -p 8089:8089 interuss/monitoring uv run locust -f loadtest/locust_files/ISA.py` |
| 90 | +### ISA.py |
33 | 91 |
|
34 | | - b. For Sub run: `docker run -e AUTH_SPEC="DummyOAuth(http://oauth.authority.localutm:8085/token,uss1)" --network="interop_ecosystem_network" -p 8089:8089 interuss/monitoring uv run locust -f loadtest/locust_files/Sub.py` |
| 92 | +`docker run -e AUTH_SPEC="DummyOAuth(http://oauth.authority.localutm:8085/token,uss1)" --network="interop_ecosystem_network" -p 8089:8089 -v .:/app/ interuss/monitoring-dev uv run locust -f loadtest/locust_files/ISA.py -H http://dss.uss1.localutm -u 10 --uss-base-url http://dss.uss1.localutm` |
35 | 93 |
|
36 | | -## Use |
37 | | -1. Navigate to http://localhost:8089 |
38 | | -1. Start new test with number of Users to spawn and the rate to spawn them. |
39 | | -1. For the Host, provide the DSS Core Service endpoint used for testing. An example of such url is: http://dss.uss1.localutm/v1/dss/ in case local environment is setup with `make start-locally` |
| 94 | +### Sub.py |
| 95 | + |
| 96 | +`docker run -e AUTH_SPEC="DummyOAuth(http://oauth.authority.localutm:8085/token,uss1)" --network="interop_ecosystem_network" -p 8089:8089 -v .:/app/ interuss/monitoring-dev uv run locust -f loadtest/locust_files/Sub.py -H http://dss.uss1.localutm -u 10 --uss-base-url http://dss.uss1.localutm` |
| 97 | + |
| 98 | +### SCD.py |
| 99 | + |
| 100 | +`docker run -e AUTH_SPEC="DummyOAuth(http://oauth.authority.localutm:8085/token,uss1)" --network="interop_ecosystem_network" -p 8089:8089 -v .:/app/ interuss/monitoring-dev uv run locust -f loadtest/locust_files/SCD.py -H http://dss.uss1.localutm -u 10 --area-lat -34.93 --area-lng 138.6 --area-radius 1000 --max-flight-distance 12000 --uss-base-url http://dss.uss1.localutm` |
| 101 | + |
| 102 | +### FlightsInSub.py |
| 103 | + |
| 104 | +`docker run -e AUTH_SPEC="DummyOAuth(http://oauth.authority.localutm:8085/token,uss1)" --network="interop_ecosystem_network" -p 8089:8089 -v .:/app/ interuss/monitoring-dev uv run locust -f loadtest/locust_files/FlightsInSub.py -H http://dss.uss1.localutm -u 10 --cluster-count 3 --base-lat -34.93 --base-lng 138.6 --area-radius 1000 --max-flight-distance 1000 --uss-base-url http://dss.uss1.localutm` |
0 commit comments