This spike explores using AWS LLRT as a faster JavaScript runtime for Lambda functions.
It pairs a working repository with a writeup so the runtime tradeoffs are easier to test and understand.
The implementation details below are synced from the project README.
This project demonstrates how to build a serverless API using AWS Lambda with LLRT (Low Latency Runtime) - a lightweight JavaScript runtime optimized for AWS Lambda.
The function are behind simple HTTP API Gateway endpoints.
npm install -g serverless)npm installnpm run setupnpm run check:hello
npm run check:goodbye
# Or run all tests
npm testnpm run deployname (optional) - Name to greet{
"message": "Hello World from LLRT!",
"timestamp": "2024-03-14T12:00:00.000Z",
"path": "/hello",
"method": "GET"
}name (optional) - Name to bid farewell{
"message": "Goodbye World, thanks for using LLRT!",
"timestamp": "2024-03-14T12:00:00.000Z",
"path": "/goodbye",
"method": "GET"
}.
├── bootstrap # LLRT runtime
├── bin/ # CLI tools
│ └── llrt-check.js # LLRT compatibility checker
├── docs/ # Documentation
│ └── llrt-check.md # Checker documentation
├── node_modules # Node.js dependencies
├── package.json
├── serverless.yml
├── src/ # Source code
│ ├── hello.js
│ ├── goodbye.js
│ └── test-function.js
├── scripts/ # Setup and utility scripts
│ ├── setup.js
│ ├── get-compat.js
│ └── test-checker.js
└── llrt-compatibility.json # Compatibility matrixTo deploy the service, run:
npm run deployTo delete the service, run:
npm run removeThis project includes a custom compatibility checker to verify your code will work with LLRT before deployment:
# Check specific functions
npm run check:hello
npm run check:goodbye
# Check any JavaScript file
./bin/llrt-check.js path/to/your/function.js
# Run all compatibility tests
npm testThe checker performs:
See docs/llrt-check.md for detailed usage instructions.
You can perf test with node perf-test.js
Average response time: 54.05ms. Not too shabby.
=== PERFORMANCE COMPARISON SUMMARY ===
Comparing Node.js vs LLRT implementations:
Hello Function:
Average: 149.96ms (Node) vs 32.37ms (LLRT) - 78.4% faster
Min: 127.19ms (Node) vs 22.47ms (LLRT) - 82.3% faster
Max: 182.75ms (Node) vs 51.00ms (LLRT) - 72.1% faster
Goodbye Function:
Average: 133.00ms (Node) vs 30.40ms (LLRT) - 77.1% faster
Min: 119.05ms (Node) vs 22.92ms (LLRT) - 80.7% faster
Max: 148.67ms (Node) vs 48.12ms (LLRT) - 67.6% faster
Test Function:
Average: 135.46ms (Node) vs 30.98ms (LLRT) - 77.1% faster
Min: 124.46ms (Node) vs 21.34ms (LLRT) - 82.9% faster
Max: 151.80ms (Node) vs 49.26ms (LLRT) - 67.6% faster
=== OVERALL SUMMARY ===
LLRT is on average 77.6% faster than Node.js
Average response times: 139.47ms (Node) vs 31.25ms (LLRT)