Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Feature: Added Queue/Running Autoscale Formula (#316)
Browse files Browse the repository at this point in the history
* Added autoscale for queue and running

* Updated documentation from comments
  • Loading branch information
brnleehng authored Oct 16, 2018
1 parent 844ebde commit 7192e08
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
31 changes: 28 additions & 3 deletions R/autoscale.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,19 @@ autoscaleQueueFormula <- paste0(
"max( $ActiveTasks.GetSample(1), avg($ActiveTasks.GetSample(TimeInterval_Minute * 15)));",
"$maxTasksPerNode = %s;",
"$round = $maxTasksPerNode - 1;",
"$targetVMs = $tasks > 0? (($tasks + $round)/ $maxTasksPerNode) : max(0, $TargetDedicated/2) + 0.5;",
"$targetVMs = $tasks > 0 ? (($tasks + $round) / $maxTasksPerNode) : max(0, $TargetDedicated/2) + 0.5;",
"$TargetDedicatedNodes = max(%s, min($targetVMs, %s));",
"$TargetLowPriorityNodes = max(%s, min($targetVMs, %s));",
"$NodeDeallocationOption = taskcompletion;"
)

autoscaleQueueAndRunningFormula <- paste0(
"$samples = $PendingTasks.GetSamplePercent(TimeInterval_Minute * 15);",
"$tasks = $samples < 70 ? max(0,$PendingTasks.GetSample(1)) : ",
"max( $PendingTasks.GetSample(1), avg($PendingTasks.GetSample(TimeInterval_Minute * 15)));",
"$maxTasksPerNode = %s;",
"$round = $maxTasksPerNode - 1;",
"$targetVMs = $tasks > 0 ? (($tasks + $round) / $maxTasksPerNode) : max(0, $TargetDedicated/2) + 0.5;",
"$TargetDedicatedNodes = max(%s, min($targetVMs, %s));",
"$TargetLowPriorityNodes = max(%s, min($targetVMs, %s));",
"$NodeDeallocationOption = taskcompletion;"
Expand All @@ -35,7 +47,8 @@ autoscaleFormula <- list(
"WEEKEND" = autoscaleWeekendFormula,
"WORKDAY" = autoscaleWorkdayFormula,
"MAX_CPU" = autoscaleMaxCpuFormula,
"QUEUE" = autoscaleQueueFormula
"QUEUE" = autoscaleQueueFormula,
"QUEUE_AND_RUNNING" = autoscaleQueueAndRunningFormula
)

getAutoscaleFormula <-
Expand Down Expand Up @@ -68,8 +81,20 @@ getAutoscaleFormula <-
)
)
}
else if (formulaName == formulas[5]) {
return(
sprintf(
autoscaleQueueAndRunningFormula,
maxTasksPerNode,
dedicatedMin,
dedicatedMax,
lowPriorityMin,
lowPriorityMax
)
)
}
else{
stop("Incorrect autoscale formula: QUEUE, MAX_CPU, WEEKEND, WORKDAY")
stop("Incorrect autoscale formula: QUEUE, QUEUE_AND_RUNNING, MAX_CPU, WEEKEND, WORKDAY")
}
}

Expand Down
4 changes: 3 additions & 1 deletion docs/32-autoscale.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This package pre-defines a few autoscale options (or *autoscale formulas*) that

The options are:
- "QUEUE"
- "QUEUE_AND_RUNNING"
- "WORKDAY"
- "WEEKEND"
- "MAX_CPU"
Expand Down Expand Up @@ -36,11 +37,12 @@ By default, doAzureParallel uses autoscale and uses the QUEUE autoscale formula.

## Autoscale Formulas:

For four autoscale settings are can be selected for different scenarios:
For five autoscale settings are can be selected for different scenarios:

| Autoscale Formula | Description |
| ----------------- |:----------- |
| QUEUE | This formula will scale up and down the pool size based on the amount of work in the queue |
| QUEUE_AND_RUNNING | This formula will scale up and down the pool size based on the amount of running tasks and active tasks in the queue |
| WORKDAY | This formula will adjust your pool size based on the day/time of the week. If it's a weekday, during working hours (8am - 6pm), the pool size will increase to maximum size (maxNodes). Otherwise it will default to the minimum size (minNodes). |
| WEEKEND | This formula will adjust your pool size based on the day/time of the week. At the beginning of the weekend (Saturday), the pool size will increase to maximum size (maxNodes). At the end of Sunday, the pool will shrink down to the minimum size (minNodes). |
| MAX_CPU | This formula will adjust your pool size based on the minimum average CPU usage during the last 10 minutes - if the minimum average CPU usage was above 70%, the cluster size will increase 1.1X times. |
Expand Down

0 comments on commit 7192e08

Please sign in to comment.