Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cosmos/infra/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@
"description": "Specifies insert operation percentage from 0 to 1"
}
},
"deleteproportion": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Specifies delete operation percentage from 0 to 1"
}
},
"writeOnlyOperation": {
"type": "bool",
"defaultValue": false,
Expand Down Expand Up @@ -501,7 +508,7 @@
"settings": {
},
"protectedSettings": {
"commandToExecute": "[concat('DB_BINDING_NAME=',parameters('ycsbDatabaseBindingName'),' ','ADMIN_USER_NAME=',parameters('adminUsername'),' ','BENCHMARKING_TOOLS_URL=',variables('benchmarkingToolsURL'),' ','BENCHMARKING_TOOLS_BRANCH_NAME=',parameters('benchmarkingToolsBranchName'),' ','YCSB_GIT_REPO_URL=',variables('ycsbGitHubRepoUrl'),' ','GUID=',parameters('guidValue'),' ','YCSB_GIT_BRANCH_NAME=',parameters('ycsbGitHubBranchName'),' ','TARGET_OPERATIONS_PER_SECOND=',parameters('targetOperationsPerSecond'),' ','THREAD_COUNT=',parameters('threads'),' ','YCSB_OPERATION_COUNT=',parameters('ycsbOperationCount'), ' ','WORKLOAD_TYPE=',parameters('workloadType'),' ','VM_NAME=',variables('vmName'),copyIndex(1), ' ','RESULT_STORAGE_CONNECTION_STRING=','\"',parameters('resultsStorageConnectionString'),'\"',' ','COSMOS_URI=','\"',parameters('cosmosURI'),'\"', ' ','COSMOS_KEY=',parameters('cosmosKey'), ' ','VM_COUNT=',parameters('vmCount'), ' ','USE_GATEWAY=',parameters('useGateway'), ' ','DIAGNOSTICS_LATENCY_THRESHOLD_IN_MS=',parameters('diagnosticsLatencyThresholdInMS'), ' ','YCSB_RECORD_COUNT=',parameters('ycsbRecordCount'), ' ','WRITE_ONLY_OPERATION=',parameters('writeOnlyOperation'), ' ','READ_PROPORTION=',parameters('readproportion'), ' ','SCAN_PROPORTION=',parameters('scanproportion'), ' ','UPDATE_PROPORTION=',parameters('updateproportion'), ' ','INSERT_PROPORTION=',parameters('insertproportion'), ' ','REQUEST_DISTRIBUTION=',parameters('requestdistribution'), ' ','INSERT_ORDER=',parameters('insertorder'), ' ','CUSTOM_SCRIPT_URL=',variables('customScriptUrl'), ' ','MACHINE_INDEX=',copyIndex(1), ' ','INCLUDE_EXCEPTION_STACK=',parameters('includeExceptionStackInLog'), ' ','FIELD_COUNT=',parameters('fieldcount'), ' ','SKIP_LOAD_PHASE=',parameters('skipLoadPhase'), ' ','WAIT_FOR_FAULT_TO_START_IN_SEC=',parameters('waitForFaultToStartInSec'), ' ','DURATION_OF_FAULT_IN_SEC=',parameters('durationOfFaultInSec'), ' ','DROP_PROBABILITY=',parameters('dropProbability'), ' ','FAULT_REGION=','\"',parameters('faultRegion'),'\"',' ','DELAY_IN_MS=',parameters('delayInMs'),' ','USER_AGENT=',parameters('userAgent'), ' ','PREFERRED_REGION_LIST=','\"',parameters('preferredRegionList'),'\"',' ','APP_INSIGHT_CONN_STR=','\"',parameters('appInsightConnectionString'),'\"',' ', 'bash ',variables('vmScriptExtensionScriptName'))]",
"commandToExecute": "[concat('DB_BINDING_NAME=',parameters('ycsbDatabaseBindingName'),' ','ADMIN_USER_NAME=',parameters('adminUsername'),' ','BENCHMARKING_TOOLS_URL=',variables('benchmarkingToolsURL'),' ','BENCHMARKING_TOOLS_BRANCH_NAME=',parameters('benchmarkingToolsBranchName'),' ','YCSB_GIT_REPO_URL=',variables('ycsbGitHubRepoUrl'),' ','GUID=',parameters('guidValue'),' ','YCSB_GIT_BRANCH_NAME=',parameters('ycsbGitHubBranchName'),' ','TARGET_OPERATIONS_PER_SECOND=',parameters('targetOperationsPerSecond'),' ','THREAD_COUNT=',parameters('threads'),' ','YCSB_OPERATION_COUNT=',parameters('ycsbOperationCount'), ' ','WORKLOAD_TYPE=',parameters('workloadType'),' ','VM_NAME=',variables('vmName'),copyIndex(1), ' ','RESULT_STORAGE_CONNECTION_STRING=','\"',parameters('resultsStorageConnectionString'),'\"',' ','COSMOS_URI=','\"',parameters('cosmosURI'),'\"', ' ','COSMOS_KEY=',parameters('cosmosKey'), ' ','VM_COUNT=',parameters('vmCount'), ' ','USE_GATEWAY=',parameters('useGateway'), ' ','DIAGNOSTICS_LATENCY_THRESHOLD_IN_MS=',parameters('diagnosticsLatencyThresholdInMS'), ' ','YCSB_RECORD_COUNT=',parameters('ycsbRecordCount'), ' ','WRITE_ONLY_OPERATION=',parameters('writeOnlyOperation'), ' ','READ_PROPORTION=',parameters('readproportion'), ' ','SCAN_PROPORTION=',parameters('scanproportion'), ' ','UPDATE_PROPORTION=',parameters('updateproportion'), ' ','INSERT_PROPORTION=',parameters('insertproportion'), ' ','DELETE_PROPORTION=',parameters('deleteproportion'),' ','REQUEST_DISTRIBUTION=',parameters('requestdistribution'), ' ','INSERT_ORDER=',parameters('insertorder'), ' ','CUSTOM_SCRIPT_URL=',variables('customScriptUrl'), ' ','MACHINE_INDEX=',copyIndex(1), ' ','INCLUDE_EXCEPTION_STACK=',parameters('includeExceptionStackInLog'), ' ','FIELD_COUNT=',parameters('fieldcount'), ' ','SKIP_LOAD_PHASE=',parameters('skipLoadPhase'), ' ','WAIT_FOR_FAULT_TO_START_IN_SEC=',parameters('waitForFaultToStartInSec'), ' ','DURATION_OF_FAULT_IN_SEC=',parameters('durationOfFaultInSec'), ' ','DROP_PROBABILITY=',parameters('dropProbability'), ' ','FAULT_REGION=','\"',parameters('faultRegion'),'\"',' ','DELAY_IN_MS=',parameters('delayInMs'),' ','USER_AGENT=',parameters('userAgent'), ' ','PREFERRED_REGION_LIST=','\"',parameters('preferredRegionList'),'\"',' ','APP_INSIGHT_CONN_STR=','\"',parameters('appInsightConnectionString'),'\"',' ', 'bash ',variables('vmScriptExtensionScriptName'))]",
"fileUris": [ "[concat(variables('vmScriptExtensionScriptURL'))]" ]
}
},
Expand Down
4 changes: 4 additions & 0 deletions cosmos/scripts/azurecosmos-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ if [ ! -z "$insertproportion" ]; then
sed -i "s/^[#]*\s*insertproportion=.*/insertproportion=$insertproportion/" workloads/$workload
fi

