Skip to content

Commit f301844

Browse files
authored
Adding Crank AspNet Benchmark app and scenario (#6597)
1 parent f0f91f1 commit f301844

File tree

8 files changed

+177
-4
lines changed

8 files changed

+177
-4
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29613.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetBenchmark", "AspNetBenchmark\AspNetBenchmark.csproj", "{2DE749F1-E39B-4AD8-97BA-B15592999149}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{2DE749F1-E39B-4AD8-97BA-B15592999149}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{2DE749F1-E39B-4AD8-97BA-B15592999149}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{2DE749F1-E39B-4AD8-97BA-B15592999149}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{2DE749F1-E39B-4AD8-97BA-B15592999149}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {D5FBC4AA-F01A-4218-9F73-95C069391A61}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.0" />
9+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
10+
</ItemGroup>
11+
12+
13+
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
namespace AspNetBenchmark.Controllers
4+
{
5+
[Route("api/[controller]")]
6+
[ApiController]
7+
public class HelloController : ControllerBase
8+
{
9+
[HttpGet]
10+
public IActionResult Hello()
11+
{
12+
return new OkObjectResult("Hello from ASP.NET!");
13+
}
14+
}
15+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.Extensions.Configuration;
7+
using Microsoft.Extensions.Hosting;
8+
using Microsoft.Extensions.Logging;
9+
10+
namespace AspNetBenchmark
11+
{
12+
public class Program
13+
{
14+
public static void Main(string[] args)
15+
{
16+
CreateHostBuilder(args).Build().Run();
17+
}
18+
19+
public static IHostBuilder CreateHostBuilder(string[] args) =>
20+
Host.CreateDefaultBuilder(args)
21+
.ConfigureWebHostDefaults(webBuilder =>
22+
{
23+
webBuilder.UseStartup<Startup>();
24+
});
25+
}
26+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Threading.Tasks;
7+
using Microsoft.AspNetCore.Builder;
8+
using Microsoft.AspNetCore.Hosting;
9+
using Microsoft.AspNetCore.HttpsPolicy;
10+
using Microsoft.AspNetCore.Mvc;
11+
using Microsoft.Extensions.Configuration;
12+
using Microsoft.Extensions.DependencyInjection;
13+
using Microsoft.Extensions.FileProviders;
14+
using Microsoft.Extensions.Hosting;
15+
using Microsoft.Extensions.Logging;
16+
17+
namespace AspNetBenchmark
18+
{
19+
public class Startup
20+
{
21+
public Startup(IConfiguration configuration)
22+
{
23+
Configuration = configuration;
24+
}
25+
26+
public IConfiguration Configuration { get; }
27+
28+
// This method gets called by the runtime. Use this method to add services to the container.
29+
public void ConfigureServices(IServiceCollection services)
30+
{
31+
services.AddControllers();
32+
}
33+
34+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
35+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
36+
{
37+
if (env.IsDevelopment())
38+
{
39+
app.UseDeveloperExceptionPage();
40+
}
41+
42+
app.UseStaticFiles(new StaticFileOptions
43+
{
44+
FileProvider = new PhysicalFileProvider(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))
45+
});
46+
47+
app.UseStaticFiles();
48+
49+
app.UseRouting();
50+
51+
app.UseAuthorization();
52+
53+
app.UseEndpoints(endpoints =>
54+
{
55+
endpoints.MapControllers();
56+
});
57+
}
58+
}
59+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
}
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
},
9+
"AllowedHosts": "*"
10+
}

tools/Crank/benchmarks.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@ imports:
22
- https://raw.githubusercontent.com/dotnet/crank/master/src/Microsoft.Crank.Jobs.Bombardier/bombardier.yml
33

44
jobs:
5-
server:
5+
functionsServer:
66
source:
77
repository: https://github.com/Azure/azure-functions-host
88
branchOrCommit: "{{ BranchOrCommit }}"
99
project: src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj
1010
readyStateText: Application started.
11+
aspnetServer:
12+
source:
13+
repository: https://github.com/Azure/azure-functions-host
14+
branchOrCommit: "{{ BranchOrCommit }}"
15+
project: tools/Crank/BenchmarkApps/AspNetBenchmark/AspNetBenchmark/AspNetBenchmark.csproj
16+
readyStateText: Application started.
1117

1218
scenarios:
1319
http:
1420
application:
15-
job: server
21+
job: functionsServer
1622
environmentVariables:
1723
AzureWebJobsScriptRoot: "{{ FunctionAppPath }}"
1824
ASPNETCORE_URLS: "{{ AspNetUrls }}"
@@ -23,7 +29,7 @@ scenarios:
2329
duration: 180
2430
http-appsvc:
2531
application:
26-
job: server
32+
job: functionsServer
2733
environmentVariables:
2834
HOME: "{{ TempPath }}"
2935
WEBSITE_SITE_NAME: "Test"
@@ -38,7 +44,7 @@ scenarios:
3844
duration: 180
3945
http-linux-appsvc:
4046
application:
41-
job: server
47+
job: functionsServer
4248
environmentVariables:
4349
HOME: "{{ TempPath }}"
4450
WEBSITE_SITE_NAME: "Test"
@@ -52,6 +58,16 @@ scenarios:
5258
variables:
5359
path: /api/Hello
5460
duration: 180
61+
aspnet-hello:
62+
application:
63+
job: aspnetServer
64+
environmentVariables:
65+
ASPNETCORE_URLS: "{{ AspNetUrls }}"
66+
load:
67+
job: bombardier
68+
variables:
69+
path: /api/Hello
70+
duration: 180
5571

5672
profiles:
5773
localHttps:

0 commit comments

Comments
 (0)