废话不多说,直接开干!
硬件配置
- 处理器: Intel(R) Core(TM) i5-4690k CPU @3.90GHz
- 内存容量: 8.00 GB
软件版本
- OS: Microsoft Windows 10
- HTTP 跑分工具: https://github.com/codesenberg/bombardier, 最新版本 1.2
- .NET Core SDK: https://www.microsoft.com/net/core, 最新版本 2.1.302
- iris: https://github.com/kataras/iris, 最新版本 使用 go1.10.3-windows/amd64 编译
比试选手
- iris (The fastest backend community-driven web framework on (THIS) Earth. https://github.com/kataras/iris) [使用命令go build mian.go;.\main.exe]
- aspnetcore(.NET下面的一个普通web框架 https://github.com/aspnet/Home)[使用命令dotnet publish -c Release;dotnet netcore.dll]
- aspnetcore-tieredcompilation(使用tieredcompilation进行编译,具体可看 https://blogs.msdn.microsoft.com/dotnet/2018/08/02/tiered-compilation-preview-in-net-core-2-1/)[使用命令dotnet publish -c Release;dotnet netcore.dll]
比试内容
- PlainText(路由加普通文本返回)
- MVC(mvc加普通文本返回)
比试场景
- 100连接,100,000次请求;
- 1000连接,100,000次请求。
胜负评定
- Reqs/sec - 越大越好。
- Latency - 越小越好。
- Throughput - 越大越好。
比试结果
PlainText(100连接):
PlainText(1000连接):
MVC(100连接):
MVC(1000连接):
PS:看来asp.net core不是社区驱动的web框架啊,tieredcompilation对性能的提升还是挺明显的,不过现在还是preview版本,可能正式版的性能提升会更大。另外觉得测试有问题的或者不合理欢迎评论区留言。
附录:
PlainText(100连接):
iris:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 100 connection(s)
1000000 / 1000000 [=======================================================================================] 100.00% 9s
Done!
Statistics Avg Stdev Max
Reqs/sec 100890.93 14603.97 117701.58
Latency 0.99ms 106.80us 31.98ms
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 18.76MB/s
aspnetcore:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 100 connection(s)
1000000 / 1000000 [=======================================================================================] 100.00% 8s
Done!
Statistics Avg Stdev Max
Reqs/sec 115900.67 10720.26 125724.81
Latency 0.86ms 109.38us 76.96ms
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 20.99MB/s
aspnetcore-tieredcompilation:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 100 connection(s)
1000000 / 1000000 [=======================================================================================] 100.00% 8s
Done!
Statistics Avg Stdev Max
Reqs/sec 124023.27 13668.23 144797.03
Latency 805.52us 178.97us 67.96ms
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 22.45MB/s
PlainText(1000连接):
iris:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 1000 connection(s)
1000000 / 1000000 [======================================================================================] 100.00% 13s
Done!
Statistics Avg Stdev Max
Reqs/sec 78192.20 37748.20 249899.94
Latency 13.49ms 17.04ms 1.51s
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 13.77MB/s
aspnetcore:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 1000 connection(s)
1000000 / 1000000 [======================================================================================] 100.00% 12s
Done!
Statistics Avg Stdev Max
Reqs/sec 78938.95 18707.34 193173.86
Latency 12.30ms 2.12ms 558.68ms
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 14.72MB/s
aspnetcore-tieredcompilation:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 1000 connection(s)
1000000 / 1000000 [======================================================================================] 100.00% 11s
Done!
Statistics Avg Stdev Max
Reqs/sec 85556.97 16972.96 129806.89
Latency 11.83ms 2.55ms 565.68ms
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 15.30MB/s
MVC(100连接):
iris:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 100 connection(s)
1000000 / 1000000 [======================================================================================] 100.00% 12s
Done!
Statistics Avg Stdev Max
Reqs/sec 83268.90 6405.62 93735.08
Latency 1.20ms 129.24us 37.98ms
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 15.49MB/s
aspnetcore:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 100 connection(s)
1000000 / 1000000 [======================================================================================] 100.00% 15s
Done!
Statistics Avg Stdev Max
Reqs/sec 64032.32 5136.30 73209.37
Latency 1.56ms 243.37us 142.92ms
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 14.09MB/s
aspnetcore-tieredcompilation:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 100 connection(s)
1000000 / 1000000 [======================================================================================] 100.00% 12s
Done!
Statistics Avg Stdev Max
Reqs/sec 79460.11 11395.25 98716.02
Latency 1.26ms 307.25us 139.92ms
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 17.48MB/s
MVC(1000连接):
iris:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 1000 connection(s)
1000000 / 1000000 [======================================================================================] 100.00% 16s
Done!
Statistics Avg Stdev Max
Reqs/sec 64706.80 34030.38 256487.23
Latency 16.16ms 13.56ms 1.65s
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 11.50MB/s
aspnetcore:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 1000 connection(s)
1000000 / 1000000 [======================================================================================] 100.00% 19s
Done!
Statistics Avg Stdev Max
Reqs/sec 50314.60 21544.11 200875.55
Latency 19.14ms 3.18ms 571.67ms
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 11.51MB/s
aspnetcore-tieredcompilation:
Bombarding http://localhost:5000/api/values/1 with 1000000 request(s) using 1000 connection(s)
1000000 / 1000000 [======================================================================================] 100.00% 15s
Done!
Statistics Avg Stdev Max
Reqs/sec 62695.73 22662.30 268026.80
Latency 15.70ms 2.37ms 566.67ms
HTTP codes:
1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 14.02MB/s