Created
January 9, 2020 10:51
-
-
Save tebeka/6fa627fac1a9751e99499e9421584428 to your computer and use it in GitHub Desktop.
Testing gunicorn + genvent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
from flask import Flask | |
app = Flask(__name__) | |
counter = 0 | |
@app.route('/count') | |
def count(): | |
global counter | |
counter += 1 | |
return {'count': counter} | |
@app.route('/pause/<int:seconds>') | |
def pause(seconds): | |
sleep(seconds) | |
return {'count': counter} | |
if __name__ == '__main__': | |
app.run(port=8080) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gunicorn \ | |
--bind=0.0.0.0:8080 \ | |
--worker-class gevent \ | |
httpd:app& | |
curl http://localhost:8080/pause/100& | |
for i in $(seq 10); do curl http://localhost:8080/count&; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment