Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
4dfef62
Added help and made fault_region mandatory
Nov 10, 2023
bdd84c9
Updated the usage/help
Nov 11, 2023
dfbbd5d
Revert "Updated the usage/help"
Nov 11, 2023
017bd86
Updated the help/usage
Nov 11, 2023
65c01e6
Made fault_region env variable mandatory
Nov 11, 2023
448c43d
Uninstalling Clumsy utility after the fault has stopped
Nov 11, 2023
96dc12c
Updated the help/usage for chaos_script.sh
darshan-patnekar Dec 1, 2023
48f0b4b
Converted microseconds to milliseconds
darshan-patnekar Dec 2, 2023
453e602
updated the logic for converting to milliseconds.
darshan-patnekar Dec 2, 2023
09e226a
Setting project name as Storage metadata table name
darshan-patnekar Dec 4, 2023
3c6b61f
Updated the deploy json to pass the projectName to the shell script
darshan-patnekar Dec 4, 2023
42a5fad
Added updated metadata-status image
darshan-patnekar Dec 5, 2023
3a59503
Forcing the install of chocolatey-compatibility.extension and clumsy …
darshan-patnekar Dec 6, 2023
80273b8
Merge branch 'main' into users/dpatnekar/fixissues
Feb 28, 2024
5808f96
fixing typo
Feb 28, 2024
4e6cb59
Addressed PR comments
Feb 29, 2024
744646c
updated custom-script.sh
Mar 1, 2024
6c8487a
Removed project name
Mar 2, 2024
aeaa8b6
added project name
Mar 2, 2024
fbd0ae6
commit
Mar 3, 2024
329a6fe
commit
Mar 3, 2024
ed76360
commit
Mar 3, 2024
d3ed852
revert name changes
Mar 3, 2024
47619bc
commit
Mar 3, 2024
0ea9b92
Updated the benchmarkname with fault
Mar 4, 2024
1871614
Added validation for Project name
Mar 4, 2024
ce39a23
updated execute.sh
Mar 5, 2024
615ba86
commit
Mar 5, 2024
21d10aa
Commit
Mar 5, 2024
22c623b
Added validation for projectName
Mar 5, 2024
57f34d6
Merge branch 'main' into users/dpatnekar/fixissues
Mar 9, 2024
950c5d6
Updated the chaos tool zip file
Mar 9, 2024
ff40b28
changed projectName to lowercase
Mar 11, 2024
551c730
changed projectName to lowercase for MongoAPI
Mar 11, 2024
b155e3d
Added support application insights using applicationinsights-agent
Mar 18, 2024
992823a
fixed dir creation issue
Mar 18, 2024
b2b31ed
updated custom-script.sh
Mar 18, 2024
215543f
updated the appinsights jar location
Mar 18, 2024
96bb601
moved agent wget to custom-script
Mar 18, 2024
b61f940
updated the version of agent
Mar 18, 2024
37abc81
updated custom-script.sh
Mar 19, 2024
4451746
fixed the javaagent issue
Mar 19, 2024
3f316fd
added java_opts
Mar 20, 2024
9889ca5
added java agent args
Mar 20, 2024
6dfc74f
fixing bug
Mar 20, 2024
6838f0d
updated the jvm args
Mar 20, 2024
bc0d702
removed the jvm args
Mar 20, 2024
6ccb82d
Fixed bugs
Mar 20, 2024
b4bb2e3
Added JAVA_OPTS to custom_script
Mar 21, 2024
94834c6
updated the JAVA_OPTS
Mar 21, 2024
3ad8849
Added setenv.sh
Mar 21, 2024
fcc75c7
appending env variables to bashrc
Mar 21, 2024
b43e9e4
Fixed variable name
Mar 21, 2024
24bba26
moved the env variable export to execute.sh
Mar 21, 2024
7793774
adding env variables to profile file
Mar 21, 2024
a273b99
added parameters for application insights
Mar 22, 2024
a572019
Merge branch 'main' into users/dpatnekar/fixissues
Apr 5, 2024
94e7bfe
Merged with main and updated the description
Apr 5, 2024
e8c26a1
Updated description
Apr 5, 2024
54cda90
Reverted the change to have time in milliseconds
Apr 5, 2024
ff9eb2e
blank space
Apr 5, 2024
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
12 changes: 6 additions & 6 deletions cosmos/infra/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down Expand Up @@ -68,7 +68,7 @@
"resultsStorageConnectionString": {
"type": "string",
"metadata": {
"description": "Specifies a connection string of the storage account where results will be avaialble"
"description": "Specifies a connection string of the storage account where results will be available."
}
},
"cosmosURI": {
Expand Down Expand Up @@ -155,7 +155,7 @@
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "Specifies if the gateway connectivity mode should be used. The default value 'flase' indicates direct connectivity mode"
"description": "Specifies if the gateway connectivity mode should be used. The default value 'false' indicates direct connectivity mode"
}
},
"diagnosticsLatencyThresholdInMS": {
Expand Down Expand Up @@ -543,7 +543,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'),' ','CONSISTENCY_LEVEL=',parameters('consistencyLevel'),' ','PREFERRED_REGION_LIST=','\"',parameters('preferredRegionList'),'\"',' ','APP_INSIGHT_CONN_STR=','\"',parameters('appInsightConnectionString'),'\"',' ','POINT_OPERATION_THRESHOLD_IN_MS=',parameters('pointOperationLatencyThresholdInMS'),' ','NON_POINT_OPERATION_THRESHOLD_IN_MS=',parameters('nonPointOperationLatencyThresholdInMS'),' ','REQUEST_CHARGE_THRESHOLD=',parameters('requestChargeThreshold'),' ','APP_INSIGHT_METRIC_INTERVAL_IN_SECONDS=',parameters('appInsightsMetricIntervalInSeconds'),' ', 'bash ',variables('vmScriptExtensionScriptName'))]",
"commandToExecute": "[concat('DB_BINDING_NAME=',parameters('ycsbDatabaseBindingName'),' ','ADMIN_USER_NAME=',parameters('adminUsername'),' ','PROJECT_NAME=',parameters('projectName'),' ','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'),' ','CONSISTENCY_LEVEL=',parameters('consistencyLevel'),' ','PREFERRED_REGION_LIST=','\"',parameters('preferredRegionList'),'\"',' ','APP_INSIGHT_CONN_STR=','\"',parameters('appInsightConnectionString'),'\"',' ','POINT_OPERATION_THRESHOLD_IN_MS=',parameters('pointOperationLatencyThresholdInMS'),' ','NON_POINT_OPERATION_THRESHOLD_IN_MS=',parameters('nonPointOperationLatencyThresholdInMS'),' ','REQUEST_CHARGE_THRESHOLD=',parameters('requestChargeThreshold'),' ','APP_INSIGHT_METRIC_INTERVAL_IN_SECONDS=',parameters('appInsightsMetricIntervalInSeconds'),' ', 'bash ',variables('vmScriptExtensionScriptName'))]",
"fileUris": [ "[concat(variables('vmScriptExtensionScriptURL'))]" ]
}
},
Expand All @@ -559,4 +559,4 @@
"value": "The Benchmarking job has been triggered successfully. Please check the storage account you provided for Job Status and Results. The jobs status will be available in a storage table within a few minutes and results will be available once the job finishes."
}
}
}
}
4 changes: 2 additions & 2 deletions cosmos/infra/azuredeploy_mongo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"parameters": {
"projectName": {
"type": "string",
"defaultValue": "Benchmarking",
"defaultValue": "benchmarking",
"metadata": {
"description": "Specifies a name for generating resource names."
"description": "Specifies a name for generating resource names. Should be one word, lowercase letters and numbers only."
}
},
"location": {
Expand Down
40 changes: 36 additions & 4 deletions cosmos/scripts/chaos/chaos_script.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
<#
.SYNOPSIS
This script introduces network faults into a Cosmos DB environment for testing purposes.
.DESCRIPTION
The script takes several parameters to configure the fault injection, including the endpoint, master key, database ID, container ID, duration of fault, drop percentage, delay in milliseconds, fault region, and wait time for fault to start. It then uses these parameters to introduce network faults using the Clumsy utility.
.PARAMETER endpoint
The endpoint for the Cosmos DB instance.
.PARAMETER masterKey
The master key for the Cosmos DB instance.
.PARAMETER databaseId
The ID of the database in the Cosmos DB instance.
.PARAMETER containerId
The ID of the container in the database.
.PARAMETER durationOfFaultInSec
The duration of the network fault in seconds.
.PARAMETER dropPercentage
The percentage of packets to drop (optional).
.PARAMETER delayInMs
The delay to introduce in milliseconds (optional).
.PARAMETER faultRegion
The region where the fault should be introduced.
.PARAMETER waitForFaultToStartInSec
The time to wait before starting the fault in seconds (optional).
.EXAMPLE
.\chaos_script.ps1 -endpoint "https://my-cosmos-db.documents.azure.com:443/" -masterKey "my-master-key" -databaseId "my-database" -containerId "my-container" -durationOfFaultInSec 60 -dropPercentage 50 -delayInMs 200 -faultRegion "West US" -waitForFaultToStartInSec 10
This example introduces a network fault that drops 50% of packets and introduces a 200ms delay for 60 seconds in the "West US" region of the specified Cosmos DB instance. It waits 10 seconds before starting the fault.
#>

param (
[parameter(Mandatory = $true)]
[ValidateNotNull()]
Expand Down Expand Up @@ -40,9 +68,9 @@ if ($waitForFaultToStartInSec)
}

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install chocolatey-compatibility.extension
choco install clumsy -y
#choco uninstall clumsy
choco install chocolatey-compatibility.extension -y --force
choco install clumsy -y --force
Write-Host "To remove WinDivertXX.sys, please remove/uninstall all WinDivert client application(s) and reboot." -ForegroundColor Cyan

$databaseAccountResponseJson = & .\GetDatabaseAccount.ps1 -Endpoint $endpoint -MasterKey $masterKey
$databaseAccountResponseObject = $databaseAccountResponseJson | ConvertFrom-Json
Expand Down Expand Up @@ -141,4 +169,8 @@ if ($durationOfFaultInSec)
}

# Clearing the fault
Stop-Process -Name clumsy
Stop-Process -Name clumsy

# Uninstall Clumsy
choco uninstall clumsy -y
Write-Host "To remove WinDivertXX.sys, please remove/uninstall all WinDivert client application(s) and reboot." -ForegroundColor Cyan
55 changes: 55 additions & 0 deletions cosmos/scripts/chaos/chaos_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,61 @@ install_powershell() {
pwsh
}

while getopts "e:m:d:c:w:t:r:p:l:" opt;
do
case "$opt" in
e) endpoint=$OPTARG;;
m) masterkey=$OPTARG;;
d) databaseid=$OPTARG;;
c) containerid=$OPTARG;;
w) wait_for_fault_to_start_in_sec=$OPTARG;;
t) duration_of_fault_in_sec=$OPTARG;;
r) fault_region=$OPTARG;;
p) drop_probability=$OPTARG;;
l) delay_in_ms=$OPTARG;;
esac
done

