This is a creation in Article, where the information may have evolved or changed.
Who is the fastest go Web framework? This is a review of the Go Web framework I released last year. Now a year has passed, some frameworks have been abandoned because of lack of maintenance, and new wheels have been created, the existing wheels are constantly evolving, the go version has been upgraded to 1.8. Before the youth festival, Kirilldanshin a issue, hoping to update the latest test results, and now this article records the latest test results.
Test environment
- Cpu:intel (R) Xeon (r) CPU e5-2630 v3 @ 2.40GHz, cores
- memory:32g
- go:1.8.0
- Os:centos 7/3.10.0-229.el7.x86_64
All of the benchmark web frameworks have been updated to the latest version of 2017-04-01.
Description
Julien Schmidt Implementation of the Go-http-routing-benchmark is a review of router, but as a complete web framework, from receiving user requests to send to the client/browser, the middle of the process through a number of components, How big is the performance impact of router in the overall Web request processing? Look at the test results.
The code for this project is in Go-web-framework-benchmark, you can view it, and you are welcome to pull request.
There is a problem with the Gear test code in the test, and without the router middleware, you can ignore its benchmark in this test. See # 33
Simulate the performance of different processing time frames for a business
Compare the performance of each Web framework under different processing times using 5,000 client impersonation requests.
1, 0ms
0msSimulate the ideal business process. In this processing time, each request basically consumes less than 1 milliseconds of processing time, which is an ideal extreme situation, such as accessing an in-memory cached object to return.
2, 10ms
10msSimulate a better business process. In this case, the server only needs to process the request in very short cases (10ms), and if the business is not too complex and does not have access to a local disk, database, or other remote service, it is more consistent with this test.
3, 100ms
100msSimulates a general business process. When a request is received, it may be possible to access files, databases, or one or more remote services on the local disk, in which case it may take less time to complete a request.
Pipelining
This test simulates the performance of the web framework in pipelining scenarios.
HTTP pipelining (http pipelining) is the technique of submitting multiple HTTP requests (request) batches, without waiting for a response from the server before sending.
The request results pipeline makes the HTML page load time dynamically improved, especially in the connection environment with high latency, such as satellite Internet. In a broadband connection, acceleration is not so significant because the server-side application http/1.1 protocol is required: the server side must restore the request in the order requested by the client, so that the entire connection is first-in-one, and the HOL blocking may occur, causing delays. Future asynchronous operations in http/2.0 or spdy will solve this problem. Because it may populate multiple HTTP requests within a TCP packet, HTTP pipelining requires fewer TCP packets to be transmitted over the network, reducing Network load.
is a performance comparison chart that uses 5000 of clients to test different processing times.
Concurrent
The following set of tests is the 30ms throughput of 100, 1000, and 5000 concurrent clients, in cases where the business processing time is limited.
1, 100 concurrency
2, 1000 concurrency
3, 5000 concurrency
Summarize
The Go web framework is now very much, and there are always man-made wheels, which is about the easy extension of the go web design. If I feel that the official route is inconvenient, I can easily recreate a wheel, which is why the Go Web framework/router so much that someone is calling for the wheel to stop early.
From the present existing Web framework, according to the framework of the low-level view, can be divided into two categories. One is based on the official net/http Standard library Development of the web framework, a class is based on fasthttp the development of the standard library framework. Obviously based on fasthttp better performance, but this kind of framework also has their shortcomings, do not fully support the HTTP protocol, such as unsupported HEAD , do not support HTTP2, each has advantages and disadvantages, how to choose to the user, combined with their actual situation to choose. The echo framework, for example, removes the right support from the latest version fasthttp .
In addition, Julienschmidt's httprouter has good performance, which is why a number of web framework routers use it.
Why isn't there a high level of attention iris? This is a complex and controversial issue, referring to issue #29, issue #16, temporarily removed Iris.
The test code and the latest results are all in Go-web-framework-benchmark