|
| 1 | +# Text Analytics Performance Tests |
| 2 | + |
| 3 | +In order to run the performance tests, the `azure-devtools` package must be installed. This is done as part of the `dev_requirements` install. |
| 4 | +Start by creating a new virtual environment for your perf tests. This will need to be a Python 3 environment, preferably >=3.7. |
| 5 | + |
| 6 | +### Setup for test resources |
| 7 | + |
| 8 | +The following environment variable will need to be set for the tests to access the live resources: |
| 9 | + |
| 10 | +``` |
| 11 | +AZURE_TEXT_ANALYTICS_ENDPOINT=<text analytics service endpoint> |
| 12 | +AZURE_TEXT_ANALYTICS_KEY=<text analytics API Key> |
| 13 | +``` |
| 14 | + |
| 15 | +### Setup for perf test runs |
| 16 | + |
| 17 | +```cmd |
| 18 | +(env) ~/azure-ai-textanalytics> pip install -r dev_requirements.txt |
| 19 | +(env) ~/azure-ai-textanalytics> pip install -e . |
| 20 | +``` |
| 21 | + |
| 22 | +## Test commands |
| 23 | + |
| 24 | +When `azure-devtools` is installed, you will have access to the `perfstress` command line tool, which will scan the current module for runable perf tests. Only a specific test can be run at a time (i.e. there is no "run all" feature). |
| 25 | + |
| 26 | +```cmd |
| 27 | +(env) ~/azure-ai-textanalytics> cd tests/perfstress_tests/ |
| 28 | +(env) ~/azure-ai-textanalytics/tests/perfstress_tests> perfstress |
| 29 | +``` |
| 30 | +Using the `perfstress` command alone will list the available perf tests found. |
| 31 | + |
| 32 | +### Common perf command line options |
| 33 | +These options are available for all perf tests: |
| 34 | +- `--duration=10` Number of seconds to run as many operations (the "run" function) as possible. Default is 10. |
| 35 | +- `--iterations=1` Number of test iterations to run. Default is 1. |
| 36 | +- `--parallel=1` Number of tests to run in parallel. Default is 1. |
| 37 | +- `--warm-up=5` Number of seconds to spend warming up the connection before measuring begins. Default is 5. |
| 38 | +- `--sync` Whether to run the tests in sync or async. Default is False (async). This flag must be used for Storage legacy tests, which do not support async. |
| 39 | +- `--no-cleanup` Whether to keep newly created resources after test run. Default is False (resources will be deleted). |
| 40 | + |
| 41 | +## Example command |
| 42 | +```cmd |
| 43 | +(env) ~/azure-ai-textanalytics/tests/perfstress_tests> perfstress DetectLanguagePerfStressTest |
| 44 | +``` |
0 commit comments