-
Notifications
You must be signed in to change notification settings - Fork 526
Benchmarking: Adds use of ARM Templates for benchmarking #3838
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
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
74827de
initial commit DONT REVIEW
NaluTripician 3dcedcc
fixes and documentation
NaluTripician eae282d
Merge branch 'master' into users/nalutripician/ARMBenchmarking
NaluTripician a6f49a6
Apply suggestions from code review
NaluTripician 740d48f
requested changes
NaluTripician e915ced
Merge branch 'users/nalutripician/ARMBenchmarking' of https://github.…
NaluTripician 1f89923
Merge branch 'master' into users/nalutripician/ARMBenchmarking
NaluTripician 8ee4924
Merge branch 'master' into users/nalutripician/ARMBenchmarking
NaluTripician 3366cbe
Apply suggestions from code review
NaluTripician 6df7c0e
name changes
NaluTripician 2d39fd7
Merge branch 'master' into users/nalutripician/ARMBenchmarking
NaluTripician ac1f090
readme changes
NaluTripician 8b373ec
Merge branch 'master' into users/nalutripician/ARMBenchmarking
NaluTripician fb27fb9
nits + changing case of parameters file
NaluTripician a5a2055
Merge branch 'users/nalutripician/ARMBenchmarking' of https://github.…
NaluTripician 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
fixes and documentation
- Loading branch information
commit 3dcedcc676d488add4554d8594c45ab53af5ffe1
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/ARMTemplate/README.md
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,112 @@ | ||
| # Running benchmarks on ARM Tempaltes | ||
|
|
||
| [ARM Templates](https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/) makes executing the Azure Cosmos DB SDK Benchmark extremely easy, with very few steps involved, and it's more cost-effective than using Virtual Machines for burst or single-use scenarios. Plus, it lets you test and evaluate performance quickly on multiple resource (CPU/RAM) configurations and across multiple Azure regions seamlessly. | ||
|
|
||
| For the below steps, you will **need an Azure Subscription**. | ||
|
|
||
| ## Steps | ||
|
|
||
| ### Step 1 - Download Tempalte | ||
|
|
||
| You **do not need** to clone this repository, just obtain a copy of the [benchmarkTemplate](./benchmarkTemplate.json) and [parameters](./parameters.json) file. | ||
|
|
||
| ### Step 2 - Customize the YAML file | ||
|
|
||
| The Parameters JSON file contains a list of configuration options that you need to populate for the Azure Cosmos DB account you want to execute the benchmark tests on. | ||
|
|
||
| ```json | ||
| "ENDPOINT": { | ||
| "value": "<your-endpoint-here>" | ||
| }, | ||
| "KEY": { | ||
| "value": "<your-key-here>" | ||
| }, | ||
| "THROUGHPUT": { | ||
| "value": "100000" | ||
| }, | ||
| "DOCUMENTS": { | ||
| "value": "200000" | ||
| }, | ||
| "PARALLELISM": { | ||
| "value": "-1" | ||
| }, | ||
| "CLEANUPFINISH": { | ||
| "value": "false" | ||
| } | ||
| ``` | ||
|
|
||
| Please populate the `ENDPOINT` and `KEY` for your Azure Cosmos DB account. You can [obtain these from the Azure Portal or through CLI](https://docs.microsoft.com/azure/cosmos-db/secure-access-to-data#master-keys). | ||
NaluTripician marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Optionally you can modify the other parameters, such as the `THROUGHPUT` for the container that will get created, the amount of `DOCUMENTS` to insert, the degree of `PARALLELISM`, and if you want the container to be deleted after the benchmark is run (`CLEANUPFINISH` `true/false`). | ||
|
|
||
| Additionally, the file lets you customize the size of the instance, which you can make as similar as possible to the instance you will be running in production to simulate results. | ||
NaluTripician marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```json | ||
| "cpuCores": { | ||
| "value": "4" | ||
| }, | ||
| "memoryInGb": { | ||
| "value": "8" | ||
| } | ||
| ``` | ||
|
|
||
| For a complete reference of options, please visit the [official Azure container instance ARM Template refrence](https://learn.microsoft.com/en-us/azure/templates/microsoft.containerinstance/containergroups?pivots=deployment-language-arm-template). | ||
NaluTripician marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Step 3 - Obtain Azure CLI | ||
|
|
||
| We'll be using [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest) to create the Azure Container Instance and execute the YAML file. Azure CLI is cross-platform. | ||
NaluTripician marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| After installing the Azure CLI, you will need to [login](https://docs.microsoft.com/cli/azure/authenticate-azure-cli?view=azure-cli-latest) into the subscription you want to provision and execute the benchmark on. | ||
|
|
||
| ### Step 4 - Create Respurce Group | ||
|
|
||
| The goal behind the benchmark is to simulate load. Ideally you want to co-locate the instance that will be executing the benchmark with your Azure Cosmos DB account, so the first step would be to **create a Resource Group** on the same location. For example, if your Azure Cosmos DB account is deployed on East US, we can use `az group create` to create this Resource Group: | ||
|
|
||
| ```bash | ||
| $resourceGroupName = "CosmosDBBenchmark" | ||
| az group create --name $resourceGroupName --location eastus | ||
| ``` | ||
|
|
||
| For a complete list of options see the [documentation for `az group create`](https://docs.microsoft.com/cli/azure/group?view=azure-cli-latest#az-group-create). | ||
|
|
||
| ### Step 5 - Execute the benchmark | ||
|
|
||
| Once the Resource Group is created in the correct location, we can use the ARM template to provision the Azure Container Instance and execute the benchmark. | ||
|
|
||
| Assuming your prompt is on the folder with the customized template file: | ||
|
|
||
| ```bash | ||
| az deployment group create --resource-group <your-resource-group> --template-file benchmarkTemplate.json --parameters parameters.json | ||
ealsur marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| This command will start the provisioning: | ||
|
|
||
| 1. It will create a Linux container named `cosmosdbsdkperf` and provision an image with NET Core inside an instance with the configured CPU and RAM. | ||
NaluTripician marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|  | ||
| 2. Clone the Azure Cosmos DB SDK repository with the required files | ||
| 3. Execute the benchmark and provide output logs | ||
NaluTripician marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 4. Stop the instance | ||
|
|
||
| While the container instance is running (or after), you can either use the Azure Portal or the Azure CLI to check the benchmark results with: | ||
|
|
||
| ```bash | ||
| az container logs -g $resourceGroupName -n cosmosdbsdkperf | ||
| ``` | ||
|
|
||
| The logs will show the information, including the initial parameters: | ||
|
|
||
|  | ||
NaluTripician marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| And the results: | ||
|
|
||
|  | ||
NaluTripician marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### Step 6 - Clean up | ||
|
|
||
| If you want to remove the Benchmark instance, you can also do so from the Azure CLI: | ||
|
|
||
| ```bash | ||
| az container delete -g $resourceGroupName -n cosmosdbsdkperf | ||
| ``` | ||
|
|
||
| **Remember to delete the Database and Container** that were created for the Benchmark in case you did not use the `CLEANUPFINISH` parameter as `true`. | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
2 changes: 2 additions & 0 deletions
2
Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/ARMTemplate/run.sh
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,2 @@ | ||
| cd .. | ||
| dotnet run -c Release -e ${ENDPOINT} -k ${KEY} -t ${THROUGHPUT} -n ${DOCUMENTS} --pl ${PARALLELISM} --CleanupOnFinish ${CLEANUPFINISH} -w InsertV2BenchmarkOperation |
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.