Skip to content

Commit

Permalink
Merge branch 'master' into users/brchon/ChangeFeed/StartFromFeedRange
Browse files Browse the repository at this point in the history
  • Loading branch information
bchong95 committed Aug 6, 2020
2 parents 2bbbbd2 + bad884f commit e3746f8
Show file tree
Hide file tree
Showing 94 changed files with 10,799 additions and 387 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ClientOfficialVersion>3.11.0</ClientOfficialVersion>
<ClientOfficialVersion>3.12.0</ClientOfficialVersion>
<ClientPreviewVersion>3.11.0</ClientPreviewVersion>
<DirectVersion>3.11.3</DirectVersion>
<DirectVersion>3.11.4</DirectVersion>
<EncryptionVersion>1.0.0-preview4</EncryptionVersion>
<HybridRowVersion>1.0.0-preview</HybridRowVersion>
<AboveDirBuildProps>$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))</AboveDirBuildProps>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<IsTestProject>true</IsTestProject>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Platform>AnyCPU</Platform>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>Microsoft.Azure.Cosmos</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<IsTestProject>true</IsTestProject>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Platform>AnyCPU</Platform>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>Microsoft.Azure.Cosmos.Encryption.Tests</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public class BenchmarkConfig
[Option(Required = false, HelpText = "Partitionkey, only for publish")]
public string ResultsPartitionKeyValue { get; set; }

[Option(Required = false, HelpText = "Disable core SDK logging")]
public bool DisableCoreSdkLogging { get; set; }

[Option(Required = false, HelpText = "Container to publish results to")]
internal string ResultsContainer { get; set; } = "runsummary";

Expand All @@ -105,12 +108,12 @@ internal void Print()
{
using (ConsoleColorContext ct = new ConsoleColorContext(ConsoleColor.Green))
{
Console.WriteLine($"{nameof(BenchmarkConfig)} arguments");
Console.WriteLine($"IsServerGC: {GCSettings.IsServerGC}");
Console.WriteLine("--------------------------------------------------------------------- ");
Console.WriteLine(JsonHelper.ToString(this));
Console.WriteLine("--------------------------------------------------------------------- ");
Console.WriteLine();
Utility.TeeTraceInformation($"{nameof(BenchmarkConfig)} arguments");
Utility.TeeTraceInformation($"IsServerGC: {GCSettings.IsServerGC}");
Utility.TeeTraceInformation("--------------------------------------------------------------------- ");
Utility.TeeTraceInformation(JsonHelper.ToString(this));
Utility.TeeTraceInformation("--------------------------------------------------------------------- ");
Utility.TeeTraceInformation(string.Empty);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>CosmosBenchmark</RootNamespace>
<AssemblyName>CosmosBenchmark</AssemblyName>
<ServerGarbageCollection>true</ServerGarbageCollection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ private async Task<RunSummary> LogOutputStats(IExecutor[] executors)

RunSummary runSummary = new RunSummary();

if (summaryCounters.Length > 0)
if (summaryCounters.Length > 10)
{

Console.WriteLine();
Console.WriteLine("After Excluding outliers");
Utility.TeeTraceInformation("After Excluding outliers");

runSummary.Top10PercentAverageRps = Math.Round(summaryCounters.Take((int)(0.1 * summaryCounters.Length)).Average(), 0);
runSummary.Top20PercentAverageRps = Math.Round(summaryCounters.Take((int)(0.2 * summaryCounters.Length)).Average(), 0);
Expand All @@ -131,14 +131,18 @@ private async Task<RunSummary> LogOutputStats(IExecutor[] executors)
runSummary.Top95PercentAverageRps = Math.Round(summaryCounters.Take((int)(0.95 * summaryCounters.Length)).Average(), 0);
runSummary.AverageRps = Math.Round(summaryCounters.Average(), 0);

Console.WriteLine(JsonHelper.ToString(runSummary));
string summary = JsonHelper.ToString(runSummary);
Utility.TeeTraceInformation(summary);
}
else
{
Utility.TeeTraceInformation("Please adjust ItemCount high to run of at-least 1M");
}

Console.WriteLine("--------------------------------------------------------------------- ");

return runSummary;
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public double Rps()

public void Print(long globalTotal)
{
Console.WriteLine("Stats, total: {0,5} success: {1,5} fail: {2,3} RPs: {3,5} RUps: {4,5}",
Utility.TeePrint("Stats, total: {0,5} success: {1,5} fail: {2,3} RPs: {3,5} RUps: {4,5}",
globalTotal,
this.succesfulOpsCount,
this.failedOpsCount,
Expand Down
14 changes: 14 additions & 0 deletions Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ private async Task<RunSummary> ExecuteAsync(BenchmarkConfig config, string accou
cosmosClient,
documentClient);

if (config.DisableCoreSdkLogging)
{
// Do it after client initialization (HACK)
Program.ClearCoreSdkListeners();
}

IExecutionStrategy execution = IExecutionStrategy.StartNew(config, benchmarkOperationFactory);
runSummary = await execution.ExecuteAsync(taskCount, opsPerTask, config.TraceFailures, 0.01);
}
Expand Down Expand Up @@ -236,5 +242,13 @@ private static async Task<ContainerResponse> CreatePartitionedContainerAsync(Ben
return await database.CreateContainerAsync(options.Container, partitionKeyPath, options.Throughput);
}
}

private static void ClearCoreSdkListeners()
{
Type defaultTrace = Type.GetType("Microsoft.Azure.Cosmos.Core.Trace.DefaultTrace,Microsoft.Azure.Cosmos.Direct");
TraceSource traceSource = (TraceSource)defaultTrace.GetProperty("TraceSource").GetValue(null);
traceSource.Switch.Level = SourceLevels.All;
traceSource.Listeners.Clear();
}
}
}
25 changes: 25 additions & 0 deletions Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Utility.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace CosmosBenchmark
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

internal static class Utility
{
public static void TeeTraceInformation(string payload)
{
Console.WriteLine(payload);
Trace.TraceInformation(payload);
}

public static void TeePrint(string format, params object[] arg)
{
string payload = string.Format(format, arg);
Utility.TeeTraceInformation(payload);
}
}
}
2 changes: 1 addition & 1 deletion Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ fi

