Discussion forum for David Beazley

Curio http server, how?


There are some talks about a curio http server In topic https://forum.dabeaz.com/t/curio-benchmarks-with-pypy/167/14, and yet i can not figure out how curio works in a http server, is there any one can share something?

Here is the thing i can not figure out:

As curio is single thread, so if a request handler do not yield, curio can not handle many requests but just one request one time.

And a request handler only yield when it hit a database, or a cache, so we have to write some asynchronous database/cache packages to support yield from in a request handler?

Or just put all IO operations into other threads?

Hope i make it clearly.


you can look at the h2 project : https://python-hyper.org/projects/h2/en/stable/curio-example.html


thinks for apply!

spawn a task for every request and every IO operation, yes, i know that.

what exactly i am struggle with is should we include a async orm(or any other async database operation tool)in a async http server, like django include a orm?

maybe no, i guess.


I don’t know if people are still interested for example, but I did some work using Curio, to get a feeling on the lib and did this :

Feel free to comment, try or contribute… It’s currently just an exercise