Skip to content

Instantly share code, notes, and snippets.

@xen
Created August 20, 2013 13:57
Show Gist options
  • Save xen/6281806 to your computer and use it in GitHub Desktop.
Save xen/6281806 to your computer and use it in GitHub Desktop.
Useless go vs python http speed comparsion
$ ab -q -c 50 -n 10000 http://127.0.0.1:8080/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient).....done
Server Software:
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 2 bytes
Concurrency Level: 50
Time taken for tests: 3.727 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1370000 bytes
HTML transferred: 20000 bytes
Requests per second: 2682.84 [#/sec] (mean)
Time per request: 18.637 [ms] (mean)
Time per request: 0.373 [ms] (mean, across all concurrent requests)
Transfer rate: 358.93 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 9 2.7 9 19
Processing: 4 9 2.6 9 20
Waiting: 3 9 2.6 9 20
Total: 7 18 4.8 18 35
Percentage of the requests served within a certain time (ms)
50% 18
66% 21
75% 22
80% 23
90% 24
95% 27
98% 29
99% 30
100% 35 (longest request)
$ ab -q -c 50 -n 10000 http://127.0.0.1:8000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient).....done
Server Software: TornadoServer/3.1
Server Hostname: 127.0.0.1
Server Port: 8000
Document Path: /
Document Length: 2 bytes
Concurrency Level: 50
Time taken for tests: 6.964 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1940194 bytes
HTML transferred: 20002 bytes
Requests per second: 1436.01 [#/sec] (mean)
Time per request: 34.819 [ms] (mean)
Time per request: 0.696 [ms] (mean, across all concurrent requests)
Transfer rate: 272.08 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 13 6.8 12 49
Processing: 2 22 9.9 20 92
Waiting: 1 18 8.9 17 86
Total: 7 34 13.3 33 103
Percentage of the requests served within a certain time (ms)
50% 33
66% 38
75% 43
80% 45
90% 50
95% 57
98% 69
99% 79
100% 103 (longest request)
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Ok")
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
import tornado.web
import tornado.httpserver
import tornado.ioloop
class Handler(tornado.web.RequestHandler):
def get(self):
self.write("Ok")
app = tornado.web.Application([
(r'/', Handler)
])
if __name__ == "__main__":
server = tornado.httpserver.HTTPServer(app)
server.bind(8000)
server.start(0)
tornado.ioloop.IOLoop.instance().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment