Skip to content

Commit

Permalink
Potential latency improvements (#500)
Browse files Browse the repository at this point in the history
* Track record staleness

* bump up provisioned concurrency

* bump up provisioned concurrency

* Assortment of improvements
  • Loading branch information
codyborn authored Dec 20, 2024
1 parent 0c4578b commit dff60bd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bin/stacks/lambda-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class LambdaStack extends cdk.NestedStack {
entry: path.join(__dirname, '../../lib/handlers/order-notification/index.ts'),
handler: 'orderNotificationHandler',
retryAttempts: 0,
memorySize: 512,
memorySize: 1024,
timeout: Duration.seconds(29),
bundling: {
minify: true,
Expand All @@ -169,6 +169,7 @@ export class LambdaStack extends cdk.NestedStack {
retryAttempts: 0,
bisectBatchOnError: true,
reportBatchItemFailures: true,
parallelizationFactor: 10,
}

// TODO: add alarms on the size of this dead letter queue
Expand Down Expand Up @@ -475,7 +476,7 @@ export class LambdaStack extends cdk.NestedStack {

const orderNotificationLambdaTarget = new asg.ScalableTarget(this, `OrderNotificationLambda-ProvConcASG`, {
serviceNamespace: asg.ServiceNamespace.LAMBDA,
maxCapacity: provisionedConcurrency * 2,
maxCapacity: provisionedConcurrency * 4,
minCapacity: provisionedConcurrency,
resourceId: `function:${this.orderNotificationLambdaAlias.lambda.functionName}:${this.orderNotificationLambdaAlias.aliasName}`,
scalableDimension: 'lambda:function:ProvisionedConcurrency',
Expand All @@ -484,7 +485,7 @@ export class LambdaStack extends cdk.NestedStack {
orderNotificationLambdaTarget.node.addDependency(this.orderNotificationLambdaAlias)

orderNotificationLambdaTarget.scaleToTrackMetric(`OrderNotificationLambda-ProvConcTracking`, {
targetValue: 0.8,
targetValue: 0.5,
predefinedMetric: asg.PredefinedMetric.LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION,
})
}
Expand Down

0 comments on commit dff60bd

Please sign in to comment.