Last active
January 4, 2018 18:43
-
-
Save kamsar/5500f7840349b9d6a488746d6e55e31d to your computer and use it in GitHub Desktop.
Benchmark script to test actions on Sitecore instances
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "Habitat.sln" /p:Configuration=Debug /m /t:Clean /nr:false | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "Habitat.sln" /p:Configuration=Debug /m /t:Build /nr:false | |
echo Take note of the timing above, this is the CLEAN BUILD time | |
pause | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "Habitat.sln" /p:Configuration=Debug /m /t:Build /nr:false | |
echo Take note of the timing above, this is the WARM BUILD time | |
pause | |
echo. >> src\Project\Habitat\code\Properties\AssemblyInfo.cs | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "Habitat.sln" /p:Configuration=Debug /m /t:Build /nr:false | |
echo Take note of the timing above, this is the WARM BUILD WEBSITE time | |
pause | |
echo. >> src\Feature\FAQ\code\Properties\AssemblyInfo.cs | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "Habitat.sln" /p:Configuration=Debug /m /t:Build /nr:false | |
echo Take note of the timing above, this is the WARM BUILD FEATURE time | |
pause | |
echo. >> src\Foundation\Testing\code\Attributes\CoreDbAttribute.cs | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "Habitat.sln" /p:Configuration=Debug /m /t:Build /nr:false | |
echo Take note of the timing above, this is the WARM BUILD FOUNDATION time | |
echo And with that you're done. | |
pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "LegendaryPancake.sln" /p:Configuration=Debug /m /t:Clean /nr:false | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "LegendaryPancake.sln" /p:Configuration=Debug /m /t:Build /nr:false | |
echo Take note of the timing above, this is the CLEAN BUILD time | |
pause | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "LegendaryPancake.sln" /p:Configuration=Debug /m /t:Build /nr:false | |
echo Take note of the timing above, this is the WARM BUILD time | |
pause | |
echo. >> src\Project\Prototype\Project.Prototype\DependencyConfiguration.cs | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "LegendaryPancake.sln" /p:Configuration=Debug /m /t:Build /nr:false | |
echo Take note of the timing above, this is the WARM BUILD WEBSITE time | |
pause | |
echo. >> src\Feature\ExperienceBlocks\Feature.ExperienceBlocks\ExperienceBlockContext.cs | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "LegendaryPancake.sln" /p:Configuration=Debug /m /t:Build /nr:false | |
echo Take note of the timing above, this is the WARM BUILD FEATURE time | |
pause | |
echo. >> src\Foundation\Orm\DependencyConfiguration.cs | |
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "LegendaryPancake.sln" /p:Configuration=Debug /m /t:Build /nr:false | |
echo Take note of the timing above, this is the WARM BUILD FOUNDATION time | |
echo And with that you're done. | |
pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = 'Stop' | |
function Run-SingleBenchmark($root) { | |
return Measure-Command -Expression { set-location $root; & cmd /c gulp 05-Sync-Unicorn } | |
} | |
function Run-Benchmark($root) { | |
$results = 0 | |
Write-Host "Benchmarking $root..." | |
for($i = 0; $i -lt 3; $i++) { | |
Write-Host "Starting run $($i)..." | |
$run = (Run-SingleBenchmark $root).TotalMilliseconds | |
Write-Host "Run $($i): $($run)ms" | |
if($i -ne 2) { | |
Start-Sleep -m 20000 | |
} | |
$results += $run | |
} | |
return $results/3 | |
} | |
function Warmup-Instance($url) { | |
write-host "Resetting services before testing $url" | |
iisreset | |
if ($LASTEXITCODE -gt 0) { | |
iisreset | |
if ($LASTEXITCODE -gt 0) { | |
throw 'iisreset exit failed.' | |
} | |
} | |
restart-service mssqlserver | |
$foo = Invoke-WebRequest "http://$url/unicorn.aspx" -UseBasicParsing | |
Write-Host "Warmed up Unicorn control on $url" | |
} | |
# $sites = @{ "habitat.ssd.u3" = "C:\Web\Habitat.ssd.u3"; "habitat.ssd.u4" = "C:\Web\Habitat.ssd.u4"; "habitat.hdd.u3" = "D:\WebTemp\habitat.hdd.u3"; "habitat.hdd.u4" = "D:\WebTemp\habitat.hdd.u4" } | |
$sites = @{ "habitat.ssd.u4" = "C:\Web\Habitat.ssd.u4"; } | |
# run benchmarks | |
$sites.GetEnumerator() | % { | |
Warmup-Instance $($_.Key) | |
$result = Run-Benchmark $($_.Value) | |
Write-Host "Result: $($result)ms" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment