From ba8b3faa81064717ecb19b971ffba6c3720dd18f Mon Sep 17 00:00:00 2001 From: Sam Mirazi Date: Tue, 3 Jun 2025 12:05:36 -0700 Subject: [PATCH] 23 --- .../{app_no_delay.py => FastAPI_no_delay.py} | 0 app_fastapi/{app.py => FastAPI_with_delay.py} | 0 app_fastapi/__init__.py | 1 + .../FastAPI_with_delay.cpython-312.pyc | Bin 0 -> 742 bytes app_fastapi/__pycache__/__init__.cpython-312.pyc | Bin 0 -> 184 bytes ...application_no_delay.py => Flask_no_delay.py} | 0 ...{flask_application.py => Flask_with_delay.py} | 0 run_benchmark_NO_RESTRICTIONS.py | 15 +++++++++------ run_benchmark_table.py | 14 +++++++------- 9 files changed, 17 insertions(+), 13 deletions(-) rename app_fastapi/{app_no_delay.py => FastAPI_no_delay.py} (100%) rename app_fastapi/{app.py => FastAPI_with_delay.py} (100%) create mode 100644 app_fastapi/__init__.py create mode 100644 app_fastapi/__pycache__/FastAPI_with_delay.cpython-312.pyc create mode 100644 app_fastapi/__pycache__/__init__.cpython-312.pyc rename app_flask/{flask_application_no_delay.py => Flask_no_delay.py} (100%) rename app_flask/{flask_application.py => Flask_with_delay.py} (100%) diff --git a/app_fastapi/app_no_delay.py b/app_fastapi/FastAPI_no_delay.py similarity index 100% rename from app_fastapi/app_no_delay.py rename to app_fastapi/FastAPI_no_delay.py diff --git a/app_fastapi/app.py b/app_fastapi/FastAPI_with_delay.py similarity index 100% rename from app_fastapi/app.py rename to app_fastapi/FastAPI_with_delay.py diff --git a/app_fastapi/__init__.py b/app_fastapi/__init__.py new file mode 100644 index 0000000..0177da3 --- /dev/null +++ b/app_fastapi/__init__.py @@ -0,0 +1 @@ +# This file makes app_fastapi a Python package \ No newline at end of file diff --git a/app_fastapi/__pycache__/FastAPI_with_delay.cpython-312.pyc b/app_fastapi/__pycache__/FastAPI_with_delay.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..06bd8881c1919da08edc25620c150b25436469d0 GIT binary patch literal 742 zcmYLH&ubGw6rS1HZQ8^XG(r&~?8QUGHijOgAyx{ZDncm+LE}PLb|%dxyV+%CY)w^& zM*IOnZ?>R+fD-*nyc8-Zs|Q6vy;X9Np86*2+6VLIy_xU5_kF{B$Y#?BZ0qdB)-8co;+LI@8;kq`}cn$q>3Lqxxg?A3f32 z3dSFGT+pJ_vMuD&>eXoSIul{g6>KHKMMvExrb94*HEM#phA^;_abJYmS^_)TDNg1N zfbTs}^itaTxpdSW141- z@pZ<_=J~n#*&1_#E*0hymu}N_T-!6N%(Hvo{h(5Ws?90M?#g0I`kvAXaLKwdO8bnu zc0=|;Rv=Nz7QL?H29Y5=#zL<27I37iDxrj$2ewnTZV1MORkMAo%0x#7p;dD!Ggo=g zW{wnA!f;)f%bqPd))m|7Fm6_Zc3|0I*l5B_+o78P8yl`{HK-yy7xrLW;4_|uaVc1$ z2<|uf*GE6o$G2vm&+d@DbpDf`-_`S%nT1__Vc$T;=>u^LY95^` z;a9k*zdl*Qg;bP^hjR6;#>)5KC=KtrZZGBXfpb(WGG?+@;-yq{0dLDiU}=FEh>%) zPRxyQNiEJU$uEcr&P+*F2q?JmtkIamWj77{q F7686RFb4nt literal 0 HcmV?d00001 diff --git a/app_flask/flask_application_no_delay.py b/app_flask/Flask_no_delay.py similarity index 100% rename from app_flask/flask_application_no_delay.py rename to app_flask/Flask_no_delay.py diff --git a/app_flask/flask_application.py b/app_flask/Flask_with_delay.py similarity index 100% rename from app_flask/flask_application.py rename to app_flask/Flask_with_delay.py diff --git a/run_benchmark_NO_RESTRICTIONS.py b/run_benchmark_NO_RESTRICTIONS.py index d9a1b3e..46a5148 100644 --- a/run_benchmark_NO_RESTRICTIONS.py +++ b/run_benchmark_NO_RESTRICTIONS.py @@ -222,20 +222,23 @@ def display_table(rows): SCENARIOS = [ { "name": "FastAPI (No Delay)", - "config": "Uvicorn, async (41 workers)", + "config": "Uvicorn, async (1 worker, httptools)", "delay": "None", - "cmd": ["uvicorn", "app_fastapi.app_no_delay:app", "--host", "0.0.0.0", - "--port", "8000", "--log-level", "warning", "--workers", "41"], + "cmd": ["uvicorn", "app_fastapi.FastAPI_no_delay:app", "--host", "0.0.0.0", + "--port", "8000", "--log-level", "warning", + "--workers", "1", + "--http", "httptools" + ], "url": FASTAPI_SERVER_URL, - "bench_arg": "fastapi", # benchmark/run_benchmark.py uses this to pick the URL/method + "bench_arg": "fastapi", }, { "name": "Flask (No Delay, Threaded)", "config": "Werkzeug (threaded=True)", "delay": "None", - "cmd": [PYTHON_EXE, "app_flask/flask_application_no_delay.py"], + "cmd": [PYTHON_EXE, "app_flask/Flask_no_delay.py"], "url": FLASK_SERVER_URL, - "bench_arg": "flask", # benchmark/run_benchmark.py uses this to pick the URL/method + "bench_arg": "flask", } ] diff --git a/run_benchmark_table.py b/run_benchmark_table.py index c8801b9..0f72361 100644 --- a/run_benchmark_table.py +++ b/run_benchmark_table.py @@ -24,9 +24,9 @@ def start_server(command_args, health_check_url, server_name, cwd=None): console.print(f"[yellow]Starting {server_name} server…[/yellow]") # --- STREAM HANDLING: inherit console so the child can always write - popen_kwargs = dict(cwd=cwd, text=True, - stdout=subprocess.DEVNULL, - stderr=subprocess.STDOUT) + popen_kwargs = dict(cwd=cwd, text=True) + # stdout=subprocess.DEVNULL, # Temporarily allow stdout + # stderr=subprocess.STDOUT # Temporarily allow stderr # run either as "python -m uvicorn ..." or plain exe if "uvicorn" in command_args[0] and not command_args[0].endswith(".exe"): @@ -196,10 +196,10 @@ def display_table(rows): SCENARIOS = [ { "name": "FastAPI", - "config": "Uvicorn, async", + "config": "Uvicorn, async (default worker, h11, debug log)", "delay": "0.3 s asyncio.sleep", - "cmd": ["uvicorn", "app_fastapi.app:app", "--host", "0.0.0.0", - "--port", "8000", "--log-level", "warning"], + "cmd": ["uvicorn", "app_fastapi.FastAPI_with_delay:app", "--host", "0.0.0.0", + "--port", "8000", "--log-level", "debug", "--http", "h11"], "url": FASTAPI_SERVER_URL, "bench_arg": "fastapi", }, @@ -207,7 +207,7 @@ SCENARIOS = [ "name": "Flask", "config": "Single-threaded, synchronous", "delay": "0.3 s time.sleep", - "cmd": [PYTHON_EXE, "app_flask/flask_application.py"], + "cmd": [PYTHON_EXE, "app_flask/Flask_with_delay.py"], "url": FLASK_SERVER_URL, "bench_arg": "flask", } -- 2.25.1