if [ ! -z "$deleteproportion" ]; then
sed -i "s/^[#]*\s*deleteproportion=.*/deleteproportion=$deleteproportion/" workloads/$workload
fi

if [ ! -z "$requestdistribution" ]; then
sed -i "s/^[#]*\s*requestdistribution=.*/requestdistribution=$requestdistribution/" workloads/$workload
fi
Expand Down
20 changes: 16 additions & 4 deletions cosmos/scripts/custom-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# Function to parse repo name from git repo URL
parse_repo_name() {
local repo_url="$1"
# Remove the .git suffix if present
YCSB_REPO_NAME=$(basename "$repo_url" .git)
echo "$YCSB_REPO_NAME"
}

# Parse repo name from git url
YCSB_REPO_NAME=$(parse_repo_name "$YCSB_GIT_REPO_URL")

echo "##########VM NAME###########: $DB_BINDING_NAME"
echo "##########VM NAME###########: $VM_NAME"
echo "##########YCSB_RECORD_COUNT###########: $YCSB_RECORD_COUNT"
Expand All @@ -15,13 +26,14 @@ echo "##########BENCHMARKING_TOOLS_BRANCH_NAME###########: $BENCHMARKING_TOOLS_B
echo "##########BENCHMARKING_TOOLS_URL###########: $BENCHMARKING_TOOLS_URL"
echo "##########YCSB_GIT_BRANCH_NAME###########: $YCSB_GIT_BRANCH_NAME"
echo "##########YCSB_GIT_REPO_URL###########: $YCSB_GIT_REPO_URL"
echo "##########YCSB_GIT_REPO_NAME###########: $YCSB_REPO_NAME"
echo "##########WAIT_FOR_FAULT_TO_START_IN_SEC###########: $WAIT_FOR_FAULT_TO_START_IN_SEC"
echo "##########DURATION_OF_FAULT_IN_SEC###########: $DURATION_OF_FAULT_IN_SEC"
echo "##########DROP_PROBABILITY###########: $DROP_PROBABILITY"
echo "##########FAULT_REGION###########: $FAULT_REGION"
echo "##########DELAY_IN_MS###########: $DELAY_IN_MS"
echo "##########USER_AGENT###########: $USER_AGENT"

