DEV Community

loading...

Discussion on: Achieving asynchronous behavior using asyncio in Python

Collapse
bruck1701 profile image
Bruno Kümmel

Very nice post! But I'm humbly bringing a different opinion to the table
There is an online article published in june 2020 that disagrees that async is always a better solution.
The author defends that under realistic heavy load, according to his tests, the worst performers are all async frameworks! Maybe the premise that "async is necessarily faster" is still on debate :)

What do you think?

source: calpaterson.com/async-python-is-no...

Collapse
singh1114 profile image
Ranvir Singh Author

Not saying the async is always better but for some cases, you can really see the difference with an open eye. Don't you think it is better to opt-in for it?

Collapse
bruck1701 profile image
Bruno Kümmel

Don't get me wrong, I really like the idea of using asyncio to boost performance when possible. And I do agree that for some (most?) cases asyncio should give better performances results.
However, under heavy load, if one thread becomes stuck in the CPU for whatever reason, the other threads would not be able to kick in due to asyncio's co-operative multi-threading behavior, right? So, In this scenario, a solution that uses the kernel scheduler would give better latency results. I think that's the point of the article that I linked.

Anyway, it is always good to see different approachs in different scenarios 👍👍 Thanks again for the post!

Thread Thread
singh1114 profile image
Ranvir Singh Author • Edited

I am generally into giving more time for the framework to mature itself. Although JavaScript was built keeping async behavior in mind, when async-await first came to it, took it some time for async-await to mature and make itself what it is today.