Reputation: 12567
I was running an arbitrary benchmark on an empty .NET Core web app today and was disappointed at how low the req/s numbers consistently were. I've seen examples online where people are getting 50-60k req/s, some as crazy as 1.15M req/s, and mine clock in between 1-2.5k.
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using System.IO;
namespace NetCore
{
public class Startup
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
}
}
Which I'm running using the release configuration, targeting netcoreapp2.1
:
dotnet publish -c release -f netcoreapp2.1
And I'm benchmarking using bombardier:
bombardier http://localhost:5000 -c 250 -d 30s
Just wondering whether I'm missing something obvious here. Or doing something wrong.
To track, I've posted an issue on GitHub.
Upvotes: 1
Views: 268
Reputation: 3431
Might have console logging at Information
level? (There are also faster forms of logging)
Try switching reducing it to Warning
off by adding a appsettings.json
file
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
}
}
Also ensure you are using Server GC; the top of your .csproj
should have .Web
at the end
<Project Sdk="Microsoft.NET.Sdk.Web">
Also you are running the published dll?
dotnet bin\release\netcoreapp2.1\publish\myapp.dll
Upvotes: 1
Reputation: 25350
Short Answer: Your CPU is i7-7500U @2.70G @2.90G
Here the letter U
in the i7-7500U
stands for Ultra Low Voltage
, which means your CPU is not that powerful even compared with a Core i4 with the letter HQ , HK , or no letter at all .
Note that those benchmarking online often use a more powerful CPU . For example , the Benchmarking here , which processes 97.9K req/sec , use a processor of Intel(R) Core(TM) i7–4710HQ CPU @ 2.50GHz 2.50GHz
.
I don't think the benchmarking matters or not . Because we'll always have different hardware, different OS , different processes running , and different networks . However , just as a example to prove that CPU does matters , I paste the bencnmarking of your code on My computer (Core(TM) i7-4900 @3.6GHz @3.6GHz ) as below :
>bombardier.exe http://localhost:5000 -c 250 -d 30s
Bombarding http://localhost:5000 for 30s using 250 connection(s)
[=================================================================================================================] 30s
Done!
Statistics Avg Stdev Max
eqs/sec 9625.47 1759.59 13165.59
Latency 25.94ms 498.77us 73.96ms
HTTP codes:
1xx - 0, 2xx - 289210, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 1.70MB/s
Upvotes: 0