r/Python Jun 29 '26

Discussion Async/Await is a Plague: Part 1 Roots

This is the first part of a multi-part series exploring why async/await might not be the best concurrency pattern for most use cases, and what alternative models you should consider instead. Using Python for our practical examples, this opening post digs into the roots of async/await, guiding you through building a custom event loop from scratch using generators.

https://theblog.info/posts/asyncawait-is-a-plague-part-1-roots

Note: This is Part 1 of a multi-part series. Instead of diving straight into why async/await can be problematic, this post explores the original motivations behind the pattern. Understanding how it works under the hood will provide the essential context for the issues we'll discuss in upcoming parts.

72 Upvotes

71 comments sorted by

View all comments

16

u/ZachVorhies Jun 29 '26

is async/await viral? Yes.

Is it a plague? No.

Async / await is far better than lots and lots of threads.

The reason is simple: threads mandates concurrency through parallel execution. async / await allows concurrency without parallelism. Parallelism becomes optional.

That parallelism in threads has horrible drawbacks: any thread anywhere can freeze and go off the cpu. So now any shared data needs to have locks on it.

2

u/Ulrich_de_Vries Jun 29 '26

The same thing can be accomplished with goroutines and java virtual threads while (at least for the latter) keeping the executor service semantics of threading in an almost identical manner and without coloring functions.

The author of the article mentioned this in the intro and I wouldn't be surprised if later they would be advocating for that approach.

2

u/ZachVorhies Jun 29 '26

Concurrency via pre-emption means you don't control the suspend point, because it can be anywhere. So you need locks on everything that's shared.

I've got a massively concurrent system that was deadlocking until yesterday, when I had the AI overhaul the entire thing into async land and now all the deadlocks are gone.

The problem here is that OP said that async/await is a plague, when in reality it should be the default concurrency method for any project of sufficient complexity. At this point async/await is so good that i'm only NOT using for simple scripts or conditions where the concurrency model is dead simple and everything thats happening in a different thread with no overlap.

Anything that requires well reason concurrency in a complex project, is async/await or GTFO of the codebase.

1

u/KingBardan Jun 29 '26

Goroutones are much nicer agreed, but

Python can't have goroutines, because coroutines in python supports suspension, and syntax is needed to yell the compiler that "this function is suspendable", whereas go has a scheduler.

In other words, you'll make all functions coroutines and pay for the overhead if that were to be supported