Last active
August 11, 2016 13:15
-
-
Save shibacow/058064da90b87fa7853740d7024b744e to your computer and use it in GitHub Desktop.
compare golang web framework echo and python flask
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 ( | |
"net/http" | |
"github.com/labstack/echo" | |
"github.com/labstack/echo/engine/standard" | |
) | |
func main() { | |
e := echo.New() | |
e.GET("/", func(c echo.Context) error { | |
return c.String(http.StatusOK, "Hello, World!") | |
}) | |
e.Run(standard.New(":1323")) | |
} |
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
benchmark result | |
shibacow@ubuntu:~/prog/golang/echo_test$ ab -n 100000 -c 100 http://localhost:1323/ | |
This is ApacheBench, Version 2.3 <$Revision: 1706008 $> | |
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 10000 requests | |
... | |
Completed 100000 requests | |
Finished 100000 requests | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 1323 | |
Document Path: / | |
Document Length: 13 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 9.525 seconds | |
Complete requests: 100000 | |
Failed requests: 0 | |
Total transferred: 13000000 bytes | |
HTML transferred: 1300000 bytes | |
Requests per second: 10498.93 [#/sec] (mean) | |
Time per request: 9.525 [ms] (mean) | |
Time per request: 0.095 [ms] (mean, across all concurrent requests) | |
Transfer rate: 1332.87 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 3 2.8 2 19 | |
Processing: 0 6 3.2 7 31 | |
Waiting: 0 5 2.5 4 26 | |
Total: 0 9 4.1 9 33 | |
Percentage of the requests served within a certain time (ms) | |
50% 9 | |
66% 11 | |
75% 12 | |
80% 13 | |
90% 15 | |
95% 17 | |
98% 18 | |
99% 19 | |
100% 33 (longest request) |
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
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def hello(): | |
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
benchmark result | |
shibacow@ubuntu:~/prog/golang/echo_test$ ab -n 100000 -c 100 http://localhost:1323/ | |
This is ApacheBench, Version 2.3 <$Revision: 1706008 $> | |
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 10000 requests | |
...... | |
Completed 100000 requests | |
Finished 100000 requests | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 1323 | |
Concurrency Level: 100 [51/502] | |
Time taken for tests: 67.849 seconds | |
Complete requests: 100000 | |
Failed requests: 0 | |
Total transferred: 16700000 bytes | |
HTML transferred: 1200000 bytes | |
Requests per second: 1473.87 [#/sec] (mean) | |
Time per request: 67.849 [ms] (mean) | |
Time per request: 0.678 [ms] (mean, across all concurrent requests) | |
Transfer rate: 240.37 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.2 0 8 | |
Processing: 3 68 5.7 66 118 | |
Waiting: 1 68 5.6 65 118 | |
Total: 9 68 5.6 66 118 | |
Percentage of the requests served within a certain time (ms) | |
50% 66 | |
66% 68 | |
75% 70 | |
80% 71 | |
90% 75 | |
95% 80 | |
98% 84 | |
99% 87 | |
100% 118 (longest request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment