vatsrahul1001 commented on issue #43035: URL: https://github.com/apache/airflow/issues/43035#issuecomment-2553914293
To perform the comparison. I replaced Gunicorn code in else [block](https://github.com/apache/airflow/blob/main/airflow/cli/commands/local_commands/fastapi_api_command.py#L95) with below ` uvicorn.run` command ``` uvicorn.run("airflow.api_fastapi.main:app", host=args.hostname, port=args.port, workers=num_workers, timeout_keep_alive=worker_timeout, timeout_graceful_shutdown=worker_timeout, ssl_keyfile=ssl_key, ssl_certfile=ssl_cert, access_log=access_logfile) ``` I used locust for performance testing with below configuration These are the stats comparing `uvicorn.run()` with` Gunicorn + GunicornMonitor` <html><head></head><body> <hr> <h3><strong>Comparison: Uvicorn vs. Gunicorn Performance</strong></h3> <h4><strong>Request Statistics</strong></h4> Metric | Uvicorn | Gunicorn -- | -- | -- Total Requests | 14,714 | 14,726 Total Failures | 0 | 13 Average Response Time | 12.05 ms | 13.46 ms Min Response Time | 7 ms | 1 ms Max Response Time | 195 ms | 216 ms Average Size (bytes) | 4,608 | 4,603.93 Requests Per Second (RPS) | 49.05 | 49.09 Failures Per Second | 0 | 0.04 <hr> <h3><strong>Observations</strong></h3> <ol> <li> <p><strong>Response Times</strong>:</p> <ul> <li>Uvicorn demonstrates slightly lower average and maximum response times compared to Gunicorn.</li> <li>Percentile analysis shows Uvicorn's response times are more consistent, with fewer extreme values at higher percentiles.</li> </ul> </li> <li> <p><strong>Failures</strong>:</p> <ul> <li>Uvicorn had <strong>no failures</strong>, whereas Gunicorn recorded <strong>13 failures</strong> caused by <code inline="">RemoteDisconnected</code> errors. This could indicate potential issues in connection handling under load.</li> </ul> </li> <li> <p><strong>Performance Consistency</strong>:</p> <ul> <li>Uvicorn offers better consistency and reliability based on the above data.</li> </ul> </li> </ol> <hr> </html> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
