[Internal] Benchmark: Adds Few more benchmark related changes (#1705)

* Directory.Build.props refractoring

* OOBB ability to target source code

* Directory.Build.props refractoring

* OOBB ability to target source code

* Adding simple command for perf runs test results as well (INERNAL)

* Including  -p:OSSProjectRef=True

* dotnet run -p looks for project

* Perf runs with internal command

* Some more changes
This commit is contained in:
kirankumarkolli 2020-07-20 19:42:38 +05:30 коммит произвёл GitHub
Родитель e5442aac98
Коммит 8db382d3a3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 102 добавлений и 16 удалений

13
Directory.Build.props Normal file
Просмотреть файл

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ClientOfficialVersion>3.11.0</ClientOfficialVersion>
<ClientPreviewVersion>3.11.0</ClientPreviewVersion>
<DirectVersion>3.11.2</DirectVersion>
<EncryptionVersion>1.0.0-preview4</EncryptionVersion>
<HybridRowVersion>1.0.0-preview</HybridRowVersion>
<AboveDirBuildProps>$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))</AboveDirBuildProps>
<DefineConstants Condition=" '$(IsNightly)' == 'true' or '$(IsPreview)' == 'true' ">$(DefineConstants);PREVIEW</DefineConstants>
</PropertyGroup>
<Import Project="$(AboveDirBuildProps)" Condition=" '$(AboveDirBuildProps)' != '' " />
</Project>

Просмотреть файл

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\Microsoft.Azure.Cosmos\Directory.Build.props" />
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
</Project>

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
</Project>

Просмотреть файл

@ -26,11 +26,11 @@
</ItemGroup>
<ItemGroup Condition=" '$(ProjectRef)' == 'True' ">
<!-- UNCOMMENTING BELOW and REMOVING ABOVE condition above will enable run with latest V3 sources
<PackageReference Include="Microsoft.Azure.Cosmos.Direct" Version="*" />
<PackageReference Include="Microsoft.Azure.Cosmos.Serialization.HybridRow" Version="1.0.0-preview" />
-->
<ProjectReference Include="..\..\..\Microsoft.Azure.Cosmos\src\Microsoft.Azure.Cosmos.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(OSSProjectRef)' == 'True' ">
<ProjectReference Include="..\..\..\Microsoft.Azure.Cosmos\src\Microsoft.Azure.Cosmos.csproj" />
<PackageReference Include="Microsoft.Azure.Cosmos.Direct" Version="[$(DirectVersion)]" />
<PackageReference Include="Microsoft.Azure.Cosmos.Serialization.HybridRow" Version="[$(HybridRowVersion)]" />
</ItemGroup>
</Project>

Просмотреть файл

@ -10,6 +10,25 @@ Dry tun targeting emulator will look like below
dotnet run CosmosBenchmark.csproj -e "https://localhost:8081" -k "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
```
To target Microsoft.Azure.Cosmos\src\Microsoft.Azure.Cosmos.csproj
```
export OSSProjectRef=True
dotnet run CosmosBenchmark.csproj -e {ACCOUNT_ENDPOINT} -k {ACCOUNT_KEY}
```
For PerfRuns with reports (INTERNAL)
```
export OSSProjectRef=True
export ACCOUNT_ENDPOINT=<ENDPOINT
export ACCOUNT_KEY=<KEY>
export RESULTS_PK="runs-summary" #For test runs use different one
export PL=300
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 500000 -w ReadStreamExistsV3 --pl $PL
```
![image](https://user-images.githubusercontent.com/6880899/61565403-8e41bd00-aa96-11e9-9996-b7fc77c3aed3.png)
## Usage

Просмотреть файл

@ -0,0 +1,55 @@
#!/bin/bash
# Looped benchmrak run
# $1: BenchmarkName
# $2: IterationCount
loopedBenchmarkRun() {
echo
echo ========$1==========
echo
for ((i=0; i < $2; i++))
do
echo ========ITER: $i ==========
echo SLEEPING for 60s
sleep 60
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 500000 -w ReadStreamExistsV3 --pl $PL
done
}
if [ -z "$ACCOUNT_ENDPOINT" ]
then
echo "Missing ACCOUNT_ENDPOINT"
exit -1
fi
if [ -z "$ACCOUNT_KEY" ]
then
echo "Missing ACCOUNT_KEY"
exit -1
fi
if [ -z "$RESULTS_PK" ]
then
echo "Missing RESULTS_PK"
exit -1
fi
if [ -z "$PL" ]
then
echo "Missing PL"
exit -1
fi
if [ -z "$BENCH_MARK_ITER_COUNT" ]
then
echo "BENCH_MARK_ITER_COUNT not set, setting to default 5"
BENCH_MARK_ITER_COUNT=5
fi
for BENCHMARK_NAME in InsertV3 ReadFeedStreamV3 ReadNotExistsV3 ReadStreamExistsV3 ReadTExistsV3
do
loopedBenchmarkRun $BENCHMARK_NAME $BENCH_MARK_ITER_COUNT
done

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
</Project>

Просмотреть файл

@ -1,13 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ClientOfficialVersion>3.11.0</ClientOfficialVersion>
<ClientPreviewVersion>3.11.0</ClientPreviewVersion>
<DirectVersion>3.11.2</DirectVersion>
<EncryptionVersion>1.0.0-preview4</EncryptionVersion>
<HybridRowVersion>1.0.0-preview</HybridRowVersion>
<AboveDirBuildProps>$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))</AboveDirBuildProps>
<DefineConstants Condition=" '$(IsNightly)' == 'true' or '$(IsPreview)' == 'true' ">$(DefineConstants);PREVIEW</DefineConstants>
</PropertyGroup>
<Import Project="$(AboveDirBuildProps)" Condition=" '$(AboveDirBuildProps)' != '' " />
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
</Project>