- Introduction
- Project Structure
- Lambda Functions
- Deployment with AWS CDK
- Getting Started
- Results and Analysis
- License
This project aims to compare the performance and ease of use of four JavaScript runtimes: Node.js, Bun, Deno.js, and LLRT (Latest JavaScript Runtime from AWS Labs). We achieve this by implementing three common Lambda functions:
- Hello World: A simple benchmarking function to measure cold start and execution times.
- Weather Extraction: A Lambda function with Gen AI according to today's weather forecast stored in DynamoDB, extracts rainy forecast from the forecast, and return the result.
All Lambda functions are deployed using the AWS Cloud Development Kit (CDK) to ensure replicability and ease of deployment.
The project is organized as follows:
aws-lambda-runtimes-comparison/
│
├── bin/
│ └── benchmark.ts
├── lib/
│ ├── hello-world-stack.ts
│ ├── dynamodb-bedrock-stack.ts
├── layer/
│ ├── bun/
│ ├── llrt/
├── lambda/
│ ├── hello-world/
│ ├── dynamodb-bedrock/
├── cdk.json
├── LICENSE
└── README.md
A simple "Hello World" Lambda function used for benchmarking the cold start and execution times of different runtimes. We tried our best to share the same implementation across each runtime (Node.js, Bun, Deno.js, LLRT) for comparability.
This Lambda function with Gen AI based on weather forecast stored in DynamoDB. It also added the date-fns package. It performs the following steps:
- Fetches today weather forecast from DynamoDB.
- Extracts rainy forecast from the text through AWS Bedrock Claude 3.
- Return the result.
The project uses AWS CDK to define and deploy the infrastructure. Each Lambda function is defined in a separate stack, making it easy to manage and deploy individually.
Before you begin, ensure you have the following installed:
- Node.js
- AWS CLI
- AWS CDK
Clone the repository and install the dependencies:
git clone https://github.com/teckyio/aws-lambda-runtimes-comparison.git
cd aws-lambda-runtimes-comparison/cdk
pnpm install You may download the binaries for the runtimes from the following links:
Download and replace the runtime located in ./layer/bun and ./layer/llrt if necessary.
Deploy the CDK stacks to your AWS account:
cdk bootstrap
cdk deploy --allInvoke the Lambda functions to collect benchmarking data:
time aws lambda invoke --no-cli-pager --function-name (function name created by cdk) /dev/nullAfter running the benchmarks, analyze the results to compare the performance of each runtime. Key metrics to consider include cold start times, execution times, and memory usage.
This project is licensed under the MIT License. See the LICENSE file for details.