diff --git a/.gitignore b/.gitignore index e30a491fca..e353a67858 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ _ReSharper.*/ packages/ artifacts/ PublishProfiles/ +BenchmarkDotNet.Artifacts/ *.user *.suo *.cache diff --git a/IISIntegration.sln b/IISIntegration.sln index d8564e4be6..adccebbe1f 100644 --- a/IISIntegration.sln +++ b/IISIntegration.sln @@ -95,6 +95,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RequestHandler", "src\AspNe EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OutOfProcessWebSite", "test\WebSites\OutOfProcessWebSite\OutOfProcessWebSite.csproj", "{42E60F88-E23F-417A-8143-0CCEC05E1D02}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{622D35C9-627B-466E-8D15-752968CC79AF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.Performance", "benchmarks\IIS.Performance\IIS.Performance.csproj", "{48F46909-E76A-4788-BCE1-E543C0E140FE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -309,6 +313,18 @@ Global {42E60F88-E23F-417A-8143-0CCEC05E1D02}.Release|x64.Build.0 = Release|x64 {42E60F88-E23F-417A-8143-0CCEC05E1D02}.Release|x86.ActiveCfg = Release|x86 {42E60F88-E23F-417A-8143-0CCEC05E1D02}.Release|x86.Build.0 = Release|x86 + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Debug|x64.ActiveCfg = Debug|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Debug|x64.Build.0 = Debug|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Debug|x86.ActiveCfg = Debug|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Debug|x86.Build.0 = Debug|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Release|Any CPU.Build.0 = Release|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Release|x64.ActiveCfg = Release|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Release|x64.Build.0 = Release|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Release|x86.ActiveCfg = Release|Any CPU + {48F46909-E76A-4788-BCE1-E543C0E140FE}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -336,6 +352,7 @@ Global {09D9D1D6-2951-4E14-BC35-76A23CF9391A} = {06CA2C2B-83B0-4D83-905A-E0C74790009E} {D57EA297-6DC2-4BC0-8C91-334863327863} = {06CA2C2B-83B0-4D83-905A-E0C74790009E} {42E60F88-E23F-417A-8143-0CCEC05E1D02} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520} + {48F46909-E76A-4788-BCE1-E543C0E140FE} = {622D35C9-627B-466E-8D15-752968CC79AF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DB4F868D-E1AE-4FD7-9333-69FA15B268C5} diff --git a/benchmarks/IIS.Performance/FirstRequestConfig.cs b/benchmarks/IIS.Performance/FirstRequestConfig.cs new file mode 100644 index 0000000000..727746871f --- /dev/null +++ b/benchmarks/IIS.Performance/FirstRequestConfig.cs @@ -0,0 +1,39 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using BenchmarkDotNet.Columns; +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Diagnosers; +using BenchmarkDotNet.Engines; +using BenchmarkDotNet.Exporters; +using BenchmarkDotNet.Jobs; +using BenchmarkDotNet.Loggers; +using BenchmarkDotNet.Toolchains.CsProj; +using BenchmarkDotNet.Toolchains.DotNetCli; +using BenchmarkDotNet.Validators; + +namespace BenchmarkDotNet.Attributes +{ + internal class FirstRequestConfig : ManualConfig + { + public FirstRequestConfig() + { + Add(ConsoleLogger.Default); + Add(MarkdownExporter.GitHub); + + Add(MemoryDiagnoser.Default); + Add(StatisticColumn.OperationsPerSecond); + Add(DefaultColumnProviders.Instance); + + Add(JitOptimizationsValidator.FailOnError); + + Add(Job.Core + .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp21)) + .With(new GcMode { Server = true }) + .WithTargetCount(10) + .WithInvocationCount(1) + .WithUnrollFactor(1) + .With(RunStrategy.ColdStart)); + } + } +} diff --git a/benchmarks/IIS.Performance/IIS.Performance.csproj b/benchmarks/IIS.Performance/IIS.Performance.csproj new file mode 100644 index 0000000000..5a29058351 --- /dev/null +++ b/benchmarks/IIS.Performance/IIS.Performance.csproj @@ -0,0 +1,31 @@ + + + + + IIS.Performance + Microsoft.AspNetCore.Server.IIS.Performance + netcoreapp2.1 + Exe + true + true + false + + + + + + + + + + False + + + + + + + + + + \ No newline at end of file diff --git a/benchmarks/IIS.Performance/StartupTimeBenchmark.cs b/benchmarks/IIS.Performance/StartupTimeBenchmark.cs new file mode 100644 index 0000000000..9797a02eba --- /dev/null +++ b/benchmarks/IIS.Performance/StartupTimeBenchmark.cs @@ -0,0 +1,53 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.IO; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Running; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing; +using Microsoft.Extensions.Logging.Abstractions; + +namespace Microsoft.AspNetCore.Server.IIS.Performance +{ + [AspNetCoreBenchmark(typeof(FirstRequestConfig))] + public class StartupTimeBenchmark + { + private IApplicationDeployer _deployer; + public HttpClient _client; + + [IterationSetup] + public void Setup() + { + var deploymentParameters = new DeploymentParameters(Path.Combine(TestPathUtilities.GetSolutionRootDirectory("IISIntegration"), "test/Websites/InProcessWebSite"), + ServerType.IISExpress, + RuntimeFlavor.CoreClr, + RuntimeArchitecture.x64) + { + ServerConfigTemplateContent = File.ReadAllText("Http.config"), + SiteName = "HttpTestSite", + TargetFramework = "netcoreapp2.1", + ApplicationType = ApplicationType.Portable, + ANCMVersion = ANCMVersion.AspNetCoreModuleV2 + }; + _deployer = ApplicationDeployerFactory.Create(deploymentParameters, NullLoggerFactory.Instance); + _client = _deployer.DeployAsync().Result.HttpClient; + } + + [IterationCleanup] + public void Cleanup() + { + _deployer.Dispose(); + } + + [Benchmark] + public async Task SendFirstRequest() + { + var response = await _client.GetAsync(""); + } + } +} diff --git a/build/dependencies.props b/build/dependencies.props index e329df4db4..ff93798e8c 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,11 +1,13 @@ - + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + 0.10.13 2.2.0-preview1-17047 2.2.0-preview1-34135 2.2.0-preview1-34135 + 2.2.0-preview1-34135 2.2.0-preview1-34135 2.2.0-preview1-34135 2.2.0-preview1-34135