-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Corehttp] add perf tests #34412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
swathipil
merged 23 commits into
Azure:main
from
swathipil:swathipil/corehttp/perf-tests
Mar 1, 2024
Merged
[Corehttp] add perf tests #34412
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3e535ca
copy over core perf tests
swathipil dec94cc
update readme
swathipil c89409f
update perf tests to corehttp
swathipil 2c2bef4
add query attribute to httprequest in perf tests
swathipil 4370659
update httppolicy checks in pipeline base
swathipil 48da671
add perf tests yml for corehttp
swathipil 50dfb95
move perf tests yml into corehttp folder
swathipil a4ad92c
merge main
swathipil f04ae5c
fix merge
swathipil 6fac2d0
move perf files to corehttp
swathipil a448e44
black
swathipil 037e563
add dev reqs for perf
swathipil 6a2c099
add identity to dev reqs
swathipil 7613e4a
remove 1.0.0b3 from perf tests
swathipil 9e8d1c1
update corehttp aad envvars get
swathipil b9b1082
merge main
swathipil 808ac29
update perf tests.yml
swathipil 720a8af
revert azure core perf yml
swathipil 7801266
update perf readme
swathipil c5ed55e
remove unneeded policies
swathipil 3a266c9
address kashif/paul comments
swathipil 35d9749
black
swathipil 7bea445
black on azure core
swathipil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| param baseName string = resourceGroup().name | ||
| param location string = resourceGroup().location | ||
| param storageEndpointSuffix string = 'core.windows.net' | ||
| param testApplicationOid string | ||
|
|
||
| resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = { | ||
| name: '${baseName}storage' | ||
| location: location | ||
| kind: 'StorageV2' | ||
| sku: { | ||
| name: 'Standard_RAGRS' | ||
| } | ||
| } | ||
|
|
||
| resource storageAccountBlobServices 'Microsoft.Storage/storageAccounts/blobServices@2021-09-01' = { | ||
| name: 'default' | ||
| parent: storageAccount | ||
| } | ||
|
|
||
| resource testContainer 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-09-01' = { | ||
| name: 'testcontainer' | ||
| parent: storageAccountBlobServices | ||
|
|
||
| } | ||
|
|
||
| @description('This is the Blob owner role.') | ||
| resource blobOwnerRoleDefinition 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = { | ||
| scope: resourceGroup() | ||
| name: 'b7e6dc6d-f1e8-4753-8033-0f276bb0955b' | ||
| } | ||
|
|
||
| resource blobRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
| name: guid(resourceGroup().id, testApplicationOid, blobOwnerRoleDefinition.id) | ||
| properties: { | ||
| roleDefinitionId: blobOwnerRoleDefinition.id | ||
| principalId: testApplicationOid | ||
| principalType: 'ServicePrincipal' | ||
| } | ||
| } | ||
|
|
||
| resource tableServices 'Microsoft.Storage/storageAccounts/tableServices@2022-09-01' = { | ||
| name: 'default' | ||
| parent: storageAccount | ||
| } | ||
|
|
||
| resource tables 'Microsoft.Storage/storageAccounts/tableServices/tables@2022-09-01' = { | ||
| name: 'default' | ||
| parent: tableServices | ||
| } | ||
|
|
||
| @description('This is the Blob owner role.') | ||
| resource tableOwnerRoleDefinition 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = { | ||
| scope: resourceGroup() | ||
| name: '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3' | ||
| } | ||
|
|
||
| resource tableRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
| name: guid(resourceGroup().id, testApplicationOid, tableOwnerRoleDefinition.id) | ||
| properties: { | ||
| roleDefinitionId: tableOwnerRoleDefinition.id | ||
| principalId: testApplicationOid | ||
| principalType: 'ServicePrincipal' | ||
| } | ||
| } | ||
|
|
||
| var storageAccountKey = storageAccount.listKeys('2021-09-01').keys[0].value | ||
| output AZURE_STORAGE_ACCOUNT_NAME string = storageAccount.name | ||
| output AZURE_STORAGE_BLOBS_ENDPOINT string = storageAccount.properties.primaryEndpoints.blob | ||
| output AZURE_STORAGE_ACCOUNT_KEY string = storageAccountKey | ||
| output AZURE_STORAGE_CONN_STR string = 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};AccountKey=${storageAccountKey};EndpointSuffix=${storageEndpointSuffix}' | ||
| output AZURE_STORAGE_CONTAINER_NAME string = testContainer.name | ||
|
|
||
| output AZURE_STORAGE_TABLE_NAME string = tables.name | ||
| output AZURE_STORAGE_TABLES_ENDPOINT string = 'https://${storageAccount.name}.table.${storageEndpointSuffix}/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| Service: core | ||
|
|
||
| Project: sdk/core/corehttp | ||
|
|
||
| PrimaryPackage: corehttp | ||
|
|
||
| PackageVersions: | ||
| - corehttp: 1.0.0b4 | ||
| - corehttp: source | ||
|
|
||
| Tests: | ||
| - Test: upload-binary | ||
| Class: UploadBinaryDataTest | ||
| Arguments: | ||
| - --size 1024 --parallel 64 --duration 60 --policies all | ||
| - --size 1024 --parallel 64 --duration 60 --policies all --use-entra-id | ||
| - --size 10240 --parallel 32 --duration 60 | ||
| - --size 10240 --parallel 32 --duration 60 --transport httpx | ||
|
|
||
| - Test: download-binary | ||
| Class: DownloadBinaryDataTest | ||
| Arguments: | ||
| - --size 1024 --parallel 64 --duration 60 | ||
| - --size 1024 --parallel 64 --duration 60 --transport httpx | ||
| - --size 1024 --parallel 64 --duration 60 --use-entra-id | ||
| - --size 10240 --parallel 32 --duration 60 --policies all | ||
|
|
||
| - Test: update-entity | ||
| Class: UpdateEntityJSONTest | ||
| Arguments: | ||
| - --size 1024 --parallel 64 --duration 60 | ||
| - --size 1024 --parallel 64 --duration 60 --transport httpx | ||
| - --size 1024 --parallel 64 --duration 60 --use-entra-id | ||
| - --size 1024 --parallel 64 --duration 60 --policies all | ||
|
|
||
| - Test: query-entities | ||
| Class: QueryEntitiesJSONTest | ||
| Arguments: | ||
| - --size 1024 --parallel 64 --duration 60 | ||
| - --size 1024 --parallel 64 --duration 60 --transport httpx | ||
| - --size 1024 --parallel 64 --duration 60 --use-entra-id | ||
| - --size 1024 --parallel 64 --duration 60 --policies all | ||
|
|
||
| - Test: list-entities | ||
| Class: ListEntitiesPageableTest | ||
| Arguments: | ||
| - --count 500 --parallel 32 --warmup 60 --duration 60 | ||
| - --count 500 --parallel 32 --warmup 60 --duration 60 --transport httpx | ||
| - --count 500 --parallel 32 --warmup 60 --duration 60 --use-entra-id | ||
| - --count 500 --parallel 32 --warmup 60 --duration 60 --policies all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| parameters: | ||
| - name: LanguageVersion | ||
| displayName: LanguageVersion (3.8, 3.9, 3.10, 3.11, 3.12) | ||
| type: string | ||
| default: '3.11' | ||
| - name: PackageVersions | ||
| displayName: PackageVersions (regex of package versions to run) | ||
| type: string | ||
| default: '1|source' | ||
| - name: Tests | ||
| displayName: Tests (regex of tests to run) | ||
| type: string | ||
| default: '^(upload-binary|download-binary|update-entity|query-entities|list-entities)$' | ||
| - name: Arguments | ||
| displayName: Arguments (regex of arguments to run) | ||
| type: string | ||
| default: '(1024)|(10240)|(500)' | ||
| - name: Iterations | ||
| displayName: Iterations (times to run each test) | ||
| type: number | ||
| default: '5' | ||
| - name: AdditionalArguments | ||
| displayName: AdditionalArguments (passed to PerfAutomation) | ||
| type: string | ||
| default: ' ' | ||
|
|
||
| extends: | ||
| template: /eng/pipelines/templates/jobs/perf.yml | ||
| parameters: | ||
| TimeoutInMinutes: 720 | ||
| ServiceDirectory: core/corehttp | ||
| LanguageVersion: ${{ parameters.LanguageVersion }} | ||
| PackageVersions: ${{ parameters.PackageVersions }} | ||
| Tests: ${{ parameters.Tests }} | ||
| Arguments: ${{ parameters.Arguments }} | ||
| Iterations: ${{ parameters.Iterations }} | ||
| AdditionalArguments: ${{ parameters.AdditionalArguments }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # Core Python client performance tests | ||
|
|
||
| In order to run the performance tests, the `devtools_testutils` package must be installed. This is done as part of the `dev_requirements.txt` installation. Start be creating a new virtual environment for your perf tests. This will need to be a Python 3 environment, preferably >=3.7. | ||
|
|
||
| ### Setup for test resources | ||
| The following environment variables will need to be set for the tests to access the live resources: | ||
|
|
||
| ``` | ||
| AZURE_STORAGE_CONN_STR=<the connection string to the Storage account> | ||
| AZURE_STORAGE_ACCOUNT_NAME=<the Storage account name> | ||
| AZURE_STORAGE_ACCOUNT_KEY=<the Storage account key> | ||
|
|
||
| AZURE_STORAGE_CONTAINER_NAME=<the container name> | ||
| AZURE_STORAGE_BLOBS_ENDPOINT=<The Storage Blobs endpoint in the format 'https://{storageAccountName}.blob.core.windows.net'> | ||
|
|
||
| AZURE_STORAGE_TABLE_NAME=<The name to use for the Storage Table> | ||
| AZURE_STORAGE_TABLES_ENDPOINT=<The Storage Tables endpoint in the format 'https://{storageAccountName}.table.core.windows.net'> | ||
| ``` | ||
|
|
||
| ### Setup for perf test runs | ||
|
|
||
| ```cmd | ||
| (env) ~/core/corehttp> pip install -r dev_requirements.txt | ||
| (env) ~/core/corehttp> pip install . | ||
| ``` | ||
|
|
||
| ## Test commands | ||
|
|
||
| When `devtools_testutils` 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). | ||
|
|
||
| ```cmd | ||
| (env) ~/core/corehttp> cd tests | ||
| (env) ~/core/corehttp/tests> perfstress | ||
| ``` | ||
|
|
||
| Using the `perfstress` command alone will list the available perf tests found. | ||
|
|
||
| ### Tests | ||
|
|
||
| The tests currently available: | ||
|
|
||
| - `UploadBinaryDataTest` - Puts binary data of `size` in a Storage Blob (corresponds to the `upload_blob` Blob operation). | ||
| - `DownloadBinaryDataTest` - Gets binary data of `size` from a Storage Blob (corresponds to the `download_blob` Blob operation). | ||
| - `UpdateEntityJSONTest` - Puts JSON data of `size` in a Storage Table (corresponds to the `update_entity` Tables operation). | ||
| - `QueryEntitiesJSONTest` - Gets JSON data of `size` from a Storage Table (corresponds to the `query_entities` Tables operation). | ||
| - `ListEntitiesPageableTest` - Gets pageable data from a Storage Table (corresponds to the `list_entities` Tables operation). | ||
|
|
||
| ### Common perf command line options | ||
|
|
||
| The `perfstress` framework has a series of common command line options built in. View them [here](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/perfstress_tests.md#default-command-options). | ||
|
|
||
| - `--sync` Whether to run the tests in sync or async. Default is False (async). | ||
| - `-d --duration=10` Number of seconds to run as many operations (the "run" function) as possible. Default is 10. | ||
| - `-i --iterations=1` Number of test iterations to run. Default is 1. | ||
| - `-p --parallel=1` Number of tests to run in parallel. Default is 1. | ||
| - `-w --warm-up=5` Number of seconds to spend warming up the connection before measuring begins. Default is 5. | ||
|
|
||
| #### Core perf test common command line options | ||
|
|
||
| The options that are available for all Core perf tests: | ||
|
|
||
| - `--transport` - By default, uses AiohttpTransport ("aiohttp") for async. By default, uses RequestsTransport ("requests") for sync. All options: | ||
| - For async: | ||
| - `"aiohttp"`: AiohttpTransport (default) | ||
| - `"httpx"`: AsyncHttpXTransport | ||
| - For sync: | ||
| - `"requests"`: RequestsTransport (default) | ||
| - `"httpx"`: HttpXTransport | ||
| - `--use-entra-id` - Flag to pass in to use Microsoft Entra ID as the authentication. By default, set to False. | ||
| - `--size=10240` - Size of request content (in bytes). Defaults to 10240. (Not used by `ListEntitiesPageableTest`.) | ||
| - `--policies` - List of policies to pass in to the pipeline. Options: | ||
| - None: No extra policies passed in, except for authentication policy. This is the default. | ||
| - 'all': All policies added automatically by autorest. | ||
| - 'policy1,policy2': Comma-separated list of policies, such as 'RetryPolicy,UserAgentPolicy'" | ||
|
|
||
| #### Additional ListEntitiesPageableTest command line options | ||
|
|
||
| The options that are additionally available for `ListEntitiesPageableTest`: | ||
|
|
||
| - `--count=100` - Number of table entities to list. Defaults to 100. | ||
| - `--page-size=None` - Maximum number of entities to list per page. Default is None, which will return all possible results per page. | ||
|
|
||
| ## Example command | ||
|
|
||
| ```cmd | ||
| (env) ~/core/corehttp> perfstress DownloadBinaryDataTest --use-entra-id --transport httpx --size=20480 --parallel=2 | ||
| ``` | ||
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.