One model of asynchronous-request processing in a server is through multiplexing incoming connections. In this case, each connection is assigned a unique ID of some kind and replies are issued whenever one is ready, irrespective of the order in which it was received. Thus, this allows a higher throughput, as the shortest job gets the highest priority implicitly. This model also makes the server highly responsive with a larger number of incoming requests of varying complexity. Traditional Unix-like systems support this using the select and poll system calls for socket multiplexing.
In the tokio ecosystem, this is mirrored by a number of traits that enable implementing multiplexed protocols. The basic anatomy of ...