for BENCHMARK_NAME in InsertV3 ReadStreamExistsV3 #ReadFeedStreamV3 ReadNotExistsV3 ReadTExistsV3
do
dotnet run -c Release -- -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $(git log -1 | head -n 1 | cut -d ' ' -f 2) --commitdate $(git log -1 --date=format:'%Y-%m-%d %H:%M:%S' | grep Date | cut -f 2- -d ':' | sed 's/^[ \t]*//;s/[ \t]*$//' | cut -f 1 -d ' ') --committime $(git log -1 --date=format:'%Y-%m-%d %H:%M:%S' | grep Date | cut -f 2- -d ':' | sed 's/^[ \t]*//;s/[ \t]*$//' | cut -f 2 -d ' ') --branchname $(git rev-parse --abbrev-ref HEAD) --database testdb --container testcol --partitionkeypath /pk -n 2000000 -w $BENCHMARK_NAME --pl $PL
dotnet run -c Release -- -e $ACCOUNT_ENDPOINT -k $ACCOUNT_KEY --disablecoresdklogging --publishresults --resultspartitionkeyvalue $RESULTS_PK --commitid $(git log -1 | head -n 1 | cut -d ' ' -f 2) --commitdate $(git log -1 --date=format:'%Y-%m-%d %H:%M:%S' | grep Date | cut -f 2- -d ':' | sed 's/^[ \t]*//;s/[ \t]*$//' | cut -f 1 -d ' ') --committime $(git log -1 --date=format:'%Y-%m-%d %H:%M:%S' | grep Date | cut -f 2- -d ':' | sed 's/^[ \t]*//;s/[ \t]*$//' | cut -f 2 -d ' ') --branchname $(git rev-parse --abbrev-ref HEAD) --database testdb --container testcol --partitionkeypath /pk -n 2000000 -w $BENCHMARK_NAME --pl $PL
done

2 changes: 1 addition & 1 deletion Microsoft.Azure.Cosmos.Samples/Usage/Shared/Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit e3746f8

Please sign in to comment.