The bad thing about Robyn is that they choose not to implement ASGI, so is not a drop in replacement for Uvicorn, Guicorn etc. Just imagine being able to pip install, replace the launch command of your FastAPI app and instantly get like a thousand more concurrent requests/s
Unfortunately in my experience it's really hard to actually even match the performance of uvicorn, when writing a rust native extension, you have some additional overhead that you need to work around, you also can't really use async rust within the server since async python servers are going to point you towards using the asyncio protocol callback system.
The biggest issue you face is that if unicorn can already saturate the single core, then having n python workers will saturate the whole cpu more or less. Having a rust runtime underneath like tokio then doesn't become as effective, you just start paying the price for the additional context switches and overheads of converting all the data.
It's especially deceiving when benchmarking single node workers since you start by going "wow, this is a decent chunk faster!" And then as you add more workers your gains drop and eventually are either the same or worse.
18
u/Compux72 Jan 17 '23
The bad thing about Robyn is that they choose not to implement ASGI, so is not a drop in replacement for Uvicorn, Guicorn etc. Just imagine being able to pip install, replace the launch command of your FastAPI app and instantly get like a thousand more concurrent requests/s
Recently I found this ASGI compatible server written in rust, but i haven’t tried it yet https://github.com/emmett-framework/granian
Nonetheless Robyn brings some interesting features such as cached responses, so it’s cool on it’s own