Skip to content

Commit

Permalink
Merge pull request #264 from Uniswap/cgkol/adjust-concurrencies
Browse files Browse the repository at this point in the history
Feat: Adjust concurrencies
  • Loading branch information
cgkol authored Feb 5, 2024
2 parents 2c3fae1 + fa8e0db commit 7b420e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class APIPipeline extends Stack {
// Prod us-east-2
const prodUsEast2Stage = new APIStage(this, 'prod-us-east-2', {
env: { account: '830217277613', region: 'us-east-2' },
provisionedConcurrency: 150,
provisionedConcurrency: 70,
internalApiKey: internalApiKey.secretValue.toString(),
chatbotSNSArn: 'arn:aws:sns:us-east-2:644039819003:SlackChatbotTopic',
envVars: {
Expand Down
8 changes: 4 additions & 4 deletions bin/stacks/api-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export class APIStack extends cdk.Stack {
const switchLambdaAlias = new aws_lambda.Alias(this, `SwitchLiveAlias`, {
aliasName: 'live',
version: switchLambda.currentVersion,
provisionedConcurrentExecutions: provisionedConcurrency > 0 ? provisionedConcurrency : undefined,
provisionedConcurrentExecutions: 0,
});

const mockQuoteLambda = new aws_lambda_nodejs.NodejsFunction(this, 'mockQuote', {
Expand Down Expand Up @@ -326,13 +326,13 @@ export class APIStack extends cdk.Stack {
const rfqLambdaAlias = new aws_lambda.Alias(this, `RfqLiveAlias`, {
aliasName: 'live',
version: integrationRfqLambda.currentVersion,
provisionedConcurrentExecutions: provisionedConcurrency > 0 ? provisionedConcurrency : undefined,
provisionedConcurrentExecutions: 0,
});

if (provisionedConcurrency > 0) {
const quoteTarget = new aws_asg.ScalableTarget(this, 'QuoteProvConcASG', {
serviceNamespace: aws_asg.ServiceNamespace.LAMBDA,
maxCapacity: provisionedConcurrency * 5,
maxCapacity: provisionedConcurrency * 10,
minCapacity: provisionedConcurrency,
resourceId: `function:${quoteLambdaAlias.lambda.functionName}:${quoteLambdaAlias.aliasName}`,
scalableDimension: 'lambda:function:ProvisionedConcurrency',
Expand All @@ -341,7 +341,7 @@ export class APIStack extends cdk.Stack {
quoteTarget.node.addDependency(quoteLambdaAlias);

quoteTarget.scaleToTrackMetric('QuoteProvConcTracking', {
targetValue: 0.8,
targetValue: 0.7,
predefinedMetric: aws_asg.PredefinedMetric.LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION,
});
}
Expand Down

0 comments on commit 7b420e0

Please sign in to comment.