[dead]
Re:Granian – a Rust HTTP server for Python applications
by WhyNotHugo on Wednesday January 18, 2023 @08:20AM
(#34426289)
Thanks for your reply! Indeed, this should still be more efficient than a pure-python approach.
My main confusion around this is: how do I scale threads? Say I have to CPU cores. Do you run one Granian thread and one python thread? I Granian under-uses CPU, Python can't use the excess. But if I run one Granian thread and two python threads, I risk Python leaving Granian with less CPU than it needs.
In practice it should not be hard to find a balance... but somehow I'm still bothered by the fact that the design has no obvious solution for this.
Granian sounds interesting. I'm not sure how you deal with the "two async runtimes" problem tho. Essentially, if you do non-blocking IO, then your processes start to become CPU-bound. So granian can eat up CPU on high load, and leave little CPU for the asgi application (or vice-versa). Somehow that doesn't sound right, but I also can't think of how you'd solve that.