Skip to content
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
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ starlite:
litestar:
uvicorn servers.litestar.main:app --host 0.0.0.0 --port 8000 --workers 16

pulya:
uvicorn servers.pulya.main:app --host 0.0.0.0 --port 8000 --workers 16

benchmark:
wrk -t12 -c400 -d10s -s wrk_script.lua http://localhost:8000/echo
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ A repository to do simple "echo server" benchmarks for famous ASGI and WSGI Pyth
1. Install dependencies

```bash
python -m venv venv
source venv/bin/activate

pip install -r requirements.txt
uv venv
source .venv/bin/activate
uv sync
```

2. Run benchmark script
Expand Down
6 changes: 6 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def main():
print("Hello from python-framework-benchmarks!")


if __name__ == "__main__":
main()
90 changes: 90 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
[project]
name = "python-framework-benchmarks"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.14"
dependencies = [
"aiofiles>=25.1.0",
"alembic>=1.18.3",
"annotated-types>=0.7.0",
"anyio>=4.12.1",
"black>=26.1.0",
"blinker>=1.9.0",
"certifi>=2026.1.4",
"charset-normalizer>=3.4.4",
"click>=8.3.1",
"dill>=0.4.1",
"dnspython>=2.8.0",
"email-validator>=2.3.0",
"exceptiongroup>=1.3.1",
"faker>=40.1.2",
"fast-query-parsers>=1.0.3",
"fastapi>=0.128.0",
"flask>=3.1.2",
"gunicorn>=25.0.0",
"h11>=0.16.0",
"h2>=4.3.0",
"hpack>=4.1.0",
"html5tagger>=1.3.0",
"httpcore>=1.0.9",
"httptools>=0.7.1",
"httpx>=0.28.1",
"hypercorn>=0.18.0",
"hyperframe>=6.1.0",
"idna>=3.11",
"inquirerpy>=0.3.4",
"itsdangerous>=2.2.0",
"jinja2>=3.1.6",
"litestar>=2.19.0",
"mako>=1.3.10",
"markdown-it-py>=4.0.0",
"markupsafe>=3.0.3",
"mdurl>=0.1.2",
"msgspec>=0.20.0",
"multidict>=6.7.1",
"multiprocess>=0.70.14",
"mypy-extensions>=1.1.0",
"nestd>=0.3.2",
"packaging>=26.0",
"pathspec>=1.0.4",
"pfzy>=0.3.4",
"platformdirs>=4.5.1",
"polyfactory>=3.2.0",
"priority>=2.0.0",
"prompt-toolkit>=3.0.52",
"pulya>=0.2.0",
"pydantic>=2.12.5",
"pydantic-core>=2.41.5",
"pydantic-factories>=1.17.3",
"pydantic-openapi-schema>=1.5.1",
"pygments>=2.19.2",
"python-dateutil>=2.9.0.post0",
"pyyaml>=6.0.3",
"quart>=0.20.0",
"requests>=2.32.5",
"rich>=14.3.2",
"robyn>=0.76.0",
"sanic>=25.12.0",
"sanic-routing>=23.12.0",
"six>=1.17.0",
"sniffio>=1.3.1",
"sqlalchemy>=2.0.46",
"starlette>=0.50.0",
"starlite>=1.51.12",
"tomli>=2.4.0",
"tracerite>=2.3.1",
"typing-extensions>=4.15.0",
"ujson>=5.11.0",
"urllib3>=2.6.3",
"uvicorn>=0.40.0",
"uvloop>=0.22.1",
"watchdog>=4.0.1",
"wcwidth>=0.5.3",
"websockets>=16.0",
"werkzeug>=3.1.5",
"wsproto>=1.3.2",
]

[tool.uv.sources]
pulya = { path = "../pulya", editable = true }
78 changes: 0 additions & 78 deletions requirements.txt

This file was deleted.

