Recipe
Lambda layer + bundle strategy
Ship Meridian's native loader alongside your Node.js runtime without bloating deployment packages.
Why layers
Lambda layers decouple the Meridian C++ loader binary from your function code. The layer ships once, caches across cold starts, and updates independently of your application bundle.
Layer structure
/opt/
├── bin/
│ └── meridian-loader
├── lib/
│ └── libmeridian.so
└── licenses/
└── THIRD_PARTYLambda extracts layers to /opt. Your function wrapper invokes the loader via child_process with the layer path on LD_LIBRARY_PATH.
Bundle strategy
- Keep the function zip under 50 MB — layer carries the heavy native bits.
- Use esbuild to tree-shake your handler; exclude the loader binary from the bundle.
- Pin layer ARN in
serverless.ymlor Terraform for deterministic deploys. - Version layers with Meridian release tags so rollbacks are instant.
Cold-start impact
Layers add zero latency to cold starts beyond the base image. Meridian's loader initializes in under 80 ms on arm64 Graviton. Combined with SnapStart or provisioned concurrency, p99 stays below 200 ms.