#async-task #job #task #async

rework

Multi-threaded task processing in the Master-Worker pattern

2 unstable releases

0.1.0 Oct 11, 2022
0.0.2 Aug 25, 2022
0.0.1 Aug 25, 2022

#1121 in Concurrency

MIT license

42KB
981 lines

rework

version documentation

Multi-threaded async task processing in the Master-Worker pattern.

A rework system consists of a dispatcher and multiple workers. The dispatcher receives work requests via its Handle and schedules work with the help of a Scheduler. The way workers process incoming requests is defined by a WorkFn which takes a request and asynchronously generates a response.

The dispatcher, as well as every worker, runs on its dedicated thread. Although the concrete Request type must be Send, the response futures do not have to, allowing workers to leverage !Send mechanisms, e.g., thread locals.

Features

  • Multi-threaded workers, each with a single-thread async runtime, that can work on !Send futures.
  • Async as an option--you don't necessarily need an async runtime at all.
  • Load balanced, as long as Workload is properly defined.

Dependencies

~3–9.5MB
~85K SLoC