This article mainly introduces the simple performance test results of common python web frameworks (including django, flask, bottle, tornado ), for more information about the performance of django, flask, bottle, and tornado frameworks. The performance of django is completely speechless.
Django, flask, and bottle are all started using gunicorn + gevent, single process, and DEBUG disabled. only one string OK is returned for requests.
Tornado is directly started by itself, and other content is consistent.
The test software is siege, the OS is cenos6 64-bit, and the test command is:
The code is as follows:
Siege-c 100-r 100-B http: // 127.0.0.1: 5000/
Django test result:
The code is as follows:
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 (remove all middleware) test result:
The code is as follows:
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 test results:
The code is as follows:
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
The bottle test result is:
The code is as follows:
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 test results:
The code is as follows:
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
It can be seen that the performance of the pure framework itself is:
The code is as follows:
Bottle> flask> tornado> django
Combined with actual use:
Tornado uses an asynchronous driver. Therefore, when writing business code, the performance will decrease sharply if synchronization is time-consuming;
There are too many things that need to be implemented by the bottle itself, and I don't know what the performance will do after the addition;
The flask performance is a little poor, but the surrounding support is already very rich;
Django won't talk about it, and the performance can no longer be viewed. The only advantage is that the development architecture has been set up, and the development speed is much faster.
I'm worried about selecting a project recently, so I tested it and recorded it here.
PS: We re-tested centos6 with 64-bit centos6 to get a better match with the production environment, and modified the article.