In Iris Go vs .NET Core Kestrel in terms of HTTP performance, an article by @kataras, he explains how his Iris framework beats AspNetCore and also tells his story on how some of the DotNet community members insulted him because of technological disagreements. In some cases, he is right and I am sure we can have a more constructive discourse. I appreciate his work and the technology he developed.
I tried his code and yes, Iris outperforms Kestrel when it returns a short constant string (value
). In real world scenarios, we don’t do this usually. We do so many different things to prepare the response. To simulate a real-world example and a fair benchmark, I modified his example to return 1KB randomly generated string as response. On my machine (Corei7-7700K) Kestrel does the job 10+ times faster.
BTW, this result is more about runtime, memory management and compiler performance. Iris is still a lightweight framework comparing to AspNetCore and may perform better in some cases.
Bombarding http://localhost:5000/api/values/5 with 500000 requests using 125 connections
500000 / 500000 [=============================================================================================================] 100.00% 5s
Done!
Statistics Avg Stdev Max
Reqs/sec 99891.00 13123.35 111093
Latency 1.25ms 1.00ms 39.00ms
HTTP codes:
1xx - 0, 2xx - 500000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 110.60MB/s
Bombarding http://localhost:5000/api/values/5 with 500000 requests using 125 connections
500000 / 500000 [===========================================================================================================] 100.00% 1m6s
Done!
Statistics Avg Stdev Max
Reqs/sec 7501.00 199.76 9393
Latency 16.66ms 3.09ms 55.00ms
HTTP codes:
1xx - 0, 2xx - 500000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 8.31MB/s
my result of your proposed code in updated Ubuntu 16.04 within virtual machine with 2-core processor and 1GB RAM with latest C# ASP.NET Core and Go Iris:
ASP.NET Core 2.1:
1000000 / 1000000 [=============================================] 100.00% 2m18s
Done!
Statistics Avg Stdev Max
Reqs/sec 7220.33 3255.30 20041.65
Latency 17.31ms 4.86ms 210.54ms
Iris 10.6:
1000000 / 1000000 [=============================================] 100.00% 1m44s
Done!
Statistics Avg Stdev Max
Reqs/sec 9550.23 1626.76 22610.84
Latency 13.10ms 8.00ms 184.01ms
How do you reach that throughput?!