All Projects → smallnest → Go Web Framework Benchmark

smallnest / Go Web Framework Benchmark

Licence: apache-2.0
⚡ Go web framework benchmark

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Gnuplot
187 projects
rust
11053 projects
Dockerfile
14818 projects
awk
318 projects
lua
6591 projects

Projects that are alternatives of or similar to Go Web Framework Benchmark

benchmark-http
No description or website provided.
Stars: ✭ 15 (-99.06%)
Mutual labels:  benchmark, concurrency
Kaggle Dogs Vs Cats Caffe
Kaggle dogs vs cats solution in Caffe
Stars: ✭ 105 (-93.44%)
Mutual labels:  benchmark
Gym Electric Motor
Gym Electric Motor (GEM): An OpenAI Gym Environment for Electric Motors
Stars: ✭ 95 (-94.07%)
Mutual labels:  benchmark
Evo
Python package for the evaluation of odometry and SLAM
Stars: ✭ 1,373 (-14.24%)
Mutual labels:  benchmark
Job
JOB, make your short-term command as a long-term job. 将命令行规划成任务的工具
Stars: ✭ 98 (-93.88%)
Mutual labels:  concurrency
Single Image Deraining
Single Image Deraining: A Comprehensive Benchmark Analysis
Stars: ✭ 102 (-93.63%)
Mutual labels:  benchmark
Swimmer
🏊 Swimmer - An async task pooling and throttling utility for JS
Stars: ✭ 94 (-94.13%)
Mutual labels:  concurrency
Factory bot instruments
Instruments for benchmarking, tracing, and debugging Factory Girl models.
Stars: ✭ 108 (-93.25%)
Mutual labels:  benchmark
Bouncer
Bouncer is a network TCP port redirector/forward proxy (like rinetd) with extra features like Reverse tunneling (like ssh -R), SSL tunneling (like stunnel), connection Failover, LoadBalancing and Clustering. In pure Java (BIO)
Stars: ✭ 103 (-93.57%)
Mutual labels:  mux
Yar
Light, concurrent RPC framework for PHP & C
Stars: ✭ 1,369 (-14.49%)
Mutual labels:  concurrency
Violetear
Go HTTP router
Stars: ✭ 100 (-93.75%)
Mutual labels:  mux
Twig
Twig - less is more's web server for golang
Stars: ✭ 98 (-93.88%)
Mutual labels:  webframework
Hark Lang
Build stateful and portable serverless applications without thinking about infrastructure.
Stars: ✭ 103 (-93.57%)
Mutual labels:  concurrency
Phoronix Test Suite
The Phoronix Test Suite open-source, cross-platform automated testing/benchmarking software.
Stars: ✭ 1,339 (-16.36%)
Mutual labels:  benchmark
Warp
S3 benchmarking tool
Stars: ✭ 107 (-93.32%)
Mutual labels:  benchmark
Benchyou
benchyou is a benchmark tool for MySQL, real-time monitoring TPS and vmstat/iostat
Stars: ✭ 95 (-94.07%)
Mutual labels:  benchmark
Luna
Yet another web framework—this time in modern C++!
Stars: ✭ 99 (-93.82%)
Mutual labels:  webframework
Tastylib
C++ implementations of data structures, algorithms, and system designs.
Stars: ✭ 101 (-93.69%)
Mutual labels:  benchmark
Benchexec
BenchExec: A Framework for Reliable Benchmarking and Resource Measurement
Stars: ✭ 108 (-93.25%)
Mutual labels:  benchmark
Easyiterator
🏃 Iterators made easy! Zero cost abstractions for designing and using C++ iterators.
Stars: ✭ 107 (-93.32%)
Mutual labels:  benchmark

go-web-framework-benchmark

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: QEMU Virtual CPU version(1.8GHZ, 8 cores)
  • Memory: 16G
  • Go: go1.16.3 linux/amd64
  • OS: CentOS Linux release 7.5.1804 (Core)

Tested web frameworks (in alphabetical order)

Only test those webframeworks which are stable

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:

api.Get("/rest/hello", func(c *XXXXX.Context) {
	sleepTime := strconv.Atoi(os.Args[1]) //10ms
	if sleepTime > 0 {
		time.Sleep(time.Duration(sleepTime) * time.Millisecond)
	}

	c.Text("Hello world")
})

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.

The 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.

Benchmark (Round 3) the concurrency clients are 5000.

Latency (Round 3) Latency is the time of real processing time by web servers. The smaller is the better.

Allocs (Round 3) 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:

benchmark pipelining (Round 2)

Concurrency Test

In 30 ms processing time, the test result for 100, 1000, 5000 clients is:

concurrency (Round 3)

Latency (Round 3)

Latency (Round 3)

If we enable http pipelining, test result as below:

concurrency pipelining(Round 2)

cpu-bound case Test

cpu-bound (5000 concurrency)

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 *.go
./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:
……
web_frameworks=( "default" "ace" "beego" "bone" "denco" "echov1" "echov2standard" "echov2fasthttp" "fasthttp-raw" "fasthttprouter" "fasthttp-routing" "gin" "gocraftWeb" "goji" "gojiv2" "gojsonrest" "gorestful" "gorilla" "httprouter" "httptreemux" "lars" "lion" "macaron" "martini" "pat" "r2router" "tango" "tiger" "traffic" "violetear" "vulcan")
……
  • If you want to test all cases, you can run:
./test-all.sh

Plot

you can run the shell script plot.sh in testresults directory and it can generate all images in its parent directory.

Add new web framework

Welcome to add new Go web frameworks. You can follow the below steps and send me a pull request.

  1. add your web framework link in README
  2. add a hello implementation in server.go
  3. add your webframework in libs.sh

Please add your web framework alphabetically.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].