Skip to content

Commit 9855c5c

Browse files
committed
Allow up to 5 warming waves for lambda with 3 warm lambdas and more memory
1 parent dbe04d9 commit 9855c5c

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

cloudformation/warmer.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Parameters:
1212
AllowedPattern: ^[a-zA-Z0-9]+[a-zA-Z0-9-]+[a-zA-Z0-9]+$
1313
NumInstances:
1414
Type: Number
15-
Default: 2
15+
Default: 3
1616

1717
Resources:
1818
WarmerLambdaLogGroup:
@@ -67,7 +67,7 @@ Resources:
6767
Description: !Sub "Lambda warmer for function ${FunctionToWarm}"
6868
FunctionName: !Sub "${LambdaFunctionNameBase}-${FunctionToWarm}"
6969
Handler: lambda.handler
70-
MemorySize: 128
70+
MemorySize: 512
7171
Role: !GetAtt WarmerLambdaIAMRole.Arn
7272
Timeout: 15
7373
Environment:

src/api/warmer/lambda.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
import { LambdaClient, InvokeCommand, LogType } from "@aws-sdk/client-lambda";
1+
import { LambdaClient, InvokeCommand } from "@aws-sdk/client-lambda";
22
import { TextDecoder } from "util";
33

44
const lambdaClient = new LambdaClient({});
55
const textDecoder = new TextDecoder();
66

7-
interface WarmerEvent {
8-
lambdaName: string;
9-
numInstances: number;
10-
}
11-
127
/**
138
* Invokes a batch of lambdas concurrently and returns the unique instance IDs found.
149
*/
@@ -64,8 +59,8 @@ export const handler = async (event: {}) => {
6459
}
6560

6661
const numInstances = parseInt(numInstancesStr, 10);
67-
// Default to 2 waves if MAX_WAVES is not set
68-
const maxWaves = parseInt(maxWavesStr || "2", 10);
62+
// Default to 5 waves if MAX_WAVES is not set
63+
const maxWaves = parseInt(maxWavesStr || "5", 10);
6964

7065
let totalInvocations = 0;
7166
let wavesCompleted = 0;

0 commit comments

Comments
 (0)