diff --git a/frameworks/Python/fastapi/benchmark_config.json b/frameworks/Python/fastapi/benchmark_config.json index 6fbceb1f0ae..0f51898981a 100755 --- a/frameworks/Python/fastapi/benchmark_config.json +++ b/frameworks/Python/fastapi/benchmark_config.json @@ -1,6 +1,7 @@ { "framework": "fastapi", - "tests": [{ + "tests": [ + { "default": { "json_url": "/json", "fortune_url": "/fortunes", @@ -237,6 +238,50 @@ "display_name": "FastAPI-uvicorn-orjson", "notes": "", "versus": "None" + }, + "granian": { + "json_url": "/json", + "fortune_url": "/fortunes", + "db_url": "/db", + "query_url": "/queries?queries=", + "update_url": "/updates?queries=", + "port": 8080, + "approach": "Realistic", + "classification": "Micro", + "database": "Postgres", + "framework": "FastAPI", + "language": "Python", + "flavor": "Python3", + "orm": "Raw", + "platform": "asyncio", + "webserver": "Granian", + "os": "Linux", + "database_os": "Linux", + "display_name": "FastAPI-granian", + "notes": "", + "versus": "None" + }, + "granian-orjson": { + "json_url": "/json", + "db_url": "/db", + "query_url": "/queries?queries=", + "update_url": "/updates?queries=", + "port": 8080, + "approach": "Realistic", + "classification": "Micro", + "database": "Postgres", + "framework": "FastAPI", + "language": "Python", + "flavor": "Python3", + "orm": "Raw", + "platform": "asyncio", + "webserver": "Granian", + "os": "Linux", + "database_os": "Linux", + "display_name": "FastAPI-granian-orjson", + "notes": "", + "versus": "None" } - }] + } + ] } diff --git a/frameworks/Python/fastapi/fastapi-granian-orjson.dockerfile b/frameworks/Python/fastapi/fastapi-granian-orjson.dockerfile new file mode 100644 index 00000000000..b6d210bb32d --- /dev/null +++ b/frameworks/Python/fastapi/fastapi-granian-orjson.dockerfile @@ -0,0 +1,26 @@ +FROM python:3.11 + +WORKDIR /fastapi + +RUN python -m venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" + +COPY requirements.txt requirements-granian.txt requirements-orjson.txt ./ + +RUN pip3 install \ + -r requirements.txt \ + -r requirements-granian.txt \ + -r requirements-orjson.txt + +COPY . ./ + +EXPOSE 8080 + +CMD granian \ + --host=0.0.0.0 \ + --port=8080 \ + --interface=asgi \ + --loop=uvloop \ + --workers=$(nproc) \ + --log-level=error \ + app:app diff --git a/frameworks/Python/fastapi/fastapi-granian.dockerfile b/frameworks/Python/fastapi/fastapi-granian.dockerfile new file mode 100644 index 00000000000..53427123b78 --- /dev/null +++ b/frameworks/Python/fastapi/fastapi-granian.dockerfile @@ -0,0 +1,25 @@ +FROM python:3.11 + +WORKDIR /fastapi + +RUN python -m venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" + +COPY requirements.txt requirements-granian.txt ./ + +RUN pip3 install \ + -r requirements.txt \ + -r requirements-granian.txt + +COPY . ./ + +EXPOSE 8080 + +CMD granian \ + --host=0.0.0.0 \ + --port=8080 \ + --interface=asgi \ + --loop=uvloop \ + --workers=$(nproc) \ + --log-level=error \ + app:app diff --git a/frameworks/Python/fastapi/requirements-granian.txt b/frameworks/Python/fastapi/requirements-granian.txt new file mode 100644 index 00000000000..8ca60d3ace0 --- /dev/null +++ b/frameworks/Python/fastapi/requirements-granian.txt @@ -0,0 +1 @@ +granian==0.7.1