echo "##########PREFERRED_REGION_LIST###########: $PREFERRED_REGION_LIST"

# The index of the record to start at during the Load
insertstart=$((YCSB_RECORD_COUNT * (MACHINE_INDEX - 1)))
Expand Down Expand Up @@ -51,7 +63,7 @@ cp -r ./azure-db-benchmarking/cosmos/scripts/* /tmp/ycsb
echo "########## Cloning YCSB repository ##########"
git clone -b "$YCSB_GIT_BRANCH_NAME" --single-branch "$YCSB_GIT_REPO_URL"

cd YCSB
cd $YCSB_REPO_NAME
echo "########## Pulling Latest YCSB ##########"
git pull
echo "########## Building YCSB ##########"
Expand Down Expand Up @@ -189,7 +201,7 @@ if [ "$WRITE_ONLY_OPERATION" = True ] || [ "$WRITE_ONLY_OPERATION" = true ]; the

## Execute run phase for YCSB tests with write only workload
echo "########## Run operation with write only workload for YCSB tests ###########"
uri=$COSMOS_URI primaryKey=$COSMOS_KEY workload_type=$WORKLOAD_TYPE ycsb_operation="run" insertproportion=1 readproportion=0 updateproportion=0 scanproportion=0 recordcount=$recordcountForWriteOps operationcount=$YCSB_OPERATION_COUNT threads=$THREAD_COUNT target=$TARGET_OPERATIONS_PER_SECOND useGateway=$USE_GATEWAY diagnosticsLatencyThresholdInMS=$DIAGNOSTICS_LATENCY_THRESHOLD_IN_MS requestdistribution=$REQUEST_DISTRIBUTION insertorder=$INSERT_ORDER includeExceptionStackInLog=$INCLUDE_EXCEPTION_STACK fieldcount=$FIELD_COUNT appInsightConnectionString=$APP_INSIGHT_CONN_STR userAgent=$USER_AGENT preferredRegionList=$PREFERRED_REGION_LIST bash $DB_BINDING_NAME-run.sh
uri=$COSMOS_URI primaryKey=$COSMOS_KEY workload_type=$WORKLOAD_TYPE ycsb_operation="run" insertproportion=1 readproportion=0 updateproportion=0 scanproportion=0 deleteproportion=0 recordcount=$recordcountForWriteOps operationcount=$YCSB_OPERATION_COUNT threads=$THREAD_COUNT target=$TARGET_OPERATIONS_PER_SECOND useGateway=$USE_GATEWAY diagnosticsLatencyThresholdInMS=$DIAGNOSTICS_LATENCY_THRESHOLD_IN_MS requestdistribution=$REQUEST_DISTRIBUTION insertorder=$INSERT_ORDER includeExceptionStackInLog=$INCLUDE_EXCEPTION_STACK fieldcount=$FIELD_COUNT appInsightConnectionString=$APP_INSIGHT_CONN_STR userAgent=$USER_AGENT preferredRegionList=$PREFERRED_REGION_LIST bash $DB_BINDING_NAME-run.sh
else
if [ "$SKIP_LOAD_PHASE" = False ] || [ "$SKIP_LOAD_PHASE" = false ]; then
## Execute load operation for YCSB tests
Expand Down Expand Up @@ -223,7 +235,7 @@ else

## Execute run phase for YCSB tests
echo "########## Run operation for YCSB tests ###########"
uri=$COSMOS_URI primaryKey=$COSMOS_KEY workload_type=$WORKLOAD_TYPE ycsb_operation="run" recordcount=$totalrecordcount operationcount=$YCSB_OPERATION_COUNT threads=$THREAD_COUNT target=$TARGET_OPERATIONS_PER_SECOND insertproportion=$INSERT_PROPORTION readproportion=$READ_PROPORTION updateproportion=$UPDATE_PROPORTION scanproportion=$SCAN_PROPORTION useGateway=$USE_GATEWAY diagnosticsLatencyThresholdInMS=$DIAGNOSTICS_LATENCY_THRESHOLD_IN_MS requestdistribution=$REQUEST_DISTRIBUTION insertorder=$INSERT_ORDER includeExceptionStackInLog=$INCLUDE_EXCEPTION_STACK fieldcount=$FIELD_COUNT appInsightConnectionString=$APP_INSIGHT_CONN_STR userAgent=$USER_AGENT preferredRegionList=$PREFERRED_REGION_LIST bash $DB_BINDING_NAME-run.sh
uri=$COSMOS_URI primaryKey=$COSMOS_KEY workload_type=$WORKLOAD_TYPE ycsb_operation="run" recordcount=$totalrecordcount operationcount=$YCSB_OPERATION_COUNT threads=$THREAD_COUNT target=$TARGET_OPERATIONS_PER_SECOND insertproportion=$INSERT_PROPORTION readproportion=$READ_PROPORTION updateproportion=$UPDATE_PROPORTION scanproportion=$SCAN_PROPORTION deleteproportion=$DELETE_PROPORTION useGateway=$USE_GATEWAY diagnosticsLatencyThresholdInMS=$DIAGNOSTICS_LATENCY_THRESHOLD_IN_MS requestdistribution=$REQUEST_DISTRIBUTION insertorder=$INSERT_ORDER includeExceptionStackInLog=$INCLUDE_EXCEPTION_STACK fieldcount=$FIELD_COUNT appInsightConnectionString=$APP_INSIGHT_CONN_STR userAgent=$USER_AGENT preferredRegionList=$PREFERRED_REGION_LIST bash $DB_BINDING_NAME-run.sh
fi

#Copy YCSB log to storage account
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 10 Thousand Deletes Per Second
This recipe encapsulates a update only workload with a maximum requests per second of 10 thousand. This "1-Click" recipe combines both the load and run phases of YCSB.

## Recipe definition

| Config | Value |
| --- | --- |
| Database | Cosmos SQL API |
| Benchmarking tool | YCSB |
| Workload | Update |
| Max RPS | 10 Thousand |
| Duration | 1 Hour |
| Number of documents in DB |100,000 |
| Document Size | ≈1 KB(YCSB default) |

## Execute
1. Create a [Cosmos DB SQL API container](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/quickstart-portal)

| Setting | value |
| --- | --- |
| Database Name | ycsb |
| Container Name | usertable |
| Partition Key | /id |
| Container Throughput Type | Manual |
| Container throughput | 161,900 RU/s[^1] |

[^1]: Container throughput is slightly higher than normal to accommodate for the YCSB request distribution skew. For more details about capacity planning refer to [Cosmos DB capacity planner](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/estimate-ru-with-capacity-planner)

2. Create a [storage account](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-create?tabs=azure-portal)
3. Create a [resource group](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-portal) in the same region as the Cosmos DB account
4. Click the deploy to Azure button and fill in the following missing parameter values:

| Parameter | Value |
| --- | --- |
| Resource group | name of the resource group from step 3 |
| Region | Make sure the region is the same as the Cosmos DB account region |
| Results Storage Connection String | connection string of the storage account from step 2 |
| Cosmos URI | URI of the Cosmos DB account from step 1 |
| Cosmos Key | Primary key of the Cosmos DB account from step 1 |
| Admin Password | Admin account password for the VM |

[More details about the parameters](../../#basic-configuration)

[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-db-benchmarking%2Fmain%2Fcosmos%2Fsql%2Ftools%2Fjava%2Fycsb%2Frecipes%2Fdelete%2F10-thousand-rps-delete%2Fazuredeploy.json)

## Output
The job status and results will be available in the following locations in the storage account provided
| Type | Location |
| --- | --- |
| Status | ycsbbenchmarkingMetadata (Table) |
| Results | ycsbbenchmarking-{Date} (Container) |

[More details about job status and results](../../#monitoring)

Loading