From 7f2a0adc9e576318c1ab3c2ac8283617c2575bee Mon Sep 17 00:00:00 2001 From: Kenji Kono Date: Fri, 20 Mar 2026 10:33:07 +0900 Subject: [PATCH] feat: increase webapp Lambda memory from 512MB to 1024MB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Increase the Lambda function memory size to improve cold start performance. Based on measurements across 887 requests (116 cold starts), 1024MB is the sweet spot: 3x faster cold starts (21.7s → 7.1s P50) and 32% cost reduction due to lower billed duration. Changes: - Update memorySize from 512 to 1024 in webapp.ts - Update CDK test snapshots - Update README cost table Closes #101 --- README.md | 2 +- cdk/lib/constructs/webapp.ts | 2 +- ...ess-fullstack-webapp-starter-kit-without-domain.test.ts.snap | 2 +- .../serverless-fullstack-webapp-starter-kit.test.ts.snap | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f817db0..9e2af82 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ The following table provides a sample cost breakdown for deploying this system i | Aurora Serverless v2 | 0.5 ACU × 2 hour/day, 1GB storage | 3.6 | | Cognito | 100 MAU (Monthly Active Users) | 1.5 | | AppSync Events | 100 events/month, 10 hours connection/user/month | 0.02 | -| Lambda | 512MB×200ms/request | 0.15 | +| Lambda | 1024MB×200ms/request | 0.15 | | Lambda@Edge | 128MB×50ms/request | 0.09 | | VPC | NAT Instance (t4g.nano) x1 | 3.02 | | EventBridge | Scheduler 100 jobs/month | 0.0001 | diff --git a/cdk/lib/constructs/webapp.ts b/cdk/lib/constructs/webapp.ts index 67115f3..0f423b4 100644 --- a/cdk/lib/constructs/webapp.ts +++ b/cdk/lib/constructs/webapp.ts @@ -82,7 +82,7 @@ export class Webapp extends Construct { ASYNC_JOB_HANDLER_ARN: asyncJob.handler.functionArn, }, vpc: database.cluster.vpc, - memorySize: 512, + memorySize: 1024, architecture: Architecture.ARM_64, }); handler.connections.allowToDefaultPort(database); diff --git a/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit-without-domain.test.ts.snap b/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit-without-domain.test.ts.snap index 3d54c92..ab57ed1 100644 --- a/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit-without-domain.test.ts.snap +++ b/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit-without-domain.test.ts.snap @@ -3466,7 +3466,7 @@ service iptables save", }, }, }, - "MemorySize": 512, + "MemorySize": 1024, "PackageType": "Image", "Role": { "Fn::GetAtt": [ diff --git a/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit.test.ts.snap b/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit.test.ts.snap index 43325df..0a17848 100644 --- a/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit.test.ts.snap +++ b/cdk/test/__snapshots__/serverless-fullstack-webapp-starter-kit.test.ts.snap @@ -3296,7 +3296,7 @@ service iptables save", }, }, }, - "MemorySize": 512, + "MemorySize": 1024, "PackageType": "Image", "Role": { "Fn::GetAtt": [