smallnest/go-web-framework-benchmark — dự án mã nguồn mở — đang có 2.1k sao GitHub. :zap: Go web framework benchmark
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
This benchmark suite aims to compare the performance of Go web frameworks. It is inspired by Go HTTP Router Benchmark but this benchmark suite is different with that. Go HTTP Router Benchmark suit aims to compare the performance of routers but this Benchmark suit aims to compare whole HTTP request processing.
Last Test Updated: 2020-05
test environment
CPU: KVM Virtual CPU version(2 GHz, 4 cores)
Memory: 16G
Go: go1.18.5 linux/amd64
OS: Ubuntu 22.04.1 LTS with Kernel 5.15.0-41-generic
Tested web frameworks (in alphabetical order)
Only test those webframeworks which are stable
atreugo
baa
beego
bone
chi
clevergo
default http
denco
don
echo
fasthttp-routing
fasthttp/router
fasthttp
fiber
gear
gearbox
gem
gin
goframe
go-ozzo
go-restful
go-tigertonic
goji
goji
golf
gorilla
gorouter
goyave
httprouter
httptreemux
httpz
indigo
lars
lion
macaron
muxie
negroni
pat
pulse
pure
r2router
tango
tinyrouter
treemux
violetear
vulcan
webgo
some libs have not been maintained and the test code has removed them
Motivation
When I investigated performance of Go web frameworks, I found Go HTTP Router Benchmark, created by Julien Schmidt. He also developed a high performance http router: httprouter. I had thought I got the performance result until I created a piece of codes to mock the real business logics:
When I use the above codes to test those web frameworks, the token time of route selection is not so important in the whole http request processing, although performance of route selection of web frameworks are very different.
So I create this project to compare performance of web frameworks including connection, route selection, handler processing. It mocks business logics and can set a special processing time.
Then you can get some interesting results if you use it to test.
Implementation
When you test a web framework, this test suit will starts a simple http server implemented by this web framework. It is a real http server and only contains GET url: "/hello".
When this server processes this url, it will sleep n milliseconds in this handler. It mocks the business logics such as:
read data from sockets
write data to disk
access databases
access cache servers
invoke other microservices
……
It contains a test.sh that can do those tests automatically.
It uses wrk to test.
Basic Test
The first test case is to mock 0 ms, 10 ms, 100 ms, 500 ms processing time in handlers.
the concurrency clients are 5000.
Latency is the time of real processing time by web servers. The smaller is the better.
Allocs is the heap allocations by web servers when test is running. The unit is MB. The smaller is the better.
If we enable http pipelining, test result as below:
Concurrency Test
In 30 ms processing time, the test result for 100, 1000, 5000 clients is:
If we enable http pipelining, test result as below:
cpu-bound case Test
Usage
You should install this package first if you want to run this test.
go get github.com/smallnest/go-web-framework-benchmark
It takes a while to install a large number of dependencies that need to be downloaded. Once that command completes, you can run:
cd $GOPATH/src/github.com/smallnest/go-web-framework-benchmark
go build -o gowebbenchmark .
./test.sh
It will generate test results in processtime.csv and concurrency.csv. You can modify test.sh to execute your customized test cases.
If you also want to generate latency data and allocation data, you can run the script:
./test-latency.sh
If you don't want use keepalive, you can run:
./test-latency-nonkeepalive.sh
If you want to test http pipelining, you can run:
./test-pipelining.sh
If you want to test some of web frameworks, you can modify the test script and only keep your selected web frameworks:
NOTE: comparing 2 webframeworks consumes approx. 11-13 minutes (doesn't depend on the machine). Just test.sh with all
the webframeworks enabled will take a couple of hours to run.
Plot
All the graphs are generated automatically as the ./test.sh finishes. However, if the run was interrupted, you can
generate them manually of partial data by executing plot.sh in testresults directory.
Interactive HTML charts
In addition to the static PNGs, an interactive HTML view is generated from the same CSV data — no gnuplot required to
view it. It lets you hover for exact per-framework values, toggle frameworks via the legend, and switch between bar and
line charts, which makes crowded results much easier to read.
Open testresults/index.html in a browser, or regenerate it after a run:
cd testresults
go run ./genhtml
plot.sh / plot_mac.sh already invoke it as their last step, so it stays in sync with the PNGs.
Add new web framework
Welcome to add new Go web frameworks. You can follow the below steps and send me a pull request.
Đọc thêm về smallnest/go-web-framework-benchmark ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/smallnest/go-web-framework-benchmark là nguồn chính thức.
smallnest/go-web-framework-benchmark có phải mã nguồn mở không?
Có — smallnest/go-web-framework-benchmark phát hành theo license Apache-2.0, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/smallnest/go-web-framework-benchmark.
smallnest/go-web-framework-benchmark có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho smallnest/go-web-framework-benchmark. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
smallnest/go-web-framework-benchmark dùng license gì?
smallnest/go-web-framework-benchmark phát hành theo license Apache-2.0. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
smallnest/go-web-framework-benchmark là gì?
smallnest/go-web-framework-benchmark (smallnest/go-web-framework-benchmark) là dự án Go trên GitHub. Theo mô tả gốc: :zap: Go web framework benchmark
Đọc đầy đủ README ở tab phía trên.
Chưa chắc go-web-framework-benchmark có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về go-web-framework-benchmark.