Hi, Welcome back, we talked about building a FastAPI app with production ready architecture patterns and structure previously. Today we are going to see something more interesting and useful regardless of what programming language you use, as you can see from the title.
We will see about event loop as well in the upcoming sections. let’s get deep down with asynchronous world!
I have heard may Junior developers saying and sometimes seniors too… just slap async on everything and it’ll be faster!
I’ve heard this advice. I’ve seen the bugs it creates. Async is powerful, but it’s not magic pixie dust. Used wrong, it makes your code slower, harder to debug, and more complex for zero benefit.
In this post I will help you make informed decisions about async — not cargo-cult choices...
Hi, Welcome back, we talked about building a FastAPI app with production ready architecture patterns and structure previously. Today we are going to see something more interesting and useful regardless of what programming language you use, as you can see from the title.
We will see about event loop as well in the upcoming sections. let’s get deep down with asynchronous world!
I have heard may Junior developers saying and sometimes seniors too… just slap async on everything and it’ll be faster!
I’ve heard this advice. I’ve seen the bugs it creates. Async is powerful, but it’s not magic pixie dust. Used wrong, it makes your code slower, harder to debug, and more complex for zero benefit.
In this post I will help you make informed decisions about async — not cargo-cult choices.
Sync vs Async: What’s Actually Happening
Synchronous Code
def get_user(user_id: int): user = database.query(user_id) # Wait... wait... wait... return user
Synchronous means one thing at a time. When you call database.query(), Python stops and waits…