Last active
August 29, 2015 14:01
-
-
Save gudmundur/0513a965c1cf6b8a7327 to your computer and use it in GitHub Desktop.
Simple throughput benchmark in Go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ran this on my 2014 MBA 13" 1.7 GHz i7, 8GB Ram. | |
$ go version | |
go version go1.2.1 darwin/amd64 | |
$ go build go-web.go | |
$ GOMAXPROCS=4 ./go-web & | |
$ wrk -t10 -c400 http://localhost:8080 | |
Running 10s test @ http://localhost:8080 | |
10 threads and 400 connections | |
Thread Stats Avg Stdev Max +/- Stdev | |
Latency 4.72ms 1.33ms 47.42ms 95.49% | |
Req/Sec 5.56k 3.57k 14.00k 56.97% | |
524490 requests in 10.00s, 64.02MB read | |
Socket errors: connect 159, read 77, write 0, timeout 636 | |
Requests/sec: 52455.45 | |
Transfer/sec: 6.40MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func handler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hello world") | |
} | |
func main() { | |
http.HandleFunc("/", handler) | |
http.ListenAndServe(":8080", nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I decided to write a similar example using dynamo:
Running the above
Gave this result