Go vs. NET Core 2.1

Source: Internet
Author: User
Tags dotnet hosting

As the. NET Core 2.1 was officially released, the Microsoft team mentioned the performance gains in. NET Core 2.1 in the blog. This reminds me of the performance contrast between go and. NET Core 2.0, which was made by the Go language Iris MVC Framework author last year, when Iris performed at least 1 time times more than. NET core in all aspects, and the test results were a very small discussion in the community, and the Microsoft team Members of the Iris have had a cordial and friendly meeting with the authors, and have conducted in-depth discussions on the WEB framework performance tuning related aspects. Now that the. NET Core 2.1 is released, let's take a look at what is now. NET core performance.

Running points for reference only

Test Project Address: Https://github.com/zeekozhu/iris

Original address: Https://hackernoon.com/go-vs-net-core-in-terms-of-http-performance-7535a61b67b8

Hardware configuration
    • Processor: Intel (R) Core (TM) I7-4870HQ CPU @ 2.50GHz 2.50GHz
    • Memory capacity: 16.00 GB
Software version
    • Os:microsoft Windows [version number 1803 17134.48], Power Plan: "Best Performance"
    • HTTP Run-point tool: Https://github.com/codesenberg/bombardier, latest version 1.1
    • . NET Core SDK: Https://www.microsoft.com/net/core, Latest version 2.1.300
    • Iris: Https://github.com/kataras/iris, Latest version 10.6.5 compiled with GO1.10.2-WINDOWS/AMD64

This test is carried out in three rounds. In the first round of tests, the server only returned simple plain text. In the second round of tests, the server needs to respond to the rendered HTML template. In the third round of tests, the server uses the low-level API to process requests and responds to simple plain text.

Respond to simple text content

To avoid the effects of serialization and encoding for a particular format (e.g., JSON XML ), only the response speed and stability of simple text are tested in this test. To be fair, both Go and. NET Core Use the MVC pattern most commonly used in daily development.

. NET Core MVC
$ CD  netcore-mvc$ dotnet  run-c releasehosting  environment:production content  root Path:c:\mygopath\src\github.com\kataras\iris\_benchmarks\netcore-mvcnow  listening on:http://localhost:5000now  listening On:https://localhost : 5001application  started. Press CTRL + C to shut down. application  is shutting down ...  
bombardier -c 125 -n 5000000 http://localhost:5000/api/values/5Bombardingusing5000000 / 5000000 [================================================================================] 100.00% 2m16sDone!Statistics        Avg      Stdev        Max  Reqs/sec     36682.65    7344.86  125924.45  Latency        3.40ms   449.42us   254.50ms  HTTP codes:    1xx - 0, 2xx - 5000000, 3xx - 0, 4xx - 0, 5xx - 0    others - 0  Throughput:     8.09MB/s
Iris MVC
$ CD  iris-mvc$ go  run Main.gonow  listening on:http://localhost:5000 application  started. Press CTRL + C to shut down.  
bombardier -c 125 -n 5000000 http://localhost:5000/api/values/5Bombardingusing5000000 / 5000000 [================================================================================] 100.00% 1m11sDone!Statistics        Avg      Stdev        Max  Reqs/sec     70416.19   10167.84   89850.59  Latency        1.77ms    74.69us    31.50ms  HTTP codes:    1xx - 0, 2xx - 5000000, 3xx - 0, 4xx - 0, 5xx - 0    others - 0  Throughput:    13.09MB/s
Simple text Performance Test results
    • 5000000 请求time to finish-the smaller the better.
    • Reqs/sec-the bigger the better.
    • Latency-the smaller the better.
    • Throughput-the bigger the better.

The. NET Core MVC Program, which uses 2 minutes and 16 seconds to complete the test, is capable of processing on average per second:36682.65 requests with an average response delay of around 3.40ms and a maximum delay of 254.50ms.

Iris MVC Program, using 1 minutes and 11 seconds to complete the test, the average processing per second:70416.19 requests, the average response delay of about 1.77ms , the maximum delay of 31.50ms.

MVC + Templates

The next step is the MVC server-side template rendering performance test, in which the service-side program needs to process 1 million requests and respond to HTML rendered through the view engine.

