Skip to content

Instantly share code, notes, and snippets.

@pkieltyka
Created January 8, 2017 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkieltyka/713e88b401c17e4f964a925426adac43 to your computer and use it in GitHub Desktop.
Save pkieltyka/713e88b401c17e4f964a925426adac43 to your computer and use it in GitHub Desktop.
// bare-bones chi hello world
package main
import (
"net/http"
"github.com/pressly/chi"
)
func main() {
r := chi.NewRouter()
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("hello world"))
})
http.ListenAndServe(":3333", r)
}
/*
[peter@pak ~]$ wrk -c 20 -t 20 -d 10 http://localhost:3333/
Running 10s test @ http://localhost:3333/
20 threads and 20 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 261.61us 38.20us 2.10ms 85.07%
Req/Sec 3.81k 173.33 4.22k 66.29%
765217 requests in 10.10s, 93.41MB read
Requests/sec: 75767.50
Transfer/sec: 9.25MB
*/
// bare-bones gin hello world
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.New()
r.GET("/", func(c *gin.Context) {
c.Writer.Write([]byte("hello world"))
})
r.Run() // listen and serve on 0.0.0.0:8080
}
/*
[peter@pak ~]$ wrk -c 20 -t 20 -d 10 http://localhost:8080
Running 10s test @ http://localhost:8080
20 threads and 20 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 2.03ms 13.22ms 152.03ms 97.88%
Req/Sec 3.71k 540.10 8.45k 96.12%
734326 requests in 10.00s, 89.64MB read
Requests/sec: 73402.15
Transfer/sec: 8.96MB
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment