Class: SidekiqAutoscale::Strategies::DynamicLatencyScaling

Inherits:
BaseScaling
  • Object
show all
Defined in:
lib/sidekiq_autoscale/strategies/dynamic_latency_scaling.rb

Constant Summary collapse

LOG_TAG =
"[SIDEKIQ_SCALE][DYNAMIC_LATENCY_SCALING]"

Instance Method Summary collapse

Methods inherited from BaseScaling

#log_job

Instance Method Details

#scaling_direction(_job) ⇒ Object



11
12
13
14
15
16
# File 'lib/sidekiq_autoscale/strategies/dynamic_latency_scaling.rb', line 11

def scaling_direction(_job)
  return -1 if workload_too_low?
  return [scale_up_factor.to_i, 1].max if workload_too_high?

  0
end

#workload_change_needed?(_job) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/sidekiq_autoscale/strategies/dynamic_latency_scaling.rb', line 7

def workload_change_needed?(_job)
  workload_too_high? || workload_too_low?
end