kigawas / blog

Blog powered by hugo
https://kigawas.me
Other
0 stars 1 forks source link

Write a blog about sqlalchemy and fastapi #3

Open kigawas opened 3 years ago

kigawas commented 3 years ago

title: FastAPI and Async Sqlalchemy: the catalyst for Python web development

kigawas commented 3 years ago
kigawas commented 3 years ago

Why fastapi

Competitive performance, even compared with Java or Go without much tuning

Python web framework benchmarks

Note that the word "performance" means throughput, rather than speed Actually, async web frameworks may make some requests obviously slower (it's highly variant in latency)

[Wrk result here]

Performance: uvloop-based frameworks are on the top among Python frameworks, more specifically (req/s): Generally uvicorn > sanic > starlette > fastapi >>> flask/django

Read from db: Fastapi ~= spring (Java)

Write to db: Fastapi > spring (Java) > gin (Golang)

[Benchmark here]

What if ORM?

How to solve?

Documentation included

Web API -> OpenAPI? OpenAPI -> Web API?

kigawas commented 2 years ago

Gino -> Async SqlAlchemy