Skip to content

Commit 92601e2

Browse files
committed
[Python] FastAPI: Add tests with using FastPySGI server
1 parent b1845c9 commit 92601e2

5 files changed

Lines changed: 67 additions & 1 deletion

File tree

frameworks/Python/fastapi/app_server.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ def run_app():
3535
siapp.listen(opt.port, lambda config: logging.info(f"Listening on port http://localhost:{opt.port} now\n"))
3636
siapp.run()
3737
return
38-
38+
39+
if opt.server in [ 'fp', 'fastpysgi' ]:
40+
import fastpysgi
41+
fastpysgi.server.hook_sigint = 1
42+
fastpysgi.server.backlog = 4096
43+
fastpysgi.run(app, host=opt.host, port=opt.port, loglevel=opt.verbose)
44+
return
45+
3946
raise Exception(f'Unknown server name = "{opt.server}"')
4047

4148
def create_fork():

frameworks/Python/fastapi/benchmark_config.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,29 @@
152152
"display_name": "FastAPI-uvicorn",
153153
"notes": "",
154154
"versus": "None"
155+
},
156+
"fastpysgi": {
157+
"json_url": "/json",
158+
"fortune_url": "/fortunes",
159+
"plaintext_url": "/plaintext",
160+
"db_url": "/db",
161+
"query_url": "/queries?queries=",
162+
"update_url": "/updates?queries=",
163+
"port": 8080,
164+
"approach": "Realistic",
165+
"classification": "Micro",
166+
"database": "Postgres",
167+
"framework": "FastAPI",
168+
"language": "Python",
169+
"flavor": "Python3",
170+
"orm": "Raw",
171+
"platform": "asyncio",
172+
"webserver": "FastPySGI",
173+
"os": "Linux",
174+
"database_os": "Linux",
175+
"display_name": "FastAPI [FastPySGI]",
176+
"notes": "",
177+
"versus": "fastapi"
155178
}
156179
}
157180
]

frameworks/Python/fastapi/config.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,20 @@ orm = "Raw"
111111
platform = "None"
112112
webserver = "uvicorn"
113113
versus = "None"
114+
115+
[fastpysgi]
116+
urls.plaintext = "/plaintext"
117+
urls.json = "/json"
118+
urls.db = "/db"
119+
urls.query = "/queries?queries="
120+
urls.update = "/updates?queries="
121+
urls.fortune = "/fortunes"
122+
approach = "Realistic"
123+
classification = "Micro"
124+
database = "Postgres"
125+
database_os = "Linux"
126+
os = "Linux"
127+
orm = "Raw"
128+
platform = "None"
129+
webserver = "nginx"
130+
versus = "fastapi"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM python:3.14-bookworm
2+
3+
WORKDIR /fastapi
4+
5+
RUN python -m venv /opt/venv
6+
ENV PATH="/opt/venv/bin:$PATH"
7+
8+
RUN apt-get install -y --no-install-recommends libpq-dev
9+
RUN rm -rf /var/lib/apt/lists/*
10+
11+
COPY . ./
12+
13+
RUN pip install -r requirements-fastpysgi.txt
14+
15+
EXPOSE 8080
16+
17+
CMD python app_server.py -s fastpysgi
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-r requirements.txt
2+
git+https://github.com/remittor/fastpysgi.git@ce6c449d5ff251b6864f06ee1b8dca286eb21b8f

0 commit comments

Comments
 (0)