Skip to content

Instantly share code, notes, and snippets.

@tebeka
Created January 9, 2020 10:51
Show Gist options
  • Save tebeka/6fa627fac1a9751e99499e9421584428 to your computer and use it in GitHub Desktop.
Save tebeka/6fa627fac1a9751e99499e9421584428 to your computer and use it in GitHub Desktop.
Testing gunicorn + genvent
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)
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