Performance: WSGI concept overview
MEDIUM IMPACT
WSGI affects how the server handles requests and responses, impacting server response time and throughput.
from flask import Flask app = Flask(__name__) @app.route('/') def fast_response(): return 'Fast response' if __name__ == '__main__': app.run()
def app(environ, start_response): # Blocking operation inside WSGI app import time time.sleep(2) # Simulate slow processing start_response('200 OK', [('Content-Type', 'text/plain')]) return [b'Slow response']
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Blocking WSGI app | N/A | N/A | N/A | [X] Bad |
| Non-blocking Flask app | N/A | N/A | N/A | [OK] Good |