flask 四种wsgi方式对比(tornado,Gunicorn,Twisted,Gevent)
2014-12-15 14:48
429 查看
使用工具:siege
代码结构:
hello.py
templates
|--hello.html
hello.py代码:
hello.html代码:
flask
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13579/3344
结果:
gunicorn
命令:gunicorn -w 1 -b 127.0.0.1:13578 hello_gunicorn:app
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13578/3344
结果:
tornado
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13577/3344
结果:
gevent
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13576/3344
结果:
twisted
命令:twistd -n web --port 13575 --wsgi hello_twised.app
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13575/3344
结果:
代码结构:
hello.py
templates
|--hello.html
hello.py代码:
from flask import Flask, render_template app = Flask(__name__) @app.route('/') @app.route('/<name>') def index(name=None): return render_template('hello.html',name=name) if __name__ == '__main__': app.run(host='0.0.0.0',port=13579, debug=False)
hello.html代码:
from Flask</title> {% if name %} <h1>Hello {{ name }}!</h1> {% else %} <h1>Hello World!</h1> {% endif %}
flask
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13579/3344
结果:
Transactions: 29511 hits Availability: 95.08 % Elapsed time: 254.69 secs Data transferred: 1.15 MB Response time: 1.16 secs Transaction rate: 115.87 trans/sec Throughput: 0.00 MB/sec Concurrency: 134.19 Successful transactions: 29511 Failed transactions: 1527 Longest transaction: 88.56 Shortest transaction: 0.00
gunicorn
命令:gunicorn -w 1 -b 127.0.0.1:13578 hello_gunicorn:app
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13578/3344
结果:
Transactions: 57354 hits Availability: 96.91 % Elapsed time: 188.50 secs Data transferred: 2.24 MB Response time: 0.41 secs Transaction rate: 304.27 trans/sec Throughput: 0.01 MB/sec Concurrency: 124.78 Successful transactions: 57354 Failed transactions: 1831 Longest transaction: 85.62 Shortest transaction: 0.00
tornado
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13577/3344
结果:
Transactions: 217509 hits Availability: 99.42 % Elapsed time: 205.48 secs Data transferred: 8.50 MB Response time: 0.34 secs Transaction rate: 1058.54 trans/sec Throughput: 0.04 MB/sec Concurrency: 356.45 Successful transactions: 217509 Failed transactions: 1266 Longest transaction: 89.39 Shortest transaction: 0.03
gevent
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13576/3344
结果:
Transactions: 999952 hits Availability: 100.00 % Elapsed time: 509.62 secs Data transferred: 39.10 MB Response time: 0.48 secs Transaction rate: 1962.15 trans/sec Throughput: 0.08 MB/sec Concurrency: 935.08 Successful transactions: 999952 Failed transactions: 48 Longest transaction: 63.23 Shortest transaction: 0.02
twisted
命令:twistd -n web --port 13575 --wsgi hello_twised.app
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13575/3344
结果:
Transactions: 155276 hits Availability: 99.14 % Elapsed time: 321.25 secs Data transferred: 6.07 MB Response time: 0.77 secs Transaction rate: 483.35 trans/sec Throughput: 0.02 MB/sec Concurrency: 371.09 Successful transactions: 155276 Failed transactions: 1340 Longest transaction: 83.32 Shortest transaction: 0.04
相关文章推荐
- 对比Tornado和Twisted两种异步Python框架
- XML文件四种解析方式对比
- java 四种方式实现字符流文件的拷贝对比
- Python高效开发实战——Django、Tornado、Flask、Twisted
- Python高效开发实战(web)——Django、Tornado、Flask、Twisted
- 横向对比分析Python解析XML的四种方式
- 对比Tornado和Twisted
- 四种读入方式的效率对比
- Flask+Gunicorn+Gevent+Supervisor+Nginx生产环境部署
- c#List<T>四种查询方式的效率对比
- Java:io流写入文件的四种实现方式的效率对比
- 对比Tornado和Twisted
- CentOS 6.5 Python 2.6.6+Flask 用wsgi方式部署在Apache 2.2.15下
- flask+gevent+gunicorn+nginx 初试
- python web一锅烩(flask,gunicom,gevent,tornado)
- gevent和twisted对比
- Java并发学习之四种线程创建方式的实现与对比
- Android 四种阴影实现方式对比
- 用gunicorn+gevent启动Flask项目
- XML四种解析方式优缺点对比