Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Add FastAPI-Granian tests #8541

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions frameworks/Python/fastapi/benchmark_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"framework": "fastapi",
"tests": [{
"tests": [
{
"default": {
"json_url": "/json",
"fortune_url": "/fortunes",
Expand Down Expand Up @@ -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"
}
}]
}
]
}
26 changes: 26 additions & 0 deletions frameworks/Python/fastapi/fastapi-granian-orjson.dockerfile
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions frameworks/Python/fastapi/fastapi-granian.dockerfile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions frameworks/Python/fastapi/requirements-granian.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
granian==0.7.1
Loading