api-performance-tests
starlette
api-performance-tests | starlette | |
---|---|---|
10 | 55 | |
30 | 9,586 | |
- | 2.6% | |
5.3 | 9.2 | |
16 days ago | 11 days ago | |
Python | Python | |
- | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
api-performance-tests
-
Starlite December '22 Updates
Since version v1.39.0 Starlite (released on the 12.11.22) no longer has any dependency on Starlette. Between this version and v1.45.0 that was released today (11.12.22), we have invested significant effort into benchmarking and optimizing code. One of our maintainers, @provinzkraut (Janek NouvertnƩ), has done amazing work rewriting our benchmarking framework. You can read more about this in here and run the benchmarks on your own by cloning the benchmark repository. The results are pretty impressive if I may say so myself:
-
Starlite new features, benchmarks and a call for contributors and maintainers
Another important point I want to address is the framework's performance. The latest iteration of the TechPowered Benchmarks came out and they really surprised us. Starlite appeared rather slow there, and FastAPI was almost 200% faster thatn Starlette, which isn't technically possible given the structure of this library. Obviously something weird is happening there (no clue what), but this compelled us to invest some more efforts into our own benchmarking, the repository for which you can see here.
-
Starlite updates, features and community suggestions
here: https://github.com/Goldziher/api-performance-tests
-
Starlite vs. FastAPI vs. Starlette benchmarks
I used autocannon for this - which is a very cool benchmarking tool (I am not involved with it in any way). You can see the tests and more details in this repo. In a nutshell - I used identical setup for all 3 frameworks. Since both FastAPI and Starlite use Starlette as a basis, I also compared with Starlette.
- Starlite comparison to FastAPI and Starlette
-
Starlite is one of the fastest python API frameworks - its even faster than Starlette and FastAPI
I looked but still donāt understandā¦ https://github.com/Goldziher/api-performance-tests/blob/main/results/json-starlite-sync-json-abc-1.json has 32k requests (per second?) but your graphs talk about 107
-
Starlite is fast(er)
Legend: - a-: async, s-: sync - np: no params, pp: path param, qp: query param, mp: mixed params **Note*\*: only Starlite uses orjson by default - using their default settings both Starlette and FastAPI are significantly slower in serializing/deserializing JSON. You can find the tests in this repo, which also documents the test setup etc. As always, I invite you to checkout Starlite and maybe āour repo. Starlite is a collaborative project - we have a discord server, which you can find here. You can find my previous reddit posts related to Starlite in these links: 1. Post regarding the builtin support for SQL Alchemy and the plugin system 2. Post introducing Starlite You can also read the article in medium (no pay gate) introducing Starlite.
-
Starlite is faster than Starlette and FastAPI
You can find the tests in this repo, which also documents the test setup etc.
starlette
- Ask HN: What is your go-to stack for the web?
-
Building Fast APIs with FastAPI: A Comprehensive Guide
Fast Execution: FastAPI is built on top of Starlette and Pydantic, making it one of the fastest Python frameworks for building APIs.
-
Embracing Modern Python for Web Development
The framework's efficiency comes from its use of Starlette for building asynchronous web services and Pydantic for robust data validation and serialization, powered by Python's type hints. Pydantic has recently announced the official release of Pydantic V2 (June 2023), which is a ground-up rewrite that offers many new features and performance improvements, so make sure to be using that instead of V1.
-
FastHttp for Python (64k requests/s)
Uvicorn + Starlette 8k requests/s
- Microdot "The impossibly small web framework for Python and MicroPython"
-
An Introduction to ā”FastAPI
Starlette documentation
-
Writing a chat application in Django 4.2 using async StreamingHttpResponse
Same here, but without these weird utils it doesn't get any better.
I have 7 YoE with Django. Its great at so many things. You see some code, like middlewares, and immediately understand what's going on.
Now, we also have Starlette. The base of all new, fancy asgi libraries. Here's the base middleware class.
https://github.com/encode/starlette/blob/8d7a1cacfb3e1a30cbb...
In the last couple of years I heard 'we're running fastapi on production. Wanna join us?' so many times... but the reality is that it's still not suitable for prod. Who wants to work with a code like that if you have a readable, stable Django? I'm clueless.
-
Deploying an ML model to Paperspace and creating an API
Set up Starlette, a tool we'll use to make async requests
-
FastAPI middleware doesn't run while making request to websocket endpoint
I never used websockets in FastAPI so I wouldn't know how to guide you more, but Middleware in Websockets are 100% supported by Starlette : https://github.com/encode/starlette/issues/641
-
Chat implementation
Websockets are the way but I would not recommend django as it's still not fully async. I would go for other tools.
What are some alternatives?
starlite - Light, Flexible and Extensible ASGI API framework | Effortlessly Build Performant APIs [Moved to: https://github.com/litestar-org/litestar]
Flask - The Python micro framework for building web applications.
elements - Build beautiful, interactive API Docs with embeddable React or Web Components, powered by OpenAPI and Markdown.
fastapi - FastAPI framework, high performance, easy to learn, fast to code, ready for production
msgspec - A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
uvicorn - An ASGI web server, for Python. š¦
litestar - Production-ready, Light, Flexible and Extensible ASGI API framework | Effortlessly Build Performant APIs
AIOHTTP - Asynchronous HTTP client/server framework for asyncio and Python
quart - An async Python micro framework for building web applications.
pydantic - Data validation using Python type hints
Tornado - Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.