11 changes: 5 additions & 6 deletions results/fastapi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ wrk -t12 -c400 -d10s -s wrk_script.lua http://localhost:8000/echo
Running 10s test @ http://localhost:8000/echo
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 11.04ms 11.90ms 150.77ms 87.52%
Req/Sec 3.82k 0.93k 21.76k 85.02%
456996 requests in 10.10s, 66.25MB read
Socket errors: connect 0, read 317, write 0, timeout 0
Requests/sec: 45227.99
Transfer/sec: 6.56MB
Latency 4.68ms 3.78ms 47.85ms 81.40%
Req/Sec 7.85k 627.92 12.23k 74.13%
945438 requests in 10.10s, 137.05MB read
Requests/sec: 93575.14
Transfer/sec: 13.56MB
11 changes: 5 additions & 6 deletions results/flask.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ wrk -t12 -c400 -d10s -s wrk_script.lua http://localhost:8000/echo
Running 10s test @ http://localhost:8000/echo
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 73.64ms 99.58ms 919.86ms 85.78%
Req/Sec 0.86k 185.15 1.54k 66.42%
102608 requests in 10.02s, 17.42MB read
Socket errors: connect 0, read 635, write 13, timeout 0
Requests/sec: 10235.36
Transfer/sec: 1.74MB
Latency 178.64ms 106.20ms 954.66ms 68.53%
Req/Sec 187.04 39.37 565.00 75.83%
22509 requests in 10.08s, 3.82MB read
Requests/sec: 2232.87
Transfer/sec: 388.25KB
13 changes: 6 additions & 7 deletions results/litestar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ wrk -t12 -c400 -d10s -s wrk_script.lua http://localhost:8000/echo
Running 10s test @ http://localhost:8000/echo
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 14.65ms 18.44ms 162.58ms 86.78%
Req/Sec 3.62k 2.03k 16.73k 86.52%
433571 requests in 10.10s, 71.12MB read
Socket errors: connect 0, read 306, write 0, timeout 0
Non-2xx or 3xx responses: 433571
Requests/sec: 42916.57
Transfer/sec: 7.04MB
Latency 4.02ms 3.49ms 37.85ms 85.61%
Req/Sec 9.44k 1.43k 38.45k 98.67%
1129986 requests in 10.10s, 185.35MB read
Non-2xx or 3xx responses: 1129986
Requests/sec: 111868.04
Transfer/sec: 18.35MB
9 changes: 9 additions & 0 deletions results/pulya.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
wrk -t12 -c400 -d10s -s wrk_script.lua http://localhost:8000/echo
Running 10s test @ http://localhost:8000/echo
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 5.40ms 8.58ms 128.34ms 89.02%
Req/Sec 11.72k 1.55k 55.05k 92.67%
1400773 requests in 10.10s, 221.76MB read
Requests/sec: 138690.14
Transfer/sec: 21.96MB
11 changes: 5 additions & 6 deletions results/quart.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ wrk -t12 -c400 -d10s -s wrk_script.lua http://localhost:8000/echo
Running 10s test @ http://localhost:8000/echo
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 28.36ms 33.89ms 343.51ms 84.96%
Req/Sec 1.82k 0.92k 5.73k 70.92%
217954 requests in 10.02s, 31.80MB read
Socket errors: connect 0, read 291, write 0, timeout 0
Requests/sec: 21749.43
Transfer/sec: 3.17MB
Latency 6.43ms 4.95ms 97.71ms 83.90%
Req/Sec 5.65k 524.20 6.99k 75.58%
674451 requests in 10.00s, 98.41MB read
Requests/sec: 67418.17
Transfer/sec: 9.84MB
11 changes: 5 additions & 6 deletions results/robyn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ wrk -t12 -c400 -d10s -s wrk_script.lua http://localhost:8000/echo
Running 10s test @ http://localhost:8000/echo
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 45.33ms 75.92ms 627.32ms 85.32%
Req/Sec 5.56k 2.77k 37.09k 82.25%
644527 requests in 10.10s, 79.91MB read
Socket errors: connect 0, read 375, write 0, timeout 0
Requests/sec: 63799.35
Transfer/sec: 7.91MB
Latency 21.89ms 35.32ms 262.86ms 85.43%
Req/Sec 4.50k 1.29k 12.98k 74.23%
538927 requests in 10.09s, 66.81MB read
Requests/sec: 53397.80
Transfer/sec: 6.62MB
11 changes: 5 additions & 6 deletions results/sanic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ wrk -t12 -c400 -d10s -s wrk_script.lua http://localhost:8000/echo
Running 10s test @ http://localhost:8000/echo
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 15.23ms 18.94ms 152.21ms 86.20%
Req/Sec 3.51k 2.01k 12.76k 84.67%
419482 requests in 10.01s, 68.41MB read
Socket errors: connect 0, read 347, write 0, timeout 0
Requests/sec: 41891.69
Transfer/sec: 6.83MB
Latency 4.39ms 4.01ms 48.66ms 83.57%
Req/Sec 8.88k 0.97k 13.16k 70.71%
1070484 requests in 10.10s, 174.57MB read
Requests/sec: 105941.45
Transfer/sec: 17.28MB
11 changes: 5 additions & 6 deletions results/starlette.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ wrk -t12 -c400 -d10s -s wrk_script.lua http://localhost:8000/echo
Running 10s test @ http://localhost:8000/echo
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 8.04ms 8.67ms 82.63ms 86.90%
Req/Sec 5.47k 1.13k 20.76k 76.23%
654579 requests in 10.10s, 94.89MB read
Socket errors: connect 0, read 363, write 3, timeout 0
Requests/sec: 64799.43
Transfer/sec: 9.39MB
Latency 3.78ms 4.80ms 132.25ms 91.47%
Req/Sec 10.88k 1.57k 16.88k 70.05%
1312704 requests in 10.10s, 190.29MB read
Requests/sec: 129946.20
Transfer/sec: 18.84MB
28 changes: 28 additions & 0 deletions servers/pulya/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import logging.config
from typing import Annotated

from dependency_injector import containers, providers
from dependency_injector.wiring import inject, Provide
from pulya import Pulya, RequestContainer

logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': True,
'root': {
"level": "ERROR",
}
})

class Container(containers.DeclarativeContainer):
wiring_config = containers.WiringConfiguration(
modules=[__name__]
)

request = providers.Container(RequestContainer)

app = Pulya(Container)

@app.post("/echo")
@inject
def echo(body: Annotated[bytes, Provide[RequestContainer.body.provided.content]]) -> bytes:
return body
Loading