-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
QueueProcessingFargateServiceProps Cooldown property is not used when using a CPU Target Utilization scaling policy. #31172
Comments
@disophisis Good afternoon. Thanks for reporting the issue. Would it be possible to share minimal reproducible CDK code to investigate the issue? I'm unsure if the var service = new ecsPatterns.QueueProcessingFargateService(this, 'test', {
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
cooldown: cdk.Duration.seconds(120),
cpuTargetUtilizationPercent: 75,
}); results in following Autoscaling policies being added: The Thanks, |
Given export class DummyStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps) {
super(scope, id, props);
const vpc = getDefaultVpc(this);
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
new ecsp.QueueProcessingFargateService(this, 'Service', {
cluster,
image: ecs.ContainerImage.fromRegistry('foo:latest'),
cooldown: Duration.seconds(100),
})
}
} cdk synth ServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicy344EA7D4:
Type: AWS::ApplicationAutoScaling::ScalingPolicy
Properties:
PolicyName: dummystackServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicy83CB7F72
PolicyType: StepScaling
ScalingTargetId:
Ref: ServiceQueueProcessingFargateServiceTaskCountTarget2625B8CE
StepScalingPolicyConfiguration:
AdjustmentType: ChangeInCapacity
Cooldown: 100
MetricAggregationType: Maximum
StepAdjustments:
- MetricIntervalLowerBound: 0
MetricIntervalUpperBound: 400
ScalingAdjustment: 1
- MetricIntervalLowerBound: 400
ScalingAdjustment: 5
In this case cooldown is used in StepScalingPolicyConfiguration.
While
ServiceQueueProcessingFargateServiceTaskCountTargetCpuScalingC17EA933:
Type: AWS::ApplicationAutoScaling::ScalingPolicy
Properties:
PolicyName: dummystackServiceQueueProcessingFargateServiceTaskCountTargetCpuScaling19D8592A
PolicyType: TargetTrackingScaling
ScalingTargetId:
Ref: ServiceQueueProcessingFargateServiceTaskCountTarget2625B8CE
TargetTrackingScalingPolicyConfiguration:
PredefinedMetricSpecification:
PredefinedMetricType: ECSServiceAverageCPUUtilization
TargetValue: 50 My thoughts:
|
Thank you for supplying that code, Pahud. To your point, I think it would be preferable to expose ScaleInCooldown and ScaleOutCooldown in order to provide the most predictable experience. |
Describe the bug
QueueProcessingFargateServiceProps Cooldown property is not used when using a CPU Target Utilization scaling policy.
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
When creating a QueueProcessingFargateService and when using CPU Target Utilization, the cooldown provided should override the default (300 seconds) and be added to scale-in and scale-out.
Current Behavior
Currently, when creating a QueueProcessingFargateService and using CPU Target Utilization, the Cooldown property is not used, and the default of 300 seconds is used for scale-in and scale-out.
Reproduction Steps
Possible Solution
BaseService contains
AutoScaleTaskCount(EnableScalingProps props)
which works withApplicationLoadBalancedFargateService
, but appears not to work with Queue Processors because there is already some default scaling created under the hood. Allowing the use of AutoScaleTaskCount would be nice because it seems a bit more flexible:Currently when attempting to use AutoScaleTaskCount with a QueueProcessingFargateService, we get this during the synth:
Unhandled exception. System.Exception: Error: AutoScaling of task count already enabled for this service
Additional Information/Context
CDK CLI Version
2.130.0
Framework Version
2.130.0
Node.js Version
21.2.0
OS
Linux
Language
.NET
Language Version
8
Other information
No response
The text was updated successfully, but these errors were encountered: