i have barebone flask this:
# run.py flask import flask app = flask(__name__) @app.route('/') def index(): return 'the application running'
that deployed both in development mode:
nohup flask run --host=0.0.0.0 &
and deployed in production environment using wsgi alis myflask using virtualenv, , here wsgi file:
# flask.wsgi import os import sys activate_this = '/usr/local/myflask/env/bin/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) sys.stdout = sys.stderr sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../..')) sys.path.append('/usr/local/myflask/') myflask.run import app application # /etc/apache2/conf-enabled/myflask.conf wsgiscriptalias /myflask /usr/local/myflask/wsgi/flask.wsgi wsgiscriptreloading on <directory /usr/local/myflask/wsgi> require granted </directory>
however, did benchmark using apache bench command , realized performance of apache server way worse built in development server of flask? can explain me supposed be?
here result:
# wsgi apache ab -c 100 -n 10000 http://54.175.125.11/myflask > time taken tests: 12.805 seconds # develop ab -c 100 -n 10000 http://54.175.125.11:5000/ > time taken tests: 7.779 seconds
what going on ?!