Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,14 @@ internal Microsoft.Azure.Cosmos.CosmosClient CreateCosmosClient()
ApplicationName = this.GetUserAgentPrefix(),
MaxRetryAttemptsOnRateLimitedRequests = 0,
MaxRequestsPerTcpConnection = this.MaxRequestsPerTcpConnection,
MaxTcpConnectionsPerEndpoint = this.MaxTcpConnectionsPerEndpoint,
MaxTcpConnectionsPerEndpoint = (this.IsThinClientEnabled || this.IsGatewayModeEnabled)? this.MaxTcpConnectionsPerEndpoint : 200,
ConnectionMode = (this.IsThinClientEnabled || this.IsGatewayModeEnabled) ? Microsoft.Azure.Cosmos.ConnectionMode.Gateway: Microsoft.Azure.Cosmos.ConnectionMode.Direct,
CosmosClientTelemetryOptions = new Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions()
{
DisableSendingMetricsToService = !this.EnableTelemetry,
DisableDistributedTracing = !this.EnableDistributedTracing
},
},
GatewayModeMaxConnectionLimit = 500
};

if (!string.IsNullOrEmpty(this.ApplicationPreferredRegions))
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

export OSSProjectRef=True
export RESULTS_PK=test_runs
export PL=18
export PL=75

#These must be configured
export ACCOUNT_ENDPOINT=
Expand Down
83 changes: 38 additions & 45 deletions Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,14 @@ MODE_FLAGS="--isthinclientenabled=${THINCLIENT_ENABLED:-false} \
# ---------- 1) ALWAYS RUN THESE 10 WORKLOADS ----------
for WORKLOAD_NAME in \
CreateItemV3BenchmarkOperation \
InsertV3BenchmarkOperation \
ReadItemV3BenchmarkOperation \
ReadStreamExistsV3BenchmarkOperation \
ReplaceItemV3BenchmarkOperation \
ReplaceItemStreamV3BenchmarkOperation \
UpsertItemV3BenchmarkOperation \
UpsertItemStreamV3BenchmarkOperation \
DeleteItemV3BenchmarkOperation \
DeleteItemStreamV3BenchmarkOperation
DeleteItemV3BenchmarkOperation
do
dotnet run -c Release \
-- -n 2000000 \
-w $WORKLOAD_NAME \
$MODE_FLAGS \
--pl $PL \
--pl 75 \
-e $ACCOUNT_ENDPOINT \
-k $ACCOUNT_KEY \
--enablelatencypercentiles \
Expand All @@ -80,39 +73,39 @@ do
done

# ---------- 2) ADDITIONAL SCENARIOS DIRECT-ONLY ----------
if [ "${DIRECTMODE_ENABLED:-false}" = true ]; then
# Client telemetry disabled ReadStreamExistsV3
dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 $MODE_FLAGS --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
sleep 10 #Wait

# Client telemetry enabled ReadStreamExistsV3. This is needed to see the impact of client telemetry.
dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 $MODE_FLAGS --WorkloadName ReadStreamExistsV3WithTelemetry --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
sleep 10 #Wait

# Open telemetry enabled ReadStreamExistsV3. This is needed to see the impact of distributed tracing (without listener)
dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 $MODE_FLAGS --WorkloadName ReadStreamExistsV3WithDistributedTracingWOListener --enableDistributedTracing --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
sleep 10 #Wait

#Point read operations
for WORKLOAD_NAME in ReadNotExistsV3 ReadTExistsV3 ReadStreamExistsWithDiagnosticsV3
do
dotnet run -c Release -- -n 2000000 -w $WORKLOAD_NAME $MODE_FLAGS --pl $PL --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
sleep 10 #Wait
done

#Insert operation
dotnet run -c Release -- -n 2000000 -w InsertV3 $MODE_FLAGS --pl 30 --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 1 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
sleep 45 #Wait

if [ "$INCLUDE_QUERY" = true ]
then
#Query operations
# n value is lowered to 200000 because queries are significantly slower. This prevents the runs from taking to long.
# pl is 16 because 18 was casuing a small amount of thorrtles.
for WORKLOAD_NAME in ReadFeedStreamV3 QueryTSinglePkV3 QueryTSinglePkOrderByWithPaginationV3 QueryTSinglePkOrderByFullDrainV3 QueryTCrossPkV3 QueryTCrossPkOrderByWithPaginationV3 QueryTCrossPkOrderByFullDrainV3 QueryStreamSinglePkV3 QueryStreamSinglePkOrderByWithPaginationV3 QueryStreamSinglePkOrderByFullDrainV3 QueryStreamCrossPkV3 QueryStreamCrossPkOrderByWithPaginationV3 QueryStreamCrossPkOrderByFullDrainV3
do
dotnet run -c Release -- -n 200000 -w $WORKLOAD_NAME $MODE_FLAGS --pl 16 --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
sleep 10 #Wait
done
fi
fi
#if [ "${DIRECTMODE_ENABLED:-false}" = true ]; then
# # Client telemetry disabled ReadStreamExistsV3
# dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 $MODE_FLAGS --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
# sleep 10 #Wait
#
# # Client telemetry enabled ReadStreamExistsV3. This is needed to see the impact of client telemetry.
# dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 $MODE_FLAGS --WorkloadName ReadStreamExistsV3WithTelemetry --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
# sleep 10 #Wait
#
# # Open telemetry enabled ReadStreamExistsV3. This is needed to see the impact of distributed tracing (without listener)
# dotnet run -c Release -- -n 2000000 -w ReadStreamExistsV3 $MODE_FLAGS --WorkloadName ReadStreamExistsV3WithDistributedTracingWOListener --enableDistributedTracing --tcp 10 --pl $PL -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
# sleep 10 #Wait
#
# #Point read operations
# for WORKLOAD_NAME in ReadNotExistsV3 ReadTExistsV3 ReadStreamExistsWithDiagnosticsV3
# do
# dotnet run -c Release -- -n 2000000 -w $WORKLOAD_NAME $MODE_FLAGS --pl $PL --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
# sleep 10 #Wait
# done
#
# #Insert operation
# dotnet run -c Release -- -n 2000000 -w InsertV3 $MODE_FLAGS --pl 30 --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 1 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
# sleep 45 #Wait
#
# if [ "$INCLUDE_QUERY" = true ]
# then
# #Query operations
# # n value is lowered to 200000 because queries are significantly slower. This prevents the runs from taking to long.
# # pl is 16 because 18 was casuing a small amount of thorrtles.
# for WORKLOAD_NAME in ReadFeedStreamV3 QueryTSinglePkV3 QueryTSinglePkOrderByWithPaginationV3 QueryTSinglePkOrderByFullDrainV3 QueryTCrossPkV3 QueryTCrossPkOrderByWithPaginationV3 QueryTCrossPkOrderByFullDrainV3 QueryStreamSinglePkV3 QueryStreamSinglePkOrderByWithPaginationV3 QueryStreamSinglePkOrderByFullDrainV3 QueryStreamCrossPkV3 QueryStreamCrossPkOrderByWithPaginationV3 QueryStreamCrossPkOrderByFullDrainV3
# do
# dotnet run -c Release -- -n 200000 -w $WORKLOAD_NAME $MODE_FLAGS --pl 16 --enableTelemetry --telemetryScheduleInSec 60 --telemetryEndpoint $TELEMETRY_ENDPOINT --tcp 10 -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --enablelatencypercentiles --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $COMMIT_ID --commitdate $COMMIT_DATE --committime $COMMIT_TIME --branchname $BRANCH_NAME --database testdb --container testcol --partitionkeypath /pk
# sleep 10 #Wait
# done
# fi
#fi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace CosmosBenchmark
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;

Expand Down Expand Up @@ -51,7 +52,8 @@ public async Task PrepareAsync()

public async Task<OperationResult> ExecuteOnceAsync()
{
ItemResponse<Dictionary<string, object>> response = await this.container.ReadItemAsync<Dictionary<string, object>>(this.itemId, new PartitionKey(this.itemPk));
using CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
ItemResponse<Dictionary<string, object>> response = await this.container.ReadItemAsync<Dictionary<string, object>>(this.itemId, new PartitionKey(this.itemPk), cancellationToken: cts.Token);
return new OperationResult
{
DatabseName = this.databaseName,
Expand Down
Loading