class AutoScaler

Methods

__construct(Factory $queue, MetricsRepository $metrics)

Create a new auto-scaler instance.

void
scale(Supervisor $supervisor)

Balance the workers on the given supervisor.

poolsByQueue(Supervisor $supervisor)

Get the process pools keyed by their queue name.

timeToClearPerQueue(Supervisor $supervisor, Collection $pools)

Get the times in milliseconds needed to clear the queues.

numberOfWorkersPerQueue(Supervisor $supervisor, Collection $queues)

Get the number of workers needed per queue for proper balance.

void
scalePool(Supervisor $supervisor, ProcessPool $pool, float $workers)

Scale the given pool to the recommended number of workers.

Details

at line 19
__construct(Factory $queue, MetricsRepository $metrics)

Create a new auto-scaler instance.

Parameters

Factory $queue

the queue factory implementation

MetricsRepository $metrics

the metrics repository implementation

at line 28
void scale(Supervisor $supervisor)

Balance the workers on the given supervisor.

Parameters

Supervisor $supervisor

Return Value

void

at line 47
protected Collection poolsByQueue(Supervisor $supervisor)

Get the process pools keyed by their queue name.

Parameters

Supervisor $supervisor

Return Value

Collection

at line 57
protected Collection timeToClearPerQueue(Supervisor $supervisor, Collection $pools)

Get the times in milliseconds needed to clear the queues.

Parameters

Supervisor $supervisor
Collection $pools

Return Value

Collection

at line 82
protected Collection numberOfWorkersPerQueue(Supervisor $supervisor, Collection $queues)

Get the number of workers needed per queue for proper balance.

Parameters

Supervisor $supervisor
Collection $queues

Return Value

Collection

at line 124
protected void scalePool(Supervisor $supervisor, ProcessPool $pool, float $workers)

Scale the given pool to the recommended number of workers.

Parameters

Supervisor $supervisor
ProcessPool $pool
float $workers

Return Value

void