Socket multiplexing in tokio

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 ...

Get Network Programming with Rust now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.