Skip to content

Instantly share code, notes, and snippets.

@vangheem
Created June 11, 2019 08:15
Show Gist options
  • Save vangheem/c35cabc5da9ae1328ed5feee1894bbd2 to your computer and use it in GitHub Desktop.
Save vangheem/c35cabc5da9ae1328ed5feee1894bbd2 to your computer and use it in GitHub Desktop.
Simple CPU bound flask app
# ./bin/uwsgi --http 127.0.0.1:5000 --module cpu_bound_flask:app
from flask import Flask
import time
DURATION = 0.5
app = Flask(__name__)
@app.route('/')
def cpu_bound():
start = time.time()
while True:
9 * 9
if (time.time() - start) > DURATION:
break
return 'done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment