ealsur / cosmosdb-loadtesting

ASP.NET Core load test app for Azure Cosmos DB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ASP.NET Core load test app for Azure Cosmos DB

This repo contains an ASP.NET Core web application that can be used to load test an Azure Cosmos DB account and verify if the amount of provisioned RU/s can manage an hypothetical concurrent user load.

It exposes two API endpoints, one for Reads and one for Writes, where a Load Test framework or service can be used. Once the app runs, it will provide a visual aid for the endpoints based on the current host.

  • An endpoint to test Reads of a single document.
  • An endpoint to test Writes of a single document.

Be advised that the Write endpoint will write a new document for each execution.

Endpoint rendering

You can deploy it to a service like Azure App Service, which includes a Load Test feature.

The repo includes a testitem.json file you can customize with an estimate JSON payload you will be storing in your database. This payload will be used to test both Reads and Writes to generate the most accurate RU/s consumption.

Test document

This app can be used after estimating a value with the Azure Cosmos DB Capacity Planner.

Configuration

Before deploying this app, edit the appsettings.json file and set your Azure Cosmos DB account credentials and optionally, an Azure App Insights Instrumentation Key if you want more detailed analytics.

"CosmosDb": {
    "Account": "your-account-name",
    "Key": "your-account-password",
    "DatabaseName": "your-database-name",
    "CollectionName": "your-collection-name"
},
"ApplicationInsights": {
    "InstrumentationKey": "appinsights-key"
}

Setting up the tests

Refer to this article for a full coverage on how to create tests in Azure App Service.

About

ASP.NET Core load test app for Azure Cosmos DB

License:MIT License


Languages

Language:C# 100.0%