Adjust the cool-down period for instance scale up
The previous cool down period between scaling up instances, was based on
the old autoscaler policy. The new one is a lot more reactive, so we can
shorten it to ensure the autoscaler has a chance to run and fill the
newly booted instances.
@@ -393,8 +393,8 @@ class Djinn
SMALL_WAIT = 5
- # How often we should attempt to increase the number of AppServers on a
- # given node. It's measured as a multiplier of DUTY_CYCLE.
+ # How often we should attempt to scale up. It's measured as a multiplier
+ # of DUTY_CYCLE.
SCALEUP_THRESHOLD = 5
@@ -403,10 +403,9 @@ class Djinn
SCALEDOWN_THRESHOLD = 15
- # When spinning new node up or down, we need to use a much longer time
- # to dampen the scaling factor, to give time to the instance to fully
- # boot, and to reap the benefit of an already running instance. This is
- # a multiplication factor we use with the above thresholds.
+ # When scaling down instances we need to use a much longer time in order
+ # to reap the benefit of an already running instance. This is a
+ # multiplication factor we use with the above threshold.
SCALE_TIME_MULTIPLIER = 6
@@ -414,12 +413,6 @@ class Djinn
RETRIES = 5
- # The minimum number of requests that have to sit in haproxy's wait queue for
- # an App Engine application before we will scale up the number of AppServers
- # that serve that application.
- SCALEUP_QUEUE_SIZE_THRESHOLD = 5
-
-
# A Float that determines how much CPU can be used before the autoscaler will
# stop adding AppServers on a node.
MAX_CPU_FOR_APPSERVERS = 90.00
@@ -5317,8 +5310,7 @@ HOSTS
SCALE_LOCK.synchronize {
Djinn.log_info("We need #{vms_to_spawn} more VMs.")
- if Time.now.to_i - @last_scaling_time < (SCALEUP_THRESHOLD *
- SCALE_TIME_MULTIPLIER * DUTY_CYCLE)
+ if Time.now.to_i - @last_scaling_time < (SCALEUP_THRESHOLD * DUTY_CYCLE)
Djinn.log_info("Not scaling up right now, as we recently scaled " +
"up or down.")
return
@@ -5351,7 +5343,7 @@ HOSTS
end
# Also, don't scale down if we just scaled up or down.
- if Time.now.to_i - @last_scaling_time < (SCALEUP_THRESHOLD *
+ if Time.now.to_i - @last_scaling_time < (SCALEDOWN_THRESHOLD *
SCALE_TIME_MULTIPLIER * DUTY_CYCLE)
Djinn.log_info("Not scaling down right now, as we recently scaled " +
"up or down.")
