Skip to content

Instantly share code, notes, and snippets.

@jebrial
Last active November 28, 2017 22:15
Show Gist options
  • Save jebrial/85519fef122fb26481ce886ba4795eba to your computer and use it in GitHub Desktop.
Save jebrial/85519fef122fb26481ce886ba4795eba to your computer and use it in GitHub Desktop.
Flask simple benchmark
"""
Running Flask local on osx high Sierra:
wrk -t12 -c400 -d30s http://127.0.0.1:5000Running 30s test @ http://127.0.0.1:5000
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 180.97ms 54.38ms 703.26ms 90.93%
Req/Sec 56.94 30.42 272.00 75.13%
16484 requests in 30.10s, 2.69MB read
Socket errors: connect 0, read 1520, write 25, timeout 0
Requests/sec: 547.68
Transfer/sec: 91.46KB
"""
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class HelloWorld(Resource):
def get(self):
return {'hello': 'world'}
api.add_resource(HelloWorld, '/')
if __name__ == '__main__':
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment