Backend Runtime Models

Event loops, threads, workers and processes — the runtime model decides what "slow" means for your service. Taught as concurrency models rather than framework slogans.

Backend Runtime Models
▶ lab

Four ways a server serves many requests at once, and what each one makes cheap, expensive and dangerous.

Q · While one request is waiting on the database, what is my server doing with the other two hundred?
The Node Event Loop

One thread runs your JavaScript, a small pool runs some of the I/O, and knowing which is which explains most Node production behaviour.

Q · If Node is single-threaded, how does it serve thousands of concurrent requests — and what is it actually single-threaded about?
Blocking the Event Loop

One function that does not yield holds the only thread that makes progress, so every concurrent request pays for it.

Q · Why did latency rise on every endpoint at once when only one of them changed?
Python Runtime Models

Sync workers, threads, async and processes are four different services with the same source code — and the GIL explains which is which.

Q · Which Python concurrency model does my service actually use, and what does the GIL stop it from doing?
Worker Processes

Running N copies of your service in one machine buys cores and isolation, and multiplies every per-process resource by N.

Q · What actually changes when one process becomes eight, on the same machine?
C++ Backend Services

When a backend is infrastructure, no garbage collector and direct control of memory buy predictable tail latency — at a price paid in engineering time and safety.

Q · When is a backend service worth writing in C++, and what does that choice actually buy?
Choosing a Runtime

A decision made once, changed rarely and paid for daily — decided by workload shape, ecosystem and who is on call, not by benchmarks.

Q · How do I choose a runtime for a new service without arguing about benchmarks?