Replies: 1 comment
-
That's a good question. It is hard to compete with esbuild's tree shaking. Especially if you share node_modules with your CDK project to avoid the duplicate download. I was already planning on creating a deployment benchmark. Maybe we can add a thousand concurrent calls at the end and get some metrics about cold start times for this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Have you analyzed the layer performance penalty?
From my uninstrumented observation, the layers are significantly heavier than the
esbuild
bundled Lambda counterparts. This makes sense sinceesbuild
would tree-shake out the cruft. But a simple install + zip would not.In my case, my Lambda handler was ~ 2 MB compressed. After moving some of the deps (cherry-picked, using
layerFromInline
), the handler is 800 KB, but the layer is now 8 MB.So what I am wondering about is if these layers need to be fetched from the S3 bucket, by Lambda, before executing, then a single file at 2 MB is probably faster.
But there also could be the penalty of unzipping, and loading unused files, if they haven't been tree-shaken.
Beta Was this translation helpful? Give feedback.
All reactions