The worker pool distributes work across the workers to the least loaded worker.
The pool was tested by a load generator that produces tasks at a inconsistent interval, faster than the time it takes to complete the tasks itself. The tasks also take an inconsistent amount of time to finish. In this example the tasks were just sleeps.
The gif below shows values for:
Workers
: Pending requests for workerAvg Load
: Average pending requests for worker poolStd Dev
: Standard deviation of pending requests
The design was based off the talk concurrency is not parallelism by Rob Pike, the diagram is also from there
- Requests are made by a requester
- The Balancer dispatch's requests to a select worker in the worker pool
- The Worker will execute the task specified by the request