Skip to content

Commit

Permalink
perf: remove scale down on tasks, bump up warmup time to 5 minutes to…
Browse files Browse the repository at this point in the history
… allow for longer model spin-up; bump to 180 minutes for complex videos
  • Loading branch information
danellecline committed Nov 14, 2023
1 parent afee911 commit a32c60f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions deepsea_ai/cdk/app/lib/ecs_task_autoscaling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class AutoScalingTaskStack extends cdk.Stack {
})

const scaleInQueueMetric = videoSqsQueue.metricApproximateNumberOfMessagesVisible({
period: cdk.Duration.minutes(120),
period: cdk.Duration.minutes(180),
statistic: "Average"
})

Expand All @@ -188,6 +188,8 @@ export class AutoScalingTaskStack extends cdk.Stack {
daemon: false,
desiredCount: 0,
taskDefinition: taskDefinition,
minHealthyPercent: 0,
maxHealthyPercent: 100,
placementStrategies: [ecs.PlacementStrategy.spreadAcross('instanceId')] //to deploy only once task per instance
})

Expand All @@ -196,11 +198,11 @@ export class AutoScalingTaskStack extends cdk.Stack {
trackSqsQueue.grantConsumeMessages(service.taskDefinition.taskRole)

// Task scaling steps
const serviceOutScaling = service.autoScaleTaskCount({minCapacity: 0, maxCapacity: config.FleetSize});
serviceOutScaling.scaleOnMetric(`scaling-${config}`, {
const taskOutScaling = service.autoScaleTaskCount({minCapacity: 0, maxCapacity: config.FleetSize});
taskOutScaling.scaleOnMetric(`scaling-${config}`, {
metric: scaleOutQueueMetric,
scalingSteps: [
{ upper: 0, change: -1 },
{ upper: 0, change: 0 },
{ lower: 1, change: 1 }
],
cooldown: cdk.Duration.minutes(5),
Expand All @@ -216,7 +218,7 @@ export class AutoScalingTaskStack extends cdk.Stack {

const scalingOutAction = new autoscaling.StepScalingAction(this, 'scale-out-action', {
autoScalingGroup: asg,
estimatedInstanceWarmup: cdk.Duration.minutes(2),
estimatedInstanceWarmup: cdk.Duration.minutes(5),
adjustmentType: autoscaling.AdjustmentType.CHANGE_IN_CAPACITY})

// The threshold is set to 1 so the lower bound must be equal to 0
Expand Down

0 comments on commit a32c60f

Please sign in to comment.