usage(){
echo "Usage: ./chaos_script.sh -e <endpoint> -d <databaseid> -c <containerid> -w <wait_for_fault_to_start_in_sec> -t <duration_of_fault_in_sec> -r <fault_region> -p <drop_probability> -l <delay_in_ms>"
}

if [ -z "$endpoint" ]; then
echo "The endpoint for the Cosmos DB instance is not set. Please pass it with -e option."
usage
exit 1
fi

if [ -z "$masterkey" ]; then
echo "The masterkey for the Cosmos DB instance is not set. Please pass it with -m option."
usage
exit 1
fi

if [ -z "$databaseid" ]; then
echo "The databaseid for the Cosmos DB instance is not set. Please pass it with -d option."
usage
exit 1
fi

if [ -z "$containerid" ]; then
echo "The containerid for the Cosmos DB instance is not set. Please pass it with -c option."
usage
exit 1
fi

if [ -z "$duration_of_fault_in_sec" ]; then
echo "The duration_of_fault_in_sec is not set. Please pass it with -t option."
usage
exit 1
fi

if [ -z "$fault_region" ]; then
echo "The fault_region is not set. Please pass it with -r option."
usage
exit 1
fi

if ! command -v pwsh &>/dev/null; then
install_powershell
fi
Expand Down
Loading