optima.go - a self balancing worker pool

By Rushabh Dadbhawala

Elevator Pitch

Determining the optimum worker pool size in a background service is difficult as there are several factors, often fluid and beyond control. Optima adjusts the pool in real-time to produce the optimum output, increasing capacity when scale is possible, or decreasing when peak threshold is crossed.

Description

Optima.go on Github: Optima addresses the problem of determining the optimum pool size in a background service, and dynamically adjusting it in real-time.

Background jobs depend on several factors. Many of these may be external and beyond the control of the service. Sometimes, high efficiencies may be available, which can be exploited by increasing the workers in the pool. Sometimes, constraints (such as busy databases or web services) may restrict job processing, and it might help to reduce worker pool size so as not to overload the system.

Optima creates a mechanism to dynamically adjust the pool size based on a chosen strategy. A common approach is to maximize “jobs per second”. With this strategy, one is trying to achieve the maximum possible output from the system. Optima provides a clean separation of “Workshop”, “Producer”, “Balancer” and “Strategy” concepts, with which custom behavior can be achieved for any of these components in a service.

Optima library offers a Go-Routine based workshop and a Moving-Average strategy that track the service metrics in a “batch” manner, and adjust the pool capacity in real-time to optimize “jobs-per-second”.

Notes

Presentation will include a “live” chart of a dummy producer highlighting the behavior of the library and the algorithms. It will draw out a line chart showing how the library adjusts itself according to available capacity.