Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
WSGI is a synchronous interface where each worker handles one request at a time; ASGI is asynchronous and supports WebSockets and many concurrent connections per worker. Run several worker processes behind a server like Gunicorn or Uvicorn and size them by CPU cores and workload type.
WSGI frameworks such as classic Django and Flask block a worker for the duration of a request, so concurrency comes from multiple processes or threads. ASGI frameworks such as FastAPI and Starlette, and Django in async mode, let one worker interleave many requests while awaiting I/O, and support long-lived connections. In production you run multiple processes to use all cores, typically starting around one to two workers per core for CPU-heavy apps, adjusting for I/O-bound ones, and you tune timeouts, worker recycling and graceful shutdown. A reverse proxy or load balancer handles TLS and slow clients, and health checks plus autoscaling on latency or CPU complete the setup. Database connection pool sizes must be multiplied by the number of workers to stay within database limits.