liveBook · Manning

Asynchronous server

As explained in Fast Python: High performance techniques for large datasets

An asynchronous server is a server whose operations can yield while waiting for input or other external events so that other client work can proceed.

An asynchronous server accepts connections and monitors slow input without holding other clients while one connection waits. It can improve efficiency without parallelism, and remains distinct from single-threaded, multithreaded, or multiprocess execution. section 3.1

A practical implementation combines request reception with explicit lifecycle management:

  • Start an asyncio server that accepts client connections and receives MapReduce requests containing data and code. section 3.1
  • Use a worker thread and process pool for request processing while the asynchronous server continues serving clients. section 3.5.2
  • Handle interruption through the event loop, cancel serving, wait for shutdown, and signal the worker to terminate. section 3.5.2

Slow client input

A synchronous single-process server can leave every other client waiting when one user takes a long time to submit a request; an asynchronous design monitors that connection instead. section 3.1

Figure 3.2 Several architectures covering synchronous single-process/thread, synchronous multiprocess, and asynchronous single-process implementations for a server

Compare synchronous single-process and multiprocess architectures with an asynchronous single-process server. section 3.1

How Fast Python: High performance techniques for large datasets covers it

How deep it goes
Descends from synchronous blocking problems to asyncio construction, worker coordination, cancellation, signal handling, and graceful shutdown.
Examples
Uses web-server I/O, slow client requests, asyncio server setup, Control-C handling, worker threads, and process pools.
What it assumes
Assumes Python server and concurrency familiarity while demonstrating asynchronous programming alongside threading and multiprocessing.
What you can do after
Build it from scratch with asyncio, then operate it safely through cancellation, signal handling, worker coordination, and graceful shutdown.
How it connects
Connects asynchronous programming with synchronous processing, parallelism, multithreading, multiprocessing, and MapReduce.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast Python: High performance techniques for large datasets. The section links point to the parts of the book it draws on.