$ ab -k -c 10 -n 10000 http://127.0.0.1:3000/
Node
Requests per second: 10137.73 [#/sec] (mean)
Go
Requests per second: 94338.73 [#/sec] (mean)
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| ) | |
| func main() { | |
| http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | |
| w.Header().Add("Content-Type", "text/html") | |
| fmt.Fprintf(w, "<h1>Hello World</h1>") | |
| }) | |
| http.ListenAndServe(":3000", nil) | |
| } |
| const http = require("http"); | |
| const port = 3000; | |
| const server = http.createServer((request, response) => { | |
| response.writeHead(200, { | |
| "Content-Type": "text/html" | |
| }); | |
| const responseMessage = "<h1>Hello World</h1>"; | |
| response.end(responseMessage); | |
| }); | |
| server.listen(port); |