Created
April 23, 2021 22:10
-
-
Save thanoskoutr/cb32b6c2a2b23418ad45f65a6f1318a9 to your computer and use it in GitHub Desktop.
A simple flask app with two endpoints to check the multithread performance of flask.
This file contains 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 flask import Flask, request, jsonify | |
from math import sqrt | |
app = Flask(__name__) | |
def successResponse(): | |
return jsonify(success=True) | |
@app.route('/', methods=['POST', 'GET']) | |
def root(): | |
return successResponse() | |
@app.route('/fast', methods=['POST', 'GET']) | |
def fast(): | |
if request.method == 'GET': | |
return successResponse() | |
@app.route('/slow', methods=['POST', 'GET']) | |
def slow(): | |
if request.method == 'GET': | |
for i in range(0, 10000): | |
res = i ** i | |
return successResponse() | |
if __name__ == '__main__': | |
app.run(port=5000, debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment