This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients Rokas K. (rku), crusaderky, djarb, jcea, martin.panter, yselivanov, zzzeek
Date 2020-07-06.21:33:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594071184.13.0.240817737898.issue22239@roundup.psfhosted.org>
In-reply-to
Content
Thanks for posting this, Mike.

> Vague claims of "framework X is faster because it's async" appear, impossible to confirm as it is unknown how much of their performance gains come from the "async" aspect and how much of it is that they happened to rewrite a new framework from scratch in a completely different way (hint: it's the latter).

These kind of claims are not specific to async vs. sync. They are all over the place for every two pieces of comparable technologies. While novice users might base their technology choice purely on such benchmarks, it's less of an issue for startups/tech companies.

That said, I agree with most of your points so far.

> The asyncpg project, one of the few asyncio database drivers that exists, notes in its FAQ "asyncpg uses asynchronous execution model and API, which is fundamentally incompatible with SQLAlchemy" [2], yet we know this is not true  because SQLAlchemy works just fine with gevent and eventlet, with no architectural changes at all.

But it is true. Making asynchronous network requests in asyncio requires async/await or using callbacks and it's not possible to do them, say, from __getattr__ (you mention this yourself).  This is what that particular comment is about, nothing more. Using gevent and eventlet as examples in this particular context isn't helping you. Apologies for nitpicking, I know it's not the point of this discussion.

> A day later, someone took the same idea and got Flask to work in an asyncio event loop at [5].  The general idea of using greenlet in this way is also present at [6], so I won't be patenting this idea today as oremanj can claim prior art.

Yes, this approach definitely works and I even did that in production myself a few years ago with https://github.com/1st1/greenio (it's terribly outdated now).

> The recipe is simple and so far appears to be very effective.

This recipe was one of the reasons why I added `loop.set_task_factory` method to the spec, so that it's possible to implement this in an *existing* event loop like uvloop. But ultimately asyncio is flexible enough to let users use their own event loop which can be compatible with greenlets among other improvements.

Ultimately, asyncio will probably never ship with greenlets integration enabled by default, but we should definitely make it possible (if there are some limitations now).  It doesn't seem to me that nested event loops are needed for this, right?
History
Date User Action Args
2020-07-06 21:33:04yselivanovsetrecipients: + yselivanov, jcea, djarb, zzzeek, martin.panter, Rokas K. (rku), crusaderky
2020-07-06 21:33:04yselivanovsetmessageid: <1594071184.13.0.240817737898.issue22239@roundup.psfhosted.org>
2020-07-06 21:33:04yselivanovlinkissue22239 messages
2020-07-06 21:33:03yselivanovcreate