[Insights](/insights/) / [Core Engineering Intelligence](/insights/core_engineering_intelligence/)

# Blocking vs asynchronous code, explained simply

Blocking code stands and waits, async code works on something else in the meantime. Why that matters, and why neither one fixes a slow query.

![Ivan Borshchov](https://static.devforth.io/adminusers/avatars/2026/48db9847-d461-40cd-b344-f2bd7b0d98ca-avatar_ivan@devforth.io_f4ce9df9-8363-4314-9345-28753c76a386.jpeg)

Ivan Borshchov

CEO & System Architect @ DevForth

Dec 3, 2026

![Blocking vs asynchronous code, explained simply](https://static.devforth.io/posts/logo-svg/2026/1c717208-1a6c-497e-8676-3f879a925104-logo-preview-new.svg)

![Blocking vs asynchronous code, explained simply](https://static.devforth.io/posts/logo-svg/2026/1c717208-1a6c-497e-8676-3f879a925104-logo-preview-new.svg)

Picture a café with one waiter.

**Blocking:** the waiter takes your order, walks to the kitchen and stands there until the soup is ready. The next customer waits at the door the whole time, even though the waiter is doing nothing.

**Asynchronous:** the waiter hands your order to the kitchen and goes back to take the next one. When the soup is ready, the kitchen rings a bell and the waiter brings it over.

In code, the "kitchen" is anything slow that isn't your own program: a database query, a call to another API, reading a file. A blocking server, such as a classic Django or Flask app on Gunicorn's sync workers, handles one request per worker, so you add workers or threads to serve more people. An async server (Node.js, or Python with asyncio and FastAPI) starts the slow call, serves other requests while it waits, and picks the work up again when the answer arrives.

```python
import asyncio

async def load_dashboard():
    users, orders = await asyncio.gather(
        fetch_users(),
        fetch_orders(),
    )
```

Both calls wait at the same time, so this takes as long as the slower one, not as long as both added together.

**Where async doesn't help**

Async only helps with _waiting_. If the kitchen itself is slow, a faster waiter changes nothing. A query that takes one second still keeps the database busy for one second, and many of them at once will overload it, whichever style your app uses. Heavy CPU work like resizing images or big calculations also blocks an async server, because there is no waiting to hand off. Move that work to a separate worker or a job queue.

So when an app feels slow, measure first. Often the fix is an index or a better query rather than a new programming model. We cover that in [SQL query optimization: understanding the key principle](/insights/sql-query-optimization-understanding-key-principle/).

In short: async lets one worker serve many requests while they wait, but it can't make the slow thing itself any faster.

## Get your project quote

Free result within 48-72 hours

[

Get a quote

](/estimation-request/)[

Talk to our engineers

](https://talk.devforth.io/book/30-minute-meeting)

[

Back to insights

](/insights/)

[](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdevforth.io%2Finsights%2Fblocking-vs-asynchronous-code-explained-simply%2F)[](https://bsky.app/intent/compose?text=Blocking%20vs%20asynchronous%20code%2C%20explained%20simply%0A%0Ahttps%3A%2F%2Fdevforth.io%2Finsights%2Fblocking-vs-asynchronous-code-explained-simply%2F)[](https://x.com/intent/tweet?text=Blocking%20vs%20asynchronous%20code%2C%20explained%20simply%20by%20%40ivanborshchov%0A%0Ahttps%3A%2F%2Fdevforth.io%2Finsights%2Fblocking-vs-asynchronous-code-explained-simply%2F)

## Related insights

[

![Install PostgreSQL and create a database and user from the command line](https://static.devforth.io/posts/logo-svg/2026/4289b5ee-f719-4e22-8f1d-519f5fa1fa11-logo-preview-new.svg)

Core Engineering Intelligence Dec 3, 2026

## Install PostgreSQL and create a database and user from the command line

Install PostgreSQL on Ubuntu or WSL, then create a database owned by its own user in two SQL commands, and connect with one URL.

](/insights/install-postgresql-and-create-a-database-and-user-from-the-command-line/)[

![How to create an AWS account and keep it safe](https://static.devforth.io/posts/logo-svg/2026/9846537f-161d-4fbc-b845-786ab85ed79c-logo-preview-new.svg)

Core Engineering Intelligence Dec 3, 2026

## How to create an AWS account and keep it safe

Create an AWS account the safe way. Protect the root user with MFA, set a budget alert and use a separate short-lived login for daily work.

](/insights/how-to-create-an-aws-account-and-keep-it-safe/)[

![Painterro, a simple JS paint plugin for your website](https://static.devforth.io/posts/logo-svg/2026/c453add8-a6e5-4a6d-817d-fe94f866725c-logo-preview-new.svg)

Core Engineering Intelligence Dec 3, 2026

## Painterro, a simple JS paint plugin for your website

Painterro is a small open-source image editor for the browser. Paste a screenshot, crop it, add arrows and text, and save it to your own backend.

](/insights/painterro-a-simple-js-paint-plugin-for-your-website/)
