Last active
December 14, 2015 21:49
-
-
Save jsullivanlive/5153411 to your computer and use it in GitHub Desktop.
Was going to deploy a rest web service on Heroku and was curious if there was a big difference between handling very simple requests between the standard ways of deploying to Heroku for Flask/wsgi/Go: Golang Requests per second: 6446.75 [#/sec] (mean)
Flask Requests per second: 1029.64 [#/sec] (mean)
gunicorn+wsgi Requests per second: 2164.54 [#…
This file contains hidden or 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
Golang Requests per second: 6446.75 [#/sec] (mean) | |
Flask Requests per second: 1029.64 [#/sec] (mean) | |
gunicorn+wsgi Requests per second: 2164.54 [#/sec] (mean) |
This file contains hidden or 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
11:10:12 ~/Code/gofyourself (master)$ ab -k -c 20 -n 10000 http://localhost:5000/ | |
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 localhost (be patient) | |
Completed 1000 requests | |
Completed 2000 requests | |
Completed 3000 requests | |
Completed 4000 requests | |
Completed 5000 requests | |
Completed 6000 requests | |
Completed 7000 requests | |
Completed 8000 requests | |
Completed 9000 requests | |
Completed 10000 requests | |
Finished 10000 requests | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 5000 | |
Document Path: / | |
Document Length: 14 bytes | |
Concurrency Level: 20 | |
Time taken for tests: 1.551 seconds | |
Complete requests: 10000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 0 | |
Total transferred: 1300000 bytes | |
HTML transferred: 140000 bytes | |
Requests per second: 6446.75 [#/sec] (mean) | |
Time per request: 3.102 [ms] (mean) | |
Time per request: 0.155 [ms] (mean, across all concurrent requests) | |
Transfer rate: 818.43 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.1 0 8 | |
Processing: 1 3 0.7 3 12 | |
Waiting: 0 3 0.7 3 12 | |
Total: 1 3 0.7 3 12 | |
Percentage of the requests served within a certain time (ms) | |
50% 3 | |
66% 3 | |
75% 3 | |
80% 3 | |
90% 4 | |
95% 4 | |
98% 4 | |
99% 5 | |
100% 12 (longest request) | |
11:10:15 ~/Code/gofyourself (master)$ ab -k -c 20 -n 10000 http://localhost:5000/ | |
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 localhost (be patient) | |
Completed 1000 requests | |
Completed 2000 requests | |
Completed 3000 requests | |
Completed 4000 requests | |
Completed 5000 requests | |
Completed 6000 requests | |
Completed 7000 requests | |
Completed 8000 requests | |
Completed 9000 requests | |
Completed 10000 requests | |
Finished 10000 requests | |
Server Software: Werkzeug/0.8.3 | |
Server Hostname: localhost | |
Server Port: 5000 | |
Document Path: / | |
Document Length: 12 bytes | |
Concurrency Level: 20 | |
Time taken for tests: 9.712 seconds | |
Complete requests: 10000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 0 | |
Total transferred: 1650000 bytes | |
HTML transferred: 120000 bytes | |
Requests per second: 1029.64 [#/sec] (mean) | |
Time per request: 19.424 [ms] (mean) | |
Time per request: 0.971 [ms] (mean, across all concurrent requests) | |
Transfer rate: 165.91 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.3 0 9 | |
Processing: 1 19 3.8 18 90 | |
Waiting: 1 19 3.8 18 90 | |
Total: 3 19 3.9 18 91 | |
Percentage of the requests served within a certain time (ms) | |
50% 18 | |
66% 19 | |
75% 20 | |
80% 21 | |
90% 23 | |
95% 25 | |
98% 29 | |
99% 34 | |
100% 91 (longest request) | |
11:17:32 ~/Code/gofyourself (master)$ | |
(.venv)11:40:05 ~/Code/gofyourself (master)$ ab -k -c 20 -n 10000 http://localhost: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 localhost (be patient) | |
Completed 1000 requests | |
Completed 2000 requests | |
Completed 3000 requests | |
Completed 4000 requests | |
Completed 5000 requests | |
Completed 6000 requests | |
Completed 7000 requests | |
Completed 8000 requests | |
Completed 9000 requests | |
Completed 10000 requests | |
Finished 10000 requests | |
Server Software: gunicorn/0.17.2 | |
Server Hostname: localhost | |
Server Port: 8000 | |
Document Path: / | |
Document Length: 12 bytes | |
Concurrency Level: 20 | |
Time taken for tests: 4.620 seconds | |
Complete requests: 10000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 0 | |
Total transferred: 1380828 bytes | |
HTML transferred: 120072 bytes | |
Requests per second: 2164.54 [#/sec] (mean) | |
Time per request: 9.240 [ms] (mean) | |
Time per request: 0.462 [ms] (mean, across all concurrent requests) | |
Transfer rate: 291.88 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 1 1.0 1 27 | |
Processing: 1 8 26.3 6 474 | |
Waiting: 0 7 20.9 5 474 | |
Total: 1 9 26.3 6 475 | |
Percentage of the requests served within a certain time (ms) | |
50% 6 | |
66% 7 | |
75% 8 | |
80% 8 | |
90% 10 | |
95% 12 | |
98% 25 | |
99% 37 | |
100% 475 (longest request) | |
(.venv)11:40:29 ~/Code/gofyourself (master)$ |
This file contains hidden or 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
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello World!' | |
if __name__ == '__main__': | |
app.run() |
This file contains hidden or 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" | |
"os" | |
) | |
func main() { | |
http.HandleFunc("/", hello) | |
fmt.Println("listening...") | |
err := http.ListenAndServe(":"+os.Getenv("PORT"), nil) | |
if err != nil { | |
panic(err) | |
} | |
} | |
func hello(res http.ResponseWriter, req *http.Request) { | |
fmt.Fprintln(res, "hello, world.") | |
} |
This file contains hidden or 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
# gunicorn -w10 --keep-alive 60 wsgi-app | |
def application(environ, start_response): | |
start_response("200 OK", [("Content-type", "text/plain")]) | |
return [ "Hello World!" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment