python常用web框架简单性能测试结果分享(包含django、flask、bottle、tornado)
这篇文章主要介绍了python常用web框架简单性能测试结果分享(包含django、flask、bottle、tornado),需要的朋友可以参考下
测了一下django、flask、bottle、tornado 框架本身最简单的性能。对django的性能完全无语了。
django、flask、bottle 均使用gunicorn+gevent启动,单进程,并且关闭DEBUG,请求均只返回一个字符串ok。
tornado直接自己启动,其他内容一致。
测试软件为 siege,测试os为cenos6 64位,测试命令为:
复制代码 代码如下:
siege -c 100 -r 100 -b http://127.0.0.1:5000/
django测试结果为:
复制代码 代码如下:
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 18.51 secs
Data transferred: 0.02 MB
Response time: 0.18 secs
Transaction rate: 540.25 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 99.35
Successful transactions: 10000
Failed transactions: 0
Longest transaction: 0.30
Shortest transaction: 0.12
django(去掉所有middleware)测试结果为:
复制代码 代码如下:
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 12.97 secs
Data transferred: 0.02 MB
Response time: 0.13 secs
Transaction rate: 771.01 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 99.41
Successful transactions: 10000
Failed transactions: 0
Longest transaction: 0.28
Shortest transaction: 0.12
flask测试结果为:
复制代码 代码如下:
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 5.47 secs
Data transferred: 0.02 MB
Response time: 0.05 secs
Transaction rate: 1828.15 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 96.25
Successful transactions: 10000
Failed transactions: 0
Longest transaction: 0.11
Shortest transaction: 0.00
bottle测试结果为:
复制代码 代码如下:
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 4.55 secs
Data transferred: 0.02 MB
Response time: 0.04 secs
Transaction rate: 2197.80 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 96.81
Successful transactions: 10000
Failed transactions: 0
Longest transaction: 0.09
Shortest transaction: 0.00
tornado测试结果为:
复制代码 代码如下:
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 7.06 secs
Data transferred: 0.02 MB
Response time: 0.07 secs
Transaction rate: 1416.43 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 99.51
Successful transactions: 10000
Failed transactions: 0
Longest transaction: 0.09
Shortest transaction: 0.01
可见纯框架自身的性能为:
复制代码 代码如下:
bottle > flask > tornado > django
结合实际使用:
精彩图集
精彩文章