. NET Core MVC with Templates
$ CD  netcore-mvc-templates$ span class= "kw" >dotnet  run-c releasehosting  environment:production Root Path:c:\mygopath\src\github.com\kataras\iris\_benchmarks\netcore-mvc-templates now  listening on:http://localhost:5000now  listening on:https:// Localhost:5001application  started. Press CTRL + C to shut down. application  is shutting down ...  
bombardier -c 125 -n 1000000 http://localhost:5000Bombardingusing1000000 / 1000000 [=================================================================================] 100.00% 1m18sDone!Statistics        Avg      Stdev        Max  Reqs/sec     13043.07    4754.11  120734.38  Latency        9.74ms     2.07ms   464.00ms  HTTP codes:    1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0    others - 0  Throughput:    92.25MB/s
Iris MVC with Templates
$ CD  iris-mvc-templates$ go  run Main.gonow  listening on:http://localhost:5000 started. Press CTRL + C to shut down.  
bombardier -c 125 -n 1000000 http://localhost:5000Bombardingusing1000000 / 1000000 [==================================================================================] 100.00% 37sDone!Statistics        Avg      Stdev        Max  Reqs/sec     26927.88    4174.31   33129.39  Latency        4.64ms   206.76us    34.00ms  HTTP codes:    1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0    others - 0  Throughput:   194.24MB/s
View Performance Test Results
    • 1000000 请求time to finish-the smaller the better.
    • Reqs/sec-the bigger the better.
    • Latency-the smaller the better.
    • Throughput-the bigger the better.

The. NET Core MVC Program, which uses 1 minutes and 18 seconds to complete the test, is capable of processing on average per second:13043.07 requests with an average response delay of around 9.74ms and a maximum delay of 464.00ms.

Iris MVC program, using 37 seconds to complete the test, the average processing per second:33129.39 requests, the average response delay of about 4.64ms , the maximum delay of 34.00ms.

Low level API simple text performance test

In this test, the service-side program needs to process 1 million requests and return a simple plain text response.. NET core no longer uses the ASP, but instead processes requests directly through Kestrel, and Iris uses the underlying handlers to process requests 。

. NET Core (Kestrel)
$ CD  netcore$ dotnet  run-c releasehosting  environment:production content  root Path:c:\mygopath\src\github.com\kataras\iris\_benchmarks\netcore now  listening on:http://localhost:5000now  listening on:https:// Localhost:5001application  started. Press CTRL + C to shut down.  
bombardier -c 125 -n 1000000 http://localhost:5000/api/values/5Bombardingusing1000000 / 1000000 [==================================================================================] 100.00% 17sDone!Statistics        Avg      Stdev        Max  Reqs/sec     55937.72    4492.32   66770.94  Latency        2.23ms   328.65us    87.00ms  HTTP codes:    1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0    others - 0  Throughput:    10.13MB/s
Iris
$ CD  iris$ go  run Main.gonow  listening on:http://localhost:5000application  started. Press CTRL + C to shut down.  
bombardier -c 125 -n 1000000 http://localhost:5000/api/values/5Bombardingusing1000000 / 1000000 [==================================================================================] 100.00% 12sDone!Statistics        Avg      Stdev        Max  Reqs/sec     80559.83    6029.77   92301.38  Latency        1.55ms   185.02us    34.50ms  HTTP codes:    1xx - 0, 2xx - 1000000, 3xx - 0, 4xx - 0, 5xx - 0    others - 0  Throughput:    14.98MB/s
Low level API Simple text performance test results
    • 1000000 请求time to finish-the smaller the better.
    • Reqs/sec-the bigger the better.
    • Latency-the smaller the better.
    • Throughput-the bigger the better.

The. NET Core MVC program, which used 17 seconds to complete the test, is capable of processing on average per second:55937.72 requests with an average response delay of around 2.23ms and a maximum delay of 87.00ms.

Iris MVC program, using 12 seconds to complete the test, the average processing per second:80559.83 requests, the average response delay of about 1.55ms , the maximum delay of 34.50ms.

Summarize

Although Microsoft mentioned in the release notes that the. NET Core 2.1 has a significant performance boost, there is not much difference in my test results from the test results that were run by the Iris author last year. If you think the test code in this article is problematic, you are welcome to point it out in the comments section.

Go vs. NET Core 2.1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.